DOMDOM
0posts
today
total
personal posts · since 2021

Fragments
of a day.

A small notebook for slow moments slipping by.

2023 IT Creator
2024 Food Creator
2025 News Creator
2026 News Creator

Latest Posts최근

Security/Research

Quine SQL Injection, Quine Query, Quines in SQL 정리

A computer program that takes no input and produces a copy of its own source code as its only output. Quine 이란 소스코드를 그대로 출력으로 반환하는 프로그램을 의미합니다. 자세한 정의는 위키백과에서 참고해볼 수 있습니다. https://en.wikipedia.org/wiki/Quine_(computing) Quine (computing) - Wikipedia From Wikipedia, the free encyclopedia Self-replicating program A quine's output is exactly the same as its source code. (Note that the syntax highli..

Security/CTF

[HackTheBoo] [Web] Horror Feeds Writeup(문제풀이)

Introduction Category : Web Difficulty : easy Description : An unknown entity has taken over every screen worldwide and is broadcasting this haunted feed that introduces paranormal activity to random internet-accessible CCTV devices. Could you take down this streaming service? Code Analysis 먼저 Flag를 획득하기 위한 방법에 대해서 알아봅니다. Flag는 config.py에 Flask 환경변수로 저장된 것을 볼 수 있습니다. class Config(object): SECRET..

Security/CTF

[Hackthebox] Intergalactic Post Writeup(문제풀이)

문제 개요 RCE with Sqlite3 query injection 코드 분석 index.php 를 보면 라우터로 등록된 경로는 GET / 과 POST /subscribe 로 한개씩 존재합니다.

Security/Wargame

[Lord of SQLi] dragon Writeup/문제풀이

이번 문제는 다른 문제와는 다르게 별다른 필터링이 없습니다. 그리고 희한하게도 query문에 주석(#)이 포함되어 있습니다. 언뜻보면 pw 에 어떤 걸 입력해도 모두 주석처리되어서 mysql 쿼리 결과를 조작할 수 없는 것처럼 보이는데 말이죠. 정말 그랬다면, 문제로 나오지도 않았겠지만 말입니다. 사실 mysql 에서 # 주석문은 한 줄 주석문입니다. 말그대로 한 줄에 대한 주석이기 때문에 다음 줄에는 해당되지 않습니다. SQL 쿼리문은 여러줄을 입력할 수 있습니다. 다음 예시를 보도록 하겠습니다. mysql> select * from user -> where user='guest'; +----+-------+----------+ | id | user | pass | +----+-------+------..

Security/Wargame

[Lord of SQLi] xavis Writeup/문제풀이

if(preg_match('/prob|_|\.|\(\)/i', $_GET[pw])) exit("No Hack ~_~"); if(preg_match('/regex|like/i', $_GET[pw])) exit("HeHe"); pw 파라미터를 받고, prob 문자열이 들어가거나 _(언더바), .(온점), (나 ) 괄호들이 필터링되고 있습니다. 추가로 regex 나 like 라는 단어들이 필터링되고 있는 걸 볼 수 있습니다. $query = "select id from prob_xavis where id='admin' and pw='{$_GET[pw]}'"; echo "query : {$query} "; $result = @mysqli_fetch_array(mysqli_query($db,$query)); if..

Security/Wargame

[Hackthebox] - Under Construction Writeup(문제풀이)

처음 들어가면 위 페이지와 같이 나옵니다. 우선 회원가입을 위해서 아이디와 비밀번호에 test / test 를 입력해보았습니다. 회원가입 완료 후 로그인을 해보았습니다. 로그인하면 위와 같은 페이지가 나옵니다. 그 이외의 다른 페이지는 찾을 수 없어보입니다. 그리고 나서 쿠키값을 살펴보았습니다. JWT 토큰 값이 있습니다. //Set-Cookie: session=eyJhbGciOiJSUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VybmFtZSI6InRlc3QiLCJwayI6Ii0tLS0tQkVHSU4gUFVCTElDIEtFWS0tLS0tXG5NSUlCSWpBTkJna3Foa2lHOXcwQkFRRUZBQU9DQVE4QU1JSUJDZ0tDQVFFQTk1b1RtOUROemNIcjhnTGhqWmFZX..

Security/Wargame

[Lord of SQLi] nightmare Writeup/문제풀이

if(preg_match('/prob|_|\.|\(\)|#|-/i', $_GET[pw])) exit("No Hack ~_~"); if(strlen($_GET[pw])>6) exit("No Hack ~_~"); pw 파라미터 한 개를 입력받습니다. 근데 필터링이 prob, _(언더바), .(온점), ()(괄호), #(샵), -(빼기) 가 있고, 심지어 pw 의 길이가 6개 이하로 제한되어 있습니다. 6개를 넘을 수 없는 것으로 제한이 심한 것으로 보아 정답이 정해져있는 것 같습니다. $query = "select id from prob_nightmare where pw=('{$_GET[pw]}') and id!='admin'"; echo "query : {$query} "; $result = @mysqli..

Security/Wargame

[Lord of SQLi] zombie assassin Writeup/문제풀이

$_GET['id'] = strrev(addslashes($_GET['id'])); $_GET['pw'] = strrev(addslashes($_GET['pw'])); 우선 id 와 pw 파라미터를 전부 addslashes 로 먼저 필터링을 해줍니다. addslahes 에 대해서 잠시 복습해보자면, 인자 값으로 들어온 문자열에서 '(작은따옴표), "(큰 따옴표), \(백슬래시), NUL(널바이트) 와 같은 문자가 오게 되었을 때 해당 문자 바로 이전에 \(백슬래시)를 추가해주는 기능을 하는 함수입니다. 아래 예시는 '(작은 따옴표)가 addslashes 함수에 의해서 \(백슬래시)가 추가되어 이스케이핑 되는 모습입니다.

Security/Wargame

[Lord of SQLi] succubus Writeup/문제풀이

if(preg_match('/prob|_|\.|\(\)/i', $_GET[id])) exit("No Hack ~_~"); if(preg_match('/prob|_|\.|\(\)/i', $_GET[pw])) exit("No Hack ~_~"); if(preg_match('/\'/',$_GET[id])) exit("HeHe"); if(preg_match('/\'/',$_GET[pw])) exit("HeHe"); id 와 pw 파라미터 모두 동일한 필터링이 걸려있는 것을 볼 수 있겠습니다. prob, _(언더바), .(온점), ()(괄호), '(작음따옴표) 모두 사용 불가합니다. (이번에 깨달았는데 이전문제에서 \(\) 라고 되어 있던 것을 저는 (, ) 괄호 두 개 모두 안되는 것으로 착각했었던 것 같은데,..

Security/Wargame

[Lord of SQLi] assassin Writeup/문제풀이

if(preg_match('/\'/i', $_GET[pw])) exit("No Hack ~_~"); pw 파라미터에 대한 필터링으로는 '(작은따옴표)만 막고 있습니다. $query = "select id from prob_assassin where pw like '{$_GET[pw]}'"; echo "query : {$query} "; $result = @mysqli_fetch_array(mysqli_query($db,$query)); if($result['id']) echo "Hello {$result[id]}"; if($result['id'] == 'admin') solve("assassin"); 그리고 들어온 pw 파라미터에 대한 query 의 결과로 아이디가 admin 일 경우 문제는 바로 풀린다..

Security/Wargame

[Hackthebox] - wafwaf Writeup(문제풀이)

처음에 제공된 URL에 접속하면 바로 아래와 같은 PHP 소스코드가 나옵니다.

728x90
반응형
728x90
반응형

Thanks for staying up late.

// keep wandering · keep listening