mirror of
https://github.com/elicpeter/nyx.git
synced 2026-06-12 19:55:14 +02:00
Dynamic (#77)
This commit is contained in:
parent
55247b7fcd
commit
991c84a1eb
1464 changed files with 225448 additions and 1985 deletions
28
tests/dynamic_fixtures/javascript/express/benign.js
Normal file
28
tests/dynamic_fixtures/javascript/express/benign.js
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
// Phase 13 — Express route handler, benign control.
|
||||
//
|
||||
// Uses execFile (no shell) so the payload bytes are never interpreted as
|
||||
// shell metacharacters. The oracle marker cannot appear in stdout because
|
||||
// the inner child reads `true` and its stdio is ignored.
|
||||
|
||||
'use strict';
|
||||
const express = require('express');
|
||||
const { execFileSync } = require('child_process');
|
||||
|
||||
function ping(req, res) {
|
||||
const host = (req.query && req.query.host) || '';
|
||||
process.stdout.write('__NYX_SINK_HIT__\n');
|
||||
try {
|
||||
execFileSync('true', [host], {
|
||||
encoding: 'utf8',
|
||||
timeout: 5000,
|
||||
stdio: ['ignore', 'pipe', 'ignore'],
|
||||
});
|
||||
res.send('ok');
|
||||
} catch (_e) {
|
||||
res.send('err');
|
||||
}
|
||||
}
|
||||
|
||||
void express;
|
||||
|
||||
module.exports = { ping };
|
||||
12
tests/dynamic_fixtures/javascript/express/package-lock.json
generated
Normal file
12
tests/dynamic_fixtures/javascript/express/package-lock.json
generated
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
{
|
||||
"name": "nyx-harness-express",
|
||||
"version": "0.0.0",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "nyx-harness-express",
|
||||
"version": "0.0.0"
|
||||
}
|
||||
}
|
||||
}
|
||||
8
tests/dynamic_fixtures/javascript/express/package.json
Normal file
8
tests/dynamic_fixtures/javascript/express/package.json
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
{
|
||||
"name": "nyx-harness-express",
|
||||
"version": "0.0.0",
|
||||
"private": true,
|
||||
"dependencies": {
|
||||
"express": "^4.19.2"
|
||||
}
|
||||
}
|
||||
26
tests/dynamic_fixtures/javascript/express/vuln.js
Normal file
26
tests/dynamic_fixtures/javascript/express/vuln.js
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
// Phase 13 — Express route handler, vulnerable.
|
||||
//
|
||||
// Vulnerable handler concatenates `req.query.host` into a shell command.
|
||||
// Harness builds a mock req/res via js_shared::emit_express and dispatches
|
||||
// synchronously; we never bind a real listener.
|
||||
|
||||
'use strict';
|
||||
const express = require('express');
|
||||
const { execSync } = require('child_process');
|
||||
|
||||
function ping(req, res) {
|
||||
const host = (req.query && req.query.host) || '';
|
||||
process.stdout.write('__NYX_SINK_HIT__\n');
|
||||
try {
|
||||
const out = execSync('echo hello ' + host, { encoding: 'utf8', timeout: 5000 });
|
||||
res.send(out);
|
||||
} catch (e) {
|
||||
res.send((e.stdout || '') + (e.stderr || ''));
|
||||
}
|
||||
}
|
||||
|
||||
// Touch the dep so the materialised package.json's `express` pin survives
|
||||
// shake-down by `npm install --no-save`; harness never starts the server.
|
||||
void express;
|
||||
|
||||
module.exports = { ping };
|
||||
Loading…
Add table
Add a link
Reference in a new issue