Skip to content

Instantly share code, notes, and snippets.

@h3ku
Last active March 27, 2018 20:53
Show Gist options
  • Save h3ku/209b3d1e0806369736b0c506b0762d34 to your computer and use it in GitHub Desktop.
Save h3ku/209b3d1e0806369736b0c506b0762d34 to your computer and use it in GitHub Desktop.
Hook fail asserts to prevent false positives with AFL
go build -buildmode=c-shared -o fail_assert.so main.go
Then just LD_PRELOAD the generated .so
package main
import (
"C"
"github.com/rainycape/dl"
"log"
)
func main() {}
//export __assert_fail
func __assert_fail() {
lib, err := dl.Open("libc", 0)
if err != nil {
log.Fatalln(err)
}
defer lib.Close()
var exit_func func()
lib.Sym("exit", &exit_func)
exit_func()
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment