Last active
March 27, 2018 20:53
-
-
Save h3ku/209b3d1e0806369736b0c506b0762d34 to your computer and use it in GitHub Desktop.
Hook fail asserts to prevent false positives with AFL
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
go build -buildmode=c-shared -o fail_assert.so main.go | |
Then just LD_PRELOAD the generated .so |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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