Skip to content

Relying on PATH to find executables is a security hole. #3

@vampirechicken

Description

@vampirechicken

Use full paths to executables.

If you don't provide a full path to the executable, you execute the first one on the path.

$ cat <<EOF > /tmp/head
echo 'Problem?'
EOF
$chmod +x /tmp/head
$ export PATH=/tmp:$PATH 

Now run a program that calls 'head' instead of '/full/path/to/head

You'll run /tmp/head.

If you combine this with setuid/setgid, you have an escalation of privileges waiting to happen.

See also: level one of Stripe Capture the Flag

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions