mirror of
https://github.com/elicpeter/nyx.git
synced 2026-06-15 20:05:13 +02:00
Dynamic (#77)
This commit is contained in:
parent
55247b7fcd
commit
991c84a1eb
1464 changed files with 225448 additions and 1985 deletions
26
tests/dynamic_fixtures/javascript/koa/benign.js
Normal file
26
tests/dynamic_fixtures/javascript/koa/benign.js
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
// Phase 13 — Koa middleware, benign control.
|
||||
//
|
||||
// execFile (no shell), stderr silenced, child writes nothing to stdout.
|
||||
|
||||
'use strict';
|
||||
const Koa = require('koa');
|
||||
const { execFileSync } = require('child_process');
|
||||
|
||||
async function ping(ctx) {
|
||||
const host = (ctx.query && ctx.query.host) || '';
|
||||
process.stdout.write('__NYX_SINK_HIT__\n');
|
||||
try {
|
||||
execFileSync('true', [host], {
|
||||
encoding: 'utf8',
|
||||
timeout: 5000,
|
||||
stdio: ['ignore', 'pipe', 'ignore'],
|
||||
});
|
||||
ctx.body = 'ok';
|
||||
} catch (_e) {
|
||||
ctx.body = 'err';
|
||||
}
|
||||
}
|
||||
|
||||
void Koa;
|
||||
|
||||
module.exports = { ping };
|
||||
12
tests/dynamic_fixtures/javascript/koa/package-lock.json
generated
Normal file
12
tests/dynamic_fixtures/javascript/koa/package-lock.json
generated
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
{
|
||||
"name": "nyx-harness-koa",
|
||||
"version": "0.0.0",
|
||||
"lockfileVersion": 3,
|
||||
"requires": true,
|
||||
"packages": {
|
||||
"": {
|
||||
"name": "nyx-harness-koa",
|
||||
"version": "0.0.0"
|
||||
}
|
||||
}
|
||||
}
|
||||
8
tests/dynamic_fixtures/javascript/koa/package.json
Normal file
8
tests/dynamic_fixtures/javascript/koa/package.json
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
{
|
||||
"name": "nyx-harness-koa",
|
||||
"version": "0.0.0",
|
||||
"private": true,
|
||||
"dependencies": {
|
||||
"koa": "^2.15.3"
|
||||
}
|
||||
}
|
||||
23
tests/dynamic_fixtures/javascript/koa/vuln.js
Normal file
23
tests/dynamic_fixtures/javascript/koa/vuln.js
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
// Phase 13 — Koa middleware, vulnerable.
|
||||
//
|
||||
// Vulnerable middleware reads `ctx.query.host` and concatenates it into a
|
||||
// shell command. Harness builds a mock ctx via js_shared::emit_koa.
|
||||
|
||||
'use strict';
|
||||
const Koa = require('koa');
|
||||
const { execSync } = require('child_process');
|
||||
|
||||
async function ping(ctx) {
|
||||
const host = (ctx.query && ctx.query.host) || '';
|
||||
process.stdout.write('__NYX_SINK_HIT__\n');
|
||||
try {
|
||||
const out = execSync('echo hello ' + host, { encoding: 'utf8', timeout: 5000 });
|
||||
ctx.body = out;
|
||||
} catch (e) {
|
||||
ctx.body = (e.stdout || '') + (e.stderr || '');
|
||||
}
|
||||
}
|
||||
|
||||
void Koa;
|
||||
|
||||
module.exports = { ping };
|
||||
Loading…
Add table
Add a link
Reference in a new issue