damnever / hosts-hijacking

[NSFW] Hijack UDP-based(libc recvfrom) DNS A/AAAA response with LD_PRELOAD.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

hosts-hijacking

Hijack UDP-based(libc recvfrom) DNS A/AAAA response with LD_PRELOAD.

# make build

# cat /path/to/hosts
10.8.8.8 google.com

# HOSTS_HIJACKING=/path/to/hosts LD_PRELOAD=$(pwd)/src/hosts-hijacking.so xx-cmd-using-libc-recvfrom

Why

  • We want to keep the dirty hack at the client-side.
  • We have no permission to change the hosts file(or we do not want to change it, see below).
  • No side effect to other processes.

NOTES

  • NOT FULLY TESTED!!!
  • If you want to use it with golang, the most reliable way is compiling the golang program with -tags netcgo(DO NOT use cross-platform compile).

About

[NSFW] Hijack UDP-based(libc recvfrom) DNS A/AAAA response with LD_PRELOAD.

License:BSD 3-Clause "New" or "Revised" License


Languages

Language:C 99.1%Language:Makefile 0.9%