Catalog GTFOBins

GTFO · Tool

cp

10 techniques Linux · macOSGTFOBins GPL-3.0

file-write

File WritePrivilege Escalation LinuxmacOS
echo DATA | cp /dev/stdin /path/to/output-file
Context
sudo
Native
file-write
MITRE
T1565

file-write

File WritePrivilege Escalation LinuxmacOS
echo DATA | cp /dev/stdin /path/to/output-file
Context
suid
Native
file-write
MITRE
T1565

privilege-escalation

Privilege Escalation LinuxmacOS

This can be used to copy and then read or write files from a restricted file systems or with elevated privileges. (The GNU version of `cp` has the `--parents` option that can be used to also create the directory hierarchy specified in the source path, to the destination folder.)

cp /path/to/input-file /path/to/output-file
Context
sudo
Native
privilege-escalation
MITRE
T1548

privilege-escalation

Privilege Escalation LinuxmacOS

This can be used to copy and then read or write files from a restricted file systems or with elevated privileges. (The GNU version of `cp` has the `--parents` option that can be used to also create the directory hierarchy specified in the source path, to the destination folder.)

cp /path/to/input-file /path/to/output-file
Context
suid
Native
privilege-escalation
MITRE
T1548

privilege-escalation

Privilege Escalation LinuxmacOS

This can copy SUID permissions from any SUID binary (e.g., `/path/to/input-file`) to another.

cp --attributes-only --preserve=all /path/to/input-file /path/to/output-file
Context
sudo
Native
privilege-escalation
MITRE
T1548

privilege-escalation

Privilege Escalation LinuxmacOS

This can copy SUID permissions from any SUID binary (e.g., `/path/to/input-file`) to another.

cp --attributes-only --preserve=all /path/to/input-file /path/to/output-file
Context
suid
Native
privilege-escalation
MITRE
T1548