XSS attacks:
Cross-site scripting attacks, where an attacker embeds malicious code in a webpage, when a user opens a webpage, the script starts executing on the client's browser to steal the client cookie, the user name password, the download to execute the virus trojan, or even to get the client admin permission.
The principle is that when the user enters, enter some executable code, for example <input name= "username" value= "<script>alert (' haha ') </script>"/>
The reason that XSS occurs is because the data entered by the user becomes code. So we need to do an HTML escape of the user's input data, and escape the code with special characters such as parentheses and quotation marks.
CRSF attacks, cross-site request forgery, an attacker who steals your identity, sends a malicious request to a third-party website on your behalf, CRSF can do things including emailing, texting, trading transfers, and even stealing your account.
Attack value do 2 things to complete the CSRF attack:
1, Login to trusted site A, and produce cookies locally;
2, without logging out of site A (clearing the cookie from site a), visit rogue site B. At this point, a page of malicious site B sends a request to site A, which takes the cookie of site a saved by the browser, and site A is identified as a user's legitimate behavior based on the cookie that is requested.
CSRF defensive means:
1, set the cookie to HttpOnly
2, form submission add hidden token submission
3, using HTTP Referer to identify the source of the request
SQL injection attack, is to pass the SQL command as normal HTTP request parameters, passed to the server, to deceive the servers to finally execute a malicious SQL command, to achieve the purpose of the intrusion, the current large number of data breaches involved in the attack, most of which are implemented through SQL injection.
Defensive means:
1, using precompiled statements
2, using an ORM model
3, avoid password plaintext storage
3, handle the related anomalies, avoid the error exposing too much information.
File Upload Vulnerability
Defense: Verify the Upload file type
Common web attacks and defenses