0

I was asked the following question at a job interview recently:

You need to reach a web server at the IP address 20.21.22.23 via browser using HTTP. Browser checks the IP address and blocks requests to the IPs that match the regex ^http(s)?:\/\/20\.21\.22\.23$. How can you bypass the restriction and gain access to the web server? There are multiple correct answers.

Please help me figure out what the correct answers are.

0

4 Answers 4

2

In the regex ^http(s)?:\/\/20\.21\.22\.23$, the $ operator should match the end of line.

Any payload that querry a URI path will access the server. This without match by the regex.

Examples include:

http://20.21.22.23/
http://20.21.22.23/index.html
http://20.21.22.23/AaaAAa
....

You can also suffix the URI with the HTTP port (80 by default)

http://20.21.22.23:80

Another trick would be to use HTTP Basic Auth URI scheme (which may not be suported depending on your browser)

http://user:[email protected]:80

see https://serverfault.com/questions/371907/can-you-pass-user-pass-for-http-basic-authentication-in-url-parameters

1

Just access the site by a domain name instead of IP address.

This can for example be achieved by setting up a local mapping between some arbitrary domain name and the servers IP address in your hosts file and then just use this domain name in the URL instead of the IP address.

1

You can convert the IP to hex: http://0x14151617 or decimal http://336926231 which will pass some checks but possibly not all of them.

1
0

Other answers are already good. Here's another one: Set a user.

http://[email protected]

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .