Commitment Issues (picoCTF 6)

Challenge Author:

Difficulty: Easy

Description

I accidentally wrote the flag down. Good thing I deleted it!

Process / Notes

  1. A lot of files in a .git folder got unzipped
  2. cat on a message reads “TOP SECRET”
  3. Recursively grepping grep -r 'pico' .git/* - a few things pop up, looks like it’ll be in the log file with the initial commit
  4. Using tree to help navigate around
  5. cat into the files doesn’t seem to help. I have a feeling the key has something to do with the commit code in ./logs/refs/head/master
  6. The commit code
  7. There’s a 3d folder in objects, and the rest of the line corresponds to a file in that folder, so I’ll check that out
  8. The file type is “zlib compressed data” - whatever that means
  9. cat produces jibberish
  10. strings and hexdump don’t seem to help
  11. At 17:41 looking up how to access the file. I believe I know which one
  12. It’s a git-specific command!
  13. Access the git log with git log
  14. You can see the commit codes and comments for each commit
  15. It looks like you need to be in the project root in order to run git checkout log_code_here
###
You are in 'detached HEAD' state. You can look around, make experimental changes and commit them, and you can discard any commits you make in this state wihtout impacting any branches by switching back to a branch.

If you want to create a new branch to retain commits you create, you may do so (now or later) by using -c with the switch command. Example:

    git switch -c <new-branch-name>

Or undo this operation with:

    git swtich -

Turn off this advice by setting config variable advice.detachedHead to false

HEAD is now at ### create flag
  1. Now we’re back to the version where the message has the flag!!!
  2. git switch - brought us back to the master branch
  3. cat on the message now reads “TOP SECRET” like it did before. Incredible

24 minutes 42 seconds to complete

Hints

  1. Version control can help you recovery files if you change or lost them!
  2. Read the chapter on git from the picoPrimer
  3. You can ‘checkout’ commits to see the files inside them

Core Lessons

  1. Understanding the version control aspects of git is massive
  2. Examining the git log with git log to see commit comments and commit codes
  3. Switching to old commits with git checkout log_code
  4. Creating a new branch wiht `git switch -c
  5. Returning to the master branch with git switch -