{"id":20913063,"url":"https://github.com/mattbostock/go-ldpreload-backdoor","last_synced_at":"2025-10-17T13:02:55.267Z","repository":{"id":78459214,"uuid":"41390326","full_name":"mattbostock/go-ldpreload-backdoor","owner":"mattbostock","description":"LD_PRELOAD libc hooking using Go","archived":false,"fork":false,"pushed_at":"2015-12-09T01:28:34.000Z","size":21,"stargazers_count":157,"open_issues_count":2,"forks_count":27,"subscribers_count":9,"default_branch":"master","last_synced_at":"2025-04-01T20:31:44.538Z","etag":null,"topics":["cgo","go","golang","ldpreload","shell"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mattbostock.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-08-25T22:06:05.000Z","updated_at":"2025-01-10T13:56:29.000Z","dependencies_parsed_at":"2023-05-02T03:13:39.111Z","dependency_job_id":null,"html_url":"https://github.com/mattbostock/go-ldpreload-backdoor","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mattbostock%2Fgo-ldpreload-backdoor","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mattbostock%2Fgo-ldpreload-backdoor/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mattbostock%2Fgo-ldpreload-backdoor/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mattbostock%2Fgo-ldpreload-backdoor/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mattbostock","download_url":"https://codeload.github.com/mattbostock/go-ldpreload-backdoor/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253913045,"owners_count":21983246,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cgo","go","golang","ldpreload","shell"],"created_at":"2024-11-18T14:34:43.560Z","updated_at":"2025-09-18T22:55:12.672Z","avatar_url":"https://github.com/mattbostock.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# LD_PRELOAD libc hooking using Go\n\nThis is an experiment to use Go in a shared library to wrap a libc function and\nstart a TCP server (a 'backdoor') allowing arbitrary commands to be\nrun from a client such as telnet or netcat.\n\nThis is a toy intended for educational purposes to demonstrate some of\nGo's capabilities.\n\nWorks on Linux only and requires Go version 1.5 or above in order to build the\nshared library.\n\n## Rationale\n\nIn writing this, I have four aims:\n\n- to try out [Go's new build modes][], which allow Go to be compiled to a\n  shared library that can be called from C\n\n- to experiment with `LD_PRELOAD` exploits\n\n- to experiment with calling C from Go\n\n- to learn some C ;)\n\n[Go's new build modes]: https://docs.google.com/document/d/1nr-TQHw_er6GOQRsF6T43GGhFDelrAP0NqSS_00RgZQ\n\n## Usage\n\nAs this is an experiment, the backdoor will only listen on localhost.\n\n    GO15VENDOREXPERIMENT=1 go build -buildmode=c-shared -o backdoor.so main.go\n    LD_PRELOAD=./backdoor.so top\n\nIn a separate console, while `top` is running:\n\n    nc localhost 4444\n    [...type your commands here...]\n\n## Limitations\n\n- Only works on Linux\n- Only works with binaries that call libc's `strrchr` function. I'd ideally\n  like to hook `__libc_start_main` instead. The binaries I tested with are `ps`\n  and `top` as provided by Ubuntu Trusty LTS.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmattbostock%2Fgo-ldpreload-backdoor","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmattbostock%2Fgo-ldpreload-backdoor","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmattbostock%2Fgo-ldpreload-backdoor/lists"}