분류 전체보기 156

[Kernel] Linux kernel (7) - pwnable.kr rookiss syscall write-up ( Syscall overwrite )

Kernel (7) - Syscall overwrite ( pwnable.kr rookiss syscall write-up )ContentsAnalysisAttack cenarioExploitShellReference Analysis// adding a new system call : sys_upper ​ #include #include #include #include #include #include #include #include ​ #define SYS_CALL_TABLE 0x8000e348 // manually configure this address!! #define NR_SYS_UNUSED 223 ​ //Pointers to re-mapped writable pages unsigned int**..

[Kernel] Linux kernel (6) - CISCN 2017 babydriver write-up ( Linux kernel UAF )

Kernel (6) - CISCN 2017 babydriver write-up ( Linux kernel UAF )ContentsWhat is UAF?CISCN 2017 babydriversettinganalysisexploitConclusion What is UAF(first-fit)?UAF란 Use After Free의 약자이다.말 그대로, 힙 공간을 사용 한 후 힙을 해제했을때 발생되는 취약점이다.아래 코드를 보자.#include #include int main(void) { int *heap1; int *heap2; int *heap3; heap1 = (int *)malloc(sizeof(int) * 50); heap2 = (int *)malloc(sizeof(int) * 50); printf("..

[pwnable.tw] bookwriter ( write-up )

Pwnable.tw bookwriter ( 350 pts )Summaryoff by onehouse of orange처음 풀어보는 오렌지 문제였습니다. 오렌지 꿀잼. Analysismain()void __fastcall main(__int64 a1, char **a2, char **a3) { setvbuf(stdout, 0LL, 2, 0LL); puts("Welcome to the BookWriter !"); input_author(); while ( 1 ) { menu(); switch ( read_int() ) { case 1LL: add(); break; case 2LL: view(); break; case 3LL: edit(); break; case 4LL: information(); break;..

[Layer7 CTF] Angel-in-us ( write-up )

Layer7 CTF - Angel in usSummaryTop chunk freestdout leakscanf trick이문제는 SED팀 소속 Howdays라는 빡고수형이 낸 문제이다.대회중에도 솔버가 한명도 없었던 재밌는 문제이다. Analysismain()void __fastcall __noreturn main(__int64 a1, char **a2, char **a3) { __int16 buf; // [rsp+6h] [rbp-Ah] unsigned __int64 canary; // [rsp+8h] [rbp-8h] ​ canary = __readfsqword(0x28u); setup(); buf = 0; while ( 1 ) { menu(); read(0, &buf, 2uLL); if ( buf ==..

[Layer7 CTF] How old are you? ( write-up )

Layer7 CTF - How old are you?Summarysimple trickseccomp syscallopenat()다른 출제자분들이 문제를 너무 빡시게내셔서 나도 빡시게 내야하나 싶었다.근데 그냥 쉬운문제 하나 있어야겠다 싶어서 쉬운거 하나 냈다.원래 getdents함수를 이용해서 플래그 패스를 찾게 하려고 했으나 그냥 쉽게 냈다. Analysismain()int __cdecl main(int argc, const char **argv, const char **envp) { char buf; // [rsp+0h] [rbp-110h] int v5; // [rsp+100h] [rbp-10h] int v6; // [rsp+104h] [rbp-Ch] int v7; // [rsp+108h] [rbp-..

[Kernel] Linux kernel (4) - Kernel memory protection and kernel command

Kernel (4) - Kernel protection and kernel commandContentsKernel memory protectionLinux command - control kernelKernel exploit methodology Kernel memory protectionKASLR(Kernel Address Space Layout Randomization)기능 : 부팅에 따라 커널의 메모리 주소를 랜덤화 시킴 SMEP(Supervisor Mode Execution Protection)기능 : 유저 영역의 주소 공간에서 커널의 코드를 실행할 수 없게 함 SMAP(Supervisor Mode Access Protection)기능 : 유저 영역의 주소 공간에서 메모리 접근을 허용하지 않음. ..

[Kernel] Linux kernel (3) - ioctl function and make test program

Kernel (3) - ioctl()ContentsLinux Kernel Function - ioctl()make test program and debuging Linux Kernel Function - ioctl()#include int ioctl(int d,int requset, ...); ​ success : return 0; error : return -1;first parameter : 파일 디스크립터second parameter : 디바이스에 전달한 명령arg : 가변인자 매게변수로 개발자의 설정에 따라 인자의 갯수 등이 달라질 수 있음ioctl()은 read()나 write()함수만으로 해결되지 않는 제어에 사용된다. read함수와 write함수는 데이터의 읽고 쓰기 등의 기능은 가능하지만 ..

[Kernel] Linux kernel (2) - kernel basic 2

Kernel (2) - Linux kernelContents리눅스 커널의 특징리눅스 OS의 기초 개념리눅스(유닉스)의 파일 시스템 리눅스 커널의 특징리눅스 커널(Linux kernel)은 오픈 소스 모놀리딕 유닉스 계열 컴퓨터 운영 체제 커널이다. 리눅스 계열의 운영 체제는 이 커널에 기반을 두며 개인용 컴퓨터와 서버와 같은 전통적인 컴퓨터 시스템들[1]과 라우터, 무선 액세스 포인트, PBX, 셋톱 박스, FTA 리시버, 스마트 TV, PVR, NAS 어플라이언스 등의 다양한 임베디드 장치에 보통 리눅스 배포판의 형태로 배치된다. 태블릿 컴퓨터, 스마트폰, 스마트워치를 위한 안드로이드 운영 체제는 기능 구현을 위해 리눅스 커널이 제공하는 서비스들을 사용한다. 데스크톱 컴퓨터에 채용하는 경우가 낮은 편이..

[Kernel] Linux kernel (1) - kernel basic 1

Kernel (1) - what is kernel?ContentsDefinition of kernelRole of kernelKinds of kernel Definition of kernel컴퓨터 과학에서 커널(kernel)은 컴퓨터의 운영 체제의 핵심이 되는 컴퓨터 프로그램의 하나로, 시스템의 모든 것을 완전히 통제한다.[1] 운영 체제의 다른 부분 및 응용 프로그램 수행에 필요한 여러 가지 서비스를 제공한다. 핵심(核心)[2]이라고도 한다.위키백과에서 긁어온 커널의 정의이다.지금까지 포너블을 공부하면서 많은것을 접했지만 어느 사이트에서도 저렇게 당당하게 컴퓨터 과학에서는 내가 제일 중요한 핵심이야! 라는 내용을 본적이 없었다.그만큼 커널이 담당하고 있는 부분이 크다고 할 수 있겠다.포너블을 공부하면서..