C0deH4cker / PwnableHarness

Manage building and deploying exploitation challenges with ease
MIT License
57 stars 4 forks source link

Add support for passing arguments to the challenge binary #26

Closed C0deH4cker closed 3 weeks ago

C0deH4cker commented 10 months ago

As discussed in #25, there's currently no easy way to pass custom arguments to the challenge binary when it is run to handle a new connection. This is normally not needed if a challenge is developed from scratch using PwnableHarness. However, I can see how it could be useful if the challenge binary is some existing program that the challenge author would like to make accessible over a socket connection.

A new Build.mk variable like DOCKER_CHALLENGE_ARGS could be added that gets passed onto pwnable_server, likely after a -- sentinel. Then, pwnable_server can pass along these arguments directly to the challenge binary when it gets executed on an incoming connection.

C0deH4cker commented 3 weeks ago

Implemented in #31, which is now merged to dev!

See this example: https://github.com/C0deH4cker/PwnableHarness/blob/dev/examples/GimmeArgs/Build.mk

examples/GimmeArgs (dev)$ nc localhost 32323
argv[0] = "/home/gimme-args/gimme-args"
argv[1] = "--foo"
argv[2] = "haha"