{"id":18627491,"url":"https://github.com/yugr/sighandlercheck","last_synced_at":"2025-08-08T08:44:22.804Z","repository":{"id":129419424,"uuid":"46635208","full_name":"yugr/sighandlercheck","owner":"yugr","description":"Proof-of-concept tool for checking signal handlers for reentrancy issues.","archived":false,"fork":false,"pushed_at":"2020-06-06T06:21:12.000Z","size":43,"stargazers_count":19,"open_issues_count":0,"forks_count":2,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-03-25T09:53:00.465Z","etag":null,"topics":["dynamic-analysis","program-analysis","reentrancy","runtime-verification","signal","signal-handler"],"latest_commit_sha":null,"homepage":"","language":"C","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/yugr.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","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":"2015-11-21T21:45:45.000Z","updated_at":"2025-01-23T13:26:37.000Z","dependencies_parsed_at":"2023-03-13T11:23:02.259Z","dependency_job_id":null,"html_url":"https://github.com/yugr/sighandlercheck","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/yugr%2Fsighandlercheck","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yugr%2Fsighandlercheck/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yugr%2Fsighandlercheck/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/yugr%2Fsighandlercheck/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/yugr","download_url":"https://codeload.github.com/yugr/sighandlercheck/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248347470,"owners_count":21088659,"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":["dynamic-analysis","program-analysis","reentrancy","runtime-verification","signal","signal-handler"],"created_at":"2024-11-07T04:42:35.468Z","updated_at":"2025-04-11T05:31:39.677Z","avatar_url":"https://github.com/yugr.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# What is this?\n\nSignal Checker is a small proof-of-concept tool for detecting\nunsafe signal handlers. C standard requires signal handlers\nto only call reentrant subset of libc (see CERT's [SIG30-C](https://wiki.sei.cmu.edu/confluence/display/c/SIG30-C.+Call+only+asynchronous-safe+functions+within+signal+handlers) for more details and real-world vulnerabilities).\n\nThe tool works by preloading a DSO (libsigcheck.so) to a process.\nThe DSO intercepts all (!) libc functions. The interceptors check\nwhether they run in unsafe context.\n\nThe tool is rather hacky but it was able to detect potential errors\nin popular programs (zip, aspell).\n\nAll credits for the idea (but not for it's ugly implementation)\nshould go to Michal Zalewski (aka [lcamtuf](http://lcamtuf.coredump.cx)).\n\nThe project is MIT licensed. It does not have any fancy dependencies,\njust Glibc, GCC and Python.\n\n# Why should I care about signal safety?\n\nCheck lcamtuf's [Delivering Signals for Fun and Profit](http://lcamtuf.coredump.cx/signals.txt) or CWE's\n[Signal Handler with Functionality that is not Asynchronous-Safe](https://cwe.mitre.org/data/definitions/828.html).\n\nBasically unsafe signal handlers may be used to exploit enclosing process.\nThis is particularly dangerous on Linux, where ordinary user can send signal\nto setuid process.\n\n# What are current results?\n\nQuite interesting: I saw unsafe behavior in archivers (tar, bzip2, zip, etc.),\nTexinfo, aspell, make, calendar, gpg and gdb (see scripts/examples for details).\n\n# Usage\n\nRun your app under sigcheck tool and send it a signal:\n\n```\n $ sigcheck myapp ... \u003e /dev/null \u0026\n $ kill -HUP $!\n```\n\nInstead of manually sending the signals, you can ask the tool to automate it\nby setting SIGCHECK\\_FORK\\_TESTS environment variable to \"atexit\"\n(to send signals prior to exiting program) or to \"onset\"\n(to send signal immediately after it got set). Both may find different sets of\nbugs for different applications.\n\nOther influential environment variables:\n* SIGCHECK\\_VERBOSE        - print debug info\n* SIGCHECK\\_MAX\\_ERRORS     - limit number of reported errors\n* SIGCHECK\\_OUTPUT\\_FILENO - output file descriptor (TODO: make this a filename?)\n\nFor some examples, see scripts/examples.\n\n# Build\n\nTo build the tool, simply run ./build.sh from project top directory.\nThis has only been tested in Ubuntu 14.04.\n\n# Test\n\nTo test the tool, run scripts/runtests.sh from project top directory.\nReal-world examples are available in scripts/examples.\n\n# Future plans\n\nThe main high-level items are\n* run a complete distro under this (e.g. by putting libsigcheck.so to /etc/ld.so.preload)\n* design (basically whether all this should be rewritten to use uprobes)\n* interception of libc is ugly ugly (although efficient)\n* make code thread-safe\n\nAlso various TODOs are scattered all over the codebase.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyugr%2Fsighandlercheck","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fyugr%2Fsighandlercheck","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fyugr%2Fsighandlercheck/lists"}