hackvertor / hackvertor

158 stars 45 forks source link

Tag not processed due to java.lang.StackOverflowError with long body in multipart/form-data; #105

Open rationalpsyche opened 9 months ago

rationalpsyche commented 9 months ago

When using a tag in a multipart/form-data request with a long body the following error is triggered:

java.lang.StackOverflowError
        at burp.Convertors.weakConvert(Convertors.java:819)
        at burp.Convertors.weakConvert(Convertors.java:819)
        ...

To reproduce:

POST /<@random_num(10)/>test.txt HTTP/1.1
Host: localhost:9000
Content-Length: 1589723
Origin: http://localhost:9000
Content-Type: multipart/form-data; boundary=----WebKitFormBoundaryTEXguCvxaPhmeG5v
Accept-Encoding: gzip, deflate, br
Accept-Language: en-US,en;q=0.9
Connection: close

------WebKitFormBoundaryTEXguCvxaPhmeG5v
Content-Disposition: form-data; name="filename"; filename="7z2301-x64.exe"
Content-Type: application/x-ms-dos-executable
<binary blob - I used the 7zip binary>
------WebKitFormBoundaryTEXguCvxaPhmeG5v--

In logger the tag is visible as not processed

POST /<@random_num(10)/>test.txt HTTP/1.1

Use case: a web app requiring a specific large file (e.g. ID card image) for processing and at the same time having GET parameters where HackVertor would be useful.

hackvertor commented 8 months ago

I could check the length of the body and see if it exceeds a certain amount and then just process the headers and leave the body as is. Would that be ok? What would be a reasonable maximum body length?

rationalpsyche commented 7 months ago

Sorry for the late reply, yes, that would be great. For the use case I had I would allow a body length of 2 MB which is enough to upload a good quality ID.