기본 콘텐츠로 건너뛰기

Bandit12

Bandit12

Bandit Level 12

이번 문제는 설명에서 확인할 수 있듯이 압축에 관련된 문제이다. 반복 압축된 파일을 file 명령어로 형식을 확인하며 압축 형식에 맞춰 해제시키면 된다. xxd, tar, gzip, bzip2를 명령어 사용법을 익히는 것이 이번 문제에 목적이라고 볼 수 있다.

hexdump로 파일 생성

bandit12@bandit:/tmp/bongbongco$ cp ~/data.txt .
bandit12@bandit:/tmp/bongbongco$ cat data.txt 
00000000: 1f8b 0808 ffb2 095a 0203 6461 7461 322e  .......Z..data2.
00000010: 6269 6e00 0143 02bc fd42 5a68 3931 4159  bin..C...BZh91AY
00000020: 2653 5915 1ab4 ec00 0016 ffff f9ef 39d7  &SY...........9.
00000030: fd9f 55ff bf7d ebf7 7fb9 dfdf bb7b ddef  ..U..}.......{..
00000040: 5bff 9efd f5af 7fff defb ffbb b001 3b18  [.............;.
00000050: a403 d41a 00d0 0000 0680 000d 0d06 9a06  ................
00000060: 8d00 f50d 01a0 001a 0003 2341 a683 4320  ..........#A..C 
00000070: 69ea 0323 4193 41a0 3653 434f 4880 d0d0  i..#A.A.6SCOH...
00000080: 69a0 6434 00d0 01a3 200d 3400 6868 1a34  i.d4.... .4.hh.4
00000090: d1a6 81a0 f506 4646 20d0 0341 a640 640d  ......FF ..A.@d.
000000a0: 3468 d034 000d 000d 191e a0e6 8832 6819  4h.4.........2h.
000000b0: 3234 00d3 4c43 40d0 0068 0d18 834d 00c8  24..LC@..h...M..
000000c0: 00d0 6800 0d32 000d 3406 8c86 4620 c800  ..h..2..4...F ..
000000d0: 1a34 0000 0000 0a30 0049 a75b 6e20 a543  .4.....0.I.[n .C
000000e0: d09d 4d66 fe85 b120 e837 e252 3301 618a  ..Mf... .7.R3.a.
000000f0: bd1e d8af 2af0 e6eb 25ef 0a2f 0251 a437  ....*...%../.Q.7
00000100: c452 ed6e 392a aa9a 6e0a 1a39 300d 66a7  .R.n9*..n..90.f.
00000110: 6b38 9455 c1bb 7fd0 011a 4815 02c9 9d2c  k8.U......H....,
00000120: 6547 da37 da8f 0c4f 274b 22b8 037d 8bab  eG.7...O'K"..}..
00000130: 1d73 5c1f 99dd a462 d3e8 708c 686a a9f4  .s\....b..p.hj..
00000140: ac5c 14b7 0847 f033 f94f 14fe 22cd 121c  .\...G.3.O.."...
00000150: d452 ccc5 d046 6f31 747d 28a3 f740 4501  .R...Fo1t}(..@E.
00000160: caea 80c6 19d1 7204 1486 2ab4 8659 4d95  ......r...*..YM.
00000170: 5ce8 c14d e3fc 4559 30a2 3dce 2b1c 4c42  \..M..EY0.=.+.LB
00000180: a145 b65a 32d2 3815 d834 e211 6223 64d0  .E.Z2.8..4..b#d.
00000190: 0a3a 2194 2e04 2747 9414 2448 f317 5637  .:!...'G..$H..V7
000001a0: 613a a9eb 0ae7 293e e081 bce2 3ef0 4042  a:....)>....>.@B
000001b0: eb16 a424 c647 a04b a919 9008 c1a9 0ffd  ...$.G.K........
000001c0: fcbe 8786 3ac8 44e6 8804 9cba 8244 c80f  ....:.D......D..
000001d0: 2e0e e18e bece 276c 6f4a d308 b8fc 2d3e  ......'loJ....->
000001e0: 9351 90fd 68f5 2922 f294 92a5 4afd dc64  .Q..h.)"....J..d
000001f0: 37e3 7f05 fe04 01a6 803c 1d09 16a2 aa0f  7........<......
00000200: 359b a5b8 e110 2bfd 3733 7e21 b207 7aaa  5.....+.73~!..z.
00000210: bc41 4152 641c 15f8 081b 22d9 f891 a093  .AARd.....".....
00000220: 24e6 f18f befe 9651 6a14 e086 1826 9eec  $......Qj....&..
00000230: f9ce bc70 47fe 983b df74 1d32 f483 cbfe  ...pG..;.t.2....
00000240: 0992 0f50 78e1 65b2 c2c9 1d93 5631 5914  ...Px.e.....V1Y.
00000250: 9fe2 ee48 a70a 1202 a356 9d80 0cbb 8293  ...H.....V......
00000260: 4302 0000                                C...
bandit12@bandit:/tmp/bongbongco$ xxd -r ./data.txt ./output.bin

압축 해제

bandit12@bandit:/tmp/bongbongco$ file output.bin
output.bin: gzip compressed data, was "data2.bin", last modified: Mon Nov 13 14:58:07 2017, max compression, from Unix
bandit12@bandit:/tmp/bongbongco$ mv output.bin data1.gz  
bandit12@bandit:/tmp/bongbongco$ gzip -d data1.gz
bandit12@bandit:/tmp/bongbongco$ ls   
data.txt  data1
bandit12@bandit:/tmp/bongbongco$ file data1
data1: bzip2 compressed data, block size = 900k
bandit12@bandit:/tmp/bongbongco$ bzip2 -d data1
bzip2: Cant guess original name for data1 -- using data1.out
bandit12@bandit:/tmp/bongbongco$ file data1.out
data1.out: gzip compressed data, was "data4.bin", last modified: Mon Nov 13 14:58:07 2017, max compression, from Unix
bandit12@bandit:/tmp/bongbongco$ mv data1.out data1.gz
bandit12@bandit:/tmp/bongbongco$ gzip -d data1.gz
bandit12@bandit:/tmp/bongbongco$ ls
data.txt  data1
bandit12@bandit:/tmp/bongbongco$ file data1
data1: POSIX tar archive (GNU)
bandit12@bandit:/tmp/bongbongco$ tar xvf ./data1
data5.bin
bandit12@bandit:/tmp/bongbongco$ ls
data.txt  data1  data5.bin
bandit12@bandit:/tmp/bongbongco$ file data5.bin
data5.bin: POSIX tar archive (GNU)
bandit12@bandit:/tmp/bongbongco$ tar xvf ./data5.bin
data6.bin
bandit12@bandit:/tmp/bongbongco$ ls
data.txt  data1  data5.bin  data6.bin
bandit12@bandit:/tmp/bongbongco$ file data6.bin
data6.bin: bzip2 compressed data, block size = 900k
bandit12@bandit:/tmp/bongbongco$ ls
data.txt  data1  data5.bin  data6.bin
bandit12@bandit:/tmp/bongbongco$ bzip2 -d data6.bin
bzip2: Can't guess original name for data6.bin -- using data6.bin.out
bandit12@bandit:/tmp/bongbongco$ file data6.bin.out
data6.bin.out: POSIX tar archive (GNU)
bandit12@bandit:/tmp/bongbongco$ ls
data.txt  data1  data5.bin  data6.bin.out
bandit12@bandit:/tmp/bongbongco$ tar -xvf ./data6.bin.out
data8.bin
bandit12@bandit:/tmp/bongbongco$ file data8.bin
data8.bin: gzip compressed data, was "data9.bin", last modified: Mon Nov 13 14:58:07 2017, max compression, from Unix
bandit12@bandit:/tmp/bongbongco$ mv data8.bin data8.gz
bandit12@bandit:/tmp/bongbongco$ gzip -d data8.gz
bandit12@bandit:/tmp/bongbongco$ ls
data.txt  data1  data5.bin  data6.bin.out  data8
bandit12@bandit:/tmp/bongbongco$ file data8 
data8: ASCII text

패스워드 확인

bandit12@bandit:/tmp/bongbongco$ cat data8
The password is 8ZjyCRiBWFYkneahHwxCv3wb2a1ORpYL 

이 블로그의 인기 게시물

Remove-Server-Header

응답 메시지 내 서버 버전 정보 제거 1. Apache 1) 조치 방법 “/etc/htpd/conf/httpd.conf” 파일 안에서 1. ServerTokens OS → ServerTokens Prod 2. ServerSignature On → ServerSignature Off 로 변경한 후 아파치를 재시작하면 헤더 값의 아파치 버전 정보 및 OS 정보를 제거할 수 있다. 2) 참고 URL http://zetawiki.com/wiki/CentOS_ 아파치_보안권장설정_ServerTokens_Prod,_ServerSignature_Off 2. IIS 1) 조치 방법 IIS 6.0 urlscan_setup 실행. 설치. \windows\system32\inetsrv\urlscan\urlscan.ini 파일을 열어 다음 수정(RemoveServerHeader=0 을 RemoveServerHeader=1 로 변경) 서비스에서 IIS Admin Service 재시작. IIS 7.0 IIS 관리자를 열고 관리하려는 수준으로 이동합니다. 기능 보기에서 HTTP 응답 헤더를 두 번 클릭합니다. HTTP 응답 헤더 페이지에서 제거할 헤더를 선택합니다. 작업 창에서 제거를 클릭하고 예를 클릭합니다. 2) 참고 URL IIS 6.0 : http://gonnie.tistory.com/entry/iis6- 응답헤더-감추기 IIS 7.0 : https://technet.microsoft.com/ko-kr/library/cc733102(v=ws.10).aspx 3. jetty 1) 조치 방법 “jetty.xml” 파일에서 jetty.send.server.version=false 설정 2) 참고 URL http://attenuated-perspicacity.blogspot.kr/2009/09/jetty-61x-hardening.html 4. Nginx

X-Frame-Options-Test

X-Frame-Options 테스트하기 X-Frame-Options 페이지 구성 시 삽입된 프레임의 출처를 검증하여 허용하지 않는 페이지 URL일 경우 해당 프레임을 포함하지 않는 확장 응답 헤더이다. 보안 목적으로 사용되는 확장 헤더로 아직 적용되지 않은 사이트들이 많지만 앞으로 점차 적용될 것으로 보인다. X-Frame OptionsDENY, SAMEORIGIN, ALLOW-FROM 옵션을 이용하여 세부 정책을 설정한다. 옵션 설명 DENY Frame 비허용 SAMEORIGIN 동일한 ORIGIN에 해당하는 Frame만 허용 ALLOW-FROM 지정된 ORIGIN에 해당하는 Frame만 허용 크롬 4.1 , IE 8 , 오페라 10.5 , 사파리 4.0 , 파이어폭스 3.6.9 이상에서는 DENY , SAMEORIGIN 이 적용되며, ALLOW-FROM 은 각 브라우저 마다 지원 현황이 다르다. https://developer.mozilla.org/ko/docs/Web/HTTP/Headers/X-Frame-Options 해당 확장헤더는 브라우저에서 처리하는 응답 헤더이므로 미지원 브라우저 사용 시 설정과 무관하게 페이지 내 포함된 모든 Frame을 출력한다. (검증 테스트: Opera 5.0.0) 테스트 코드 DENY <!DOCTYPE html> < html lang = "en" > < head > < meta http-equiv = "X-Frame-Options" content = "deny" /> < title > Deny option Test </ title > </ head > < bod

데일 카네기 인간관계론 정리