mirror of
https://github.com/elicpeter/nyx.git
synced 2026-06-24 20:28:06 +02:00
[pitboss] phase 14: Track B — Java harness emitter shapes
This commit is contained in:
parent
7628c48930
commit
bd1bd0ce84
36 changed files with 1793 additions and 155 deletions
31
tests/dynamic_fixtures/java/quarkus_route/Vuln.java
Normal file
31
tests/dynamic_fixtures/java/quarkus_route/Vuln.java
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
// Phase 14 — Quarkus reactive route, vulnerable.
|
||||
//
|
||||
// `@Path("/run")` on the type + `@GET` on the handler matches the
|
||||
// Phase 14 [`JavaShape::detect`] for Quarkus. The harness invokes
|
||||
// `run(payload)` via reflection.
|
||||
|
||||
// import io.quarkus.runtime.Quarkus;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.InputStreamReader;
|
||||
|
||||
@Path("/run")
|
||||
public class Vuln {
|
||||
@GET
|
||||
public String run(String payload) throws Exception {
|
||||
System.out.print("__NYX_SINK_HIT__\n");
|
||||
if (payload == null) payload = "";
|
||||
String[] cmd = {"/bin/sh", "-c", "echo hello " + payload};
|
||||
Process p = Runtime.getRuntime().exec(cmd);
|
||||
BufferedReader reader = new BufferedReader(new InputStreamReader(p.getInputStream()));
|
||||
StringBuilder out = new StringBuilder();
|
||||
String line;
|
||||
while ((line = reader.readLine()) != null) {
|
||||
out.append(line);
|
||||
out.append('\n');
|
||||
System.out.println(line);
|
||||
}
|
||||
p.waitFor();
|
||||
return out.toString();
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue