📖
CTF Wiki
  • 🚩Arne's CTF Writeups!
  • 2025
    • TUCTF
      • Forensics - Security Rocks
    • San Diego CTF
      • Crypto - RustSA
      • Misc - Triglot
  • 2024
    • Lexington CTF
      • Misc - a little bit of tomcroppery
    • Imaginary CTF
      • Web - Journal
    • Space Heroes CTF
      • Web - Antikythera
    • HTB Cyber Apocalypse
      • Pwn - Sound of Silence
      • Misc - MultiDigilingual
  • 2023
    • NahamConCTF
      • Mobile - Red Light Green Light
    • BucketCTF
      • Rev - Schematic
      • Rev - Random security
    • HTB Cyber Apocalypse
      • Rev - Cave System
      • Rev - Somewhat Linear
      • Pwn - Void
  • 2022
    • DownUnderCTF 2022
      • Cloud - Jimmy Builds a Kite
    • Ã¥ngstromCTF 2022
      • Pwn - really obnoxious problem
      • Pwn - whatsmyname
    • Engineer CTF
      • Misc - Not really random
      • Misc - Broken Pieces
    • KnightCTF 2022
    • HTB CTF: Dirty Money
      • Forensics - Perseverance
  • 2021
    • MetaCTF CyberGames 2021
    • HTB - Cyber Santa
      • RE - Infiltration
    • Securebug CTF Thor 2021
      • Web - Tricks 1
      • Web - Tricks 2
      • RE - Hidden in Plain Sight
    • TFC CTF 2021
      • RE - Crackity
      • Pwn - Jumpy
      • Misc - Weird Friend
    • K3RN3L CTF 2021
      • Crypto - Pascal RSA
    • DamCTF 2021
      • Misc - library-of-babel
      • Pwn - cookie-monster
    • Killer Queen CTF 2021
      • Pwn - Tweety Birb
      • Forensics - Tippy Tappies
      • Pwn - I want to break free
    • BuckeyeCTF 2021
      • Web - pay2win
      • Misc - USB Exfiltration
Powered by GitBook
On this page
  • Description
  • Downloads
  • Solution
  1. 2021
  2. DamCTF 2021

Misc - library-of-babel

72 solves | 462 points

Last updated 3 years ago

Description

Legend has it there is a secret somewhere in this library. Unfortunately, all of our Babel Fishes have gotten lost and the books are full of junk.

Note: You do not need a copy of Minecraft to play this challenge.

The flag is in standard flag format.

Downloads

Solution

This challenge seems interesting because its related to Minecraft but because I don't play Minecraft much, I was afraid I didn't have the knowledge required to solve the challenge. However, turns out that my limited Minecraft knowledge was sufficient.

The files we were given appears to be a Minecraft save file and although the challenge explicitly stated that a copy of Minecraft is not needed to solve the challenge, I believed that it would help me understand the overall picture. First, drag the save folder into %APPDATA%/Roaming/.minecraft/saves/ and launch the game.

We are greeted with a beautiful custom library map filled with loads of book. Let's get some books and read their content.

The books are filled with gibberish content and if I were to make a guess, the flag is probably hidden in one of the books. Since the challenge description explicitly stated that a copy of Minecraft is not needed to solve the challenge, we probably need a way to analyse the save file content. So I proceeded on researching which tools can be used to to analyse Minecraft save files and the tool that came up was NBTExplorer. I quickly downloaded the tool and loaded up the save folder.

Turns out that although there is a search function in NBTExplorer, it doesn't work very well and searching the strings in the books does not yield any results at all. Initially, I looked through the save folder manually and while I couldn't find any trace of the books, I found minecraft:librarian which was interesting.

Naturally, I googled for minecraft:book book but the first result that came out didn't seem right. It lacks the purple glow that the book have. Luckily, the second result seems like what we are looking for, on the Minecraft fandom wiki page we found out that the Data value for it is written_book.

So we searched for minecraft:written_book and voila! We have the gibberish strings that we're looking for.

Unfortunately, NBTExplorer search function doesn't work and I tried to manually search for the flag among the books but there was just way too many books. I tried to use an hex editor to search for the flag wrapper but the save files were packed. After some researching, it seems that there is a python library that can help to parse the save files called anvil-parser.

So the next step is to read the library API from its GitHub page and write the search engine myself. The final solve script is as follows:

import anvil

region = anvil.Region.from_file('r.-1.0.mca')

for j in range(0, 32):
	for i in range(0, 32):
		try:
			chunk = anvil.Chunk.from_region(region, j, i)
			for k in chunk.tile_entities:
				compound = k
				book = compound[0]
				book_tab = book[-1]
				book_pages = book_tab[1]

				for ind, page in enumerate(book_pages):
					#print(page)
					if "dam{" in page:
						print(page)
						print("Found!!!")
						exit()
		except:
			pass

Flag: dam{b@B3l5-b@bBL3}

14MB
library-of-babel.zip
archive
Custom Library Map
Collect books
Book 1
Book 2