mirror of
https://github.com/elicpeter/nyx.git
synced 2026-07-03 20:41:00 +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/go_frameworks/echo/benign.go
Normal file
26
tests/dynamic_fixtures/go_frameworks/echo/benign.go
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
// Phase 17 (Track L.15) — echo benign control fixture.
|
||||
//
|
||||
// The /run route consults an allow-list before invoking exec, so
|
||||
// attacker bytes never reach the sink directly.
|
||||
package main
|
||||
|
||||
import (
|
||||
"os/exec"
|
||||
|
||||
"github.com/labstack/echo/v4"
|
||||
)
|
||||
|
||||
func Run(c echo.Context) error {
|
||||
cmd := c.QueryParam("cmd")
|
||||
allow := map[string]string{"ls": "ls", "ps": "ps"}
|
||||
if safe, ok := allow[cmd]; ok {
|
||||
return exec.Command(safe).Run()
|
||||
}
|
||||
return nil
|
||||
}
|
||||
|
||||
func main() {
|
||||
e := echo.New()
|
||||
e.GET("/run", Run)
|
||||
_ = e
|
||||
}
|
||||
27
tests/dynamic_fixtures/go_frameworks/echo/vuln.go
Normal file
27
tests/dynamic_fixtures/go_frameworks/echo/vuln.go
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
// Phase 17 (Track L.15) — echo CMDI vuln fixture.
|
||||
//
|
||||
// The /run route forwards a `cmd` query parameter straight into
|
||||
// `os/exec.Command`. Adapter binding: `e.GET("/run", Run)` with
|
||||
// `cmd` flowing through `c.QueryParam`.
|
||||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os/exec"
|
||||
|
||||
"github.com/labstack/echo/v4"
|
||||
)
|
||||
|
||||
func Run(c echo.Context) error {
|
||||
cmd := c.QueryParam("cmd")
|
||||
fmt.Print("__NYX_SINK_HIT__\n")
|
||||
out, err := exec.Command("sh", "-c", cmd).CombinedOutput()
|
||||
fmt.Print(string(out))
|
||||
return err
|
||||
}
|
||||
|
||||
func main() {
|
||||
e := echo.New()
|
||||
e.GET("/run", Run)
|
||||
_ = e
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue