2

I saw someone doing this in a php shell injection:

test | cat /var/backup/secret.txt

Why are they using test |? How is that not useless here?

1
  • Is test a command?
    – schroeder
    Commented Oct 13, 2022 at 10:11

1 Answer 1

0

it's just a junk value, sometimes the command you're injecting to wants some specific data in a string, and some commands need at least one argument or it can cause a pipe fail and not execute the cat command.

In this case I guess it's just there because they were testing and didn't bother removing it. As you observed, cat isn't reading from stdin so whatever data is piped into cat is useless, the attacker is controlling the execution after the pipe command so anything that happens prior is usually irrelevant.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .