iT邦幫忙

2021 iThome 鐵人賽

DAY 8
0
Security

一起資安入門 -- picoCTF 探索與解題系列 第 8

[2021鐵人賽 Day08] General Skills 05

  • 分享至 

  • twitterImage
  •  
  • 引言
    昨天學習到的工具是 nc netcat ,可以想成網路版本的 cat ,
    但可以雙向溝通,最簡單的使用格式是:

    nc destination port
    
    • destination 是你要連接的目標主機位址,例如 mercury.picoctf.net ,
      代表跟你通訊的程式正在 mercury.picoctf.net 這台主機上面運行。
    • port 是該程式在該主機上與外面對接的埠號,例如 7449 ,簡單來說,
      你想要 nc 在 mercury.picoctf.net 這台大主機中找到目標程式的話,
      就必須給 nc 知道你要找的程式在某某通訊埠上,每個主機上都有很多通訊埠。
  • General Skills / Static ain't always noise
    https://ithelp.ithome.com.tw/upload/images/20210923/20111429reJcSR1gmM.png
    題目給了一個執行檔 static 與 shell script ltdis.sh
    將他們載下來後,因為題目要求看 static 中的資料,
    因此直接給權限後執行:

    $ chmod +x ./static
    $ ./static
    

    執行後:

    Oh hai! Wait what? A flag? Yes, it's around here somewhere!
    

    沒有 flag ,題目有說另一個 shell script 會有幫助,
    先執行該 shell script 看看:

    $ chmod +x ./ltdis.sh
    $ ./ltdis.sh
    

    執行後:

    Attempting disassembly of  ...
    objdump: 'a.out': No such file
    objdump: section '.text' mentioned in a -j option, but not found in any input file
    Disassembly failed!
    Usage: ltdis.sh <program-file>
    Bye!
    

    這邊可以看出它將對執行檔進行反組譯
    disassembly 就是反組譯的意思,會將執行檔的二進位檔案內容,
    轉換成對應組合語言,藉此可以間接觀察執行檔的行為,
    但一般來說都不好直接觀察,只能找找蛛絲馬跡。

    程式輸出表示需要一個程式輸入,
    所以我們把 static 當作參數輸入 shell script:

    $ ./ltdis.sh ./static
    

    執行後:

    Attempting disassembly of ./static ...
    Disassembly successful! Available at: ./static.ltdis.x86_64.txt
    Ripping strings from binary with file offsets...
    Any strings found in ./static have been written to ./static.ltdis.strings.txt with file offset
    

    然後就可以看到產生了兩個檔案:
    ./static.ltdis.x86_64.txt./static.ltdis.strings.txt
    根據程式輸出訊息,任何找到的字串都在 ./static.ltdis.strings.txt 中,
    我們用 grep 命令來找出 flag :

    $ grep 'picoCTF' ./static.ltdis.strings.txt
    

    輸出:

    1020 picoCTF{d15a5m_t34s3r_f5aeda17}
    

    當然這個 flag 每個人不同,之後不會再贅述。


上一篇
[2021鐵人賽 Day07] General Skills 04
下一篇
[2021鐵人賽 Day09] General Skills 06
系列文
一起資安入門 -- picoCTF 探索與解題30
圖片
  直播研討會
圖片
{{ item.channelVendor }} {{ item.webinarstarted }} |
{{ formatDate(item.duration) }}
直播中

尚未有邦友留言

立即登入留言