본문 바로가기

system/material

seccomp_bypass_trick 보호되어 있는 글입니다. 더보기
linux file vtable check bypass linux file vtable check bypassvtable check (glibc >= 2.24)/* _IO_vtable_check Source: https://code.woboq.org/userspace/glibc/libio/vtables.c.html#_IO_vtable_check */ ​ void attribute_hidden _IO_vtable_check (void) { #ifdef SHARED void (*flag) (void) = atomic_load_relaxed (&IO_accept_foreign_vtables); #ifdef PTR_DEMANGLE PTR_DEMANGLE (flag); #endif if (flag == &_IO_vtable_check) return; { Dl_info.. 더보기
iretq, fops, tty, tty_ops struct iretq, fops, tty, tty_ops structiretqstruct trap_frame { size_t user_rip ; // instruction pointer size_t user_cs ; // code segment size_t user_rflags ; // CPU flags size_t user_rsp ; // stack pointer size_t user_ss ; // stack segment };fopsstruct file_operations { struct module *owner; loff_t (*llseek) (struct file *, loff_t, int); ssize_t (*read) (struct file *, char __user *, size_t, loff_t *).. 더보기
kernel debugging with vmware kernel debugging with vmwareVMware Hypervisor를 이용하여 debugee를 만들고, 이의 kernel을 debugging하는 방법을 소개한다.make debugeeVMware로 분석 대상 kernel이 구축되어 있는 vmx를 로딩하거나, 딱히 상관없다면 편하게 아무 linux나 만들어서 debugee를 만들자.debugee를 만들었다면 먼저 uname -r로 kernel version을 확인하자.ubuntu@ubuntu:~$ uname -r 4.15.0-70-generic그리고, 디버깅을 위해 vmlinux를 추출해야 한다.vmlinux란 정적으로 링크된 실행 파일 형식의 Linux kernel을 말한다.vmlinuz는 vmlinux를 zlib, bzip2 등으로 압축한.. 더보기
peda special instruction 보호되어 있는 글입니다. 더보기
linux kernel module 작성해보기 linux kernel module 작성해보기맥커널을 공부하기에 앞서 겸사겸사 리눅스 커널부터 공부를 시작한다.Linux ubuntu 4.15.0-66-generic #75~16.04.1-Ubuntu SMP Tue Oct 1 14:01:08 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux 환경에서 테스트를 진행하였다.모든 것의 시작은 hello_world이다라고 생각하니 이러한 기능을 하는 모듈을 하나 만들어보도록 하자! #include #include #include static int __init hello_init(void) { printk("hello_init() hello world!\n"); return 0; } static void __exit hello_exit(vo.. 더보기
return-to-dynamic-linker return-to-dl-resolve return-to-dynamic-linkerx86Elf32_Rel (8 byte)typedef uint32_t Elf32_Addr;typedef uint32_t Elf32_Word;typedef struct{ Elf32_Addr r_offset; /* Address */ Elf32_Word r_info; /* Relocation type and symbol index */} Elf32_Rel;Elf32_Sym (16 byte)xxxxxxxxxxtypedef struct{ Elf32_Word st_name; /* Symbol name (string tbl index) */ Elf32_Addr st_value; /* Symbol value */ Elf32_Word st_.. 더보기
unsortedbinbin_attck died.. unsortedbin_attack unsortedbin_attack died아직 모르고 있었는데 glibc > 2.28부터는 unsortedbin의 binning code checks가 생겼다.. 이것 때문에 정말 삽질을 많이해서 안까먹게 블로그에 올린다. --- a/malloc/malloc.c+++ b/malloc/malloc.c@@ -3716,11 +3716,22 @@ _int_malloc (mstate av, size_t bytes) while ((victim = unsorted_chunks (av)->bk) != unsorted_chunks (av)) { bck = victim->bk;- if (__builtin_expect (chunksize_nomask (victim) av->system_me.. 더보기