{"id":22375504,"url":"https://github.com/slavamuravey/suidscript","last_synced_at":"2025-09-03T13:16:39.196Z","repository":{"id":210200128,"uuid":"725986078","full_name":"slavamuravey/suidscript","owner":"slavamuravey","description":"Here is a demo why suid-bits are unavailable for executable scripts","archived":false,"fork":false,"pushed_at":"2024-01-23T01:00:58.000Z","size":4,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-07-27T14:57:59.860Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Shell","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/slavamuravey.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":"2023-12-01T09:40:49.000Z","updated_at":"2025-01-24T10:16:09.000Z","dependencies_parsed_at":"2025-03-26T17:47:04.869Z","dependency_job_id":"44200fbe-6a3d-4d05-9239-20ddbc567361","html_url":"https://github.com/slavamuravey/suidscript","commit_stats":null,"previous_names":["slavamuravey/suidscript"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/slavamuravey/suidscript","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/slavamuravey%2Fsuidscript","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/slavamuravey%2Fsuidscript/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/slavamuravey%2Fsuidscript/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/slavamuravey%2Fsuidscript/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/slavamuravey","download_url":"https://codeload.github.com/slavamuravey/suidscript/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/slavamuravey%2Fsuidscript/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":273448578,"owners_count":25107597,"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","status":"online","status_checked_at":"2025-09-03T02:00:09.631Z","response_time":76,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":[],"created_at":"2024-12-04T21:26:26.130Z","updated_at":"2025-09-03T13:16:39.139Z","avatar_url":"https://github.com/slavamuravey.png","language":"Shell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# suidscript\nHere is a demo why suid-bits are unavailable for executable scripts.\nThere are a number of scripts in the repository to demonstrate the possible atack.\n\nIn OS suid-bits have no effect for executable scripts for security reason.\nBut what if there was an effect?\n\nLet's imagine you are a hacker and you have found some suid-script (**script.sh**) with root owner.\nThen you can write some malicious script using the same script language as the **script.sh**. Let it will be **hack.sh**.\nTo run **hack.sh** script with root privilege you can create **attack.sh** script where you create a symlink which follows to **script.sh** first (to get root privilege) and after running script via symlink you redirect the symlink to you **hack.sh** script.\nIf run **attack.sh** script several times you can catch a case when the symlink will be redirected before the interpreter (Bash our case) will start.\nThen **hack.sh** script will run with root privilege. To catch this case you can run **attack.sh** in the loop and **repeat-attack.sh** script could help with this.\n\nThe output for the **repeat-attack.sh** will be something like following:\n```\n$ ./repeat-attack.sh \nhack\nhack\nhack\nhack\nhack\nasd\nhack\nhack\nhack\nasd\nhack\n```\n\nAnd it means we can run **hack.sh**. If the executing script were affected by suid-bits, the **hack.sh** script would be run as root.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fslavamuravey%2Fsuidscript","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fslavamuravey%2Fsuidscript","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fslavamuravey%2Fsuidscript/lists"}