/ptrace_experiments

Experimenting shell injection with `ptrace`.

Primary LanguageCMIT LicenseMIT

ptrace_experiments

Experimenting shell injection with ptrace.

Steps

  1. Build docker image ptrace-exp:
docker build . --tag ptrace-exp
  1. Run image ptrace-exp:
docker run --name ptrace-1 --cap-add=SYS_PTRACE --security-opt seccomp=unconfined -it ptrace-exp  bash
  1. In container, run tracee, copy the pid printed:
(docker) ./tracee
  1. From another session, access the same container from the outside:
docker exec -it ptrace-1 /bin/bash
  1. In container, run tracer to inject:
(docker) ./tracer <pid>
  1. Now we should be able to run arbitrary commands from the first session.