Skip to content
Advertisement

How can I use the set-guid (i.e., set group identification) vulnerability to execute a file with limited permissions?

How can I use the set-guid bit vulnerability to execute a file /bin/grade which is owned by root using the following 3 vulnerable programs? I am not root nor part of the bsp* groups so my access to the programs is limited to read & execute only. For the file /bin/grade, I only have read access, but I want to execute it as group bsp*.

JavaScript

The 3 programs are binaries which contain the following C code:

//prog2:

JavaScript

//prog3:

JavaScript

//prog4:

JavaScript

Advertisement

Answer

This problem can be solved by exploiting shell injection vulnerabilities.

For prog2:

JavaScript

When prompted, enter /bin/grade as the file name within the special character ` which the sanitiser forgot to address.

For prog3:

JavaScript

But you have to hit Ctrl+C quickly so that the interrupt signal function is called.

For prog4:

JavaScript
User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement