분류 전체보기
클러스터, 섹터, 슬랙 ( Cluster, Sector, Slack )
클러스터, 섹터, 슬랙 ( Cluster, Sector, Slack )
2017.11.01Sector디스크는 IO 명령을 받으면, 1 sector 단위로 IO하게 된다.즉, 물리적으로 디스크가 IO하는 단위이며 따라서 실제로 디스크에 IO하게 되는 최소 크기는 1 sector다.보통 1 Sector = 512 bytes. ClusterOS에서 디스크에 접근하기 위해 사용하는 파일시스템에서 IO하는 단위.파일시스템에서는 IO횟수를 줄이기 위해 Sector 단위로 관리하지 않고 Sector들을 묶어 Cluster로 관리한다.따라서 파일시스템에서 IO 명령을 내리는 최소 단위는 1 Cluster가 된다.파일시스템에 따라 다르지만, 보통 8 sectors를 묶어 1 Cluster = 4 KB Slack이런 식으로 파일의 실제 크기와 디스크 최소 IO 크기, 파일시스템 최소 IO 크기가 차이가 나기 ..
파일 카빙 ( File Carving )
파일 카빙 ( File Carving )
2017.11.01파일 카빙 ( File Carving )metadata 보다는 파일 자체의 바이너리 데이터(content, signature, header, ...)를 이용해 디스크의 비할당 영역에서 파일을 복구하는 기법.* 파일이 디스크에 분할되어 저장되어 있는 경우, 비연속적 카빙을 사용해야 한다. http://forensic.korea.ac.kr/DFWIKI/index.php/데이터_복구 헤더, 푸터 시그니처를 모두 갖는 파일 포맷파일 포멧시그니처헤더(Hex)푸터(Hex)JPEGFF D8FF D9GIF]47 49 46 38 37 61 ("GIF87a")00 3B47 49 46 38 39 61 ("GIF89a")PNG89 50 4E 47 0D 0A 1A 0A49 45 4E 44 AE 42 60 82PDF25 50 4..
Webshell pattern 웹쉘 패턴
Webshell pattern 웹쉘 패턴
2017.10.28이 글은 보호되어 있기 때문에 이것을 보려면 암호가 필요합니다.
[CCE2017] Blue : 예선
[CCE2017] Blue : 예선
2017.10.27이 글은 보호되어 있기 때문에 이것을 보려면 암호가 필요합니다.
Volatility
Volatility
2017.10.27installstandalone 보다는 Source code로 직접 받아야 profile을 추가할 수 있다.Source code 압축 해제하면 `` setup.py``가 있는데 ``py import volatility``할거 아니면 안하는게 좋다.그냥 디렉토리 적당한 곳으로 옮기고, `` vol.py``에 symlink 걸어서 사용하면 끝이다. profile 추가Windows profile은 기본적으로 같이 설치되지만 LInux profile은 포함되어 있지 않다.`` --profile``옵션을 지정해주어야 분석이 가능하기 때문에 추가해주어야 한다.* 이미지가 Volatility에 없는 profile인 경우 결과를 출력하기 까지 굉장히 오래 걸린다.* 모든 profile을 추가하면 volatility가 ..
[PHP] SQL Escape & Bypass
[PHP] SQL Escape & Bypass
2017.10.23SQL Escape methodmysqli::real_escape_string이스케이프 문자 목록```php' " \ \x00(NUL) \x1a(EOF) \n \r``` 아래는 모두 동일한 함수.```phpstring mysqli::escape_string ( string $escapestr ) // aliasstring mysqli::real_escape_string ( string $escapestr )string mysqli_real_escape_string ( mysqli $link , string $escapestr )``` addslashes이스케이프 문자 목록```php' " \ \x00(NUL)```DB에서 지원해주는 함수가 정 없다면 addslashes() 를 사용한다. magic_quo..
[kernel] current 구조체 / cred 수정
[kernel] current 구조체 / cred 수정
2017.10.22struct task_struct current/v4.13.8/source/include/linux/sched.h#L519```c struct task_struct {#ifdef CONFIG_THREAD_INFO_IN_TASK /* * For reasons of header soup (see current_thread_info()), this * must be the first element of task_struct. */ struct thread_infothread_info;#endif /* -1 unrunnable, 0 runnable, >0 stopped: */ volatile longstate; ..........................................................
[kernel] hook sys_call_table
[kernel] hook sys_call_table
2017.10.20hook sys_call_table```c#include // included for all kernel modules#include // included for KERN_INFO#include // included for __init and __exit macros#include MODULE_LICENSE("GPL");MODULE_AUTHOR("umbum");MODULE_DESCRIPTION("sys_call_table hooking test"); #define page_offset 0xc0000000#define phys_offset 0x1a000000 // #define __NR_write 4#define __NR_target 4 typedef asmlinkage long (*sys_write_t)..
[kernel] get sys_call_table
[kernel] get sys_call_table
2017.10.16아키텍쳐마다, OS마다 동작이 다르기 때문에 상황에 맞게 생각해야 한다.다음 환경에서 테스트```bashroot@kali32:~/add_syscall# uname -aLinux kali32 4.13.0-kali1-686-pae #1 SMP Debian 4.13.4-1kali1 (2017-10-03) i686 GNU/Linux``` get sys_call_tablesys_call_table의 각 entry는 syscall function의 address이며 ``c syscall()``은 이를 참조하기 때문에, 이를 변경해주면 victim syscall을 호출할 때 마다 변경된 syscall이 호출된다.그러나 다음과 같은 제약이 있다.SYS_CALL_TABLE의 주소를 알아야 한다.SYS_CALL_TABLE..
[kernel] Page Protection
[kernel] Page Protection
2017.10.16Page Protectionx86#1 set_pages_rw , change_page_attrsource/arch/x86/mm/pageattr.c```cint set_pages_rw(struct page *page, int numpages) // use virt_to_page(){unsigned long addr = (unsigned long)page_address(page);return set_memory_rw(addr, numpages);}int set_memory_rw(unsigned long addr, int numpages){return change_page_attr_set(&addr, numpages, __pgprot(_PAGE_RW), 0);}```특정 영역(BIOS, .rodata, .....
[kernel] addr_limit : kernel space arg
[kernel] addr_limit : kernel space arg
2017.10.15addr_limitsystem call은 원래 user mode에서 호출하도록 되어 있기 때문에, system call의 인자로 넘어오는 데이터는 user space의 데이터여야 한다. 인자로 kernel space의 데이터가 넘어오면 제대로 동작하지 않는다. kernel은 `` addr_limit``를 기준으로 인자로 넘어온 데이터가 user space data인지 kernel space data를 구분한다. 따라서 이 경계를 조정해주면 user space data를 넘겨도 정상 동작하도록 만들 수 있다. /source/arch/x86/include/asm/processor.h#L421 ```ctypedef struct { unsigned long seg;} mm_segment_t; struct thr..
[ARM OS image] Android / Linaro
[ARM OS image] Android / Linaro
2017.10.15Androidhttps://developers.google.com/android/images 삼성도 android를 사용하고, android는 LINUX니까 삼성도 GPL 적용을 받지 않을까?소스코드 공개해놓았다고 하는데 나중에 필요하면 찾아보기. http://www.android-x86.org/download - x86으로 porting한 이미지. Ubuntu Linarohttp://www.linaro.org/downloads/LSK를 받으면 된다. release에 들어가면 세부 버전도 받을 수 있음.