小编Sou*_*rya的帖子

gdb 退出而不是生成 shell

我正在尝试利用 SUID 程序。

该计划是:

#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <stdio.h>


#define e(); if(((unsigned int)ptr & 0xff000000)==0xca000000) { setresuid(geteuid(), geteuid(), geteuid()); execlp("/bin/sh", "sh", "-i", NULL); }

void print(unsigned char *buf, int len)
{
    int i;
    printf("[ ");
    for(i=0; i < len; i++) printf("%x ", buf[i]); 
    printf(" ]\n");
}

int main()
{
    unsigned char buf[512];
    unsigned char *ptr = buf + (sizeof(buf)/2);
    unsigned int x;

    while((x = getchar()) != EOF) {
            switch(x) {
                    case '\n': print(buf, sizeof(buf)); continue; break;
                    case …
Run Code Online (Sandbox Code Playgroud)

c bash shell gdb suid

4
推荐指数
1
解决办法
3729
查看次数

标签 统计

bash ×1

c ×1

gdb ×1

shell ×1

suid ×1