Tucson Managed, IT Services, Computer Repair Company

What steps should I take to defend against DDoS attacks?

Pelstar Computer systems Cybersecurity Team in Tucson has been detecting and mitigating these DDoS attacks for our Managed Cybersecurity Customers.

As a precaution, we recommend taking advantage of these capabilities to improve and optimize your security posture:

DDOS is a family of attacks which overwhelm key systems in the datacenter including:

Before you start on building your DDOS defence, consider what the worst-case value-at-risk is. For a non-critical, free-to-use service for a small community, the total value at risk might be peanuts. For a paid-for, public-facing, mission-critical system for an established multi-billion dollar business, the value might be the worth of the company.

In order to defend against a DDOS attack on your webserver, you need a defence in-depth approach:

  1. Work with your hosting center to understand the services they offer, including IP and port filtering at their network connections to the internet and firewall services they offer. This is critical: Many sites are pulled from the internet by the hosting company as the hosting company deals with the data center-wide disruption caused by the DDOS to one customer. Also, during an DDOS attack, you will be working very closely with the hosting center’s staff, so know their emergency numbers and be on good terms with them 🙂 They should be able to block of whole international regions, completely block specific services or network protocols and other broad-spectrum defensive measures, or alternatively allow only whitelisted IPs (depending on your business model)
  2. While on the hosting center – use a Content Delivery Network to distribute (mainly static) services close to your end users and hide your real servers from the DDOS architects. The full CDN is too big for a DDOS to take out all nodes in all countries; if the DDOS is focused on one country, at least other users are still OK.
  3. Keep all your systems and software packages updated with the latest security patches – and I mean all of them:
    • Managed switches – yup these sometimes need updating
    • Routers
    • Firewalls
    • Load balancers
    • Operating systems
    • Web servers
    • Languages and their libraries
  4. Ensure that you have a good firewall or security appliance set up and regularly reviewed by a qualified security expert. Strong rules on the firewall are a good defence against many simple attacks. It’s also useful to be able to manage bandwidth available for each open service.
  5. Have good network monitoring tools in place – this can help you understand:
    • That you’re under attack rather than simply being under heavy load
    • Where the attack is coming from (which may include countries you don’t normally do business with) and
    • What the attack actually is (ports, services, protocols, IPs and packet contents)
  6. The attack might simply be heavy use of legitimate web site services (eg hitting ‘legal’ URIs running queries or inserting/updating/deleting data) – thousands or millions of requests coming from tens to millions of different IP addresses will bring a site to its knees. Alternatively, some services might be so expensive to run that only a few requests cause a DOS – think a really expensive report. So you need good application level monitoring of what is going on:
    • Which services have been invoked and what arguments/data are sent (i.e. logging in your application)
    • Which users are doing the invoking and from which IPs (i.e. logging in your application)
    • What queries and inserts/updates/deletes the DB is performing
    • Load average, CPU utilization, disk i/o, network traffic on all computers (and VMs) in your system
    • Making sure that all this information is easily retrievable and that you can correlate logs from different computers and services (i.e. ensure all computers are time synchronized using ntp).
  7. Sensible constraints and limits in your application. For example, you might:
    • Use a QoS feature in the load balancer to send all anonymous sessions to separate application servers in your cluster, while logged-on users use another set. This prevents an application-level anonymous DDOS taking out valuable customers
    • Using a strong CAPCHA to protect anonymous services
    • Session timeouts
    • Have a session-limit or rate-limit on certain types of request like reports. Ensure that you can turn off anonymous access if necessary
    • Ensure that a user has a limit to the number of concurrent sessions (to prevent a hacked account logging on a million times)
    • Have different database application users for different services (eg transactional use vs. reporting use) and use database resource management to prevent one type of web request from overwhelming all others
    • If possible make these constraints dynamic, or at least configurable. This way, while you are under attack, you can set aggressive temporary limits in place (‘throttling’ the attack), such as only one session per user, and no anonymous access. This is certainly not great for your customers, but a lot better than having no service at all.
  8. Last, but not least, write a DOS Response Plan document and get this internally reviewed by all relevant parties: Business, Management, the SW dev team, the IT team and a security expert. The process of writing the document will cause you and your team to think through the issues and help you to be prepared if the worst should happen at 3am on your day off. The document should cover (among other things):
    • What is at risk, and the cost to the business
    • Measures taken to protect the assets
    • How an attack is detected
    • The planned response and escalation procedure
    • Processes to keep the system and this document up-to-date

So, preamble aside, here are some specific answers:

DDOS are generally blocked on a server level, right?

Not really – most of the worst DDOS attacks are low-level (at the IP packet level) and are handled by routing rules, firewalls, and security devices developed to handle DDOS attacks.

Is there a way to block it on a PHP level, or at least reduce it?

Some DDOS attacks are aimed at the application itself, sending valid URIs and HTTP requests. When the rate of requests goes up, your server(s) begin to struggle and you will have an SLA outage. In this case, there are things you can do at the PHP level:

Preparing for the next DDoS wave

Defending against DDoS attacks is critical for organizations of all sizes. While attacks may be initiated by humans, they are executed by bots, and to play to win, you must fight bots with bots. Detection and mitigation must be automated as much as possible, because relying solely on humans to mitigate in real time puts defenders at a disadvantage. Cloudflare’s automated systems constantly detect and mitigate DDoS attacks for our customers, so they don’t have to. This automated approach, combined with our wide breadth of security capabilities, lets customers tailor the protection to their needs.

Why DDoS attacks?

Over the years, it has become easier, cheaper, and more accessible for attackers and attackers-for-hire to launch DDoS attacks. But as easy as it has become for the attackers, we want to make sure that it is even easier – and free – for defenders of organizations of all sizes to protect themselves against DDoS attacks of all types.

Unlike Ransomware attacks, Ransom DDoS attacks don’t require an actual system intrusion or a foothold within the targeted network. Usually Ransomware attacks start once an employee naively clicks an email link that installs and propagates the malware. There’s no need for that with DDoS attacks. They are more like a hit-and-run attack. All a DDoS attacker needs to know is the website’s address and/or IP address.

Is there an increase in DDoS attacks?

Yes. The size, sophistication, and frequency of attacks has been increasing over the past months. In our latest DDoS threat report, we saw that the amount of HTTP DDoS attacks increased by 79% year-over-year.

What if I am on a LAMP stack?

DDoS are generally blocked on a server level, Please enable DDoS protection in your Server Level.

Please check the below notes for DDoS protections:

Apache HTTP Server configuration settings that can help prevent DDoS problems:

The RequestReadTimeout directive allows to limit the time a client may take to send the request.

Allow 10 seconds to receive the request including the headers and 30 seconds for receiving the request body:

RequestReadTimeout header=10 body=30

Allow at least 10 seconds to receive the request body. If the client sends data, increase the timeout by 1 second for every 1000 bytes received, with no upper limit for the timeout (except for the limit given indirectly by LimitRequestBody):

RequestReadTimeout body=10,MinRate=1000

RequestReadTimeout header=10-30,MinRate=500
RequestReadTimeout header=20-40,MinRate=500 body=20,MinRate=500

The KeepAliveTimeout directive may be also lowered on sites that are subject to DoS attacks.

Some sites even turn off the keepalives completely via KeepAlive, which has of course other drawbacks on performance. The values of various timeout-related directives provided by other modules should be checked.

The directives LimitRequestBody, LimitRequestFields, LimitRequestFieldSize, LimitRequestLine, and LimitXMLRequestBody should be carefully configured to limit resource consumption triggered by client input. Tune the MaxRequestWorkers directive to allow the server to handle the maximum number of simultaneous connections without running out of resources.

 

Exit mobile version