Skip to main content

Over the Wire - Bandit 5

Bandit 5

Objectives


The password for the next level is stored in the only human-readable file in the inheredirectory. Tip: if your terminal is messed up, try the “reset” command.


Solution

Ok

so after we login we see a familiar inhere directory listed in the home directory for bandit 4 lets see whats in there

bandit4@bandit:~$ cd ./inhere/ && ls -ltotal 40-rw-r----- 1 bandit5 bandit4 33 Oct 16  2018 -file00-rw-r----- 1 bandit5 bandit4 33 Oct 16  2018 -file01-rw-r----- 1 bandit5 bandit4 33 Oct 16  2018 -file02-rw-r----- 1 bandit5 bandit4 33 Oct 16  2018 -file03-rw-r----- 1 bandit5 bandit4 33 Oct 16  2018 -file04-rw-r----- 1 bandit5 bandit4 33 Oct 16  2018 -file05-rw-r----- 1 bandit5 bandit4 33 Oct 16  2018 -file06-rw-r----- 1 bandit5 bandit4 33 Oct 16  2018 -file07-rw-r----- 1 bandit5 bandit4 33 Oct 16  2018 -file08-rw-r----- 1 bandit5 bandit4 33 Oct 16  2018 -file09


we see 10 files named in the convention -file0*  let's see what type of files they are

bandit4@bandit:~/inhere$ file ./-file0*./-file00: data./-file01: data./-file02: data./-file03: data./-file04: data./-file05: data./-file06: data./-file07: ASCII text./-file08: data./-file09: data


we also could have checked the mime types here

bandit4@bandit:~/inhere$ file --mime-type ./-file0*./-file00: application/octet-stream./-file01: application/octet-stream./-file02: application/octet-stream./-file03: application/octet-stream./-file04: application/octet-stream./-file05: application/octet-stream./-file06: application/octet-stream./-file07: text/plain./-file08: application/octet-stream./-file09: application/octet-stream


Either way we see that -file07 is a text ascii file. Give the the requirement that the password is in the only human readable file I think we can assume from here that -file07 is where our password is

bandit4@bandit:~/inhere$ cat ./-file07koReBOKuIDDepwhWk7jZC0RTdopnAYKh


And there it is our password for the next level


now lets do it with python

I spent hours trying to script out a file that would read the mime types of the files and then put them through and while state statement with an if inside to parse our just file07 but I at this point in my python journey just couldn't get there especially since I couldn't use the magic library on the overthewire server...
so in the in the end I just made this script that gets all the files in the directory and prints the content out to the  screen... its ugly but its was the best I could do right now


import os

filesvar = os.listdir(os.curdir)count = 0

while count <=len(filesvar): print filesvar[count] f = open(filesvar[count]) f.read()
 count +=1






bandit4@bandit:~/inhere$ pythonPython 2.7.13 (default, Sep 26 2018, 18:42:22)[GCC 6.3.0 20170516] on linux2Type "help", "copyright", "credits" or "license" for more information.>>> import os>>>>>>>>> filesvar = os.listdir(os.curdir)>>> count = 0>>>>>>>>> while count <=len(filesvar):...  print filesvar[count]...  f = open(filesvar[count])...  f.read()
...  count +=1...-file09'N\xbb{\xe0\xea\xbdY\xb3d\x144\xd6\xd4\xf5\x93\x1a]3\xae\xa9\x00\xdc\xdf\xc4\x179(\xc2\nQ\x96\x88\xad'-file06'\x9c\x05\xa9@\xb9%@\xe4\xda\xcd\x18ZP*E\x02\x02\xa6\xf31\xc3V\x83\x99\x97\xcc\xab*\xa6\xae\x89\x19\xdb'-file01'\xbb\x98\xd8U"7\xa2w\x19\xe2\xda\xdeH\x81\xab\xc3\xaa\xd0Q\x90\xf4\x8d\x82(\x91\x04\xec\xc4#\xa6\xad\xd2\x00'-file02'\xe9\x1eT\x1f\x9ev\x9a\x8d(\xf1\xd6\xb4\xb2\x82\x9b\x83\xecA*\x95\n2\x15J\x89\xc5\x9e\xd8\x87_\xb5y7'-file05'+\x14\x03\xac\xbbp\x03\x10m\x1e\x01\xff\xb8\x87;\x11\xdd\xec:D\x98\xf8^\x9a\xba@\x00\xe2gl\xddQ\xeb'-file03'\xe9\x96.A\x88\xe9u\x9e\xfc#\xe7\xd5\x1c\xc5w$N?c\x83-\x9d\xbbDb3\x14\x8b\xe0=\xf6\x02\xf8'-file08"\x10\x1dFPn\xa1\x0b'\x8bU\xf4\x07\xb9\xe2M\xb7\x97/u\x0cXS\n\x8amu\xb2z\xf0\xc7\xc0\xd1\x85"-file07'koReBOKuIDDepwhWk7jZC0RTdopnAYKh\n'-file04'\x8e=<\xc2\x08\x8bW\xde\x07\xf5\xd6\x10\x00\x87\xa3ht\x84\x07Z\x93\x93!\x18\x10\x95\xdb{\x19\x96U\x0b\xf8'-file00'pC\xb5\xc4\r\xe8\xf7\xac\x82\xa8\xb0\x9e\x80\x13\xf4\xa6~%\t\x13C[\xa7\xea\xb1\xb1>\xfa\xd0\x04| \x94'











Comments

Popular posts from this blog

HacktheBox - Retired - Frolic

HacktheBox - Retired - Frolic Recon Let's start out with a threader3000 scan Some interesting results here Port 22 and 445 aren't uncommon… but 1880 and 9999 are.. Let's let nmap run through these ports  Option Selection: 1 nmap -p22,445,1880,9999 -sV -sC -T4 -Pn -oA 10.10.10.111 10.10.10.111 Host discovery disabled (-Pn). All addresses will be marked 'up' and scan times will be slower. Starting Nmap 7.91 ( https://nmap.org ) at 2021-05-05 16:17 EDT Nmap scan report for 10.10.10.111 Host is up (0.060s latency). PORT     STATE SERVICE     VERSION 22/tcp   open  ssh         OpenSSH 7.2p2 Ubuntu 4ubuntu2.4 (Ubuntu Linux; protocol 2.0) | ssh-hostkey: |   2048 87:7b:91:2a:0f:11:b6:57:1e:cb:9f:77:cf:35:e2:21 (RSA) |   256 b7:9b:06:dd:c2:5e:28:44:78:41:1e:67:7d:1e:b7:62 (ECDSA) |_  256 21:cf:16:6d:82:a4:30:c3:c6:9c:d7:38:ba:b5:02:b0 (ED25519) 445/tcp  open  netbios-ssn Samba smbd 4.3.11-Ubuntu (workgroup: WORKGROUP) 1880/tcp open  http        Node.js (Express middlewar...

RingZero CTF - Cyrptography - You're Drunk

RingZero CTF - Cyptography - Your're Drunk Problem: Ayowe awxewr nwaalfw die tiy rgw fklf ua xgixiklrw! Tiy lew qwkxinw. Solution: So just looking at this one it looks like its formatted as a sentence. There is spacing between words, punctuation and capitalization. At fist I thought Cesar cipher, but I ran through some shifts and none of them came back with english words. So then I though substitution cipher. We know from frequency analysis of the English language some good starting points. The most common letter would be "E" The most common double letters would be "OO", "EE" and"SS"  so let start with that and see what we can come up with This site is a great resource for some of the assumptions I'm making here ( http://practicalcryptography.com/ciphers/monoalphabetic-substitution-category/simple-substitution/ ) I used this website to count the letter frequency for me ( https://www.dcode.fr/frequency-analysis ) ...

A collection of online Security CTF and Learning sites

 Hellbound Hackers    Embedded Security CTF Arizona Cyber Warfare Range Over The Wire - Bandit Pico CTF 2018 Hack The Box.eu Root Me: Challenges/Forensic RingZero CTF Vulnerable By Design - Vulnerable VMs Murder Mystery SQL Challenge Incident Response Challenge Authentication Lab Walkthroughs Defcon CTF Archives Matrix Holiday Hack Cyber Defenders | Blue Team and CTF Crypto Hack - learning Crypto Video Learning Zero to Hero Pentesting by The Cyber Mentor