Skip to content

Instantly share code, notes, and snippets.

@noname007
Last active June 30, 2017 01:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save noname007/b2709350db84971d15622fadae803fa9 to your computer and use it in GitHub Desktop.
Save noname007/b2709350db84971d15622fadae803fa9 to your computer and use it in GitHub Desktop.
<?php
require "2.php"
<?php
echo __FILE__;
/*************************************************************************
> File Name: test.c
> Author:
> Mail:
> Created Time: Mon 26 Jun 2017 08:35:42 PM PDT
************************************************************************/
#include<stdio.h>
#include <sys/mman.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
int
main(int argc, char* argv[])
{
int fd = open("2.php", O_RDONLY);
struct stat s;
fstat(fd, &s);
mmap(NULL, s.st_size, PROT_READ, MAP_PRIVATE, fd, 0);
sleep(5);
}
@noname007
Copy link
Author

noname007 commented Jun 27, 2017

根据 nikic 所説, 用 C 不能浮现问题。
for ((n=0;n<100;n++)) do ./a.out & done

@noname007
Copy link
Author

noname007 commented Jun 27, 2017

先用strace php 1.php 找到对应的 系统调用,然后构造出对应的 test.c

@noname007
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment