logoalt Hacker News

laserbeamtoday at 7:14 AM5 repliesview on HN

I am confused. Is this saying that if you don't have access to `cat`, instead of `cat /path/to/input-file` you can use `base64 /path/to/input-file | base64 --decode`?

Or is it saying that `base64 /path/to/input-file | base64 --decode` can bypass read file permission flags?


Replies

dominicqtoday at 7:21 AM

The first thing. Invoked processes inherit the permissions of the user who invoked them (unless they have the setuid bit). It's just in case you land access to a computer which has all the standard Unix tools disabled to stop attackers from lateral movement.

show 1 reply
prmoustachetoday at 8:27 AM

This is saying that restricting privileges by blacklisting commands do not work (and never worked).

show 1 reply
corvadtoday at 8:24 AM

It's the former. Not bypassing permissions but in shells that might be highly restricted to just a couple commands. Like others have said, very very common in CTFs.

DaSHackatoday at 7:21 AM

If there's a file your user does not have read access to, but you have the ability to run the `base64` binary as root, you can run `base64` as root, (thus encoding the file contents as base64), then pipe the output to another base64 process to decode the file contents.

So yes, the end result is just `cat` with extra steps.

MrDrMcCoytoday at 8:23 AM

Wouldn't a tar pipe be even lighter?

show 2 replies