본문 바로가기
반응형

전체 글65

08_angr_constraints #Angr Tutorial For CTF 이번 문제는 main함수에서 문자열을 입력받고, 해당 문자열을 특정 연산 후에 check_equals 함수에서 몇개의 문자가 맞는지 확인을 한다. 시작 주소는 scanf 이후로 잡고, buffer 변수를 만든다. start_address = 0x08048622 initial_state = project.factory.blank_state( addr=start_address, add_options = { angr.options.SYMBOL_FILL_UNCONSTRAINED_MEMORY, angr.options.SYMBOL_FILL_UNCONSTRAINED_REGISTERS} ) buffer = claripy.BVS('buffer', 16 * 8) buffer_address = 0x0804A050 initi.. 2022. 8. 27.
07_angr_symbolic_file #Angr Tutorial For CTF 문자열을 입력받은 후, ignore_me 함수에서 OJKSQYDP.txt에 값을 저장한다. 다시 main 함수로 돌아와 OJKSQYDP.txt 함수를 읽고, 일정한 문자열과 비교를 한다. 시작 주소는 memset이 끝나고 fopen 시작 부분으로 해준다. start_address = 0x080488E7 initial_state = project.factory.blank_state( addr=start_address, add_options = { angr.options.SYMBOL_FILL_UNCONSTRAINED_MEMORY, angr.options.SYMBOL_FILL_UNCONSTRAINED_REGISTERS} ) file 이름과 symbolic file 크기를 지정해준다. fread(buffer, .. 2022. 8. 26.
06_angr_symbolic_daynamic_memory #Angr Tutorial For CTF 이번엔 동적 할당을 한 변수가 나왔다. start_address는 scanf 이후로 한다. start_address = 0x08048699 initial_state = project.factory.blank_state( addr=start_address, add_options = { angr.options.SYMBOL_FILL_UNCONSTRAINED_MEMORY, angr.options.SYMBOL_FILL_UNCONSTRAINED_REGISTERS} ) # The binary is calling scanf("%8s %8s"). # (!) password0 = claripy.BVS('password0', 64) password1 = claripy.BVS('password1', 64) 동적 할당한다면 어.. 2022. 8. 25.
05_angr_symbolic_memory #Angr Tutorial For CTF sacnf로 전역변수에 값을 쓰고, 비교를 하는 함수다. 우선 %8s %8s %8s %8s 이므로 start_address를 scanf 이후로 맞춰주고, 변수들을 만들어 준다. 또한 8바이트를 받으므로 64(8*8)비트를 넣어준다. start_address = 0x08048601 initial_state = project.factory.blank_state( addr=start_address, add_options = { angr.options.SYMBOL_FILL_UNCONSTRAINED_MEMORY, angr.options.SYMBOL_FILL_UNCONSTRAINED_REGISTERS} ) # The binary is calling scanf("%8s %8s %8s %8s"). # (!) passw.. 2022. 8. 24.
04_angr_symbolic_stack #Angr Tutorial For CTF 음.. 이전 문제와 비슷한거 같은데.. scanf가 %u %u로 되어 있으니 시작 주소는 scanf 주소 이후로 맞춰준다. start_address = 0x8048697 initial_state = project.factory.blank_state( addr=start_address, add_options = { angr.options.SYMBOL_FILL_UNCONSTRAINED_MEMORY, angr.options.SYMBOL_FILL_UNCONSTRAINED_REGISTERS} ) * 시작주소는 scanf 이 후 어떤 주소든 상관없다. complex_function0 위로 잡으면 된다. 이 문제는 전과 같이 scanf로 받은 값을 레지스터에 저장을 안하고 스택에서 사용을 한다. 이래서 symboli.. 2022. 8. 23.
03_angr_symbolic_registers #Angr Tutorial For CTF 입력 받는 scanf 함수들이 get_user_input 함수에 들어있다. angr는 scanf에 %x %x와 같이 여러가지 입력을 지원하지 않는다. 따라서 시작 주소 기존의 entry_state가 아닌 scanf 이후로 맞춰둬야 한다. scanf는 get_user_input 함수에 있으니, 끝났을 때의 기준으로 맞췄다. start_address = 0x08048980 # :integer (probably hexadecimal) initial_state = project.factory.blank_state( addr=start_address, add_options = { angr.options.SYMBOL_FILL_UNCONSTRAINED_MEMORY, angr.options.SYMBOL_FILL_UNC.. 2022. 8. 22.
02_angr_find_condition #Angr Tutorial For CTF 음.. 1번 문제와 매우 같다. 하지만 이번 문제는 Good Job을 호출하는 부분이 많아 특정 주소를 못 적는다. 따라서 상태에 따라서 플레그를 출력 하게 해야 한다. # It is very useful to be able to search for a state that reaches a certain # instruction. However, in some cases, you may not know the address of the # specific instruction you want to reach (or perhaps there is no single # instruction goal.) In this challenge, you don't know which instruction # grant.. 2022. 8. 21.
01_angr_avoid #Angr Tutorial For CTF 흠.. 크기가 너무 커서 Hex-Ray가 작동하지 않는다. 이번 문제도 패스워드를 입력하면 complex_function에서 연산하고, avoid_me를 피한채로 maybe_good으로 들어가면 된다. avoid_me 에 들어가면 should_succeed가 0이 되므로 피해야 한다. import angr def main(): proj = angr.Project('./01_angr_avoid') init_state = proj.factory.entry_state() simulation = proj.factory.simgr(init_state) print_good = 0x80485E5 avoid_addr = 0x80485A8 simulation.explore(find=print_good, avoid=avo.. 2022. 8. 20.
00_angr_find #Angr Tutorial For CTF 문자열을 입력받고 해당 문자열을 complex_function으로 보낸다. complex_function에서는 어떠한 연산을 진행하고 return 한다. import angr def main(): # create project proj = angr.Project('./00_angr_find') # entry point init_state = proj.factory.entry_state() # create simulation simulation = proj.factory.simgr(init_state) # expected address print_good = 0x804867d # start explore simulation.explore(find=print_good) if simulation.found: .. 2022. 8. 19.
10장(문자열) 연습문제 #C언어 콘서트 1. 다음의 문장의 오류 여부를 말하고 오류가 있는 경우, 그 이유를 써라. - (a) strcat(s, '?') strcat을 사용 할 때는 "?"로 수정해야 한다. (b) if(s != "value") 문자열을 비교 할 때는 strcmp()를 사용해서 비교해야 한다. (c) char a[20]; a = "Hello World!"; 문자열을 저장하기 위해서는 초기화 할때 정하거나 strcpy()를 사용한다. 2. 문자열의 끝을 표시하는 특수문자는? - '\0' 3. 문자열 "Hello, World"을 저장하려면 최소 몇 개의 바이트가 필요한가? - 13 4. 다음 중 올바른 문자열 상수를 모두 선택하시오. - "String" 5. 2개의 문자열을 비교하는 함수는? - strcmp() 6. 하나의 문자열.. 2022. 8. 18.
9장(포인터) Programming #C언어 콘서트 1. 1차원 배열을 받아서 요소들의 합을 계산하는 함수 int get_array_sum(int *A. int size)을 구현하고 int data[10] = {1, 2, 3, 4, 5, 6, 7, 8, 9};을 가지고 테스트하라. print_array() 1 2 3 4 5 6 7 8 9 0 배열 요소의 합 = 45 #include int get_array_sum(int *A, int size) { int sum = 0; for(int i=0; i 2022. 8. 12.
9장(포인터) 연습문제 #C언어 콘서트 1. 다음 중 올바른 포인터 선언은? - int *x; 2. 다음 중 정수 변수 x의 메모리 주소를 계산하는 수식은? - &x; 3. 포인터 p가 가리키는 메모리의 내용을 계산하는 수식은? - *p; 4. void 포인터는 몇 바이트인가? - 0 5. 다음과 같이 선언되어 있다고 가정한다. int A[] = {2, 6, 5, 1, 3}; int *p; p=A 6. 다음 수식의 값을 적어보시오. (a) *p = 2 (b) *p+2 = 4 (c) *(p+2) = 5 7. 다음 중 문자형 포인터를 정의하는 문장은? - char *p; 8. 다음 프로그램의 출력은 무엇인가? #include int main(void) { int a[10] = {1, 2, 3, 4, 5, 6}; int *p = a; int *q .. 2022. 8. 11.
8장(함수) Programming #C언어 콘서트 1. f(x, y) = 1.5*x+3.0*y를 계산하는 함수를 작성하고 테스트 해본다. x=1.0, y=1.0, f(x,y)=4.500000 x=2.0, y=1.0, f(x,y)=6.000000 x=1.0, y=2.0, f(x,y)=7.500000 #include double f(double x, double y) { return 1.5*x + 3.0*y; } int main() { printf("x=%0.1lf, y=%0.1lf, f(x,y)=%lf\n",1.0, 1.0, f(1.0, 1.0)); printf("x=%0.1lf, y=%0.1lf, f(x,y)=%lf\n",2.0, 1.0, f(2.0, 1.0)); printf("x=%0.1lf, y=%0.1lf, f(x,y)=%lf\n",1.0, 2.0.. 2022. 8. 10.
Content-Type header [application... #ElasticSearch 8.3.3 >curl -X PUT "localhost:9200/user/_doc/1?pretty" -H 'Content-Type:application/json' -d '{"username":"nanglam"}' { "error" : "Content-Type header [application/x-www-form-urlencoded] is not supported", "status" : 406 } 후하. curl: (6) Could not resolve host: application 까지 해결하니깐 Content-Type header ... 에러가 나온다.. 구글링 결과 -H 'Content-Type:application/json'을 옵션에 추가하면 저 Content-Type header ... 에러가 안나온다고 .. 2022. 8. 9.
Warm up Write-Up #ASIS CTF Quals 2018 Points : 27 Solves : 283 Description : Must-Have Pre-Workout Warm up Challenge. 파일을 다운로드 받으면 warmup 파일이 있다. ExeinfoPE 로 확인해보니 Text 파일이며 #define M 37로 시작한다는 것을 알 수 있다. VScode로 확인해보면 define 이 있고, 무언가 쭉 있다. https://codebeautify.org/c-formatter-beautifier Best C Formatter and Beautifier C Formatter will help to format, beautify, minify, compact C code, string, text. Format, Save, Share codebeautify... 2022. 8. 8.
반응형