| Posted by: Lemonde - 06 August 2025 17:15:53 |
|---|
| How can I see what emails have been sent by Exchange server 2019 to investigate spamming? |
| Posted by: sirclesadmin - 06 August 2025 18:06:36 |
|---|
|
On Exchange Server 2019, your main forensic tools for seeing what emails have been sent (including any spam that might have been relayed or sent by compromised accounts) are: 1. Message Tracking LogsExchange logs every message transaction to its message tracking logs. These are the fastest way to see who sent what, when, and to where. PowerShell example - see all messages sent in the last day:
Key fields to watch for:
2. Filtering by Suspected SenderIf you think a specific account is compromised:
3. Checking SMTP Receive Logs (Protocol Logs)If you want to see SMTP conversations (including unauthenticated attempts):
These will show source IPs, HELO strings, and authentication status. 4. See Outbound Connector ActivityIf you send outbound via a smart host or connector, check:
Enable protocol logging to catch outbound conversations:
Outbound logs are in:
5. Look at Queue ViewerIf spam is still flowing:
6. Suspicious Volume DetectionIf you just want to find heavy senders:
This will show which senders pushed the most email. 7. Next Steps if Spam is Found
If you want, I can give you a one-liner that will show all external email sent from your Exchange 2019 server with subject lines and source IPs in the last 48 hours, which is usually the fastest way to catch spammers. Do you want me to prepare that command? |
| Posted by: Lemonde - 06 August 2025 18:08:35 |
|---|
| what about just by the smtp server including relays? |
| Posted by: sirclesadmin - 06 August 2025 18:08:57 |
|---|
|
If you want to see everything your SMTP service sent out - including relays, authenticated users, and automated systems - you can get it by looking only at the SEND events from the transport logs, without filtering by specific senders. That way you'll catch:
One-liner for all outbound SMTP sends (last 48 hours)
Fields explained:
Narrow it to SMTP relay activity onlyIf you want only the messages that came in via SMTP (not MAPI, OWA, EAS, etc.):
If you need to see raw relay protocol details
If you like, I can give you a combined PowerShell search that pulls from both message tracking logs and protocol logs so you see exactly what your SMTP server sent (including HELOs, auth method, and IP) - that's the method I use when investigating open relay abuse. Do you want me to prepare that? |
| Posted by: Lemonde - 06 August 2025 18:09:36 |
|---|
| Ok I have this from Spamhaus: 'The machine using this IP is infected with malware that is emitting spam, or is sharing a connection with an infected device. As a result, this IP is listed in the eXploits Blocklist (XBL) and the CSS Blocklist (CSS) Click on More Info to see if you can request a delisting from this blocklist. This will also display any further information we have relating to this listing. Less Info If this is a shared server, please call your hosting company or ISP! Why was this IP listed? 167.98.18.58 has been classified as part of a proxy network. There is a type of malware using this IP that installs a proxy that can be used for nearly anything, including sending spam or stealing customer data. This should be of more concern than a Spamhaus listing, which is a symptom and not the problem. The proxy is installed on a device - usually an Android mobile, firestick, smart doorbell, etc, but also iPads, and Windows computers - that is using your IP to send spam DIRECTLY to the internet via port 25: This is very often the result of third party "free" apps like VPNs, channel unlockers, streaming, etc being installed on someone's personal device, usually a phone. Technical information: Recent connections: (IP, UTC timestamp, HELO value) 167.98.18.58 2025-08-06 14:30:00 ch1nam05-obe.outbound.protection.outlook.co Items of note: This issue is very likely to be caused by a personal device, such as a mobile phone, with residential proxy malware or a spambot installed on it. It is EXTREMELY rare for this to be the SMTP server at fault. This is a simple explanation of how it can work. Any devices with "free" VPNs, TV streaming, channel unlocking, or 3rd-party apps installed are the first things to check. What should be done about it? DYNAMIC IPs/MOBILE USERS If you are NOT running a local mail server on this IP, please do the following: Go to What Is My IP? and find out what your public IP is. Call your ISP - the company that is providing your internet access via the IP you just looked up. Find out from your ISP if the IP is dedicated or dynamic. If it is dynamic, is it CG/NAT? What are your outbound mail settings? Have your ISP verify your mail settings are correct: SMTP server name Outgoing SMTP port Are you using SMTP authentication - yes/no? Once you have this information, open a ticket. Please provide your verified mail settings in this ticket. Our ability to help you depends on this information! STATIC IP/LOCAL MAIL SERVER(S) Do you have one or more local SMTP servers? The problem is NOT your mail server. It is never the mail server. It is always someone's mobile device (phone, laptop, tablet), or more rarely a computer, somewhere on the LAN. There can be more than one! These are the recent HELOs we have seen. If they match your mail server's rDNS, do not dismiss this, and read on. (IP, UTC timestamp, HELO value) 167.98.18.58 2025-08-06 14:30:00 ch1nam05-obe.outbound.protection.outlook.co What to do: Make sure port 25 access is limited to mail server access only / end-users should be using SMTP authentication on port 587 or 465 Guest networks need to be limited too! Remote sending of email to servers via the Internet will still work if web-based, or configured properly to use port 587 using SMTP-AUTH. Do you have clients or end users NAT'd to the same IP as your mailserver? If so, this is very likely to be the source of the problem. Set up logging at the exit point and let it run for a few days to find anomalous port 25 traffic - these proxies do not necessarily fire every day.' but there is no evidence any device on the network has sent that much traffic today |
| Posted by: sirclesadmin - 06 August 2025 18:10:00 |
|---|
|
Right - what Spamhaus are describing here is not necessarily your Exchange 2019 server pushing spam. They're saying something on the same public IP (167.98.18.58) - maybe even behind NAT with your mail server - opened a direct raw TCP connection to port 25 on the internet, bypassing your normal SMTP server entirely. That's why your message tracking logs might look clean - this traffic never hit Exchange at all. Why you might not see it in Exchange logs
What you should do now1. Check if your public IP is sharedIf this server is on a hosted environment, a CGNAT, or an ISP dynamic IP pool, the spam could be from another customer. If it's your own dedicated IP - then it's inside your network. 2. Log ALL outbound port 25 connections at the firewallSince the malicious traffic never touches Exchange, you have to catch it at the network edge. Example on a firewall with logging:
This will quickly show which internal IP is opening direct SMTP sessions. 3. If you can, block port 25 for everything except ExchangeThat's the simplest fix and industry best practice:
4. Cross-check Exchange itselfEven though Spamhaus think it's "never the SMTP server", still check Exchange:
If this is clean, you know it's not your mail server generating the spam. 5. If you find the rogue device
If you want, I can give you a PowerShell script for your firewall/router logs that will isolate every internal IP attempting port 25 connections to the internet, so you can spot it even if the traffic is small bursts. That would be the quickest way to prove whether this is inside your LAN or outside your control. Do you want me to prep that? |
| Posted by: Lemonde - 06 August 2025 18:10:34 |
|---|
| But they are reporting a outlook.com smtp ident and we don't use office365, especially from a server with our own IP address! |
| Posted by: sirclesadmin - 06 August 2025 18:11:21 |
|---|
|
Yeah - that's the interesting tell here. Spamhaus are saying they saw this on port 25:
That means the malware (or device) didn't just randomly open SMTP - it deliberately pretended to be a Microsoft 365 outbound server in its Two possibilities: 1. It's not your network at all
2. It's a device on your LAN running proxy malware
Why the "O365" string doesn't mean it's MicrosoftSpambots and proxy malware often use:
This string is just text sent by the connecting device - there's no verification that it's actually Outlook.com. How to prove whether it's you or not
Ask your ISP: "Is 167.98.18.58 dedicated to us, or is it part of a NAT/shared block?"
If your Exchange logs are clean and your firewall shows no non-Exchange port 25 traffic, you can push back to Spamhaus that it's not your network. If you want, I can give you a quick firewall rule strategy that will log - in real time - every single TCP/25 attempt to the internet and tie it to a local MAC address, so you can instantly see if it's your LAN or someone else on your ISP's block. That would let you tell Spamhaus definitively "this wasn't us". Do you want me to make that? |
| Posted by: Lemonde - 06 August 2025 18:11:45 |
|---|
| But the router shows no sign of any SMTP traffic, and everyone is blocked from sending to port 25 anyway |
| Posted by: sirclesadmin - 06 August 2025 18:12:11 |
|---|
|
Then that points very strongly to this being outside your network entirely - either:
Why the "router shows no SMTP" mattersIf your firewall/router has logging on all TCP/25 attempts and you're blocking everything except Exchange - and that's showing nothing - then there's simply no live source on your LAN that could be making those connections. That means Spamhaus's report is either historical or someone else's problem. Steps to take now
If you want, I can draft you a short but convincing technical response to Spamhaus that makes it clear the listing is a stale/misattributed hit, so you can get the block removed without them asking for endless "malware scan" proof. Do you want me to write that? |
| Posted by: Lemonde - 06 August 2025 18:12:38 |
|---|
| This is a dedicated fibe link - there is no shared IP range. Is there a way someone could spoof that IP to attack us? |
| Posted by: sirclesadmin - 06 August 2025 18:13:02 |
|---|
|
Yes - absolutely. What Spamhaus is describing could be the result of IP spoofing or abuse via a proxy network, and it would look, from their side, exactly as if your IP made the connection - even if no packet ever left your network. How someone could make it look like your IP is sending spam1. IP Spoofing on TCP is hard, but not impossible
2. Proxy Botnets
3. BGP Hijacking / Route Leaks
4. Upstream Compromise
How to check if this is spoofing / upstream abuse
If you want, I can give you a test method to confirm whether someone can spoof your IP right now, which involves sending crafted packets from outside and seeing if they arrive "from you" at a test SMTP listener. That would let us rule in or out live IP spoofing as the cause. Do you want me to prepare that test plan? |