Dear All,
This question
probably
originate from a lack of elementary knowledge about file formats, encodings etc... which I would really like to improve. Although it seem the lack is so big I could not find the correct keywords to search for info. So any resources about this topic would be very much appreciated.
Secondly, the real question, I'm testing a file (picture) upload. The upload is a POST request with the real file content-type
(e.g. image/png)
not multipart and the binary (at least I suppose) file content in the request body.
Client side validation is rather strict/rigid so I prefer to intercept and modify the upload request instead of trying to bypass it.
My question is how can I modify the original request body (binary data) by the content of another file? When I replace the request body I always get a 500 response from the server even when I use the original file content but then copy-pasted. It seems like copy-paste removes/add something and visually indeed the formatting in the request tab is different.
I'm sure the client side is not processing the uploaded file before generating the request because when I save the request body to a raw file and compare it with the original uploaded file it's identical. So it must be related to how I obtain the content (e.g. via cat but also tried other ways) and the copy-paste in the request body tab.
As I really want to replace the complete file it's not (or at least seems with my knowledge) to use the HEX view in ZAP.
More than just having a solution I would like too understand what is happening here as I know my knowledge on this area is still limited.
Many thanks for your time and your help.
Best regards,
Sam