題目連結
https://learn.cylabacademy.org/library/764
題目解法
輸入
ssh指令以及密碼來clone下專案到本地。查看
README.md內容,得知要使用使用者名稱root、電子郵件root@picoctf來推送flag.txt到遠端。1 2 3 4 5 6 7 8$ cat README.md # MyGit ### If you want the flag, make sure to push the flag! Only flag.txt pushed by ```root:root@picoctf``` will be updated with the flag. GOOD LUCK!使用
git config來設定使用者名稱和電子郵件1 2$ git config --local user.name "root" $ git config --local user.email "root@picoctf"正常設定時會使用
global參數,不過這次設定僅套用在此專案,因此使用local參數。新增
flag.txt1touch flag.txt新增 commit 並推送到遠端,再推送到遠端時即可得到 flag。
1 2 3$ git add flag.txt $ git commit -m "feat: add flag.txt" $ git push推送後的內容
1 2 3 4 5 6 7 8 9 10 11 12 13$ git push git@foggy-cliff.picoctf.net's password: Enumerating objects: 4, done. Counting objects: 100% (4/4), done. Delta compression using up to 2 threads Compressing objects: 100% (2/2), done. Writing objects: 100% (3/3), 273 bytes | 273.00 KiB/s, done. Total 3 (delta 0), reused 0 (delta 0), pack-reused 0 remote: Author matched and flag.txt found in commit... remote: Congratulations! You have successfully impersonated the root user remote: Here's your flag: picoCTF{1mp-----------------------3df} To ssh://foggy-cliff.picoctf.net:58441/git/challenge.git 1f391cc..ff4ce9c master -> master