Skip to main content

Is this xmlrpc brute force amplification attack?

Comments

27 comments

  • quizknows
    This should be addressed in the WP core in the next update: #34336 (Disable XML-RPC system.multicall authenticated requests on the first auth failure) " WordPress Trac In the mean time I have written some modsec rules but they might break some things like jetpack. Although I have tried to avoid this breaking any legitimate code or plugins, I offer no guarantee. As far as I can tell jetpack and other plugins very rarely use the multicall feature so these are probably safe but I have only used them on personal servers and not my customers servers. The first rule basically disables "system.multicall" entirely for properly formatted requests. The 2nd rule disables system.multicall for malformed requests that contain the two most commonly abused functions.
    #would work for posts with the proper content type specified but may break legit apps :/ SecRule REQUEST_HEADERS:Content-Type "^text/xml$" "phase:1,t:lowercase,nolog,pass,ctl:requestBodyProcessor=XML,id:3997" SecRule REQBODY_PROCESSOR "!^XML$" "nolog,pass,skip:1,id:3998" SecRule REQUEST_URI "xmlrpc.php" "t:lowercase,id:3999,deny,status:500,chain" SecRule XML:/methodCall/methodName/text() system.multicall #testing this because some POSTs are coming in as "application/x-www-form-urlencoded" not "text/XML" SecRule REQUEST_URI "xmlrpc.php" "deny,id:4000,chain" SecRule REQUEST_BODY "system.multicall" "chain" SecRule REQUEST_BODY "wp\.(getCategories|getUsersBlogs)"
    I recommend only using these where you are actually being attacked, and then removing them after the next WP core updates are installed on the majority of your users sites. If you do test them on servers with many sites I would be interested in receiving your feedback regarding if you get any complaints or false positives.
    0
  • garconcn
    This should be addressed in the WP core in the next update: #34336 (Disable XML-RPC system.multicall authenticated requests on the first auth failure) " WordPress Trac In the mean time I have written some modsec rules but they might break some things like jetpack. Although I have tried to avoid this breaking any legitimate code or plugins, I offer no guarantee. As far as I can tell jetpack and other plugins very rarely use the multicall feature so these are probably safe but I have only used them on personal servers and not my customers servers. The first rule basically disables "system.multicall" entirely for properly formatted requests. The 2nd rule disables system.multicall for malformed requests that contain the two most commonly abused functions.
    #would work for posts with the proper content type specified but may break legit apps :/ SecRule REQUEST_HEADERS:Content-Type "^text/xml$" "phase:1,t:lowercase,nolog,pass,ctl:requestBodyProcessor=XML,id:3997" SecRule REQBODY_PROCESSOR "!^XML$" "nolog,pass,skip:1,id:3998" SecRule REQUEST_URI "xmlrpc.php" "t:lowercase,id:3999,deny,status:500,chain" SecRule XML:/methodCall/methodName/text() system.multicall #testing this because some POSTs are coming in as "application/x-www-form-urlencoded" not "text/XML" SecRule REQUEST_URI "xmlrpc.php" "deny,id:4000,chain" SecRule REQUEST_BODY "system.multicall" "chain" SecRule REQUEST_BODY "wp\.(getCategories|getUsersBlogs)"
    I recommend only using these where you are actually being attacked, and then removing them after the next WP core updates are installed on the majority of your users sites. If you do test them on servers with many sites I would be interested in receiving your feedback regarding if you get any complaints or false positives.

    Thank you for this information. I will give it a try on my server and let you know if I have any result. :)
    0
  • quizknows
    Good deal. I know the rules work and have blocked attacks with both of them, but just curious if there are false positives on busier servers. Cheers.
    0
  • cPanelMichael
    Hello :) Thank you for taking the time to provide these Mod_Security rules as solution until the issue is addressed.
    0
  • popeye
    Hi could anyone please tell me how to block xmlrpc attack I use Free Modsecurity rules - Comodo Web Application Firewall but it does not stop them and the rule to stop them is enabled
    0
  • 24x7server
    Hello :), If you are getting this issues with only one site then you can add following code on your .htacces file to prevent this.
    Order Deny,Allow Deny from all
    0
  • popeye
    Hi no it's loads of sites.
    0
  • popeye
    Hi how long until the next Wordpress update does anyone know.
    0
  • cPanelMichael
    Hi how long until the next Wordpress update does anyone know.

    WordPress version 4.4 is available: Version 4.4 " WordPress Codex It includes the resolution for the bug referenced earlier in this thread: #34336 (Disable XML-RPC system.multicall authenticated requests on the first auth failure) " WordPress Trac Thank you.
    0
  • popeye
    Hi thanks so i need to make sure all customers upgrade to new 4.4 and is this built in or do they have to enable it please.
    0
  • popeye
    Hi i found out today that if you delete ip.pag file in var/tmp and restart web server it will create a new one and stop all attacks. This works with comodo mod security rules. My file was huge.
    0
  • quizknows
    Hi thanks so i need to make sure all customers upgrade to new 4.4 and is this built in or do they have to enable it please.

    In 4.4, in a multicall request if auth fails the subsequent calls in that request will be denied. This is in the code and is nothing that has to be manually enabled. Once upgraded to 4.4 the site is protected from multicall requests being able to try multiple auth attempts.
    0
  • gryzli
    The problem is that multicall requests are not the only trouble. In fact multicall request give the attacker better chance to guess your passwords with less number of requests and most of the times, these type of requests are not the ones breaking down your server. What is the real trouble is bruteforcing while using single request per user/password try, which is the case with the single xmlrpc.php calls like "wp.getUsersBlog" or "wp.getUsersCategories", because this way the attacker needs to issue much more requests to your servers (and they do that), which immediately leads to spike in your resource usage. In short, the bugfix of Worpress guys which is mentioned as: #34336 (Disable XML-RPC system.multicall authenticated requests on the first auth failure) " WordPress Trac
    , wont fix your xmlrpc.php ddos load spikes problems at all ! The effective protection to this attack is to try drop the request before they reach Wordpress, which could be done with ModSecurity. If you want to globally deny xmlrpc.php hits, you can do this with the following mod_Security rule:
    SecRule REQUEST_URI "@pm xmlrpc.php" "phase:1, id:22, deny, status:406, msg:'Blocked xmlrpc.php hit'"
    Consider the following: - If some software relies on xmlrpc.php it will stop working (JetPack wp plugin is one example) - The current rule id is "22", make sure you have no other rules with same id (or change it to a free one) - Every request to xmlrpc.php or xmlrpc.php containing url, will end up with error code 406
    0
  • quizknows
    The multicall requests cause significant load. WP uses a processing intensive hashing algorithm. Being able to check multiple passwords with one POST request causes that single request to make the server hash hundreds of passwords. This is by design because "hash cracking" will take longer should a database be leaked. You do not need to block xmlrpc entirely. This is an overly heavy solution and should only be used temporarily on sites under heavy attack (if at all). If you're going to use ModSecurity you can specifically block just the system.multicall requests, as well as "wp.getUsersBlog" or "wp.getUsersCategories" by doing post payload inspection. This allows things like Jetpack (which are extremely popular) to still function. You can also filter xmlrpc.php requests that are missing user agents or HTTP referers, which drops a significant portion of both multicall attacks and single calls from bogus bots. Some requests can also be caught because they contain mismatched or missing headers (such as containing a content-length header with no content-type specified). The goal of a good modsecurity rule should be to only block bad requests while still allowing software to function as intended. Rules that break legitimate features are one of the reasons customers so often demand modsecurity be disabled, causing them to forfeit their own protections.
    0
  • Infopro
    You do not need to block xmlrpc entirely. This is an overly heavy solution and should only be used temporarily on sites under heavy attack (if at all).

    For anyone unsure of what xmlrpc actually is: Should You Disable XML-RPC on WordPress? - Wordfence
    0
  • sparek-3
    But how many people actually use anything related to xmlrpc.php? I don't know about everyone else, but I'd factor a guess (conservatively) that 50% of the WordPress installs we have on our servers are single "install and never touch again" installations. At which point xmlrpc.php just becomes a venue that malicious users can easily exploit (or attempt to exploit) to hack into the installation and then do their bidding. There definitely are users that fully utilize everything regarding WordPress and xmlrpc.php, but I'm just not sure how many really are. My preferred method, for any model, is the principle of least privilege. Don't enable more privileges than are needed and if they are needed then those select users can enable them as needed.
    0
  • Infopro
    Agree, just adding context to the thread. ;)
    0
  • sparek-3
    Further to this fix for WordPress 4.4. Are they going to fix this for WordPress 4.3? 4.2? 4.1? 4.0? 3.9? 3.8? 3.7? See this is the problem with trying to support so many versions, like WordPress has tried to do. Up until 4.4, they were releasing new versions for 4.2, 4.1, etc. alongside 4.3 updates. And now that just suddenly stops?
    0
  • sparek-3
    I would probably recommend using some form of xmlrpc.php blocking (ModSecurity is probably a good one) by default and exempting those VirtualHosts that really need access to xmlrpc.php. This is why ModSecurity is probably a good avenue for doing this, because you can exempt certain ids per VirtualHost. My real recommendation would be for WordPress to do an xmlrpc disable by default on new installs. But since I don't see that happening, taking matters into your own hands might be the only solution.
    0
  • quizknows
    Least privilege is certainly a good security principle. It's much easier to enforce on small scale. I manage ModSecurity rules that are deployed to thousands of customers servers (and many of those may have hundreds of installations of wordpress each), so if I break anything for even 1% of people it's not a good day. If you just manage (for example) under 100 sites, you can probably get away with disabling it for a good percentage of them or even by default. Personally, I've had very good luck blocking the bulk of these attacks with more targeted modsec rules that inspect the aspects of the specific request to xmlrpc.php and reject the bogus ones, while leaving it functional for the people who use it.
    0
  • gryzli
    Hi quizknows,
    The multicall requests cause significant load. WP uses a processing intensive hashing algorithm. Being able to check multiple passwords with one POST request causes that single request to make the server hash hundreds of passwords. This is by design because "hash cracking" will take longer should a database be leaked.

    First of all, I want to make it clear, that I also stated, blocking whole xmlrpc.php would break software which uses it. But if you maintain just one site (or a several ones), and none of them uses the xmlrpc.php functionality, this could be handy solution. About the multicall requests, yes they cause load, but especially in my case, they were < 1% compared to the overall xmlrpc.php targeted traffic, which used wp.getUserBlogs and others like this.
    You do not need to block xmlrpc entirely. This is an overly heavy solution and should only be used temporarily on sites under heavy attack (if at all). If you're going to use ModSecurity you can specifically block just the system.multicall requests, as well as "wp.getUsersBlog" or "wp.getUsersCategories" by doing post payload inspection. This allows things like Jetpack (which are extremely popular) to still function. You can also filter xmlrpc.php requests that are missing user agents or HTTP referers, which drops a significant portion of both multicall attacks and single calls from bogus bots. Some requests can also be caught because they contain mismatched or missing headers (such as containing a content-length header with no content-type specified). The goal of a good modsecurity rule should be to only block bad requests while still allowing software to function as intended. Rules that break legitimate features are one of the reasons customers so often demand modsecurity be disabled, causing them to forfeit their own protections.

    If you are talking from the point of view of hosting provider, you are definitely right. Rules from protecting hosting company customers by these attacks are much more complex (I have also written such). But still, if you are sure your site doesn't use xmlrpc.php at all, I don't see any problems for blocking it entirely. Also, I don't think there is big difference between blocking whole xmlrpc.php access or just blocking wp.GetUsersBlog and wp.GetUsersCategories(I have cases in my mind, where it is even worse than blocking whole xmlrpc.php) . If you (or your software) uses xmlrpc.php there is big chance to also use system.multicall or getUsersBlog or ...whatever it is, also jetPack uses system.multicall too. And again, it strongly depends on user/client demands and usage. Cheers.
    0
  • quizknows
    Jetpack does use system.multicall but it seemed to be an extremely rarely used feature. I did not block that feature except on hosts where I was specifically requested to. Doing header analysis (user agent or lack there of, content type header, etc.) seems to be enough to block the majority of this. Of course, system.multicall is still a very small percentage of the xmlrpc.php attacks overall. I could probably parse out some data to get exact numbers, but the individual call requests are certainly much more prevalent. Also it has to be accounted for that a single multicall request can be the equivalent of several hundred (or even a thousand) individual calls, so the sheer number of POSTs using that method is quite misleading to us all. I also agree for a single user, if they know they're not using it, disabling xmlrpc.php is fine. Cheers mate.
    0
  • dotal
    Hi guys, Due to this xmlrpc attack issue, I've been trying to find a way to block the malicious xmlrpc attacks but still allow people who use jetpack to use it. I'm using the following code:
    ## Protect wordpress xmlrpc from attack Order Deny,Allow # Whitelist Jetpack/ Automattic CIDR IP Address Blocks Allow from 192.0.64.0/18 Allow from 209.15.0.0/16 Allow from 66.155.0.0/17 Deny from all
    But in the access logs I see the following:
    192.0.99.18 - - [21/Jan/2016:08:03:22 -0800] "POST /xmlrpc.php HTTP/1.0" 403 1097 "-" "The Incutio XML-RPC PHP Library" 192.0.81.13 - - [21/Jan/2016:08:08:21 -0800] "POST /xmlrpc.php?for=jetpack&token=z9T%25irLBEzDrJgcYG%5EFZOwR9%24%266SBdu3%3A1%3A1&timestamp=1453392490&nonce=YLdt2St1cK&body-hash=B1DQHoOeqzuFhFZSfMF2Cgh0Gpg%3D&signature=Dlh1unvh0TNSiWmzOE4XtjvhC3A%3D HTTP/1.0" 403 1097 "-" "Jetpack by WordPress.com" 192.0.81.13 - - [21/Jan/2016:08:08:24 -0800] "POST /xmlrpc.php HTTP/1.0" 403 1097 "-" "The Incutio XML-RPC PHP Library" 192.0.81.13 - - [21/Jan/2016:08:13:51 -0800] "POST /xmlrpc.php?for=jetpack&token=z9T%25irLBEzDrJgcYG%5EFZOwR9%24%266SBdu3%3A1%3A1&timestamp=1453392820&nonce=VVpHthM4e6&body-hash=B1DQHoOeqzuFhFZSfMF2Cgh0Gpg%3D&signature=xiqHOjOJ6fZ0ESY7CIbo1PAj%2FS0%3D HTTP/1.0" 403 1097 "-" "Jetpack by WordPress.com"
    Those ips 192.0.99.18 ect are in the subnet I have allowed, but they get 403 message in the logs. Does that mean Jetpack is not working? Thanks
    0
  • gryzli
    Try one of the following: 1. Change the Order statement to: "Order Allow,Deny" Or 2. Move the "Deny from all" at the beginning
    0
  • easyhoster1
    add this to the apache config, this works for us, and will allow jetpack Order Deny,Allow # Whitelist Jetpack/ Automattic CIDR IP Address Blocks Allow from 192.0.64.0/18 Allow from 209.15.0.0/16 Allow from 66.155.0.0/17 Deny from all
    0
  • quizknows
    Your "Order" is backwards. It should be Allow,Deny, or you should move your deny rule above your allow rules to follow the order you are specifying.
    0
  • dotal
    Thanks guys. I've made the change and its all good.
    0

Please sign in to leave a comment.