I have a PBX (VOIP server) where phones connect in order to make phone calls. The pbx I am using is Asterisk. That server is not being used and it's only purpose is to analyze attacks.
The PBX service is not important if I wuold have a different service such as a mongodb I am sure bots on the internet will search for vulnerabilities to attack that database.
Anyways I am analysing all the packets that arive to my server on UDP port 5060 (that is where asterisk listens) and the packets that arive look like this:
IP (tos 0x0, ttl 113, id 654, offset 0, flags [none], proto UDP (17), length 521)
43.249.129.89.58255 > 171.21.78.225.5060: SIP, length: 493
REGISTER sip:54.84.215.2:5060 SIP/2.0
To: <sip:[email protected]>
From: <sip:[email protected]>;tag=824e5f4a7221279e4f7a
Via: SIP/2.0/UDP 10.4.1.117:58255;branch=z9hG4bK183d5a24-59ec-4f05-8325-747389112824;rport
Call-ID: e5f4a722128024e4f7a824
CSeq: 1 REGISTER
Contact: <sip:[email protected]:58255>
Expires: 3600
Max-Forwards: 70
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, NOTIFY, MESSAGE, SUBSCRIBE, INFO
User-Agent: PolycomSoundPointIP SPIP_550 UA 3.3.2.0413
Content-Length: 0
That packet is from a bot because I am NOT sending any packets to my server.
Note that the only purpose of that server is to understand how bots
work and see how they attack my server. I am not using that PBX; therefore,
any request that comes to that server must come from a malicious bot.
Every time I get an UDP packet sent to port 5060 I block that IP address.
Now my question is:
I been running that server for one month and every minute or so I still get attacks. I have blocked over 15,000 IPs! How many bots are there on the internet? Are they changing their source ip address and that is the reason why they keep reaching my server? If they are able to change their source IP is it because I am using UDP protocol? Should I use TCP instead of UDP to resolve this?
Also its funny how the attacks from different ips are so similar. For example they use the same user agent as phone and the attack comes from different ips. It is as if all the bots have the same code.
Once I resolve this problem and understand how bots work I would like to implement that solution on my real server. I am not using the real server for this because filtering the good packets from bad packets will be hard. A solution would be to use a white list of ips on my firewall but I do not want my users to have to do some extra form of authentication specially if they use the service from their mobile phone where its ip address can change a lot.