In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-15 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >
Share
Shulou(Shulou.com)06/01 Report--
This article mainly introduces the meaning of SQL injection, XSS and CSRF. It is very detailed and has a certain reference value. Interested friends must read it!
SQL injection
SQL injection is an injection attack, which is caused by not isolating the code from the data (such as user-sensitive data) in the project and mistakenly executing the data as part of the code when reading the data.
A typical example is when concatenating SQL statements using unescaped user input as variables. At this time, as long as you make changes in the middle of the sql statement, such as adding drop, delete and other keywords, the consequences after execution will be unimaginable.
Speaking of which, how should we deal with this situation? Three aspects:
1. Filter the special characters in the user input parameters to reduce the risk.
2. It is forbidden to concatenate sql statements through strings, and strictly use parameter binding to pass in parameters.
3. Make rational use of the mechanism provided by the database framework. For example, Mybatis provides a way to pass in parameters # {}, which forbids the use of ${}, which is equivalent to string concatenation sql, using parameterized statements.
To sum up, you should use parameterized binding of sql variables correctly.
XSS
XSS: cross-site scripting attack, Cross-Site Scripting, in order to avoid duplicate names with the front-end css, referred to as XSS, refers to the technical means to insert malicious scripts into the HTML pages requested by normal users for execution.
This kind of attack is mainly used for the purpose of information theft and destruction. For example, in the Weibo XSS attack in 2011, the attacker took advantage of the lack of effective filtering of action-data vulnerabilities in the Weibo publishing function, and when posting Weibo messages with URL containing attack scripts, malicious scripts will be loaded when users visit, resulting in a large number of users being attacked.
With regard to the prevention of XSS, mainly by filtering or escaping the data entered by the user, you can use the tool class HtmlUtil provided by the framework. In addition, when the front end displays the data in the browser, it should use a secure API to display the data. For example, use innerText instead of innerHTML.
CSRF
Cross-site request forgery, in the case that the user does not know, impersonate the user to send the request, and perform malicious operations on the web website that has been logged in, such as malicious posting, changing password and so on.
Generally speaking, there is an overlap with XSS, the former is that hackers steal login information from users' browsers and pretend to be users to perform operations. The latter is to put malicious code in the HTML requested by normal users. The problem with XSS is that the user data is not escaped and filtered; the problem with CSRF is that the HTTP API does not prevent non-trustworthy calls.
Ways to prevent CSRF vulnerabilities:
1. CSRF Token verification, using the homology limit of the browser, verify the Token in the Cookie before the execution of the HTTP API, and the request will not be executed until the verification is passed.
2. Human-computer interaction, such as SMS CAPTCHA and interface slider.
The above is all the content of the article "what does SQL injection, XSS and CSRF mean?" Thank you for reading! Hope to share the content to help you, more related knowledge, welcome to follow the industry information channel!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.