Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added raw urls support - on parsing and sending sending requests #42

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

slicingmelon
Copy link

Since I liked your tool, I tried it and realized that it is not working correctly. Looking through the code, I saw that you use url.UrlParse to parse the URL then I checked the function that you are using to send requests.

Go is "pro-security" and functions like UrlParse will apply encodings, normalizations, etc, meaning that your payloads from midpaths and endpaths won't work.
On the other hand, Go's http.Client will also apply encodings, normalizations, in the idea to prevent vulnerabilities such as path traversal, etc.

I researched, and there is no URL parser in go that can return raw urls/paths.
For this, I wrote a simple pkg that I published here: https://github.com/slicingmelon/go-rawurlparser.

I forked your tool, made the modifications to use my pkg to parse URLs, and then patched the request() func to be able to send all the payloads as they should be sent, similar to what curl --path-as-is does. I found that the only way to still use http.Request and send raw URLs is to set the Opaque to the raw path.

I've tested it, and it looks like it's working well now; I also intercepted the traffic with Burp, and all the payloads are sent as expected.

If for any reason you want back http.NewRequest instead of http.Request, you can achieve the same thing, too; just don't forget to set the Opaque.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant