전체 글

Reversing Advanced

[dreamhack] rev-basic-0

rev-basic-0ida64로 chall0.exe를 디컴파일 했다.ida64 → open → chall0.exe → main → [tab] click main()을 hex-ray(TAB)로 디컴파일해서 코드를 확인해보자.int __cdecl main(int argc, const char **argv, const char **envp){ char v4[256]; // [rsp+20h] [rbp-118h] BYREF memset(v4, 0, sizeof(v4)); printf("Input : "); sub_1400011F0("%256s", v4); if ( (unsigned int)sub_140001000(v4) ) puts("Correct"); else puts("Wrong"); ..

System Hacking Advanced

[dreamhack] cpp_smart_pointer_1

개념정리○ smart pointer스마트 포인터(Smart Pointer)는 메모리 누수(Memory Leak)를 방지하기 위해 사용되는 C++의 기능 중 하나다. 동적 할당된 메모리를 가리키는 포인터가 더 이상 필요하지 않을 때, 해당 메모리를 자동으로 해제하는 포인터를 말한다. 스마트 포인터는 일반적으로 std::shared_ptr, std::unique_ptr, std::weak_ptr 등의 클래스로 구현된다. 이러한 스마트 포인터들은 더 이상 사용되지 않는 동적 할당된 메모리를 추적하고, 해당 메모리를 자동으로 해제하여 메모리 누수를 방지한다. ○ smart pointer Typestd::shared_ptr은 여러 포인터가 하나의 메모리를 가리킬 때 사용되며, 참조 카운트(Reference Cou..

System Hacking Advanced

[dreamhack] cpp_container_1

개념정리container overflow와 관련된 문제를 다룬다. C++에서는 std::memcpy, std::memmove, std::memset , std::copy 와 같이 메모리를 복사하는 함수들이 사용된다. 해당 함수들을 사용하는 경우에는 주의할 점이 있는데, 길이에 대한 검증이다. 만약, 복사 과정에서 길이에 대한 검증이 존재하지 않다면, 쉽게 overflow가 발생할 수 있다. void f(const std::vector &src) { std::vector dest(5); std::copy(src.begin(), src.end(), dest.begin());}특히, container는 기본적으로 heap 영역에 데이터가 생성되고 std::copy 를 이용해서 cont..

keyme
keyme - Security Study