I would like to ask for some directions to trace back to the original (malicious) script on my system (Ubuntu Server). I would try to be more specific if needed. If the question does not fit this stackexchange, then I will modify it.

In netstat's output, the PID/Program name only showed "-" and the one next to it 1441/-bash. While i can locate the PID of the latter, I have no idea to do that with the first one. These two processes would respawn after reboot.

To give more context, the two suspicious connections are from and It seems like they are trying to mine XMR. I have got rid of their keys in authorized_keys but could not find a way to stop the established connection to port 50866 from foreign port 443 (UFW already blocked that IP in and out but somehow it can still establish a connection). I was able to block connection from my server to, hence it only showed SYN_SENT.

Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
tcp        0      0 my_server_ip:50866      ESTABLISHED -               
tcp        0      1 my_server_ip:36730      SYN_SENT    1441/-bash      

UFW info

     To                         Action      From
     --                         ------      ----
[ 1] Anywhere                   DENY IN             
[ 2] Anywhere                   DENY IN             
[ 3]             DENY IN     Anywhere                  
[ 4] Anywhere                   DENY IN            
[ 5]              DENY IN     Anywhere                  
[ 6] Anywhere                   DENY IN             
[ 7]             DENY IN     Anywhere                  
[ 8] Anywhere                   DENY IN            
[ 9] Anywhere                   DENY IN              
[10] Anywhere                   DENY IN            
[11] Anywhere                   DENY IN             
[12]              DENY IN     Anywhere                  
[13]             DENY IN     Anywhere                  
[14]               DENY IN     Anywhere 

ls -l /proc/1441's output, the -bash script got deleted right after reboot.

-r--r--r--   1 root root 0  1월 28 16:17 cpuset
lrwxrwxrwx   1 root root 0  1월 28 16:06 cwd -> //
-r--------   1 root root 0  1월 28 16:17 environ
lrwxrwxrwx   1 root root 0  1월 28 16:06 exe -> /bin/-bash (deleted)
dr-x------   2 root root 0  1월 28 16:05 fd/
dr-x------   2 root root 0  1월 28 16:17 fdinfo/

How to I find what script/process that triggered exe binary file above?

  • 5
    Even if you locate your malware, the original entry-point of the attack remains. Please remove your server from production, taking it offline if possible. Then you could do a forensic analysis of its content. When you have found the probable source of entry, you should nuke your server from orbit.
    – A. Hersean
    Commented Jan 28, 2022 at 9:55
  • I really appreciate this and this is what I would definitely do in production. This is my local server and I take this chance to learn more about malware traces.
    – Long
    Commented Jan 30, 2022 at 8:11

1 Answer 1


For those who are struggling after removing the crontab created by the malware, there is one more place you should look.

System services and start-up services are located in /etc. For example, in Ubuntu it should be something like /etc/rc.local file and /etc/systemd/system.

Check for suspicious scripts and remove them.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .