Jump to content

Title: Decoding the decoding process of the front-end request and response packets once

Featured Replies

Posted

That is, after the last decryption, the development team did not give up. After a few months, the return package was also encrypted. And compressed and obfuscated front-end js

y1vf3wa4vg319287.png

According to observations, it is initially believed that the server also performs the same RSA+Aes encryption, and then sends the key and iv after RSA encrypted and the data fields encrypted by Aes together. But for us, this actually adds to the insult to the system and reduces the security of the system. Because this will allow the front-end to decrypt the rsa+aes, the rsa private key will definitely exist in the front-end!

Start the operation 1. Search the encryptIv field in the old rules, find the suspected decrypted part, press the breakpoint and submit the login request

tr3pkg0e22s19288.png

Burp grabs the packet and returns the packet and extracts the data field

13jtjpaxclj19289.png

Extract the key and iv values of the AES decrypted by RSA at the breakpoint

t2t35qtmntd19290.png

Put n and a from the front-end breakpoint as key and iv into the Guigui JS debugging tool to try decryption. The decryption is successful, which means that there is no problem with the idea. That is, the code here decrypts the encryptIv and encryptKey from the server to the original key and offset of aes.

4ur5l1dx4ea19291.png

2. According to the decryption code, find the rsa private key (p.d), and the display is incomplete. Copy a ctrl+f to search for the complete rsa private key.

jbyst435d3h19292.png

Use jsencrypt.js script to decrypt and find an error. The reason is that the original js calls the browser's window and navigator methods. These two are used to obtain browser window information and mouse position information to generate random numbers

amtl3cync5m19293.png

22m5kaoa2az19294.png

Through searching, I found that someone had changed the original JSEncrypt first, removed the window and navigator methods to use it. Post address: https://bbs.125.la/forum.php?mod=viewthreadtid=14113049

xeib4xi224419295.png

Debugging successfully using Guigui JS

xywakxvf5ut19296.png

3. The last step is to improve the writing of automated encryption and decryption scripts. The old rules are still a combination of mitmweb+burp. The browser first proxyes to burp, and then burp secondary proxys to mitmweb to execute python scripts, and then sends them to the server. The general idea is as follows:

3jeh2xth1n519297.png

In fact, I thought that 90% had been completed, and the remaining 10% were written to write automated scripts. As a result, this 10% took several days because of the reason why the call to js decryption was not successful. Afterwards, it is solved, and generally speaking, it has something to do with the AES algorithm, js, and python. We can talk about this big pit in detail next issue! Skip this part today.

Finally, the last script added the code to cancel the front-end decryption and the code to mitmweb help decrypt the response.

1049983-20230227143700492-387396060.jpg

The debugging was successful, the burp was comfortable and the whole process was clear.

1049983-20230227143701198-922955987.jpg

By the way, huh? I found a high-risk vulnerability that returned to the front end with a verification code hahaha. But I am kind-hearted. Since this encryption and decryption will not be solved for a while, it is Friday now, so let’s call it development and fix the vulnerability next Monday. Let's leave the specific new code part until next time, let's talk about it together with AES when decrypting this big pit.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

Important Information

HackTeam Cookie PolicyWe have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.