목록2020/04 (35)
Self-Improvement
CASE구문 소스코드 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 #include int main() { int n; printf("INput number:"); scanf_s(" %d",&n); printf("before switch statement\n"); switch (n) { case 0:printf("[zero]"); break; case 1:printf("[one]"); break; case 2:printf("[two]"); break; case 3:printf("[three]"); break; case 4:printf("[four]"); break; case 5:printf("[five]"); break; ..
소스코드1 1 2 3 4 5 6 7 #include int main() { printf("hellow world!!"); return 0; } cs Visual Studio로 컴파일을 해준뒤 x96dbg로 열어주면 hellow world를 출력하는 main과 printf를 찾지 못하며 이상한? 곳에서 시작을한다. 이는 컴파일러가 기본적인 구성을 확인하기 위한 절차로 컴파일한 프로그램, 버전 등에 상이하게 되어있다. 위의 소스코드의 어셈블리어를 볼라면 Main을 찾아 BP을 걸어준다. 그 다음 F9를 눌러 BP를 설정한 곳까지 진행을 해준 뒤 F7로 진입해준다. 진입을 하면 드디어 우리가 찾는 소스코드의 어셈블리어를 볼 수 있다. 여기서는 F8로 한 라인씩 진행을 해줘도 된다. 해당 어셈블리 코드에서 스택..
*MOV 옵코드 MOV는 단지 값을 넣는 역할을 한다. 예를 들면 MOV eax, 1은 eax에 1을 넣는 코드가 되고, MOV ebx, ecx는 ebx에 ecx를 넣는 코드가 된다. *LEA LEA는 MOV와 다르게 단순하다. MOV는 값을 가져오는 것이라면 LEA는 주소를 가져온다. 따라서 LEA는 가져올 src 오퍼랜드가 주소라는 의미로 대부분 []로 둘러싸여 있다. *예시 esi : 0x401000 *esi : 5640ec83 esp+8 : 0x13ff40 *(esp+8) : 33 1. lea eax, dword ptr ds:[esi] = esi가 0x401000이므로 eax에는 0x401000이 들어온다. 2. mov eax, dword ptr ds:[esi] = esi가 0x401000이므로 ..
MySQL select left((select table_name from information_schema.tables limit 1),2) select right((select table_name from information_schema.tables limit 1),2) select length((select table_name from information_schema.tables limit 1)) MSSQL select LEFT((select top 1 table_name from information_schema.tables),2) select right((select top 1 table_name from information_schema.tables),2) select len((select..
Sleep select sleep(3) select if(1=1,sleep(3),2) Benchmark benchmark(돌릴 횟수, 돌릴함수) 함수는 돌릴 함수에 대하여 몇번의 횟수를 반복하는지를 나타냄 이 방식을 통해 Time SQLi가 가능함 select benchmark(1000000,md5(1)) select if(1=1,benchmark(1000000,md5(1)),2) Heavy Query select count(*) from information_schema.tables tab1, information_schema.tables tab2, information_schema.tables tab3 select if(1=1, (select count(*) from information_schema..
* SELECT 0x457578 MySQL MSSQL Oracle X * String 이어붙히기 MySQL MSSQL Oracle p.s. MySQL
IF Statements MySQL IF(condition,true-part,false-part) MSSQL IF condition true-part ELSE false-part Oracle IF condition THEN true-part; ELSE false-part; END IF; END; 제약이 많은 IF문 보단 CASE문이 유용하며 Oracle은 PL/SQL에서 사용이 가능한것으로 보임 MySQL select if(1=1, 1,2) select if ((select substr(version(),1,1))=5,1,2) select if (1=1,(select version()),2) select if ((select length(table_name) from information_schema.t..
소스코드 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 Colored by Color Scripter cs 페이지에 접속해본다 싱글쿼터나 참/거짓 명제를 통해 Error가 존재하는지 응답 데이터가 달라지는지를 확인해보았지만 해당 DB에는 데이터가 존재하지 않기 때문에 Error와 응답의 변화가 존재하지 않는다. 그럼으로 Time 기반 SQLi를 수행해본다. 이때 데이터 값들이 존재하지 않기 때문에 시간 내장함수를 사용해도 변화가 없을..
Time 기반 SQLi는 조건과 무관하게 동일한 응답이 회신될때 사용이 가능하여 Time을 이용하여 응답을 분석한다. 방법으로는 DB 내장함수와 과도한 연산이 수반되는 SQL 쿼리문을 주입하여 시간을 지연시키는 방법이 있다. DB 내장함수 시간 지연 내장함수는 DB별로 상이하며 현실적으로 사용이 가능한 데이터베이스는 MySQL, MSSQL라고 할 수있다. Oracle은 PL/SQL 환경에서만 사용이 가능하기 때문에 SQLi 방식으로는 사용이 불가능하다. MySQL SLEEP() MSSQL WAITFOR DELAY 'hh:mm:ss' WAITFOR TIME 'hh:mm:ss' Oracle DMBS_LOCK.SLEEP() MySQL 가장 먼저 MySQL 데이터베이스의 SLEEP() 함수를 사용해본다. 수행 ..
보호되어 있는 글입니다.