Web
-
CGI / FAST CGI && WAS vs CGI vs SpringWeb 2024. 7. 31. 21:32
본 문서는 공부를 하는 과정에서 사용하는 필기이다. 정확한 정보가 아닐 수 있으니 다른 문헌도 참고하길 바란다.CGICommon Gateway Interface 라고 한다. 웹 서버에서 동적으로 처리하지 못하는 정보를 처리하기 위해 환경 변수를 통하여 외부 프로그램에 보내는 데, 이 과정에서 웹 서버가 사용하는 인터페이스이다. 사실상 웹 서버는 유저가 요청한 파일을 읽어서 출력하는 것을 목적으로 하지, 데이터를 처리하는 것을 목적으로 하지 않는다. 그래서 데이터의 처리를 외부 프로그램에 맡기는데, 이 과정에서 외부 프로그램에 처리해야 하는 데이터를 주고 받는 부분이 CGI이다. FAST CGIFAST CGI는 Open Market이 자신들의 문제를 해결하기 위해 개발CGI는 데이터의 처리를 위해 각각의 ..
-
Web Scanner / Fuzzer 차이Web 2024. 7. 15. 15:35
공부를 하는 중 Web Scanner와 Fuzzer의 차이가 궁금했다. Fuzzer와 Scanner(이하 퍼저 / 스캐너) 모두 취약점을 발굴하고 점검을 하는 도구라고 생각했지만, 친구들과 얘기하며 조사해본 결과 미묘한 차이가 있다는 것에 결론이 났다. 다음은 토의한 내용을 바탕으로 정리해본 글이다. 필자의 생각이 가미 되어 있으므로 참고용으로 사용하면 좋을 것 같다.Fuzzing (Fuzz testing)먼저 퍼저에 대해 알아볼 필요가 있다. 퍼즈 테스팅(Fuzz testing) 또는 퍼징(fuzzing)은 (종종 자동화 또는 반자동화된) 소프트웨어 테스트 기법으로서, 컴퓨터 프로그램에 유효한, 예상치 않은 또는 무작위 데이터를 입력하는 것이다. 이후 프로그램은 충돌이나 빌트인 코드 검증의 실패, 잠재..
-
LOS - xavis / level 19Web/SQLI 2024. 7. 9. 21:15
문제풀이 과정해당 문제는 2가지의 풀이 방법이 존재한다 1. Blind SQL Injection2. Union Based 1. Blind SQL Injection?pw=%27%20and%201%20or%20id=%27admin%27%20and%20ascii(substr(pw,1,1))%20%26%201%20=%200%23해당 방식으로 substr을 통해 한글자 씩 가져오고 ascii 비트 마스킹을 통하여 비밀번호를 찾을 수 있다 물론 이 방식도 효율적이지만 해당 문제에서는 Union Based 방식을 사용하면 더 쉽게 해결할 수 있다 2. Union Based Mysql 에서 변수를 지정할 수 있다 이를 활용하여 pw의 값을 변수에 넣고 Union을 사용하여 붙이면 해결 된다 select와 set에 사..
-
LOS - nightmare / level 18Web/SQLI 2024. 7. 9. 20:32
문제풀이 과정if(preg_match('/prob|_|\.|\(\)|#|-/i', $_GET[pw])) exit("No Hack ~_~"); if(strlen($_GET[pw])>6) exit("No Hack ~_~"); pw의 값이 다음과 같이 필터링이 걸려있고, 6글자를 초과하면 필터링에 걸림을 알 수 있다 고려사항은 다음과 같다1. 문자열이 아무것도 없을 시 DB에서 False값으로 받는 것을 이용한다2. 주석 처리를 하는 #이 필터링이 걸려있으므로 --나 ;%00으로 우회한다3. 문자열의 길이를 조심할 것정답더보기?pw=%27)=0;%00
-
LOS - zombie_assassin / level 17Web/SQLI 2024. 7. 9. 20:10
문제풀이 과정 $_GET['id'] = strrev(addslashes($_GET['id'])); $_GET['pw'] = strrev(addslashes($_GET['pw'])); id 와 pw값에 addslashes가 적용되는 것을 알 수 있다 addslashes 함수는 ' " Null 값에 대해 \를 붙혀 문자열로 바꿔주는 함수이다 예를 들어 id='를 입력하면 \'로 입력이 됨을 알 수 있다 또한, strrev는 들어온 값을 뒤집어 들어가게 된다 즉, id=a'&pw=b를 입력하면 다음과 같은 결과가 나오게 된다 addslashes 함수를 이용하여 싱글쿼터를 문자화 시켜 빠져나온 뒤 b에 injection을 시도하면 된다 즉, 싱글쿼터인 ' 뿐만 아니라 더블쿼터 " 도 역슬래쉬가 붙기 때문에 ..
-
LOS - succubus / level 16Web/SQLI 2024. 7. 1. 19:24
문제 풀이 과정 if(preg_match('/\'/',$_GET[id])) exit("HeHe"); if(preg_match('/\'/',$_GET[pw])) exit("HeHe"); $query = "select id from prob_succubus where id='{$_GET[id]}' and pw='{$_GET[pw]}'"; 여기서 id와 pw에서 싱글쿼터를 필터링 하고 있어 id와 pw를 자체적으로 나올 수는 없다 하지만 여기서 id와 pw를 연속적으로 받고 있으므로 \ 를 통해 우회할 수 있다 ?id=\&pw=a select id from prob_succubus where id = '\' and pw='a' 이런식으로 \'으로 인해 싱글쿼터가 문자열로 인식을 하게 되어 'and pw..
-
LOS - assassin / level 15Web/SQLI 2024. 7. 1. 19:17
문제풀이 과정pw에 값을 집어넣을 수 있으나 ' 즉 싱글쿼터를 필터링 중이라 해당 구문을 빠져나오지 못한다 하지만 pw를 기준으로 id값을 불러오고 불러온 값이 admin이면 되므로 직접 검색해서 찾는 방법을 사용한다 검색을 이용하여 풀 수 있는 방법은 여러가지가 있는데, 그 중 % / _ 와 같은 와일드 카드를 사용해서 문제를 해결한다 ex)?pw=a% => a로 시작하는 모든 문자열?pw=%a => a로 끝나는 모든 문자열?pw=%a% => a가 중간에 포함되는 모든 문자열 ?pw=_ => 1자리?pw=__ => 2자리?pw=a__% => a로 시작하고 3자리 이상인 문자열 이 방법을 사용해서 길이를 알아내고 문자열을 유추한다 하지만 여기서 조심해야 할 것이 검색을 시도할 때 DB에 저장되어 있는 모..
-
LOS - giant / level 14Web/SQLI 2024. 6. 29. 17:33
문제풀이 과정 if(preg_match('/ |\n|\r|\t/i', $_GET[shit])) exit("HeHe"); $query = "select 1234 from{$_GET[shit]}prob_giant where 1"; shit에 / / \n / \r / \t /가 필터링 됨을 알 수 있다 결국 shit에 공백 값을 넣어 select 1234 from prob_giant where 1를 만들어야 하기 때문에 공백 우회가 필요하다 \v : vertical tab\f : form feed 둘 다 수직으로 탭을 사용하지만 차이점이 있다\v는 수직으로 탭을 사용하지만 앞에 공백이 없고\t는 앞에 공백을 채운다 # \v testprint("Hello\vWorld")# Hello# World..