Sample malicious program that emulates the SolarWinds attack vector.
- Listen for processes that use the go compiler
- Wait for a syscall to open a main.go file
- Pause compiler process.
- Modify contents of main.go, cache legitimate copy.
- Start compiler
- Replace contents of trojanized file with the original.
Warning this software will modify files in your system. Use in a non-production environment only. This does not work 100% of the time. I think there are some issues with the way Go handles threading, which occasionally causes the tracing to fail. If you have a fix please submit a PR.
- compile program
go build .
- Run
solarsploit
as root - In another terminal compile a Go program that includes a file name of
main.go
Solarsploit
will inject the followinginit function
func init() {
fmt.Println("Your code is hacked")
}
Set the IMA policy to tcb
GRUB_CMDLINE_LINUX="ima_policy=tcb ima_hash=sha256 ima=on"
Inspect the IMA log and compare the SHASUM hash of the input files to the value in the logs. Then, verify the log by calculating the aggregate of all of the IMA checksums to the value in PCR register 10 of the TPM device; they should match.