Follow the Cybersecurity Medicine Water Brother to fight the target field (emergency response)

0 19
PrefaceThank you, Xuanji, for not having to set up a target field locally (it is...

Preface

Thank you, Xuanji, for not having to set up a target field locally (it is recommended to download xshell7 for connection).


Target Field Introduction

Follow the Cybersecurity Medicine Water Brother to fight the target field (emergency response)

Server scenario operating system: Linux
Server account password: root Vulntarget@123
Question source public account: Crow Security
https://mp.weixin.qq.com/s/ZO-SXw5rvpLrjmcjcN9_6w
Task Environment Description:

Today, the business environment deployed by the customer on the Aliyun suddenly found that the homepage has become a ransomware interface, requiring users to pay a ransom to decrypt the data. The customer found that some important files were encrypted with the .vulntarget ending. Subsequently, the customer asked you to carry out emergency response and forensic analysis.
Specific requirements are as follows:
Analyze how the attack event occurred and provide an attack portrait
Decrypt Ransomware
Restore the original index.jsp page and restore the normal web service
Find 3 hidden flags in it

Forensic Analysis

flag1

  1. Firstly, when encountering this kind of emergency response question, we can use the history command first to see if the attacker has left any traces.

1721486030_669bcace8495dd9baccee.png!small?1721486031017


ok directly find flag1

flag2

I

Continue to analyze the history command and find that the attacker has generated encrypted public and private keys and has not deleted them.

1721486053_669bcae5bb8e393913830.png!small?1721486055059

II. Ransomware Decryption

Find the address of the public key and private key through the find command -- find . -name pubkey.pem (if no results are found, it means that the current directory is not the root directory, and only cd / is needed to solve the problem).

Since the previous command searched for the public key, and the private key and public key are in the same directory, it is only necessary to execute a cd https://www.freebuf.com/articles/ and cat command to find the public key and private key.

1721486095_669bcb0f4e3c6040f0c40.png!small?1721486095972

Through history, it can be known that there are public keys, encrypted script files, and other files in the /opt/tomcat/webapps/ROOT/ directory. (Since the public key and private key have been known in the previous step, at this time, we only need to check the encrypted flag file, that is, flag.jsp.vulntarget file.)

1721486115_669bcb2325a08a5c9daf6.png!small?1721486115542

Place the public key, private key, and encrypted flag file content in the online rsa decryption, and you can obtain flag2.

1721486138_669bcb3a73def462261c6.png!small?1721486139703

flag3

As can be seen from history, the website is built based on Tomcat, and the logs of Tomcat are generally located in /opt/Tomcat/logs. Since the event occurred on 2024.06.04, we only need to check localhost_access_log.2024-06-04.txt.

1721486180_669bcb648a59d982f82f5.png!small?1721486182997

1721486168_669bcb588e59c34798651.png!small?1721486169621

There are too many logs, just use | grep flag

1721486200_669bcb78bfb8daa8736ea.png!small?1721486201155

That's all for the process of obtaining the flag

Expansion

  • Through logs and history, we can find that the attacker uploaded a trojan and renamed it to 404.jsp. It was found to be a small trojan upon inspection.

1721486237_669bcb9d37310d0eac8cc.png!small?1721486238003

So his attack path is:

1 The attacker uploaded a shell through the Tomcat PUT vulnerability
2 The attacker executed commands through shell
3 The attacker obtained permissions through shell (this entry is temporarily missing, no反弹shell)
4 The attacker generated rsa public and private keys on the victim's machine through commands
5 The attacker encrypted the key data with the public key
6 The attacker forgot to delete the generated public and private keys
7 Replace the index.jsp file with a ransomware interface by executing commands

  • Introduction to Tomcat vulnerabilities: If the PUT method is enabled on Apache Tomcat on Windows (default is disabled), this vulnerability exists. Attackers can use this vulnerability to upload JSP files, resulting in remote code execution.
  • The last point, the red team members must not forget to clean up the traces

你可能想看:

Data security can be said to be a hot topic in recent years, especially with the rapid development of information security technologies such as big data and artificial intelligence, the situation of d

It is possible to perform credible verification on the system boot program, system program, important configuration parameters, and application programs of computing devices based on a credible root,

In today's rapidly developing digital economy, data has become an important engine driving social progress and enterprise development. From being initially regarded as part of intangible assets to now

d) Adopt identification technologies such as passwords, password technologies, biometric technologies, and combinations of two or more to identify users, and at least one identification technology sho

How to use truffleHog to search for high-entropy strings and sensitive data in Git repositories to protect the security of code repositories

Enterprises have insufficient response capabilities, and the cybersecurity of the manufacturing industry faces severe challenges

b) It should have a login failure handling function, and should configure and enable measures such as ending the session, limiting the number of illegal login attempts, and automatically logging out w

b) It should have the login failure handling function, and should configure and enable measures such as ending the session, limiting the number of illegal logins, and automatically exiting when the lo

Case of cyber security planning project for a financial institution under the background of data security and security compliance

As announced today, Glupteba is a multi-component botnet targeting Windows computers. Google has taken action to disrupt the operation of Glupteba, and we believe this action will have a significant i

最后修改时间:
admin
上一篇 2025年03月29日 02:32
下一篇 2025年03月29日 02:55

评论已关闭