분류 전체보기
-
JavaScript Prototype과 Prototype Pollution#1 - Security/Web 2022. 12. 28. 17:35
드림핵 문제를 풀던 중 Prototype Pollution 취약점에 대해 알게 되었다. 기본적으로 JavaScript는 프로토타입 언어로 Class개념 대신 Prototype 개념이 존재합니다. 쉽게 설명하면 이렇습니다. 객체라는건 대부분 함수로 생성 하는것으로 알고 있으실텐데 자바스크립트는 아래와 같이 선언했을때도 객체 생성이 가능합니다. (Object 라는 함수를 자동으로 선언하게) var obj = {}; // = var obj = new Object(); Object와 마찬가지로 Function, Array, Dictionary 모두 함수로 정의되어 있겠죠? 다른 예시를 들어 Person 이라는 함수가 있다고 가정합니다. function Person(){ console.log("test") } 이..
-
Android Frida Script by ChatGPT#1 - Security/Android 2022. 12. 16. 11:19
ChatGPT 이용하여 libc.so 의 open함수 Frida Hooking code 요청을 해봤다. 전체 소스코드는 이렇다 // First, import the Frida API and the `Process` module var frida = require('frida'); var Process = frida.Process; // Next, find the PID of the process you want to attach to // In this example, we'll attach to the process with PID 1234 var pid = 1234; // Attach to the process Process.attach(pid).then(function (process) { // E..
-
iOS Syscall Instruction and Hooking#1 - Security/iOS 2022. 12. 12. 15:07
예전에 올린 글 중 iOS Exit 후킹 코드를 사용하다가 syscall 사용하여 exit 시키는 경우도 있어 찾아보게 되었다. 일단 iOS Syscall Table이다. https://www.theiphonewiki.com/wiki/Kernel_Syscalls 그 다음 iOS Syscall Instruction을 보면 이렇다. The immediate passed to svc is ignored, but the standard library uses svc 0x80. x16 holds the syscall number x0 through x8 hold up to 9 arguments* There are no arguments on the stack x0 and x1 hold up to 2 return ..
-
Python Requests Authorization Header#1 - Security/Web 2022. 12. 2. 10:42
로그인 시 access_token 응답값을 받아서 Post 데이터를 보내려할 때 Authorization 헤더를 추가해서 보내야한다.(JWT, OAuth) 기본적으로 로그인 후 응답값 access_token 받아오고 다른 URL 호출 시 아래 코드와 같이 쓴다. token = res.json()['access_token] requests.post(url,headers={"Authorization":"Bearer "+token} 실행하면 이런 에러가 나온다.. Bad Authorization header. Expected 'Authorization: Bearer 다른 방법이 있는건가 싶어서 찾아보니 from requests.structures import CaseInsensitiveDict headers ..
-
Dreamhack - Login page#1 - Security/CTF 2022. 11. 29. 17:09
근래 여유 시간이 있어 드림핵 문제를 풀고 있다 에러 처리의 대한 화면 표시가 안되어 Error based는 따로 생각 안했다 except pymysql.err.InterfaceError: db.close() db, cursor = connect_mysql() 로그인 할 때 Injection 포인트 발견 (바인딩 처리 미흡) while not done: try: query = 'SELECT * FROM users WHERE username = \'{0}\' ' \ 'AND password = \'{1}\'' with lock: query = query.format(username, password) cursor.execute(query) ret = cursor.fetchone() SQL_BAN_LIST ..
-
[iOS] Exit Function Hook#1 - Security/iOS 2020. 11. 25. 14:32
iOS 진단하다 탈옥 탐지 문구도 없이 앱 종료가 발생한다.. 그래서 생각해낸 방법은 exit 함수 훅걸어서 BackTrace 로 타고타고 올라감 var exit = Module.findExportByName('libSystem.B.dylib', 'exit'); Interceptor.attach(exit, { onEnter: function (args) { console.log("[*] exit Call"); console.log('\tBacktrace:\n\t' + Thread.backtrace(this.context, Backtracer.ACCURATE).map(DebugSymbol.fromAddress) .join('\n\t')); }, onLeave: function (retval) { } });
-
H@cktivitycon - Just not interesting(Mobile)#1 - Security/CTF 2020. 8. 12. 13:09
JNI 에서 로그인 처리함 Java_com_example_justnotinteresting_MainActivity_checkUsername 부분 확인 입력값과 admin 비교 -> ID 는 admin Java_com_example_justnotinteresting_MainActivity_checkPassword 부분 확인 byte_9FB 값과 NOTFLAG(the_fLag_ISN'T_here!!!!) 스트링 XOR 결과값이 flag인듯 대회떄는 미리 짜둔 Frida strncmp 후킹 스크립트로 돌려봤는데 값이 제대로 안나와서.. xor 연산했다 def decrypt(): byte_list = [0x28,0x23,0x35,0x21,0x37,0x2C,0x26,0x51,0x16,0xD, 0x3A, 0x3E,..