Unminify (picoCTF 16)

Challenge Author:

Difficulty: Easy

Description

I don’t like scrolling down to read the code of my website, so I’ve squished it. As a bonus, my pages load faster!

Process / Notes

  1. Go to the listed site
  2. It’s telling us we have the flag, but they just deliver them , they don’t know how to read them
  3. <C-u> to see what’s going on
  4. It’s all in one line. Is this the minification?
  5. Hard to read, so putting it into Neo Vim. With the html ending for syntax highlighting and such
  6. In Neo Vim, I could separate everything one at a time, or I could try to use a macro
  7. Ended up separating everything our manually, but really want to learn how to do that with a macro
  8. Found under the “If you’re reading this, your browser has successfully found the flag.”
  9. Figured I could just search /{ but that returned a lot of decoy flags in the page source.
  10. Used regex expression to find a letter after the { instead of a matching }
  11. /{[:alpha] brought me straight to the flag

11 minutes 43 seconds to complete

Hints

  1. Try CTLR+U in your browser to view the page source. You can also add ‘view-source:’ before the URL, or try curl in your shell
  2. Minification reduces the size of code, but does not change its functionality
  3. What tools do developers use when working on a website? Many text editors and browsers include formatting

Core Lessons

  1. Understand minification
  2. Understand how to search through mini-fied source code and find your target
  3. Understand how to un-minify source code if necessary