From 508a06c14a26982b241f8c0423df37d0fb6dd3a3 Mon Sep 17 00:00:00 2001 From: Emilio Pinna Date: Mon, 3 Sep 2018 21:33:24 +0100 Subject: [PATCH] Add cp as suggested in #20 --- _gtfobins/cp.md | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 _gtfobins/cp.md diff --git a/_gtfobins/cp.md b/_gtfobins/cp.md new file mode 100644 index 0000000..b2e883f --- /dev/null +++ b/_gtfobins/cp.md @@ -0,0 +1,28 @@ +--- +description: This can be used to read or write files outside a restricted file systems or with elevated privileges. +functions: + file-write: + - code: | + LFILE=file_to_write + TF=$(mktemp) + echo "DATA" > $TF + cp $TF $LFILE + file-read: + - code: | + LFILE=file_to_read + TF=$(mktemp) + cp $LFILE $TF + cat $TF + suid-enabled: + - code: | + LFILE=file_to_write + TF=$(mktemp) + echo "DATA" > $TF + ./cp $TF $LFILE + sudo-enabled: + - code: | + LFILE=file_to_write + TF=$(mktemp) + echo "DATA" > $TF + sudo cp $TF $LFILE +---