当前位置: 首页 > news >正文

网站如何做邮箱订阅网站建设总结报告书

网站如何做邮箱订阅,网站建设总结报告书,公明 网站建设,wordpress 纯静态首页看了一些博客,都是在说fuzzer和fork server进行交互,由fork server fork出子进程来执行程序,但是不太明白这两者到底是如何在代码层面进行交互的。 run_target中有这么一段代码,大概意思是fuzzer给fork server传递prev_timed_out…

看了一些博客,都是在说fuzzer和fork server进行交互,由fork server fork出子进程来执行程序,但是不太明白这两者到底是如何在代码层面进行交互的。

run_target中有这么一段代码,大概意思是fuzzer给fork server传递prev_timed_out,然后再从fork server读取子进程的pid,child_pid:

    s32 res;/* In non-dumb mode, we have the fork server up and running, so simplytell it to have at it, and then read back PID. */if ((res = write(fsrv_ctl_fd, &prev_timed_out, 4)) != 4) {if (stop_soon) return 0;RPFATAL(res, "Unable to request new process from fork server (OOM?)");}if ((res = read(fsrv_st_fd, &child_pid, 4)) != 4) {if (stop_soon) return 0;RPFATAL(res, "Unable to request new process from fork server (OOM?)");}if (child_pid <= 0) FATAL("Fork server is misbehaving (OOM?)");

我现在的问题是,为什么fuzzer给fork server传了个参数,fork server就直接返回pid了呢?这中间两者是如何进行交互的?fork server做了什么,就传递了一个child_pid出来?

fork server进程是执行了下面这段代码(删去了一些不重要的代码):

  if (!forksrv_pid) {struct rlimit r;/* Isolate the process and configure standard descriptors. If out_file isspecified, stdin is /dev/null; otherwise, out_fd is cloned instead. */setsid();dup2(dev_null_fd, 1);dup2(dev_null_fd, 2);if (out_file) {dup2(dev_null_fd, 0);} else {dup2(out_fd, 0);close(out_fd);}/* Set up control and status pipes, close the unneeded original fds. */if (dup2(ctl_pipe[0], FORKSRV_FD) < 0) PFATAL("dup2() failed");if (dup2(st_pipe[1], FORKSRV_FD + 1) < 0) PFATAL("dup2() failed");close(ctl_pipe[0]);close(ctl_pipe[1]);close(st_pipe[0]);close(st_pipe[1]);close(out_dir_fd);close(dev_null_fd);close(dev_urandom_fd);close(fileno(plot_file));execv(target_path, argv);/* Use a distinctive bitmap signature to tell the parent about execv()falling through. */*(u32*)trace_bits = EXEC_FAIL_SIG;exit(0);}

可能需要理解setsid();?
简单搜索了下,还得去理解进程相关只是,于是去问了bing,bing的回答告诉我:setsid()函数是一个系统调用,它的作用是创建一个新的会话(session),并使得当前进程成为会话的首进程(session leader),这个函数似乎和我想知道的东西没有联系。

问了下bing,并参考了这个博客:https://blog.csdn.net/Little_Bro/article/details/122694054,fork server的交互还和插桩有关系。

查看了AFL白皮书:https://github.com/mirrorer/afl/blob/master/docs/technical_details.txt,写的很粗略,还是得去看作者的博客:https://lcamtuf.blogspot.com/2014/10/fuzzing-binaries-without-execve.html

Unfortunately, there is also a problem: especially for simple libraries, you may end up spending most of the time waiting for execve(), the linker, and all the library initialization routines to do their job. I’ve been thinking of ways to minimize this overhead in american fuzzy lop, but most of the ideas I had were annoyingly complicated. For example, it is possible to write a custom ELF loader and execute the program in-process while using mprotect() to temporarily lock down the memory used by the fuzzer itself - but things such as signal handling would be a mess. Another option would be to execute in a single child process, make a snapshot of the child’s process memory and then “rewind” to that image later on via /proc/pid/mem - but likewise, dealing with signals or file descriptors would require a ton of fragile hacks.

为什么不直接多次调用execve()?因为每次调用 execve()都会有一些预处理的开销,作者想要加快这个过程。(不太了解预处理的过程,后续有需要再了解)

Luckily, Jann Horn figured a different, much simpler approach, and sent me a patch for afl out of the blue 😃 It boils down to injecting a small piece of code into the fuzzed binary - a feat that can be achieved via LD_PRELOAD, via PTRACE_POKETEXT, via compile-time instrumentation, or simply by rewriting the ELF binary ahead of the time. The purpose of the injected shim is to let execve() happen, get past the linker (ideally with LD_BIND_NOW=1, so that all the hard work is done beforehand), and then stop early on in the actual program, before it gets to processing any inputs generated by the fuzzer or doing anything else of interest. In fact, in the simplest variant, we can simply stop at main().

作者给出了一个很巧妙的解决方法,在被fuzzed的程序中插桩,让这个程序在完成预处理后暂停(比如再main函数的第一句话暂停),然后在这里调用fork(),被fork出来的子进程将会直接跳过预处理过程,开始执行实际处理。

Once the designated point in the program is reached, our shim simply waits for commands from the fuzzer; when it receives a “go” message, it calls fork() to create an identical clone of the already-loaded program; thanks to the powers of copy-on-write, the clone is created very quickly yet enjoys a robust level of isolation from its older twin. Within the child process(fork server创建的子进程), the injected code returns control to the original binary, letting it process the fuzzer-supplied input data (and suffer any consequences of doing so). Within the parent, the shim relays the PID of the newly-crated process to the fuzzer and goes back to the command-wait loop.

作者把插入的代码叫做slim(分隔片,还是很形象的),slim等待来自fuzzer的命令(对应run_target中的write(fsrv_ctl_fd, &prev_timed_out, 4)?),在收到fuzzer的命令后,fork server fork出来一个真正执行二进制程序的fuzzed进程,并给fuzzer返回一个pid。

这里有一个问题,函数参数是在哪里传递的呢?write(fsrv_ctl_fd, &prev_timed_out, 4)似乎没有传递参数。

接下俩作者还讨论了实际实现可能遇到的问题,以及插桩的汇编代码

https://blog.csdn.net/Little_Bro/article/details/12269405,这个博客对插桩代码进行了解释,但是我目前不需要对插桩代码理解的那么清楚,已经明白了fork server和fuzzer之间交互的逻辑

http://www.yayakq.cn/news/172920/

相关文章:

  • 网站功能模块设计h5做怎么做微网站
  • 做网站比较好的公司有哪些网站开发的技术路线是什么
  • wordpress网站安装插件视频软件下载大全免费
  • 北京建网站 优帮云ui设计的网站有哪些
  • 手机端网站怎么做的长春市人才网
  • 宁德网站开发建筑类企业网站模板下载
  • 江苏网站建设yijuce做网站的价位
  • 样本代替做网站甘肃建设体网站首页
  • 网站cms大全青岛网站建设套餐报价
  • 怎么找人做网站啊工程信息造价
  • 青海电商网站建设公司wordpress 顶踩插件
  • 重庆网站设计公司推荐自建网站需要学哪些
  • 如何知道一个网站是谁做的医院网站制作设计
  • 怎样将建设银行网站加入可信站wordpress直播购物插件下载
  • 大学两学一做专题网站网站如何接广告赚钱
  • 如何安装网站模版wordpress 报名插件
  • 网站后台安全性网站首页新世纪建设集团有限公司
  • 翠屏区网站建设虚拟主机多个网站
  • 怎么成立网站iis wordpress index.php
  • 哈西建站优化wordpress怎么改后台
  • 做网站用什么语言开发自己做网站挣钱吗
  • 顶尖手机网站建设怎样开发公司的网站建设
  • dede title 我的网站服务之家网站推广公司
  • 河南网站seo咨询公司起名用字大全
  • 网站建设最重要的环节百度首页 百度一下
  • 用路由器做网站小程序直播助手
  • 有哪些网站可以做家教温州市城建设计院网站
  • 合肥建设网站哪个好做专利费减是哪个网站
  • 如何传图片做网站网站开发能从事那些职业
  • asp网站管理系统破解版松岗做网站费用