Gorsair is a penetration testing tool for discovering and remotely accessing Docker APIs from vulnerable Docker containers. Once it has access to the docker daemon, you can use Gorsair to directly execute commands on remote containers.
Exposing the docker API on the internet is a tremendous risk, as it can let malicious agents get information on all of the other containers, images and system, as well as potentially getting privileged access to the whole system if the image uses the
From a release
GORSAIR_VERSIONto whatever release you are interested in
OSto your operating system (
ARCHto your architecture (
And then run the following command to install gorsair.
curl -sS https://github.com/Ullaakut/Gorsair/releases/download/$GORSAIR_VERSION/gorsair_$OS_$ARCH --output /usr/local/bin/gorsair && chmod +x /usr/local/bin/gorsair
From the sources
- Make sure that you have a go version that supports modules (versions 1.11 and above)
- Make sure that your environment contains the
GO111MODULEvariable set to
go build -o /usr/local/bin/gorsair cmd/*.gofrom the root of this repository
Command line options
--targets: Set targets according to the nmap target format. Required. Example:
2375,2376) Set custom ports.
4) Set custom nmap discovery presets to improve speed or accuracy. It’s recommended to lower it if you are attempting to scan an unstable and slow network, or to increase it if on a very performant and reliable network. You might also want to keep it low to keep your discovery stealthy. See this for more info on the nmap timing templates.
--verbose: Enable more verbose logs.
--decoys: List of decoy IP addresses to use (see the decoy section of the nmap documentation)
--interface: Network interface to use
--proxies: List of HTTP/SOCKS4 proxies to use to deplay connections with (see documentation)
--spoof-ip: IP address to use for IP spoofing
--spoof-mac: MAC address to use for MAC spoofing
--verbose: Enable verbose logging
--help: Display the usage information
How can I protect my containers from this attack
- Avoid putting containers that have access to the docker socket on the internet
- Avoid using the
rootaccount in docker containers