LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Security
User Name
Password
Linux - Security This forum is for all security related questions.
Questions, tips, system compromises, firewalls, etc. are all included here.

Notices


Reply
  Search this Thread
Old 01-29-2016, 08:01 PM   #1
v4lk3r
LQ Newbie
 
Registered: Jun 2015
Posts: 20

Rep: Reputation: Disabled
Thousands of IPs on server, ddos?


I have a ubuntu server with nginx. I am getting ddos on port 80. I ran the following command to see the current IPs:

netstat -ntu | awk '{print $5}' | cut -d: -f1 | sort | uniq -c | sort -n

It shows thousands of IPs are on server. My server is also down BTW. I do not know how to block such kind of attacks. Attached is the screenshot of the tcpdump. Please PM me if you want to have a look at the complete tcpdump.

http://158.69.217.25/ddos.jpg
 
Old 01-29-2016, 09:57 PM   #2
Habitual
LQ Veteran
 
Registered: Jan 2011
Location: Abingdon, VA
Distribution: Catalina
Posts: 9,374
Blog Entries: 37

Rep: Reputation: Disabled
All connecting to port 80?
 
Old 01-30-2016, 09:31 PM   #3
frankbell
LQ Guru
 
Registered: Jan 2006
Location: Virginia, USA
Distribution: Slackware, Ubuntu MATE, Mageia, and whatever VMs I happen to be playing with
Posts: 19,321
Blog Entries: 28

Rep: Reputation: 6141Reputation: 6141Reputation: 6141Reputation: 6141Reputation: 6141Reputation: 6141Reputation: 6141Reputation: 6141Reputation: 6141Reputation: 6141Reputation: 6141
I don't know whether or not this will help, but I offer it anyway. I did a short gig with a hosting service. It sometimes happened that a website on a shared hosting machine would get DDoS'd, which would bring down the entire server, as they all shared the ip address of the server.

The hosting service's strategy to "mitigate" (their term) the attack was to move the other websites off to a different server to get them out of the line of fire.

A web search for "mitigate ddos" will turn up lots of articles; perhaps you can find something there.
 
Old 01-31-2016, 05:51 AM   #4
Habitual
LQ Veteran
 
Registered: Jan 2011
Location: Abingdon, VA
Distribution: Catalina
Posts: 9,374
Blog Entries: 37

Rep: Reputation: Disabled
What does OVH say about it?
 
Old 01-31-2016, 07:29 PM   #5
v4lk3r
LQ Newbie
 
Registered: Jun 2015
Posts: 20

Original Poster
Rep: Reputation: Disabled
Hi all,
Thanks for you reply. I captured the packets and found it's a Wordpress pingback attack. There are thousands of IPs involved in the attack on only port 80. I used following rule to block this attack:

iptables -A INPUT -p tcp -m recent --update --seconds 600 --name PINGBACK --rsource -j DROP
iptables -A INPUT -p tcp -m tcp --dport 80 -m string --string "WordPress/" --algo kmp -m recent --set --name PINGBACK --rsource

This rule is from this site. It works all fine. However, the IPs keep coming back and my system tried to keep blocking the packets. I want to log the list of all these IPs which contain "WordPress" in the header. Is it possible to do it?
 
Old 01-31-2016, 09:01 PM   #6
frankbell
LQ Guru
 
Registered: Jan 2006
Location: Virginia, USA
Distribution: Slackware, Ubuntu MATE, Mageia, and whatever VMs I happen to be playing with
Posts: 19,321
Blog Entries: 28

Rep: Reputation: 6141Reputation: 6141Reputation: 6141Reputation: 6141Reputation: 6141Reputation: 6141Reputation: 6141Reputation: 6141Reputation: 6141Reputation: 6141Reputation: 6141
You should be able to use grep to extract the list of hits containing the string "WordPress" in them and save them to a file. For example

Code:
cat [somelog] | grep WordPress > [somefile]
"cat" reads the file, "grep Wordpress" extracts lines containing that string (note that it is case sensitive), and "> [somefile]" sends the output to a file of your choosing. You can then examine the file in a text editor.

See man pipe, man grep, and man pipe for more.
 
Old 01-31-2016, 09:46 PM   #7
v4lk3r
LQ Newbie
 
Registered: Jun 2015
Posts: 20

Original Poster
Rep: Reputation: Disabled
Thanks for the reply. I am aware of these commands. However, I couldn't find the log file where it is keeping the track of all this. Also I find out loads of following messages in dmesg:

net_ratelimit: 346 callbacks suppressed
nf_conntrack: table full, dropping packet
nf_conntrack: table full, dropping packet
nf_conntrack: table full, dropping packet
nf_conntrack: table full, dropping packet
nf_conntrack: table full, dropping packet
nf_conntrack: table full, dropping packet
nf_conntrack: table full, dropping packet
nf_conntrack: table full, dropping packet
nf_conntrack: table full, dropping packet
nf_conntrack: table full, dropping packet

Quote:
Originally Posted by frankbell View Post
You should be able to use grep to extract the list of hits containing the string "WordPress" in them and save them to a file. For example

Code:
cat [somelog] | grep WordPress > [somefile]
"cat" reads the file, "grep Wordpress" extracts lines containing that string (note that it is case sensitive), and "> [somefile]" sends the output to a file of your choosing. You can then examine the file in a text editor.

See man pipe, man grep, and man pipe for more.
 
Old 01-31-2016, 10:08 PM   #8
frankbell
LQ Guru
 
Registered: Jan 2006
Location: Virginia, USA
Distribution: Slackware, Ubuntu MATE, Mageia, and whatever VMs I happen to be playing with
Posts: 19,321
Blog Entries: 28

Rep: Reputation: 6141Reputation: 6141Reputation: 6141Reputation: 6141Reputation: 6141Reputation: 6141Reputation: 6141Reputation: 6141Reputation: 6141Reputation: 6141Reputation: 6141
I would guess that, as you are using nginx, they are somewhere in the nginx logs.

I've not used nginx, but I have used Apache, and Apache logs everything. I assume that nginx does the same, but I fear I cannot suggest where you should look.
 
Old 02-01-2016, 05:35 AM   #9
Habitual
LQ Veteran
 
Registered: Jan 2011
Location: Abingdon, VA
Distribution: Catalina
Posts: 9,374
Blog Entries: 37

Rep: Reputation: Disabled
Quote:
Originally Posted by frankbell View Post
I cannot suggest where you should look.
/var/log/nginx/{error,access}.log, of course
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
why does the ios mail client make thousands of connections to my IMAP server a day? psycroptic Linux - Server 1 02-18-2014 03:15 AM
I want to look my ddos attack to server? DeSouffle Linux - Networking 2 10-20-2013 03:20 AM
SYN_RECV, IPTABLES, Drop DDOS Flood IPs does not work! eurusd Linux - Server 2 09-02-2009 11:40 PM
cURL: Server has many IPs, how would I make a cURL script use those IPs to send data? guest Programming 0 04-11-2009 11:42 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Security

All times are GMT -5. The time now is 09:51 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration