nyx/tests/dynamic_fixtures/go/flag_cli/vuln.go
2026-06-05 10:16:30 -05:00

23 lines
437 B
Go

// Phase 15 — flag.Parse CLI, vulnerable.
// Reads the first non-flag argv positional and pipes to /bin/sh -c.
// Entry: Run() Cap: CODE_EXEC
package entry
import (
"flag"
"fmt"
"os/exec"
)
func Run() {
fmt.Print("__NYX_SINK_HIT__\n")
flag.Parse()
payload := ""
if flag.NArg() > 0 {
payload = flag.Arg(0)
}
cmd := exec.Command("sh", "-c", "echo hello "+payload)
out, _ := cmd.CombinedOutput()
fmt.Print(string(out))
}