Hello everyone,
I have a server with FreeBSD 10.1 that has been hacked recently.
My guess is the attacker "entered" the server using a weakness of the old cms I was using for one website. (This is my fault, I have waited too long and didn't change the cms despite the absence of updates since ages). The www/ directory but also several other directories in the root of the website have been deleted. This is all accessible to the www user, so no wonder. The website also hosted a phishing webpage.
At around the same time, the server started to send spam. So it seems likely both events are related, even if it's not completely sure.
I wonder if it is possible for an attacker, as www user, to modify something in the sendmail configuration to let it relay spam? Or is it necessary to gain root privileges to be able to do that?
In order to know if the sendmail configuration has been changed, I compared the contents of /etc/mail/freebsd.mc and /etc/mail/sendmail.cf on the hacked server to the ones from a fresh 10.2 install (no 10.1 available around here).
The freebsd.mc files are identical (except for the version number of FreeBSD in the comment).
But the sendmail.cf files have several differences:
Several lines seem to be comments, but there's something about "RELAY" showing up in the config file from the fresh 10.2. I don't understand what changes it makes (moreover, I cannot understand how the same freebsd.mc files can be compiled into two different sendmail.cf outputs), but could that part have been deleted from the 10.1 server to let it relay e-mails?
I have a server with FreeBSD 10.1 that has been hacked recently.
My guess is the attacker "entered" the server using a weakness of the old cms I was using for one website. (This is my fault, I have waited too long and didn't change the cms despite the absence of updates since ages). The www/ directory but also several other directories in the root of the website have been deleted. This is all accessible to the www user, so no wonder. The website also hosted a phishing webpage.
At around the same time, the server started to send spam. So it seems likely both events are related, even if it's not completely sure.
I wonder if it is possible for an attacker, as www user, to modify something in the sendmail configuration to let it relay spam? Or is it necessary to gain root privileges to be able to do that?
In order to know if the sendmail configuration has been changed, I compared the contents of /etc/mail/freebsd.mc and /etc/mail/sendmail.cf on the hacked server to the ones from a fresh 10.2 install (no 10.1 available around here).
The freebsd.mc files are identical (except for the version number of FreeBSD in the comment).
But the sendmail.cf files have several differences:
Code:
$ diff --suppress-common-lines sendmail.cf_raw sendmail.cf_hacked
1,2d0
<
<
14c12
< # $FreeBSD: releng/10.2/contrib/sendmail/cf/m4/cfhead.m4 285303 2015-07-09 05:23:17Z gshapiro $
---
> # $FreeBSD: releng/10.1/contrib/sendmail/cf/m4/cfhead.m4 266692 2014-05-26 15:28:28Z gshapiro $
36c34
< ##### $FreeBSD: releng/10.2/etc/sendmail/freebsd.mc 285304 2015-07-09 05:25:47Z gshapiro $ #####
---
> ##### $FreeBSD: releng/10.1/etc/sendmail/freebsd.mc 266698 2014-05-26 15:42:39Z gshapiro $ #####
179c177
< DZ8.15.2
---
> DZ8.14.9
267,269d264
< # use compressed IPv6 address format?
< #O UseCompressedIPv6Addresses
<
321,323d315
< # maximum time in queue before retry (if > 0; only for exponential delay)
< #O MaxQueueAge
<
574,579d565
< # SSL cipherlist
< #O CipherList
< # server side SSL options
< #O ServerSSLOptions
< # client side SSL options
< #O ClientSSLOptions
603,604d588
< # fingerprint algorithm (digest) to use for the presented cert
< #O CertFingerprintAlgorithm
612,613d595
<
<
661c643
< #
---
> #
725d706
<
861d841
<
924,925d903
<
<
1211,1214d1188
< R<@> < $* @ [IPv6:0:0:0:0:0:0:0:1] >
< $: < ? $&{client_name} > < $1 @ [IPv6:0:0:0:0:0:0:0:1] >
< R<@> < $* @ [IPv6:::1] >
< $: < ? $&{client_name} > < $1 @ [IPv6:::1] >
1366d1339
< RIPv6:0:0:0:0:0:0:0:1 $@ RELAY originated locally
1677,1678d1649
<
<
1716c1687
< #
---
> #
1725c1696
< #
---
> #
1878d1848
<
Several lines seem to be comments, but there's something about "RELAY" showing up in the config file from the fresh 10.2. I don't understand what changes it makes (moreover, I cannot understand how the same freebsd.mc files can be compiled into two different sendmail.cf outputs), but could that part have been deleted from the 10.1 server to let it relay e-mails?