readme: desync http keep-alive note

This commit is contained in:
bol-van 2020-01-23 21:27:17 +03:00
parent aa82950699
commit 7e2902bdb9
2 changed files with 22 additions and 10 deletions

View File

@ -142,7 +142,7 @@ It takes the following parameters:
--dpi-desync[=<mode>] ; try to desync dpi state. modes : fake rst rstack disorder disorder2 --dpi-desync[=<mode>] ; try to desync dpi state. modes : fake rst rstack disorder disorder2
--dpi-desync-fwmark=<int|0xHEX> ; override fwmark for desync packet. default = 0x40000000 --dpi-desync-fwmark=<int|0xHEX> ; override fwmark for desync packet. default = 0x40000000
--dpi-desync-ttl=<int> ; set ttl for desync packet --dpi-desync-ttl=<int> ; set ttl for desync packet
--dpi-desync-fooling=none|md5sig|badsum --dpi-desync-fooling=none|md5sig|ts|badseq|badsum ; can take multiple comma separated values
--dpi-desync-retrans=0|1 ; (fake,rst,rstack only) 0(default)=reinject original data packet after fake 1=drop original data packet to force its retransmission --dpi-desync-retrans=0|1 ; (fake,rst,rstack only) 0(default)=reinject original data packet after fake 1=drop original data packet to force its retransmission
--dpi-desync-skip-nosni=0|1 ; 1(default)=do not apply desync to requests without hostname in the SNI --dpi-desync-skip-nosni=0|1 ; 1(default)=do not apply desync to requests without hostname in the SNI
--dpi-desync-split-pos=<1..1500> ; (for disorder only) split TCP packet at specified position --dpi-desync-split-pos=<1..1500> ; (for disorder only) split TCP packet at specified position
@ -174,11 +174,14 @@ add tcp option "MD5 signature". All of them have their own disadvantages :
If nfqws is on the router, its not neccessary to switch of "net.netfilter.nf_conntrack_checksum". If nfqws is on the router, its not neccessary to switch of "net.netfilter.nf_conntrack_checksum".
Fake packet doesn't go through FORWARD chain, it goes through OUTPUT. But if your router is behind another NAT, for example ISP NAT, Fake packet doesn't go through FORWARD chain, it goes through OUTPUT. But if your router is behind another NAT, for example ISP NAT,
and that NAT does not pass invalid packets, you cant do anything. and that NAT does not pass invalid packets, you cant do anything.
* badseq packets will be dropped by server, but DPI also can ignore them
* TTL looks like the best option, but it requires special tuning for earch ISP. If DPI is further than local ISP websites * TTL looks like the best option, but it requires special tuning for earch ISP. If DPI is further than local ISP websites
you can cut access to them. Manual IP exclude list is required. Its possible to use md5sig with ttl. you can cut access to them. Manual IP exclude list is required. Its possible to use md5sig with ttl.
This way you cant hurt anything, but good chances it will help to open local ISP websites. This way you cant hurt anything, but good chances it will help to open local ISP websites.
If automatic solution cannot be found then use zapret-hosts-user-exclude.txt. If automatic solution cannot be found then use zapret-hosts-user-exclude.txt.
--dpi-desync-fooling takes multiple comma separated values.
For fake,rst,rstack modes original packet can be sent after the fake one or just dropped. For fake,rst,rstack modes original packet can be sent after the fake one or just dropped.
If its dropped OS will perform first retransmission after 0.2 sec, then the delay increases exponentially. If its dropped OS will perform first retransmission after 0.2 sec, then the delay increases exponentially.
Delay can help to make sure fake and original packets are properly ordered and processed on DPI. Delay can help to make sure fake and original packets are properly ordered and processed on DPI.
@ -212,12 +215,17 @@ Hostlist is applicable only to desync attack. It does not work for other options
Hosts are extracted from plain http request Host: header and SNI of ClientHelllo TLS message. Hosts are extracted from plain http request Host: header and SNI of ClientHelllo TLS message.
Subdomains are applied automatically. gzip lists are supported. Subdomains are applied automatically. gzip lists are supported.
iptables for performing the attack : iptables for performing the attack on the first packet :
iptables -t mangle -I POSTROUTING -p tcp -m multiport --dports 80,443 -m connbytes --connbytes-dir=original --connbytes-mode=packets --connbytes 2:4 -m mark ! --mark 0x40000000/0x40000000 -j NFQUEUE --queue-num 200 --queue-bypass iptables -t mangle -I POSTROUTING -p tcp -m multiport --dports 80,443 -m connbytes --connbytes-dir=original --connbytes-mode=packets --connbytes 2:4 -m mark ! --mark 0x40000000/0x40000000 -j NFQUEUE --queue-num 200 --queue-bypass
connbytes will only queue the first data packet. mark is needed to keep away generated packets from NFQUEUE. This is good if DPI does not track all requests in http keep-alive session.
nfqws sets fwmark when it sends generated packets. If it does, then pass all outgoing packets for http and only first data packet for https :
iptables -t mangle -I POSTROUTING -p tcp --dport 80 -m connbytes --connbytes-dir=original --connbytes-mode=packets --connbytes 2:4 -m mark ! --mark 0x40000000/0x40000000 -j NFQUEUE --queue-num 200 --queue-bypass
iptables -t mangle -I POSTROUTING -p tcp --dport 443 -m mark ! --mark 0x40000000/0x40000000 -j NFQUEUE --queue-num 200 --queue-bypass
mark is needed to keep away generated packets from NFQUEUE. nfqws sets fwmark when it sends generated packets.
tpws tpws
----- -----

View File

@ -245,12 +245,17 @@ hostlist относится только к атаке desync. он не раб
Хосты извлекаются из Host: хедера обычных http запросов и из SNI в TLS ClientHello. Хосты извлекаются из Host: хедера обычных http запросов и из SNI в TLS ClientHello.
Субдомены учитываются автоматически. Поддерживаются листы gzip. Субдомены учитываются автоматически. Поддерживаются листы gzip.
iptables для задействования атаки : iptables для задействования атаки на первый пакет данных :
iptables -t mangle -I POSTROUTING -p tcp -m multiport --dports 80,443 -m connbytes --connbytes-dir=original --connbytes-mode=packets --connbytes 2:4 -m mark ! --mark 0x40000000/0x40000000 -j NFQUEUE --queue-num 200 --queue-bypass iptables -t mangle -I POSTROUTING -p tcp -m multiport --dports 80,443 -m connbytes --connbytes-dir=original --connbytes-mode=packets --connbytes 2:4 -m mark ! --mark 0x40000000/0x40000000 -j NFQUEUE --queue-num 200 --queue-bypass
connbytes направит в очередь только первый пакет с данными. mark нужен, чтобы сгенерированный поддельный пакет не попал опять к нам на обработку. Этот вариант применяем, когда DPI не следит за всеми запросами http внутри keep-alive сессии.
nfqws выставляет fwmark при его отсылке. Если следит, направляем только первый пакет от https и все пакеты от http :
iptables -t mangle -I POSTROUTING -p tcp --dport 80 -m connbytes --connbytes-dir=original --connbytes-mode=packets --connbytes 2:4 -m mark ! --mark 0x40000000/0x40000000 -j NFQUEUE --queue-num 200 --queue-bypass
iptables -t mangle -I POSTROUTING -p tcp --dport 443 -m mark ! --mark 0x40000000/0x40000000 -j NFQUEUE --queue-num 200 --queue-bypass
mark нужен, чтобы сгенерированный поддельный пакет не попал опять к нам на обработку. nfqws выставляет fwmark при его отсылке.
tpws tpws
----- -----
@ -1081,9 +1086,8 @@ connbytes придется опускать, поскольку модуля в
его заново. Поэтому качество броузинга с tpws может быть хуже, но дело не в tpws. его заново. Поэтому качество броузинга с tpws может быть хуже, но дело не в tpws.
Частота сбросов заметно возрастает, если запущен торент клиент, имеется много tcp соединений. Частота сбросов заметно возрастает, если запущен торент клиент, имеется много tcp соединений.
Однако, причина не в переполнении таблицы conntrack. Увеличение лимитов и очистка conntrack не помогают. Однако, причина не в переполнении таблицы conntrack. Увеличение лимитов и очистка conntrack не помогают.
Может быть переполняется лимит NAT у провайдера, не хватает портов на всех клиентов, сидящем на одном внешнем IP. Предположительно эта особенность связана с обработкой пакетов сброса соединения в hardware offload.
Но почему тогда ничего не приходит в ответ ? Как ОС модема сразу узнает об ошибке, а не ждет ответа и не выполняет ретрансмиссии ? Точного ответа на вопрос у меня нет. Если вы знаете - поделитесь, пожалуйста.
Работают offload-ы ? Ответов на эти вопросы у меня нет. Если вы знаете - поделитесь, пожалуйста.
Чтобы не ухудшать качество броузинга, можно фильтровать заворот на tpws по ip фильтру. Чтобы не ухудшать качество броузинга, можно фильтровать заворот на tpws по ip фильтру.
Поддержка ipset отсутствует. Значит, все, что можно сделать - создать индивидуальные правила Поддержка ipset отсутствует. Значит, все, что можно сделать - создать индивидуальные правила
на небольшое количество хостов. на небольшое количество хостов.