webserver

Webserver am Raspberry Pi

Written by  on Januar 19, 2020

Unter Raspian Buster

Apache2 Webserver
MariaDB Datenbank Server
– Certbot

Über Bugs

Written by  on April 8, 2016

Manchmal ärgert man sich über einen Fehler in einer freien Software. Und erstellt einen Bugreport. Ganz konkret ist das bei Lighttpd passiert. Zum Bugreport
Und da ist es halt so, dass man einen Bugreport schreibt. Und ruck zuck, so schnell dass man kaum schauen kann, ist der Bug nach nur 7,5 (in Worten siebeneinhalb) Jahren behoben.

Apache AllowEncodedSlashes

Written by  on Januar 27, 2016

Webserver zeigen manchmal ein ganz lustiges Verhalten, etwa wenn ein URL encoded Base64 String übergeben wird.
Benutzt wird das zum Beispiel beim Aufruf eines OCSP Responders wo die Information über das zu prüfende Zertifikat als urlencodetes Base64 übergeben wird.
Ein Beispiel in Base64

jA0EAxMcxamDRMfOGV5/gyZPnyX1BBPOQAE4BHbh7=

Und urlencoded

jA0EAxMcxamDRMfOGV5%2FgyZPnyX1BBPOQAE4BHbh7%3D

Wird jetzt der String „jA0EAwMCxamDRMfOGV5%2FgyZPnyX1BBPOQAE4BHbh7%3D“ z.B. als http://example.com/test/jA0EAwMCxamDRMfOGV5%2FgyZPnyX1BBPOQAE4BHbh7%3D aufgerufen, macht ein Apache draus wieder den Schrägstrich und meldet einen „404 File not found“ zurück, weil das als Pfad und Datei interpretiert wird. Eigentlich sollte das aber wie alle URLs unter /test/ an ein Backend übergeben werden.
Lösung: Per Default ist die Option AllowEncodedSlashes auf Off, wird die Option gesetzt, wird der String sauber durchgereicht.

Die Beispiele sind übrigens Kauderwelsch und haben keine tatsächliche Bedeutung.

What’s obfuscation and what is it good for?

Written by  on Dezember 3, 2015

To see how PHP code obfuscation works, you might check out the Free Online PHP Obfuscator. What happens there, makes your code completeley unreadable. But, it creates an enormous base64 encoded file, which simply might be too much. Also I had some troubles with *larger* php scripts with around 50 lines.
Nevertheless, you’ll be able to copy a neat trick from there. First a function name gets decoded in hex. If you have no idea about how to do it check out string to hex. So now you are able to encode your function name into a variable

$a="\x73\x79\x73\x74\x65\x6d"

Now we are able to replace the calls to the system function with our variable from

system("openssl req -noout -modulus -in testfile.csr >/dev/null 2>&1",$ret);

to

$a("openssl req -noout -modulus -in testfile.csr >/dev/null 2>&1",$ret);

So what is it good for? Could you hide from the disabled function in the php.ini? That’s a clear no! But this helps, when there is some nasty „maleware scanner“ that would delete your scripts from your webspace because of containing a call of the system function.
Is it secure? As always it depends. If you use PHP to execute some hardcoded shell script, this might work in a secure way. If you hand input to your scripts, you should be extra sure, that you know what you are doing!
Will it scale? I guess no. There is no protection from PHP in a way that you might DDOS yourself i.e. your webspace.
Also check for race conditions. Just think about what will happen, when you write into a file – and another call to the webserver will write into the same file.