mirror of
https://github.com/elicpeter/nyx.git
synced 2026-07-12 21:02:11 +02:00
Dynamic (#77)
This commit is contained in:
parent
55247b7fcd
commit
991c84a1eb
1464 changed files with 225448 additions and 1985 deletions
18
tests/dynamic_fixtures/go/flag_cli/benign.go
Normal file
18
tests/dynamic_fixtures/go/flag_cli/benign.go
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
// Phase 15 — flag.Parse CLI, benign.
|
||||
// Echoes a fixed string; argv is discarded.
|
||||
|
||||
package entry
|
||||
|
||||
import (
|
||||
"flag"
|
||||
"fmt"
|
||||
"os/exec"
|
||||
)
|
||||
|
||||
func Run() {
|
||||
flag.Parse()
|
||||
_ = flag.Args()
|
||||
cmd := exec.Command("echo", "hello")
|
||||
out, _ := cmd.CombinedOutput()
|
||||
fmt.Print(string(out))
|
||||
}
|
||||
3
tests/dynamic_fixtures/go/flag_cli/go.mod
Normal file
3
tests/dynamic_fixtures/go/flag_cli/go.mod
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
module nyx_flag_cli_fixture
|
||||
|
||||
go 1.21
|
||||
23
tests/dynamic_fixtures/go/flag_cli/vuln.go
Normal file
23
tests/dynamic_fixtures/go/flag_cli/vuln.go
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
// 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))
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue