mbechler / marshalsec

MIT License
3.39k stars 680 forks source link

HTTP request not sent #20

Closed DesiralizationLover closed 3 years ago

DesiralizationLover commented 3 years ago

Hello, I really like your project it is great! but ( :-( ) i ran into a problem wile running your exploit test using Castor serializer. When running the gadget of JNDI I've set it up just as you've shown, using the provided LDAP server with a exploit.class just as you've shown in one of your issue responses. The LDAP server returns the URL address as expected but then, there is no request to the HTTP server. Even when I try your -t flag it says RCE achieved but the HTTP server won't recieve any communication. Sorry for the bad english, Thanks!

mbechler commented 3 years ago

The JNDI/LDAP exploitation vector was disabled in later Java versions, so this may be the issue.

Jackey0 commented 2 years ago

I have same issue: when I use JNDI-Injection-Exploit.jar , first ldap request, then http request image

but when use marshalsec , image ldap request success, but my http.server no request received. every env is same...

fuemoshi commented 2 years ago

i meet same issue

mbechler commented 2 years ago

I vaguely remember that Java does not like if you do not specify a trailing slash for the codebase url. Could that be causing the issue?

christophetd commented 2 years ago

Same behavior here. I attempted to use a patched version prepending a / to the javaCodeBase URL, but it didn't change the behavior.

drriguz commented 2 years ago

same issue here~~

drriguz commented 2 years ago

so I guess most of the guys cames here for the log4j2 cve?

drriguz commented 2 years ago

Hi, there, I tried JDK 1.8.0_181 and it works! any newer JDK8, 11, 17 versions does not work!

mbechler commented 2 years ago

Yes, as mentioned above and in diffent other places (e.g. https://mbechler.github.io/2018/11/01/Java-CVE-2018-3149/) the original remote-classloading RCE does only work on old (or badly configured) Java runtimes. There are however potentially alternative less direct vectors (compare https://www.veracode.com/blog/research/exploiting-jndi-injections-java)

mbechler commented 2 years ago

Howver, @Jackey0 mentioned that another (from what I found this seems mostly a copy of my code) exploit worked in the same instance, which would be curious.

mbechler commented 2 years ago

I put together a post about the relevant exploitation vectors and affected versions: https://mbechler.github.io/2021/12/10/PSA_Log4Shell_JNDI_Injection/

thehackingsnake commented 2 years ago

Hi, there, I tried JDK 1.8.0_181 and it works! any newer JDK8, 11, 17 versions does not work!

Hey, how did you manage it? I'm testing with the same version but I still have the same problem. I used 1.8.0_181 javac to compile the test exploit and java to run the marshalsec etc command. I get the hit on marshal but it doesn't contact the webserver

mbechler commented 2 years ago

The exploited target needs to use <8u191

thehackingsnake commented 2 years ago

I see, I was testing it on Ghidra 9.1 that seemed vulnerable but it uses Java 11.x

mbechler commented 2 years ago

Yes, there is "vulnerable" to the JNDI injection (easy to show) and "exploitable" for RCE (for which with modern Java you need additional preconditions, and that may be much harder to prove/disprove). Blog post above has some pointers.

ecki commented 2 years ago

I used 1.8.0_181 javac to compile the test exploit

it’s not a question of the compiler, it must be an outdated victim runtime (or use a better payload) or just turn on the codebase loading.

obada-cyber commented 1 year ago

should we use the same version of java as the website? \

mbechler commented 1 year ago

The version you run the exploit on and the target version should be independent, but the target version matters very much as stated above on multiple occasions. On your side, best stick to Java 8 to avoid module visibility issues.