Git Is Good
1 minute to read
We are given a ZIP archive that contains a flag.txt
file:
$ ls
flag.txt
$ cat flag.txt
CTFlearn{REDACTED}
But this is not the flag. Looking deeply in the folder, we find a .git
directory, so we are into a Git repository (also, the chalenge name pointed this):
$ ls -a
. .. .git flag.txt
We can use git log
to show previous commits (which are like snapshots of the project along time):
$ git log
commit d10f77c4e766705ab36c7f31dc47b0c5056666bb (HEAD -> master)
Author: LaScalaLuke <lascala.luke@gmail.com>
Date: Sun Oct 30 14:33:18 2016 -0400
Edited files
commit 195dd65b9f5130d5f8a435c5995159d4d760741b
Author: LaScalaLuke <lascala.luke@gmail.com>
Date: Sun Oct 30 14:32:44 2016 -0400
Edited files
commit 6e824db5ef3b0fa2eb2350f63a9f0fdd9cc7b0bf
Author: LaScalaLuke <lascala.luke@gmail.com>
Date: Sun Oct 30 14:32:11 2016 -0400
edited files
Using git diff
we are able to show the differences between two commits (we must provide some of the first characters of the commit identifiers). This one is interesting:
$ git diff 6e824db5 195dd65b
diff --git a/flag.txt b/flag.txt
index c5250d0..8684e68 100644
--- a/flag.txt
+++ b/flag.txt
@@ -1 +1 @@
-CTFlearn{REDACTED}
+CTFlearn{protect_your_git}
And there is the flag.