Almost-Sudo
Disclaimer
This tiny script which performs an temporary sudo-alias was developed just with awareness and educational intentions. Was tested in Ubuntu environments, using either BASH or ZSH shells.
Requirements
- Access to a user shell (Most likely to a sudoer user)
- GPG, netcat installed.
- Network access to shared server.
- Public PGP-key server in the HTTP Server need to be called "pentesting_issues.pdf" (hardcoded)
Steps to use it
- Create a pgp-pair key.
- Log in to a shared server (between the target and yourself)
- Set an HTTP-Server hosting the public PGP key at port 6666. (Right know is hardcoded, could be changed, but I don't think is necessary)
- Set an Netcat-Server receiving connections at port 6667, logging all data received to a file.
- Run the script providing the ip/host of the shared server, inside the target machine.
- Connect to the shared server and get the logging file from the NC sever.
- Decript the file using the private PGP key.
Future work
Every feedback/help will be very welcome.
- Delete temp directory.
- Remove public key from keyring.
- More..
In depth description
The bash script can be found here.
In order to ease the explaniation it is divided in different parts:
- Checks of parameters and more stuff
- Path and files configurations
- Getting information required
- Script creation
- Creating backup and giving rights to the script to execute
- Writing in the shellrc (sudo alias) and status variable