Skip to main content

CPANEL-42825 - Ratelimit incoming mail to non-existent accounts

Comments

27 comments

  • SimpleTechGuy
    I'm now getting so much spam that the message below is popping up on my Mail Delivery Report for a 24 hour lookup: Right now I have over 5,000 failures on my server in just 12 hours. I really hope someone has a solution to this. thanks, This query produced a result set that exceeds the reportable limit. If you cannot find what you are looking for by paging through these results, please restrict the query further by narrowing your search.
    0
  • SimpleSonic
    In your Exim Configuration Manager, just make sure the following are enabled:
    • Dictionary attack protection
    • Ratelimit suspicious SMTP servers
    • Ratelimit incoming connections with only failed recipients
    They should be enabled by default, if not you may want to enable them.
    0
  • cPRex Jurassic Moderator
    What @ResellerWiz said above. Can you confirm those are enabled?
    0
  • SimpleTechGuy
    Hi @cPRex, all of the settings mentioned are currently set to "on". I noticed that I was seeing this log several times at one point (generally after 100 connections from the same ip): message = "Number of failed recipients exceeded. Come back in a few hours."
    I was able to find that message in the Advanced config in the Dictionary Attack Protection, but I haven't been about to figure out how it works yet. I'm using the default config below: warn log_message = "Detected Dictionary Attack (Let $rcpt_fail_count bad recipients though before eng aging)" condition = ${if > {${eval:$rcpt_fail_count}}{4}{yes}{no}} set acl_m7 = 1 warn condition = ${if eq {${acl_m7}}{1}{1}{0}} ratelimit = 0 / 1h / strict / per_conn log_message = "Increment Connection Ratelimit - $sender_fullhost because of Dictionary Attack" drop condition = ${if eq {${acl_m7}}{1}{1}{0}} message = "Number of failed recipients exceeded. Come back in a few hours."
    -- I'm still trying to figure out how the ratelimit formula works: ratelimit = 0 / 1h / strict / per_conn
    0
  • cPRex Jurassic Moderator
    Exim averages the ratelimits over time. However, the default values on a system are these: ratelimit = 1.2 / 1h / strict / per_conn / noupdate so it appears yours may have been altered. I'd put back the defaults, but then bump the "1h" to something more aggressive like '8h' so it keeps blocking the connection for at least 8 hours.
    0
  • SimpleTechGuy
    So for my default ratelimit in ratelimit (Ratelimit suspicious SMTP servers)
    it is already set to what you posted ratelimit = 1.2 / 1h / strict / per_conn / noupdate
    But for the dictionary_attack (Dictionary attack protection)
    it is set to ratelimit = 0 / 1h / strict / per_conn
    Can you confirm the default ratelimit in the dictionary_attack (Dictionary attack protection)
    section in Advanced Config? Also, and either way, that would only change the time of the ratelimit right? And that's great, but they seem to have an infinate number of IP addresses, so I'm really hoping to find a way to limit each ip from sending more than 3 or 4 emails before the ratelimit kicks in and blocks them.
    0
  • SimpleTechGuy
    My current status:
    0
  • cPRex Jurassic Moderator
    Ah yes, the specific section under the dictionary attack is different, and that is normal. I'd recommend bumping the hour value to 8 under the dictionary section then as well and see if that helps to calm things down.
    0
  • SimpleTechGuy
    So I think the problem now is that the emails are not getting rate limited at all. I haven't seen any log messages that indicate ratelimiting. It's almost as if it's not working at all. The crazy thing is that all this started after the migration. I really think something happened during the migration that's causing the issue. I've got a ticket in now, will report back what I find.
    0
  • SimpleSonic
    So I think the problem now is that the emails are not getting rate limited at all. I haven't seen any log messages that indicate ratelimiting. It's almost as if it's not working at all. The crazy thing is that all this started after the migration. I really think something happened during the migration that's causing the issue. I've got a ticket in now, will report back what I find.

    That is weird that it only started after migrating. During the migration did you choose to copy the Exim config from the source server? If so, maybe Exim has some inconsistencies? Either way, I"m interested to see what the support team finds.
    0
  • SimpleTechGuy
    Yes sir, it was a full migration, I selected to migrate everything, but and although there were some error messages with cphulk and a few of the individual accounts, I don't remember seeing anything related to exim. I also ran the "
    0
  • cPRex Jurassic Moderator
    It sounds like it might be time to make a ticket on this issue.
    0
  • SimpleTechGuy
    Made one yesterday, still waiting on someone to pick it up.
    0
  • cPRex Jurassic Moderator
    Can you post the number here so I can follow along?
    0
  • SimpleTechGuy
    #95064510
    0
  • cPRex Jurassic Moderator
    Thanks for that - I'm following along with that now.
    0
  • SimpleTechGuy
    Turns out this is a known issue (see below). I'm not sure, but the Internal Case ID looks pretty old.... [QUOTE]After further review, I have found that your server is currently facing a known issue with the Dictionary Attack protection at this time with case ID CPANEL-42825. When the "Default Address" is set to the option to "Fail" a message to a user that does not exist, it creates the following Alias to process this: [-redacted- ~]cPs# cat /etc/valiases/-redacted-.com *: :fail: No such person at this address. At this time, the "Fail" Alias is being processed earlier in the mail process than the Dictionary Attack Protection implementation, Spam Filters, RBL checks, and other protections. Unfortunately, this is allowing Dictionary Attacks to be performed on the server as these protections will not trigger. Instead, the server simply responds with your "Fail" message and continues. Eventually, the attackers are hitting a real email address; as such, the Alias is not processed and the Dictionary Attack Protection is triggered. This then sees the previous attempts, and is why you are seeing "delayed" counts
    Wondering if anyone knows why valiases are still being used since the
    Which really isn't a solution because trusted clients would not be notified in the event of a misspelled email. I was able to verify this prior to creating the ticket by setting the accounts Default Address to blackhole [Discard (Not Recommended)] and the spam was stopped by RBLs, but blackhole really isn't an option for me. Forwarding isn't an option either as a legitimate sender would never be notified of a fail delivery. So it's looking like the only other solution is to just deal with the spam and hope it quits or find some kind of 3rd party email filter. This is honestly a bit frustrating. I've never experimented with the "pipe to a program" option. Maybe it's possible to pipe those messages back to exim, or maybe pipe to some type of 3rd party mail filter that would check for an active user and if not found then send the 550 error? At the end of the day it seems like it should be an easy thing to move the processing of the valias to some point after the ratelimiting checks... But I don't know....
    0
  • SimpleTechGuy
    It turns out the internal case ID CPANEL-42825
    is a fairly new case after all and is expected to be fixed, although not sure when. in the meantime I have an idea for a temporary solution. In exim Advanced config, the option smtp_accept_max
    is set by default to 100. This allows maximum 100 connections to smtp and is effectively limiting the attacks to 100, however, I don't want to edit this as it would likely cause issues with legit mail, so I found this smtp_accept_max_per_host
    which as the following definition from exim: [QUOTE]This option restricts the number of simultaneous IP connections from a single host (strictly, from a single IP address) to the Exim daemon. The option is expanded, to enable different limits to be applied to different hosts by reference to $sender_host_address. Once the limit is reached, additional connection attempts from the same host are rejected with error code 421. This is entirely independent of smtp_accept_reserve. The option"s default value of zero imposes no limit. If this option is set greater than zero, it is required that smtp_accept_max be non-zero. Warning: When setting this option you should not use any expansion constructions that take an appreciable amount of time. The expansion and test happen in the main daemon loop, in order to reject additional connections without forking additional processes (otherwise a denial-of-service attack could cause a vast number or processes to be created). While the daemon is doing this processing, it cannot accept any other incoming connections.
    What concerns me is the "Warning". Does anyone know what expansion constructions are?
    0
  • SimpleTechGuy
    Found this definition of "
    0
  • cPRex Jurassic Moderator
    Thanks for posting! I'm following along with the case now and I'll be sure to post an update once I have one.
    0
  • SimpleTechGuy
    Thank you @cPRex. So I set the smtp_accept_max_per_host
    to '20' but it didn't work. Also tried the smtp_accept_max
    to 20 but that didn't work either. It seems like absolutely nothing from Exim is working against dictionary attacks. This is crazy. Still getting exactly 100 messages on each attack, and something is obviously blocking or limiting them to 100, but I don't understand what it is. The only thing I can imagine is that the attacker is only sending 100 at a time, but that really defeats the purpose of sending a dictionary attack.
    0
  • JoseDieguez
    we are having this issue since some days ago.. this has never happened, and we haven't made any change. but since some days, we are seeing 400k to 1million -remote- mail on every server. and it's exactly the same as this thread.
    0
  • cPRex Jurassic Moderator
    @JoseDieguez - thanks for the feedback - I've added that to the case.
    0
  • Rackmarkt
    Same issue here.. lot of connections and trying to send to dictionary emails.. Any news about the fix? Any way to mitigate?
    0
  • cPRex Jurassic Moderator
    Since it's still so new, I don't see that there has been any action on the case just yet.
    0
  • SimpleTechGuy
    @Rackmarkt, I switched all my email accounts to :blackhole and although not ideal, it's been working. Just crossing my fingers and hoping nobody misspells any of our email addresses!
    0
  • coolcom
    Hello, I just filed a similar post and see now that you are experiencing the same issue I am with my hosting servers. No doubt someone has found a new use for AI. Mail sends are from a non-existant address to 100 random addresses at a hosted domain... using corrputed mail servers around the globe... then the next domain, and so on. Our sender verification and a few country code bans keeps all of them out of client boxes, but I'd sure like to take that load off the servers... as they still have to process them. I've also been informed by cPanel that the case is being worked on... to see why the Dictionary setting is not restricting them to 4 per domain. I'm experimenting with allowing "no such user" email to go to the admin account to see if that allows the Dictionary setting to work, but with Sender verification enabled, maybe that setting trumps the dictionary one. I believe the "smtp_max_per_host" setting and the other just limit how many emails can be in the Cc and Bcc fields.... I tried that too.
    0

Please sign in to leave a comment.