Canape

@mikekhusid said:
I have the app running locally but I still can’t get RCE. When I generate the payload for RCE and the app creates the .p file locally, I try to run it in my own python interpreter with the “vulnerable” library and method I get the following error:

ImportError: No module named os

Running dos2unix on the .p file containing the exploit fixes the issue. I still can’t get RCE b/c I think my exploit is being generated incorrectly (I’m doing it in Kali so I have no idea why dos2unix has an effect) and this in turn isn’t working in the app. If I generate the payload and then execute it in the same script (i.e. non-interactively and bypassing the app altogether) it works fine. This is very frustrating and any help would be appreciated.

This incredibly helpful message is usually caused by having the wrong line endings. Submitting multiline text in your browser that has unix line endings /n usually ends up with the browser encoding it and changing the line endings into /r/n (if you look at the web request it probably has a %0D%0A in it, if that’s the case just remove the %0D’s since you only want unix style line endings and that should fix the problem. Alternatively you can url encode your text first. (sorry for the non-specific answer but trying not to give anything away)