mirror of
https://github.com/elicpeter/nyx.git
synced 2026-06-09 19:45:13 +02:00
Dynamic (#77)
This commit is contained in:
parent
55247b7fcd
commit
991c84a1eb
1464 changed files with 225448 additions and 1985 deletions
24
tests/dynamic_fixtures/javascript/async_function/benign.js
Normal file
24
tests/dynamic_fixtures/javascript/async_function/benign.js
Normal file
|
|
@ -0,0 +1,24 @@
|
|||
// Phase 13 — bare async function, benign control.
|
||||
//
|
||||
// execFile (no shell) via util.promisify(execFile). Payload never reaches a
|
||||
// shell; stderr silenced so payload bytes do not leak via the inner process'
|
||||
// error message.
|
||||
|
||||
'use strict';
|
||||
const { execFile } = require('child_process');
|
||||
const { promisify } = require('util');
|
||||
const execFileP = promisify(execFile);
|
||||
|
||||
async function runPing(host) {
|
||||
process.stdout.write('__NYX_SINK_HIT__\n');
|
||||
try {
|
||||
const { stdout } = await execFileP('true', [host], {
|
||||
timeout: 5000,
|
||||
});
|
||||
return stdout;
|
||||
} catch (_e) {
|
||||
return 'err';
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = { runPing };
|
||||
25
tests/dynamic_fixtures/javascript/async_function/vuln.js
Normal file
25
tests/dynamic_fixtures/javascript/async_function/vuln.js
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
// Phase 13 — bare async function, vulnerable.
|
||||
//
|
||||
// Stdlib-only. Async function awaits `child_process.exec` via util.promisify
|
||||
// so the harness's `await _entry.runPing(payload)` resolves before the
|
||||
// process exits.
|
||||
|
||||
'use strict';
|
||||
const { exec } = require('child_process');
|
||||
const { promisify } = require('util');
|
||||
const execP = promisify(exec);
|
||||
|
||||
async function runPing(host) {
|
||||
process.stdout.write('__NYX_SINK_HIT__\n');
|
||||
try {
|
||||
const { stdout } = await execP('echo hello ' + host, { timeout: 5000 });
|
||||
process.stdout.write(stdout);
|
||||
return stdout;
|
||||
} catch (e) {
|
||||
const out = (e.stdout || '') + (e.stderr || '');
|
||||
process.stdout.write(out);
|
||||
return out;
|
||||
}
|
||||
}
|
||||
|
||||
module.exports = { runPing };
|
||||
Loading…
Add table
Add a link
Reference in a new issue