Verify path traversal vulnerability in web server

拜拜、爱过 提交于 2019-12-05 12:15:54

问题


I want to verify that my web application does not have a path traversal vulnerability.

I'm trying to use curl for that, like this:

$ curl -v http://www.example.com/directory/../

I would like the HTTP request to be explicitly made to the /directory/../ URL, to test that a specific nginx rule involving proxy is not vulnerable to path traversal. I.e., I would like this HTTP request to be sent:

> GET /directory/../ HTTP/1.1

But curl is rewriting the request as to the / URL, as can be seen in the output:

* Rebuilt URL to: http://www.example.com/
(...)
> GET / HTTP/1.1

Is it possible to use curl for this test, forcing it to pass the exact URL in the request? If not, what would be an appropriate way?


回答1:


The curl flag you are looking for is curl --path-as-is .




回答2:


I'm not aware of a way to do it via curl, but you could always use telnet. Try this command:

telnet www.example.com 80

You'll see:

Trying xxx.xxx.xxx.xxx... Connected to www.example.com. Escape character is '^]'.

You now have an open connection to www.example.com. Now just type in your command to fetch the page:

GET /directory/../ HTTP/1.1

And you should see your result. e.g.

HTTP/1.1 400 Bad Request




回答3:


You can use an intercepting proxy to capture a request to your application and repeat the request with parameters changed, such as the raw URL that is requested from the application.

The free version of Burp Suite will allow this using the Repeater.

However, there are alternatives that should also allow this such as Zap, WebScarab and Fiddler2.



来源:https://stackoverflow.com/questions/24936397/verify-path-traversal-vulnerability-in-web-server

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!