#663723 apache2 does not prevent DoS through .htaccess files

Package:
apache2
Source:
apache2
Description:
Apache HTTP Server
Submitter:
Date:
2021-12-15 08:51:07 UTC
Severity:
wishlist
#663723#5
Date:
2012-03-13 15:23:28 UTC
From:
To:
Hello,

I noticed on a customers server, that apache periodical crashes the
whole system by using the whole available memory until it swaps away.

I have found out that this is caused by a crafted .htaccess where german
umlauts handled in a wrong way.

I have tested it on:

* Lenny amd64 with apache2-prefork
* Lenny i386 with apache2-prefork
* Squeeze amd64 with apache2-prefork
* Squeeze i386 with apache2-prefork
* Lenny amd64 with apache2-worker
* Lenny i386 with apache2-worker
* Squeeze amd64 with apache2-worker
* Squeeze i386 with apache2-worker

It is reproduced easily on all systems (locale of all systems: de_DE.UTF-8)

Ways to reproduce:

# apt-get install apache2
# a2enmod rewrite

Put the following code to e.g. /var/www/.htaccess:

RewriteEngine on
RewriteBase /
RewriteRule ^(.*)\xC3\x84(.*)$ $1Ä$2 [N,E=utf8_fixed:1]
RewriteRule ^(.*)\xC3\xA4(.*)$ $1ä$2 [N,E=utf8_fixed:1]
RewriteRule ^(.*)\xC3\x96(.*)$ $1Ö$2 [N,E=utf8_fixed:1]
RewriteRule ^(.*)\xC3\xB6(.*)$ $1ö$2 [N,E=utf8_fixed:1]
RewriteRule ^(.*)\xC3\x9C(.*)$ $1Ü$2 [N,E=utf8_fixed:1]
RewriteRule ^(.*)\xC3\xBC(.*)$ $1ü$2 [N,E=utf8_fixed:1]
RewriteRule ^(.*)\xC3\x9F(.*)$ $1ß$2 [N,E=utf8_fixed:1]


Go to your browser and open:
http://localhost/Parf%C3%BCmerie

Now the server runs out of memory very fast!

This is especialy a big problem for shared hosters with mod_rewrite
enabled (most vhosts require them today) where users could put their own
.htaccess to the documentroot

#663723#10
Date:
2012-03-13 15:26:56 UTC
From:
To:
Am 13.03.2012 16:24, schrieb Debian Bug Tracking System:

I have attached the htaccess for the case that it isn't displayed
correctly in my previous mail

Cheers

#663723#15
Date:
2012-03-13 17:36:26 UTC
From:
To:
found #663723 2.2.9-10+lenny12
found #663723 2.2.22-1
thanks

Am 13.03.2012 16:26, schrieb Patrick Matthäi:

I have also tested it on an up to date unstable. Steps to reproduce:

# apt-get install apache2
(this installs per default the worker)
# a2enmod rewrite
(mod_rewrite is required)
# vi /etc/apache2/sites-enabled/000-default
(set allowoverride all e.g.)
# mv ~/htaccess /var/www/.htaccess
(copy htaccess to documentroot)
# /etc/init.d/apache2 restart
(take over changed module/vhost)

Now I have opened http://localhost/Parf%C3%BCmerie and after a few seconds:

root      7354  0.0  0.0  73916  3100 ?        Ss   18:28   0:00
/usr/sbin/apache2 -k start
www-data  7359  0.0  0.0  73648  2172 ?        S    18:28   0:00  \_
/usr/sbin/apache2 -k start
www-data  7362 29.8 23.9 1203548 909136 ?      Sl   18:28   0:25  \_
/usr/sbin/apache2 -k start
www-data  7364  0.0  0.0 362888  2588 ?        Sl   18:28   0:00  \_
/usr/sbin/apache2 -k start

htop shows 100% CPU usage of 7362 and at this time ~25% RAM usage of my
4GB (constant growing until I kill 7362)

#663723#24
Date:
2012-03-13 19:15:17 UTC
From:
To:
severity 663723 wishlist
tags 663723 -security
retitle 663723 apache2 does not prevent DoS through .htaccess files
thanks

The problem is not the special character but that this regular
expression has quadratic complexity in the string length. Using (.*?)
instead of (.*) everywhere will likely fix it.

This is a general problem when using regular expressions. And being
allowed to use .htaccess means having access to regular expressions.

While I don't deny that this is a problem for some use cases, it is a
fact that the .htaccess mechanism has not been designed with limiting
local DoS attacks in mind. There are many ways to cause a DoS with
crafted .htaccess files. Some of these cannot be fixed without
breaking compatibility, i.e. not within 2.2.x or 2.4.x. Therefore,
picking out a few of these issues and fixing them in Debian does not
make any sense. If you use prefork, you can work around this by adding
suitable ulimit calls in /etc/apache2/envvars.

Upstream does not consider these issues security relevant, either:

http://mail-archives.apache.org/mod_mbox/httpd-
dev/201111.mbox/%3C4EC6DE56.9020701@rowe-clan.net%3E

#663723#35
Date:
2012-03-13 19:37:12 UTC
From:
To:
Am 13.03.2012 20:15, schrieb Stefan Fritsch:
special char handling (couldn't test so much, yet).

If the regular expression is wrong, okay, but what is about e.g. the
RedirectLimit? This also could cause server problems with crafted
configurations, but there is internal apache limit available.

In this case an shared hosting server (~ 300 customers) was affected and
crashed several times about months and we had to introduce workarounds
("killer scripts") to prevent the server to crash at all; debugging was
quite hard aka impossible.
Here upstream should introduce something which prevents apache to crash
itself and the whole server.

Since this is IMHO opinion a DoS - against the whole server, not only
the service, which requires "local user access" (customer uploading his
.htaccess) - it is security important, severity important okay, but not
wishlist..

Regarding the mail from apache-dev:
How is "resource abuse" defined? IMHO if the customer uploads a htaccess
and after that e.g the cpu load + response times are higher, okay...
pure configuration issue
But adding a few lines to crash the whole server? This is not a resource
abuse.
This is something like:
- a file traversal issue where a victim could read out /etc/passwd is no
security issue
- but maybe reading out /etc/shadow

From my Debian POV it is an security issue, also if upstream don't want it..

#663723#40
Date:
2012-03-13 21:25:57 UTC
From:
To:
You mean LimitInternalRecursion? That is to protect from
misconfigurations. In the same way, it would be nice to have a
protection from runaway regexes. PCRE has a way to limit its
recursion, but no one has changed apache to use that, yet. And it
would be considerable work to do this change while avoiding unintended
side effects.

There is no clear dividing line between the two. What is only a
slightly increased memory usage on a big server with 16GB of RAM will
cause Linux's OOM-killer to wreak havoc on a small virtual server with
128MB RAM.

Apache does not try to adjust its resource usage to the size of the
used server (again, a missing feature, not a security defect). This
tuning is left to the administrator. You can prevent the whole server
from being affected by setting suitable MaxClients and memory limits.
You could also change oom_adj on the apache processes, to ensure that
apache is killed and not other processes.

#663723#45
Date:
2018-02-15 07:27:04 UTC
From:
To:
Laba diena,


Noriu Jus informuoti apie šių metų pasikeitimą dėl atnaujintos visos Lietuvos įmonių bazės 2018 metų sausio vidurio.
Visi juridiniai asmenys pateikti bazėje yra veikiantys, realiai vykdantys veiklą, turintys įdarbintų darbuotojų. Duomenys pagal Sodrą, Registrų centrą.

Bazėje nurodoma ir apyvarta, darbuotojų atlyginimai, darbuotojų skaičius, transporto skaičius ir daug kitų duomenų, kuriuos matysite pavyzdyje.

Duomenis galima filtruoti pagal veiklas, miestus ir kitus duomenis.


Šią bazę verta turėti visoms įmonėms. Pateiksiu priežastis:

1) Kontaktai pateikti bazėje direktorių ir kitų atsakingų asmenų, didelė tikimybė Jums surasti naujų klientų, partnerių, tiekėjų, kai tiesiogiai bendrausite su direktoriais, komercijos vadovais.

2) Konkurentų analizavimas, tiekėjų atsirinkimas pagal Jums reikalingus kriterijus, galite atsifiltruoti pagal įmonės dydį, bazėje nurodoma kiek įmonės skolingos Sodrai.

3) Lengva, greita ir patogu dirbti su šia baze, elektroninius pašto adresus galite importuoti į elektroninių laiškų siuntimo programas ar sistemas iš kurių siunčiate elektroninius laiškus.
Taip pat galite importuoti mobiliųjų telefonų numerius į SMS siuntimo programas.


Išsirinkite iš "Veiklų sąrašo" veiklas kurių Jums reikia.
( Sąrašas prisegtas laiške excel faile )

Parašykite, kurias veiklas išsirinkote
ir atsiųsime pavyzdį ir pasiūlymą su sąlygomis įmonių bazei įsigyti



Pagarbiai,
Tadas Giedraitis
Tel. nr. +37067881041

#663723#50
Date:
2019-06-17 07:38:26 UTC
From:
To:
Hello,

Our partners referred your company to us. Regarding your great products.
Please see required products, quantity and specifications as attached.

Kindly give us your lowest possible prices for FCL shipment.


Best Regards,

Wanda Rodriguez
Purchase Assistant

Hidroconta Trading Ltd.
Av. de Sta. Catalina,
60, 30012 Murcia, Spain
Phone: +34 968 26 77 66
Fax: +34 968 26 77 06

#663723#55
Date:
2019-11-10 00:17:44 UTC
From:
To:
Good day,

My associate from China wants to discuss a business investment deal with
you. I awaiting your response to enable us discuss about this business
investment

Nael M. Al Homoud
Executive Director & High Investment Committee Member@
The Arab Investment Co
www.taic.com [1]



Links:
------
[1] http://www.taic.com

#663723#60
Date:
2020-05-10 08:33:43 UTC
From:
To:
Good day,

My associate from China wants to discuss a business investment deal with
you. I awaiting your response to enable us discuss about this business
investment

Nael M. Al Homoud
Executive Director & High Investment Committee Member@
The Arab Investment Co
www.taic.com [1]



Links:
------
[1] http://www.taic.com

#663723#65
Date:
2021-09-27 07:40:48 UTC
From:
To:
Dzień dobry,

kontaktuję się z Państwem, ponieważ dostrzegam możliwość redukcji opłat za prąd.

Odpowiednio dobrana instalacja fotowoltaiczna to rozwiązanie, które pozwala wygenerować spore oszczędności w skali roku.

Chciałbym porozmawiać z Państwem o tego typu rozwiązaniu, a także przedstawić wstępne kalkulacje.

Czy są Państwo zainteresowani?

Pozdrawiam,
Dorian Kwiatkowski

#663723#70
Date:
2021-10-14 07:51:01 UTC
From:
To:
Dzień dobry,

jakiś czas temu zgłosiła się do nas firma, której strona internetowa nie pozycjonowała się wysoko w wyszukiwarce Google.

Na podstawie wykonanego przez nas audytu SEO zoptymalizowaliśmy treści na stronie pod kątem wcześniej opracowanych słów kluczowych. Nasz wewnętrzny system codziennie analizuje prawidłowe działanie witryny.  Dzięki indywidualnej strategii, firma zdobywa coraz więcej Klientów.

Czy chcieliby Państwo zwiększyć liczbę osób odwiedzających stronę internetową firmy? Mógłbym przedstawić ofertę?


Pozdrawiam serdecznie,
Patryk Górecki

#663723#75
Date:
2021-10-20 07:55:16 UTC
From:
To:
Dzień dobry,

jakiś czas temu zgłosiła się do nas firma, której strona internetowa nie pozycjonowała się wysoko w wyszukiwarce Google.

Na podstawie wykonanego przez nas audytu SEO zoptymalizowaliśmy treści na stronie pod kątem wcześniej opracowanych słów kluczowych. Nasz wewnętrzny system codziennie analizuje prawidłowe działanie witryny.  Dzięki indywidualnej strategii, firma zdobywa coraz więcej Klientów.

Czy chcieliby Państwo zwiększyć liczbę osób odwiedzających stronę internetową firmy? Mógłbym przedstawić ofertę?


Pozdrawiam serdecznie,
Patryk Górecki

#663723#80
Date:
2021-11-08 08:31:16 UTC
From:
To:
Dzień dobry!

Czy mógłbym przedstawić rozwiązanie, które umożliwia monitoring każdego auta w czasie rzeczywistym w tym jego pozycję, zużycie paliwa i przebieg?

Dodatkowo nasze narzędzie minimalizuje koszty utrzymania samochodów, skraca czas przejazdów, a także tworzenie planu tras czy dostaw.

Z naszej wiedzy i doświadczenia korzysta już ponad 49 tys. Klientów. Monitorujemy 809 000 pojazdów na całym świecie, co jest naszą najlepszą wizytówką.

Bardzo proszę o e-maila zwrotnego, jeśli moglibyśmy wspólnie omówić potencjał wykorzystania takiego rozwiązania w Państwa firmie.


Z poważaniem,
Dawid Rowicki

#663723#85
Date:
2021-11-19 08:50:59 UTC
From:
To:
Dzień dobry!

Czy mógłbym przedstawić rozwiązanie, które umożliwia monitoring każdego auta w czasie rzeczywistym w tym jego pozycję, zużycie paliwa i przebieg?

Dodatkowo nasze narzędzie minimalizuje koszty utrzymania samochodów, skraca czas przejazdów, a także tworzenie planu tras czy dostaw.

Z naszej wiedzy i doświadczenia korzysta już ponad 49 tys. Klientów. Monitorujemy 809 000 pojazdów na całym świecie, co jest naszą najlepszą wizytówką.

Bardzo proszę o e-maila zwrotnego, jeśli moglibyśmy wspólnie omówić potencjał wykorzystania takiego rozwiązania w Państwa firmie.


Z poważaniem,
Dawid Rowicki

#663723#90
Date:
2021-12-03 09:10:40 UTC
From:
To:
Dzień dobry,

czy interesuje Państwa wymiana niezapłaconych przez Klientów faktur na gotówkę?

Pomagamy wszystkim przedsiębiorcom, którzy szukają gwarancji bezpieczeństwa i płynności finansowej.

Jeśli są Państwo otwarci na wstępną rozmowę w tym temacie proszę o odpowiedź.


Pozdrawiam,
Adrian Ostojski
Dyrektor Finansowy

#663723#95
Date:
2021-12-15 08:40:38 UTC
From:
To:
Dzień dobry,

zapoznałem się z Państwa ofertą i z przyjemnością przyznaję, że przyciąga uwagę i zachęca do dalszych rozmów.

Pomyślałem, że może mógłbym mieć swój wkład w Państwa rozwój i pomóc dotrzeć z tą ofertą do większego grona odbiorców. Pozycjonuję strony www, dzięki czemu generują świetny ruch w sieci.

Możemy porozmawiać w najbliższym czasie?


Pozdrawiam
Adam Furgalski