Original link: https://www.cfanlost.com/archives/1431.html
Recently, the company held a city-wide network security attack and defense simulation exercise. I was called to the leadership office and was told that a local portal website had been built in a virtual environment. Now it needed to be modified to have the effect of being attacked. The manufacturer’s technical staff said that it could not be modified. The data is encrypted. So the leader remembered me as a great person, and the task fell into my hands.
When I heard this, I looked confident and confident that I could handle it. I came to the manufacturer’s web page code and found that it was saved directly in the browser. There was only one file, index.html, which was 11 megabytes in size. There is obvious lag when I turn on the computer, and the code is just a bunch of letter combinations. I’m so confused, it’s a little too early to talk nonsense now. After all, I have also opened a studio and been a professional in website construction before. Let’s think about this problem first. deceive (Do it).
After thinking for a while, I checked the website source code and found that the content was all in plain text. I captured the packet and checked the image preview. The response was like this. Encrypt data When I looked at the pictures, the headers started with data:image/jpeg;base64 , followed by a bunch of letters. I didn’t know about it until I looked at Baidu. Binary dump encoding means converting the picture text into text encoding, eliminating the need for Once you have a picture file, you can directly insert picture encoding text into the web. It is strange that the code is so large. When you open it, you think it is encrypted data.
Modify ideas
Just search and replace the text content directly. First capture the image resources and download them. After modifying the image, transcode the image into base64 encoding through the online website. Copy the original encoding of the image header, search directly in the file, and directly use the modified and converted encoding. replace.
In order to show the display effect after the website was tampered with and attacked, the leader asked his colleagues to find pictures of pornography, gambling and drugs. Haha, this job is really difficult.
Data URL
In fact, the above method is Data URL (data:image/jpg;base64,), which is mainly used in the front end to speed up the loading of web pages. Data URL draws pictures locally instead of loading them from the server, so it saves HTTP connections and plays a role in accelerating web pages.
1.data:image/jpg; declare data protocol and type name
2.base64, the encoding form is base64
3./9j/4AAQSkZ…… base64 encoding result
This article is reproduced from: https://www.cfanlost.com/archives/1431.html
This site is only for collection, and the copyright belongs to the original author.