小编Gou*_*jon的帖子

程序集执行 /bin/bash (x64)

我是 asm 的新手,我正在尝试对 /bin/bash 执行系统调用。但是我目前遇到以下问题:

我的代码适用于第一个参数长度小于 8 个字节的任何 execve 调用,即 "/bin/sh" 或 "/bin/ls" :

.section .data

    name: .string "/bin/sh"

.section .text

.globl _start

_start:
    #third argument of execve, set to NULL
    xor %rdx, %rdx 

    #push nullbyte to the stack
    pushq %rdx 

    #push /bin/sh to the stack
    pushq name 

    #copy stack to rdi, 1st arg of execve
    mov %rsp, %rdi 

    #copy 59 to rax, defining syscall number for execve  
    movq $59, %rax 

    #3rd arg of execve set to NULL
    movq $0, …
Run Code Online (Sandbox Code Playgroud)

64-bit assembly system-calls execve

0
推荐指数
1
解决办法
4490
查看次数

标签 统计

64-bit ×1

assembly ×1

execve ×1

system-calls ×1