Cookie is the meaning of a small dessert in English, and we can always see in the browser how food will be related to the browser? When you browse a previously visited website, it may appear on the webpage: Hello XX. It feels very kind, just like eating a small dessert. This is actually implemented by accessing a file in your host. Therefore, this file is called a Cookie. Do you want to fully understand cookies? Let's take a look at the following!
1. Learn more about Cookie Applicability: beginners
Cookie is a small text file stored on your machine when you browse a website. It records your user ID, password, browsed web page, stay time, and other information. When you come to the website again, the website reads cookies and obtains your related information, for example, you are welcome to the text on the page, or you do not need to enter your ID or password to log on directly. You can select "set/view files" on the "General" tab of "tools/Internet Options" of IE to view all the cookies saved to your computer. These files are generally named in the format of user @ domain. user is your local user name, and domain is the domain name of the accessed website. If you use the NetsCape browser, it is stored in "C: PROGRAMFILESNETSCAPEUSERS". Unlike IE, NETSCAPE uses a Cookie file to record Cookies of all websites.
To ensure Internet security, we need to set cookies appropriately. Open the "privacy" tab in "tools/Internet Options" (note that this setting only exists in IE6.0, for other versions of Internet Explorer, you can click "Custom Level" in the "Security" tab of "tools/Internet Options" to adjust the Cookie security level. In general, you can adjust the slider to the "medium" or "high" position. Most Forum sites require Cookie information. If you never go to these sites, you can change the security level to "block all Cookies ". To prohibit cookies of individual websites, click the "edit" button to add the websites to be blocked to the list. In the "advanced" button option, you can set the first-party Cookie and the third-party Cookie. The first-party Cookie is the Cookie of the website you are browsing, A third-party Cookie is a Cookie sent to you by a website not being browsed. You must select "reject" for a third-party Cookie ". To save the Cookie, you can use the "Import and Export" function of IE to open "file/import and export" and follow the prompts.
Most of the content in cookies is encrypted, so it seems that they are only meaningless combinations of letters and numbers, and only the CGI handler on the server can understand their true meaning. Through some software, we can view more content, and use the Cookie Pal software to view Cookie information, as shown in figure 2. It provides the Server, Expires, Name, value, and other options for us. The Server is the website that stores cookies. Expires records the Cookie's time and life cycle. The Name and value fields are specific data.
Ii. Cookie Transfer Process intended for intermediate readers
When a Web site URL is entered in the address bar of the browser, the browser sends a request to the Web site to read the Web page and displays the result on the display. At this time, the webpage looks for the Cookie file set for the Amazon website on your computer. if it finds the Cookie file, the browser will send the data in the Cookie file along with the previously entered URL to the Amazon server. When the server receives the Cookie data, it will retrieve your ID, shopping records, personal preferences, and other information in its database, and record new content, add to database and Cookie files. If no Cookie is detected or your Cookie information does not match the information in the database, it indicates that you are browsing the website for the first time. The CGI program on the server will create a new ID for you, and save it to the database.
Cookies are transmitted using the HTTP header information in the webpage code. Each webpage request of the browser can be transmitted along with the Cookie. For example, the browser can open or refresh the webpage. The server adds the Cookie to the HTTP header of the webpage. When the webpage data is sent back to your browser, the browser will choose whether to save the data based on the Cookie settings on your computer. If the browser does not allow cookies to be saved, the data disappears after the browser is closed. When a Cookie is saved on a computer
They are different. These are determined by different server settings. Cookie has an Expires (Validity Period) attribute, which determines the Cookie retention time. The server can change the Cookie retention time by setting the value of the Expires field. If this attribute is not set, the Cookie is valid only during Webpage Browsing and closes the browser. These cookies automatically disappear. This is the case for most websites. Generally, a Cookie contains the following fields: Server, Expires, Name, and value. Only the Name and value fields are useful to the Server, expires and other fields are only used to tell the browser how to handle these Cookies.
3. Cookie programming target: Senior readers
Most Web Programming Languages Support cookies. Such as javascript, VBScript, Delphi, ASP, SQL, PHP, and C. In these object-oriented programming languages, the use of Cookie programming is basically similar. The general process is to create a Cookie Object first ), then, the control function is used to assign values, read values, and write values to cookies. Then, how can we use code to obtain sensitive information in cookies of other users? The following is a brief introduction.
This method involves two steps: first, you need to locate the website where you need to collect cookies, analyze them, and construct a URL. Then, you need to compile the PHP code for collecting cookies, and put it on a website that you can control. When the visitor clicks the URL you constructed, the PHP code can be executed.
Iv. Cookie security problems applicable to: all readers who want to access the Internet safely
1. Cookie Spoofing
Cookies record the user's account ID, password, and other information. If it is transmitted online, it is usually encrypted using the MD5 method. In this way, even if the encrypted information is intercepted by some ulterior motives on the internet, it cannot be understood because it only displays meaningless letters and numbers. However, the problem is that the person who intercepts cookies does not need to know the meaning of these strings. They only need to submit others' cookies to the server and can pass the verification, they can pretend to be victims and log on to the website. This method is called Cookie spoofing. Cookie spoofing is implemented only when the server verification program has a vulnerability and the impersonator needs to obtain the Cookie information of the impersonator. At present, it is very difficult for the website's validators to exclude all illegal logins. For example, the language used to compile the validators may have vulnerabilities. In addition, it is easy to obtain others' cookies. You can write a short piece of code in a language that supports cookies (For details, refer to 3). You only need to put this code on the network, all cookies can be collected. If a Forum allows HTML code or allows Flash tags, you can use these technologies to collect Cookie code and put it in the forum. Then, you can give the post an attractive topic and write interesting content, A large number of cookies can be collected soon. On the Forum, many people have stolen their passwords. As for how to prevent it, there is no specific medicine yet. We can only use the usual protection methods. Do not use important passwords in forums, or use the IE function to automatically save passwords, and try not to log on to a website that does not know the details.
2. Flash code hazards
Flash has a getURL () function. Flash can use this function to automatically open a specified webpage. Therefore, it may direct you to a website containing malicious code. For example, when you enjoy the exquisite Flash animation on your computer, the code in the animation frame may have been quietly connected to the Internet, and opened a very small page containing special code. This page can collect your cookies or do other things, such as planting trojans on your machine or even formatting your hard disk. For Flash, websites cannot be banned because it is an internal action of Flash files. What we can do is try to open the firewall if you are browsing locally. If the firewall prompts that packets sent to the outside are not known to you, it is best to disable it. If you want to enjoy it on the Internet, you 'd better find some well-known big websites.