У компании Juniper есть замечательный ряд фаерволов SRX которая разделяется на for the Branch и for the Datacenters. Линейка для Branch включает в себя софтварные модели SRX100, SRX110, SRX210, SRX220, SRX240, SRX550, SRX650 а для датацентров аппаратные SRX1400, SRX3400, SRX3600, SRX5600. Понятно что аппаратный фаервол лучше софварного за счет ASIC’ов которые позволяют выполнять функции зациты сети без падения производительности устройства.
Оказалось что софтварная линейка имеет уязвимость перед атакой SYN FLOOD, при потоке SYN пакетов > 10Kpps загрузка CPU вырастает до максимума, а сам SRX перестает маршрутизировать трафик. Это было проверено на SRX240 и SRX650. Причем заявленная производительность SX240H 1,5Gbps а максимальное количество сессий 64K.
Итак, на сети установлен Juniper SRX240H со следующими адресами:
WAN: X.X.70.22/30
LAN: X.X.70.97/27
В LAN сети находится вебсервер с адресом X.X.70.98
На SRX настроен screen, а доступ к серверу описывается политиками (secure policy) между внешней и внутренней зонами. Screen применен к внешней зоне. С какого-то сервера из внешней сети запускаем досатаку на наш вебсервер, трафик проходит через SRX.
Этап 1.
hping3 -S --rand-source --flood X.X.70.98 -p 80
Данная команда эмулирует SYN флуд с поддельными адресами в заголовках source генерируемые рандомно, скорость порядка 50 000 запросов в секунду (20mbps).
SRX240H распознает атаку. К серверу данный траффик не пропускается, все работает корректно, загрузка процессора Juniper при этом около 60%
Этап 2.
hping3 -S --flood X.X.70.98 -p 80
При данной атаке генирируется SYN флуд но уже с реальным IP со скоростью порядка 50к запросов в секунду. SRX240H распознает данную атаку, на сервер данный траффик не пропускается но при этом загрузка процессора Juniper 99-100 % и сам Juniper ложится и с большими затруднениями отрабатывает запросы, сервер при этом практически недоступен.
Этап 3.
hping3 -S --flood 95.163.70.98 -p 81
Такая же атака но на порт не открытый в контексте (policy), загрузка опять 99-100%, Джунипер ложится.
Если доступ к серверу регулировать c помощью фильтра фаервола (firewall), и повторить эту же атаку за закрыты 81 порт, то загрузка процессора 25-30%, все работает корректно и не лагает.
При этих всех атаках колличество сессий не увеличивается
FPC 0
PIC 0
CPU utilization : 100 %
Memory utilization : 68 %
Current flow session : 37
Max flow session : 131072
root@SRX240> show version
Hostname: SRX240
Model: srx240h
JUNOS Software Release [11.4R6.6]
Конфигурация SRX :
version 11.2R4.3;
system {
host-name SRX240;
domain-name gw.test.net;
domain-search test.net;
time-zone Europe/Moscow;
root-authentication {
encrypted-password «$1$p.f8J/jo$UgJ1XYdN2VXxyGB.»; ## SECRET-DATA
}
name-server {
8.8.8.8;
8.8.4.4;
}
services {
ssh;
telnet;
xnm-clear-text;
web-management {
management-url admin;
http {
interface [ vlan.0 ge-0/0/0.0 ];
}
https {
system-generated-certificate;
interface [ vlan.0 ge-0/0/0.0 ];
}
}
}
syslog {
archive size 100k files 3;
user * {
any emergency;
}
file messages {
any critical;
authorization info;
}
file interactive-commands {
interactive-commands error;
}
}
license {
autoupdate {
url https://ae1.juniper.net/junos/key_retrieval;
}
}
}
interfaces {
interface-range interfaces-trust {
member-range ge-0/0/1 to ge-0/0/12;
unit 0 {
family ethernet-switching {
vlan {
members vlan-trust;
}
}
}
}
ge-0/0/0 {
description «— to uplink»;
speed 1g;
link-mode full-duplex;
unit 0 {
family inet {
address X.X.70.22/30;
}
}
}
ge-0/0/1 {
description «— to sr01.test.net»;
speed 1g;
link-mode full-duplex;
}
ge-0/0/2 {
description «— to sr02.test.net»;
speed 1g;
link-mode full-duplex;
}
ge-0/0/3 {
description «— to sr03.test.net»;
}
ge-0/0/4 {
description «— to sr04.test.net»;
}
ge-0/0/5 {
description «— to sr05.test.net»;
}
ge-0/0/6 {
description «— to sr06.test.net»;
}
ge-0/0/13 {
unit 0 {
family ethernet-switching;
}
}
ge-0/0/14 {
unit 0 {
family ethernet-switching;
}
}
ge-0/0/15 {
unit 0 {
family ethernet-switching;
}
}
lo0 {
unit 0 {
family inet {
filter {
input protect-re;
}
address 10.255.255.1/32;
}
}
}
vlan {
unit 0 {
description » — to LAN-1″;
family inet {
address 192.168.1.222/24;
address X.X.70.97/27;
}
}
}
}
routing-options {
static {
/* Mikhail Server for emergancy access */
route 2.2.2.20/32 next-hop X.X.70.21;
route 2.2.2.19/32 next-hop 1.1.1.185;
route 0.0.0.0/0 next-hop X.X.70.21;
}
}
protocols {
stp;
}
policy-options {
prefix-list manage-ip {
1.1.1.186/32;
1.1.5.30/32;
X.X.70.96/27;
2.2.2.19/32;
2.2.2.20/32;
}
}
security {
ike {
proposal VPN-Clients {
description VPN-Clients;
authentication-method pre-shared-keys;
dh-group group2;
authentication-algorithm sha1;
encryption-algorithm aes-128-cbc;
lifetime-seconds 28800;
}
policy VPN-Clients {
mode aggressive;
description VPN-Clients;
proposals VPN-Clients;
pre-shared-key ascii-text «$9$CmbIuORKvL7NbuO7Vs4DjfTzF6Au0ISyKBILN»; ## SECRET-DATA
}
gateway VPN-Clients {
ike-policy VPN-Clients;
dynamic {
hostname vpn.test;
connections-limit 10;
ike-user-type shared-ike-id;
}
external-interface ge-0/0/0.0;
xauth access-profile VPN-Clients;
}
}
ipsec {
proposal VPN-Clients {
description VPN-Clients;
protocol esp;
authentication-algorithm hmac-sha1-96;
encryption-algorithm 3des-cbc;
lifetime-seconds 3600;
}
policy VPN-Clients {
description VPN-Clients;
perfect-forward-secrecy {
keys group2;
}
proposals VPN-Clients;
}
vpn VPN-Users {
ike {
gateway VPN-Clients;
idle-time 3600;
ipsec-policy VPN-Clients;
}
}
}
dynamic-vpn {
access-profile VPN-Clients;
clients {
VPN-test-users {
remote-protected-resources {
X.X.70.96/27;
}
remote-exceptions {
0.0.0.0/0;
}
ipsec-vpn VPN-Users;
user {
admin;
}
}
}
}
screen {
ids-option default-screen {
icmp {
fragment;
large;
ping-death;
}
ip {
spoofing;
source-route-option;
unknown-protocol;
block-frag;
tear-drop;
}
tcp {
syn-fin;
fin-no-ack;
tcp-no-flag;
syn-frag;
syn-flood {
alarm-threshold 1024;
attack-threshold 200;
source-threshold 1024;
destination-threshold 2048;
timeout 20;
}
land;
winnuke;
}
}
ids-option untrusted-screen {
icmp {
ip-sweep threshold 1000;
fragment;
large;
flood threshold 100;
ping-death;
}
ip {
bad-option;
record-route-option;
timestamp-option;
security-option;
stream-option;
spoofing;
loose-source-route-option;
unknown-protocol;
block-frag;
tear-drop;
}
tcp {
syn-fin;
fin-no-ack;
tcp-no-flag;
syn-frag;
port-scan threshold 1000;
syn-ack-ack-proxy threshold 256;
syn-flood {
alarm-threshold 150;
attack-threshold 100;
source-threshold 100;
destination-threshold 100;
timeout 1;
}
land;
winnuke;
}
udp {
flood threshold 100;
}
limit-session {
source-ip-based 30;
destination-ip-based 70;
}
}
traceoptions {
file screen.log size 50000 world-readable;
flag all;
}
}
policies {
from-zone PUB-LAN1 to-zone UNTRUST {
policy permit_all {
match {
source-address any;
destination-address any;
application any;
}
then {
permit;
}
}
}
from-zone UNTRUST to-zone PUB-LAN1 {
policy WEB {
match {
source-address any;
destination-address [ 98.sr01.test.net 99.sr01.test.net ];
application [ junos-http tcp-8888 ];
}
then {
permit;
}
}
policy MAIL {
match {
source-address any;
destination-address [ 98.sr01.test.net 99.sr01.test.net ];
application [ junos-smtp junos-pop3 ];
}
then {
permit;
}
}
policy SSH {
match {
source-address any;
destination-address [ 98.sr01.test.net 99.sr01.test.net ];
application tcp-5117;
}
then {
permit;
}
}
policy FTP {
match {
source-address any;
destination-address [ 98.sr01.test.net 99.sr01.test.net ];
application ftp-passive;
}
then {
permit;
}
}
policy DNS {
match {
source-address any;
destination-address [ 100.sr01.test.net 101.sr01.test.net ];
application [ junos-dns-tcp junos-dns-udp ];
}
then {
permit;
}
}
policy MySQL-SR02 {
match {
source-address any;
destination-address 103.sr02.test.net;
application tcp-3306;
}
then {
permit;
}
}
policy SSH-SR02 {
match {
source-address any;
destination-address sr02.test.net;
application tcp-5117;
}
then {
permit;
}
}
policy GS104-SR02 {
match {
source-address any;
destination-address 104.sr02.test.net;
application gs-guard104;
}
then {
permit;
}
}
policy GS106-SR02 {
match {
source-address any;
destination-address 106.sr02.test.net;
application gs-guard106;
}
then {
permit;
}
}
policy GS107-SR02 {
match {
source-address any;
destination-address 107.sr02.test.net;
application gs-guard107;
}
then {
permit;
}
}
policy WEBDMIN {
match {
source-address dep;
destination-address 98.sr01.test.net;
application tcp-10000;
}
then {
permit;
}
}
policy VPN-access {
match {
source-address any;
destination-address sr01.test.net;
application any;
}
then {
permit {
tunnel {
ipsec-vpn VPN-Users;
}
}
}
}
}
}
zones {
security-zone PUB-LAN1 {
address-book {
address 98.sr01.test.net X.X.70.98/32;
address 99.sr01.test.net X.X.70.99/32;
address 100.sr01.test.net X.X.70.100/32;
address 101.sr01.test.net X.X.70.101/32;
address 102.sr01.test.net X.X.70.102/32;
address 103.sr02.test.net X.X.70.103/32;
address 104.sr02.test.net X.X.70.104/32;
address 105.sr02.test.net X.X.70.105/32;
address 106.sr02.test.net X.X.70.106/32;
address 107.sr02.test.net X.X.70.107/32;
address 108.sr03.test.net X.X.70.108/32;
address 109.sr03.test.net X.X.70.109/32;
address 110.sr03.test.net X.X.70.110/32;
address 111.sr03.test.net X.X.70.111/32;
address 112.sr03.test.net X.X.70.112/32;
address-set sr01.test.net {
address 98.sr01.test.net;
address 99.sr01.test.net;
address 100.sr01.test.net;
address 101.sr01.test.net;
address 102.sr01.test.net;
}
address-set sr02.test.net {
address 103.sr02.test.net;
address 104.sr02.test.net;
address 105.sr02.test.net;
address 106.sr02.test.net;
address 107.sr02.test.net;
}
address-set sr03.test.net {
address 108.sr03.test.net;
address 109.sr03.test.net;
address 110.sr03.test.net;
address 111.sr03.test.net;
address 112.sr03.test.net;
}
}
interfaces {
vlan.0 {
host-inbound-traffic {
system-services {
all;
}
}
}
}
}
security-zone UNTRUST {
address-book {
address dep 1.1.1.186/32;
address mikhail-home-1 1.1.5.30/32;
}
screen untrusted-screen;
interfaces {
ge-0/0/0.0 {
host-inbound-traffic {
system-services {
ping;
ssh;
https;
ike;
}
}
}
}
}
}
}
firewall {
filter protect-re {
term deny-all {
from {
source-address {
0.0.0.0/0;
}
source-prefix-list {
manage-ip except;
}
protocol tcp;
destination-port [ ssh http https ];
}
then {
discard;
}
}
term default {
then accept;
}
}
}
access {
profile VPN-Clients {
authentication-order password;
client admin {
firewall-user {
password «$9$8/.XxdGUHhSeMN-k.P5TFn61F3Wx»; ## SECRET-DATA
}
}
address-assignment {
pool VPN-Clients;
}
}
address-assignment {
pool VPN-Clients {
family inet {
network 10.255.255.0/24;
range VPN-Clients {
low 10.255.255.50;
high 10.255.255.100;
}
dhcp-attributes {
maximum-lease-time 20000;
domain-name vpn.test.net;
}
}
}
}
firewall-authentication {
web-authentication {
default-profile VPN-Clients;
}
}
}
applications {
application tcp-8888 {
protocol tcp;
destination-port 8888;
}
application ftp-passive {
term ftp-control protocol tcp destination-port 21;
term dynamic-ports protocol tcp destination-port 30000-50000;
}
application tcp-3306 {
protocol tcp;
destination-port 3306;
}
application tcp-5117 {
protocol tcp;
destination-port 5117;
}
application tcp-10000 {
protocol tcp;
destination-port 10000;
}
application gs-guard104 {
term ls-port protocol tcp destination-port 2106;
term gs-port protocol tcp destination-port 7777;
term guard-ls protocol tcp destination-port 37800-37900;
term guard-gs protocol tcp destination-port 48200-48300;
}
application gs-guard106 {
term ls-port protocol tcp destination-port 2106;
term gs-port protocol tcp destination-port 7777;
term guard-ls protocol tcp destination-port 47300-47400;
term guard-gs protocol tcp destination-port 59200-59300;
}
application gs-guard107 {
term ls-port protocol tcp destination-port 2106;
term gs-port protocol tcp destination-port 7777;
term guard-ls protocol tcp destination-port 39000-39100;
term guard-gs protocol tcp destination-port 48700-48800;
}
}
vlans {
vlan-trust {
vlan-id 3;
l3-interface vlan.0;
}
}
Интегратор провел свои тесты на SRX100 и получил такие же результаты.
Они использовали следующие настройки screen
ids-option test {
tcp {
syn-flood {
attack-threshold 4;
source-threshold 4;
destination-threshold 4;
timeout 50;
}
}
}
Syn-flood генерировали следующей командой:
#hping2 -S —rand-source -i uX -p 21 -c Y victim_IP где X — таймаут между пакетами, Y — количество пакетов, victim_IP — адрес жертвы, размеры пакетов 54bytes
========
Тест №1
852pps, 440Kbps
syn-proxy — cpu-load 27%
syn-cookie — cpu-load 4%
========
Тест №2
5573pps, 2560Kbps
syn-proxy — cpu-load 100%
syn-cookie — cpu-load 30%
========
Тест №2
38724pps, 18400Kbps
syn-proxy — cpu-load 100%
syn-cookie — cpu-load 100%
========
PPS — приблизительное(считали в wireshark’e)
При этом для SRX100 по даташитам FW(IMIX) 200Mbps, 70Kpps
В Джунипере был открыт кейс, где они признали что подобная проблема есть.
Выводы:
Если атака SYN FLOOD идет с подменой адресов — софтварный SRX флуд отсечет. Если атака идет с реального IP, тогда SRX перестанет работать при любом режиме защиты от SYN Flood (syn-cookie или syn-proxy). 2,5 Мбит/с такого флуда заблокируют работу вашего офиса или веб сервера. Решение — выбор аппаратного SRX у которых такой проблемы не наблюдается.