-
Notifications
You must be signed in to change notification settings - Fork 53
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from hduisa/pnck
finished upload , request merging
- Loading branch information
Showing
24 changed files
with
1,436 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# ROP | ||
### 描述: | ||
* GeruzoniAnsasu给他的学弟讲解了一下rop是什么之后,学弟问到,程序代码全都写成rop的形式会是什么样?答:混沌邪恶。 | ||
* 基本上主要操作都是push push push ret 完成的……输入正确的key之后会依次跳到几个加解密的代码段,跳的地址跟上一段加解密结果有关,最后跳到正确的地址后会将flagiswhatthefuck?改为flagiswhatyouwant | ||
|
||
|
||
* 这里的代码是批量出的某个版本。。而且源码部分已经部分打乱了,最初的顺序写的代码不知道被我改了什么东西编译不了了orz将就吧,反正哪个版本都看不懂的 | ||
|
||
* sample10是我自己尝试逆的另一个版本,到第二个跳rbx的地方发现不给提示没法猜原数据……orz好吧我承认这个东西确实就是写来让人做不了的,不过本意并不是逻辑意义上的做不了 | ||
* `[*][c][t][f][_][f][+][+][+][+]`打*号的位是不固定的(不过也没人发现)打+号的位置不影响跳转地址,但会因aesenc加密后不符导致最后不会显示flag正确的提示,如果真要逆这几位的话……别想了不可能逆得了的 | ||
* 程序总共有5段aesenc顺序和数据全对才能提示正确。。gg,没法做 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,135 @@ | ||
//callee.c | ||
#include <stdlib.h> | ||
#include <stdio.h> | ||
#include <memory.h> | ||
#include <sys/types.h> | ||
#include <fcntl.h> | ||
#include <unistd.h> | ||
#include <signal.h> | ||
|
||
ssize_t read(int fd, void *buf, size_t count); | ||
ssize_t write(int fd, const void *buf, size_t count); | ||
extern char * _extern; | ||
extern char* _extern_end; | ||
char flgsz[128] = {"\nflag:hctf{Ye4h_u_g0"}; | ||
char fakesz[128] = {"什么的……当然是假的啦!"}; | ||
|
||
//tmp | ||
extern char * FAKE_J1; | ||
extern char * FAKE_J2; | ||
extern char * FAKE_J3; | ||
extern char * FAKE_J4; | ||
extern char * FAKE_J5; | ||
extern char * FAKE_J6; | ||
extern char * FAKE_J7; | ||
extern char * FAKE_J8; | ||
extern char * FAKE_J9; | ||
extern char * FAKE_J10; | ||
extern char * FAKE_J11; | ||
extern char * FAKE_J12; | ||
|
||
void XOR(char *s1,char *s2,unsigned int len) | ||
{ | ||
unsigned int i=0; | ||
for(i=0;i<len;i++) | ||
{ | ||
*(s1+i) ^= *(s2+(len-i)); | ||
} | ||
} | ||
|
||
void __fini(void) __attribute__((destructor)); | ||
void __fini(void)//never here | ||
{ | ||
XOR (FAKE_J1,FAKE_J2,0x30); | ||
XOR (FAKE_J2,FAKE_J3,0x30); | ||
XOR (FAKE_J3,FAKE_J4,0x30); | ||
XOR (FAKE_J4,FAKE_J5,0x30); | ||
XOR (FAKE_J5,FAKE_J6,0x30); | ||
XOR (FAKE_J6,FAKE_J7,0x30); | ||
XOR (FAKE_J7,FAKE_J8,0x30); | ||
XOR (FAKE_J8,FAKE_J9,0x30); | ||
XOR (FAKE_J9,FAKE_J10,0x30); | ||
XOR (FAKE_J10,FAKE_J11,0x30); | ||
XOR (FAKE_J11,FAKE_J12,0x30); | ||
} | ||
void __init(void) __attribute__((constructor)); | ||
void __init(void) | ||
{ | ||
|
||
__asm__ __volatile__ ( | ||
"pushq %rbp;" | ||
"pushq %rsp;" | ||
"movq %rsp,%rbp;" | ||
"leaq _extern_end, %rsp;"//_extern_end | ||
"pushq $write;" //write | ||
"pushq $puts;" //puts | ||
"pushq $read;" //read | ||
"pushq $memcpy;" //memcpy | ||
"pushq $XOR;" //xor | ||
"leaq 8(%rbp) , %rsp;" | ||
"popq %rbp" | ||
); | ||
} | ||
void handle3() | ||
{ | ||
void handle2(); | ||
puts(fakesz); | ||
signal(SIGALRM,handle2); | ||
alarm(40); | ||
} | ||
void handle2() | ||
{ | ||
puts(flgsz); | ||
signal(SIGALRM,handle3); | ||
alarm(1); | ||
} | ||
void handle() | ||
{ | ||
puts("\nTry the flag you got:"); | ||
signal(SIGALRM,handle2); | ||
alarm(10); | ||
} | ||
|
||
int main(int argc, char **argv) | ||
{ | ||
signal(SIGALRM,handle); | ||
alarm(1); | ||
//puts("本来这个程序有好多种运行方法的实在写不下去改简单了\n"); | ||
asm volatile( | ||
"movq $0x0A86BAE4,%rax;" | ||
"push %rax;" | ||
"movq $0x958DE580AEE7B994,%rax;" | ||
"push %rax;" | ||
"movq $0xE6BB8EE58BB8E48D,%rax;" | ||
"push %rax;" | ||
"movq $0xB8E49986E5A89CE5,%rax;" | ||
"push %rax;" | ||
"movq $0x9EAEE5849AE795B3,%rax;" | ||
"push %rax;" | ||
"movq $0xE6B996E68CA1E890,%rax;" | ||
"push %rax;" | ||
"movq $0xBFE88DA7E79AA4E5,%rax;" | ||
"push %rax;" | ||
"movq $0xBDA5E5899CE68FBA,%rax;" | ||
"push %rax;" | ||
"movq $0xE58BA8E7AAB8E499,%rax;" | ||
"push %rax;" | ||
"movq $0xBFE8A59DE6AC9CE6,%rax;" | ||
"push %rax;" | ||
|
||
//"movq %rsp,%rdi;" | ||
"push %rsp;" | ||
"pop %rbx;" | ||
"push $_realstart;"//go start | ||
"push $JMP_RAX;" | ||
"push %rbx;" | ||
"push $POP_RDI;" | ||
//"lea _extern_end, %rax;" | ||
"push $MOV_SELF_RAX;" | ||
"push $SUB_RAX_16;" | ||
"push $_extern_end;" | ||
"push $POP_RAX;" | ||
//"call -0x10(%rax);" | ||
"ret;" | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
test : hctf_flag_:4Ux8dFnFy44XJzG4kvom4YQzC | ||
sample10 : hctf_flag_8417ZbAtX8FSUgeye246LrH446d9 | ||
|
Oops, something went wrong.