Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

Main question:

Is it even possible to be be infected with a bot/spamming software on Ubuntu (or any other distro)?


My ISP blocked my port 25 (and 465) for outgoing connections (outbound connections, from home to remote server) to SMTP, so I can't use my business emails from home right now. Their reasoning for blocking me is: "because of you sending spam" which I'm not and they told me that if I'm not sending then my OS is probably infected...

I could use a comprehensive list of tools and guides to check the system (Ubuntu 13.10 14.04 64bit) for any infiltrates/malware/rootkits.


  • I also have Windows 8.1 (64bit) installed just because I also like to game on my home computer... but that's what I only do on Windows...when I have time...

  • Wireless is off and even if it's on it's pass protected.

  • Scanning of windows didn't reveal anything nor should have since
    there's windows and games installed there.

  • I can connect to other ports for SMTP but our server uses 25 and that cannot change

  • I also tested connecting to port 25 from windoze (using thunderbird)

  • I use thunderbird for email client on ubuntu and tested a few others just to verify that it was not a misconfig of thunderbird.

  • Telneting also outputs connection timeout...

EDIT: My ISP still refuses to unblock me... Maybe I'll have to open up 587 on the server, since that isn't blocked at the moment (I can still use Gmail)


I guess today I was connected with another tech from my ISP's support and told me that there isn't a block from them... I was furious!!! I don't know what was the previous tech doing... maybe he is new and was reading from a script..

So I tested another ISP via tethering from my phone and I successfully managed to send emails through port 25. Essentially I didn't change anything, only the ISP. Are they kidding me? Maybe the tech-support doesn't know how to interpret what they looking on their screens for my account or could it be something else?

Another step I took was to fully reset my router to it's default settings and get another dynamic IP. Still no connection to port 25.

I'm planning to get a used router from some friend or something to test with another router just to be sure the problem lies with my ISP.

EDIT 3: It's been awhile since my last update to this question. I moved back to my old house (which is in a different part of the country) where I have the same internet provider. The same company!! My settings just work as expected. I can send emails just fine using port 25. I bet the problem was with that nasty ZTE router that the ISP hands out to new customers.

share|improve this question
You need something like this barracuda.com/products/spamfirewall but they are expensive –  Tasos Mar 25 at 16:19
Perhaps you ran something like nmap somehost/24 -p 25? –  d33tah Mar 25 at 21:30
In addition to the other answers, the ISP may be doing what most ISPs do now - they globally block outbound SMTP. Does your ISP have a smtp server you can relay through? e.g. stmp.[isp.com]? –  james Mar 26 at 2:35
Did you configure your mail server to not relay mail from elsewhere? –  Shadur Mar 26 at 11:32
this is the world of software man, within the cyber world, anything is possible, OSs can't become immune, 'virus' is merely a name for a rogure program someone coded, you're basically asking "can someone's even program run on ubuntu" - OF COURSE! –  pythonian29033 Mar 26 at 12:37

6 Answers 6

up vote 32 down vote accepted

Is it even possible?

Why wouldn't it be? Ubuntu is a really flexible system that shares many problems with most other operating systems:

  • Software in Ubuntu can be exploited
  • You don't need root to run a spam daemon.
  • People can crack weak authentication
  • Ubuntu users can be convinced into installing/running just about anything
  • Once in, hackers can upload/remote-download more software to send spam

Let's just be realistic about security here. A cross-platform Flash exploit could easily translate into a dropper loading and installing a spam daemon that runs itself on login. It doesn't need root.

Double-check the ISP's story

"But my ISP wouldn't lie to me!" said nobody ever. Many home ISPs do habitually block port 25 and others force you to use their SMTP servers (that's the only outgoing p25 connection they'll allow).

Being a moderator allows me to see your IP and I've checked your home ISP. If you google their name and "port 25" or "smtp", you'll see a lot of other people in similar situations. And they do have a central SMTP server.

I know you said this is a new issue but just double check it's not your ISP (or needing the right settings while on your ISP). The workaround at the end should still work for you.

Finding the problem

Though possible, I'm still not sure it's the most likely target. If you're anything like me, you're surrounded by internet connected devices and you need to look at them all.

I would start by asking the ISP for some evidence. Timestamps at the bare minimum but it would be great to see what they're using to make sure it's not an auto-flag gone wrong.

  • It could be that somebody has flagged a work email with the ISP's abuse department.
  • You need to know what OS you were using at the time. Both Ubuntu and Windows keep auth logs so compare them against any evidence they can send you.
  • Log outgoing port 25 activity with something like:

    iptables -I OUTPUT -p tcp --dport 25 -j LOG --log-prefix "mail connection"

    I'm honestly not sure if that will work if you're being blocked already but it's worth a shot. Various Windows firewalls will offer you various logging alternatives.

  • Note that any device on your connection could be sending emails, not just your computer. Phones, wifi-enabled toasters, naughty neighbours, etc. Finding whatever is sending this mail could require a network level packet interception and logging. This is all possible but it's a pain in the rear.

  • Once you've exhausted more likely avenues, take your pick of Linux antivirus software. I can't personally speak for any of them or their detection rates.

Working around a block immediately

If you need to carry on, the easiest way to carry on sending email is through some sort of obfuscated or encrypted connection. If you have access to a SSH server (eg at work) that can often be the best method.

ssh -D9100 user@host

Then just alter your email client to use a SOCKS proxy address localhost, port 9100. Your ISP won't be able to interfere with this and I'd be very surprised if whatever's sending the spam could guess the SOCKS configuration.

What's most likely in this case...?

Check to see if you can send email through your ISP's SMTP server. I've checked, yours has one. They might be forcing all their users to use it as that's very common. The tech support person might just be confused.

Ask another user (with another account, on another telephone line) to try connecting to your company's SMTP. This can be done quickly with telnet example.com 25.

  • If they can't connect, assume this is ISP-wide —not just your account— so it's probably not a security issue... It's just something you'll have top work with or work around.

  • If they can connect, you're back at square one. There has been something sending email from your network that has triggered your ISP to block you. Virus sweeps, traffic monitoring and paranoia are your best friends here.

share|improve this answer
Indeed, some ISPs just block it as a matter of policy so that is most likely, and so you should ask for proof. If something on your home network is actually sending span, the finding it is not exactly easy. –  psusi Mar 26 at 4:00
I'll accept this as an answer since it contains useful information. I checked my windows installation with various scanning tools... it didn't find anything. Not even tracking cookies... As for my Ubuntu installation, I just run the rkhunter tool and didn't find anything either...(please let me know if there are other tools I can try for my specific situation) –  Petsoukos Mar 26 at 16:54
@Petsoukos I'd probably favour an actual scanning antivirus than a tool like rkhunter. Perhaps I'm being unfair but I don't count them in the same league as each other. –  Oli Mar 26 at 16:56
This answer overlooks the possibility that he is an open spam relay. It is good information but may just be helping him keep his misconfigured machine accessible. –  casey Mar 26 at 20:48
@casey I don't reach that conclusion from the question. At all. It mentions connecting to a work server that only supports port 25... –  Oli Mar 26 at 23:08

It's certainly possible to be infected and part of a botnet in Ubuntu. But it's also really really unlikely.

You should be able to ask to your ISP for their records. They will help you find the problem. It's hard to diagnose it from here, but your wireless has a good chance of beign the culprigth. Please check that you are using WPA2 for security and WPS is disabled.

After you resolve your problem and stop sending spam for a while, you can probably talk your ISP into unblocking your ports.

share|improve this answer
"Please check that you are using WPA." WEP and WPA are vulnerable. I'd make sure you're running WPA2. –  MiniRagnarok Mar 25 at 20:06
I have edited it as I agree that WPA2 is more secure. But AFAIK there is no known vulnerability known in WPA that can allow you to connect to a network (short of bruting force short passwords or using WPS to obtain the password). –  Javier Rivera Mar 26 at 12:39
My ISP tech support probably doesn't know what I'm talking about when I speak with them... –  Petsoukos Mar 27 at 23:12

It's common practice to block outgoing port 25, as due to spamming concerns it kind of became discouraged for original submission of Email. It's still used between mail servers.

The proper (and typically not blocked) Port for submitting (original) Email is Port 587, the so-called submission port. Mail providers typically support it, system operators typically do not block it.

share|improve this answer

Many ISPs block ports 25 and 80 for all their consumer accounts. I use a web hosting service that includes email service. they provide me with a smtp server on a non-standard port for outgoing email. It works anywhere. You may well have access to something similar. Think about what services you already have, and investigate them.

share|improve this answer

Many of the other answers focus on someone using your wifi or infecting your machines. These are possible but they overlook the simplest explanation (Occam's razor...).

You are most likely acting as an open relay, which means that anyone in the world can connect to your machine and just ask it nicely to send mail somewhere, and you will do it, no questions asked. This is frequently why ISPs will block you because it is a simple test for them to do. They will scan their customer IP block and ask anything on port 25 to relay a test message and if you do, you are a spammer. It may be the case that no one is actually using your relay, but its mere existence is enough to be blocked.

To test if you are an open relay, telnet to your mail server and talk to it. The bold lines are the ones you type.

% telnet your.mail.server 25
Connected to your.mail.server.
Escape character is '^]'.
220 your.mail.server ESMTP Postfix (Debian/GNU)
helo geocities.com
250 your.mail.server
mail from: the90s@geocities.com
250 2.1.0 Ok
rcpt to: someone@gmail.com
554 5.7.1 <someone@gmail.com>: Relay access denied

The lines you type are the helo, mail from: and rcpt to: lines. Make sure you use addresses that are not local to you, both need to be remote hosts. If you do not get the error 554 relay denied, then you are a misconfigured spam gateway and rightfully blocked.

The simplest way to remedy this is to require authentication to send mail through your MTA. The details to set this up depend on the MTA you are running, a detail which is not present in your question.

share|improve this answer
I think in that case I should have a mail server installed on my home machine which I don't. Correct? I'm not trying to send from my machine as a mail server but rather to connect to my actual remote (off-site) server. –  Petsoukos Mar 27 at 23:15

Just to ensure you don't have something bad running on your Linux box or network.

Check your network yourself

Start by running this on your Linux machine at home:

netstat -ta

This will list all the tcp connections that are either established or listening (with servers behind them). If there's anything you don't expect, you should investigate further.

Another very useful command that would list all the processes with internet connections they held open is:

sudo lsof -i

(you will need to have the lsof package installed.)

Note that the above tests will not cover other devices sharing your internet connection: phone, tablets, internet-enabled gadgets, neighbors pigybacking on your connection etc. as Oli mentioned. If you have a list of your internal IPs, you may run an external port-scan on each of them, one by one, from your Linux box:

sudo nmap <internal-ip-address>

(requires the nmap package). It might reveal ports and services open on various devices that you may not be aware of.

share|improve this answer
Thank you! Will do that! –  Petsoukos Mar 29 at 19:36

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.