{"id":16905223,"url":"https://github.com/tobyxdd/linux-anti-debugging","last_synced_at":"2025-03-22T10:31:07.372Z","repository":{"id":84165068,"uuid":"156083090","full_name":"tobyxdd/linux-anti-debugging","owner":"tobyxdd","description":null,"archived":false,"fork":false,"pushed_at":"2022-08-04T21:35:15.000Z","size":7,"stargazers_count":37,"open_issues_count":0,"forks_count":13,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-18T10:21:28.745Z","etag":null,"topics":["anti-debugging","linux","ptrace"],"latest_commit_sha":null,"homepage":null,"language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tobyxdd.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-11-04T13:07:33.000Z","updated_at":"2024-09-06T07:38:42.000Z","dependencies_parsed_at":"2023-03-12T21:54:11.516Z","dependency_job_id":null,"html_url":"https://github.com/tobyxdd/linux-anti-debugging","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/tobyxdd%2Flinux-anti-debugging","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tobyxdd%2Flinux-anti-debugging/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tobyxdd%2Flinux-anti-debugging/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tobyxdd%2Flinux-anti-debugging/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tobyxdd","download_url":"https://codeload.github.com/tobyxdd/linux-anti-debugging/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244943725,"owners_count":20536290,"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":["anti-debugging","linux","ptrace"],"created_at":"2024-10-13T18:37:47.851Z","updated_at":"2025-03-22T10:31:07.349Z","avatar_url":"https://github.com/tobyxdd.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Linux ptrace anti-debugging demo\n\nSimple proof-of-concept of a random idea.\n\nClassic anti-debugging techniques on Linux include either checking `TracerPID` in `/proc/pid/status` or using `ptrace` to attach to the process and do nothing. These techniques are easy to bypass.\n\nInstead of just attaching to the process and doing nothing, what about we make `ptrace` an integral part of the program that can't be simply removed?\n\nIn this demo, the program has a custom system call (it's just `write` with a different system call number and argument/register mapping in this case) that cannot be recognized by the standard Linux kernel. It must rely on its own `ptrace` code to dynamically replace the calls with standard `write` calls. If someone detaches it and attaches their own debugger, the program automatically loses its ability to run normally.\n\nThis demo itself is still relatively easy to bypass since a reverser can analyze the syscall mapping and implement it into their own debuggers. To make it more effective, consider doing the following:\n\n - Build a custom `libc` with all syscall modified\n - Dynamically randomize the syscall mapping each time the program starts\n - Further mess up the argument (register) order\n - Do some weird things to register values (XOR, rotations etc.)\n - Compile your `ptrace` code with `OLLVM` or use other obfuscators\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftobyxdd%2Flinux-anti-debugging","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftobyxdd%2Flinux-anti-debugging","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftobyxdd%2Flinux-anti-debugging/lists"}