store | blogs | forums | twitter | facebook | wiki | mailing lists | downloads | support portal
Atomic Secure Linux
It is currently Thu May 23, 2013 7:58 pm

» Feed - Atomicorp

All times are UTC - 5 hours [ DST ]




Post new topic Reply to topic Share/Bookmark  [ 12 posts ] 
Author Message
 Post subject: Level 6 event causing a block
Unread postPosted: Wed Dec 14, 2011 8:51 pm 
Offline
Long Time Forum Regular
Long Time Forum Regular

Joined: Thu Dec 09, 2004 11:19 am
Posts: 1846
I recently raised a case in the portal about an event that I didn't think should cause a block, but I don't think we understood each other and due to the pressures of work I let the matter drop as I was able to resolve the issue temporarily.

Unfortunately a related issue has come up and this one needs a general discussion, I think.

Here's what happened:

Code:
hostname suhosin[17666]: ALERT - script tried to increase memory_limit to 268435456 bytes which is above the allowed value (attacker `a.b.c.d`, file `/path/to/wp-admin/admin.php`, line 109)


This caused rule 2010 to trigger, which is Level 6.

Now I don't expect Level 6 events to cause a block, but this one does by default. That can't be a right, can it, especially with the GUI set to show level 7 and above by default? Only Level 7+ events normally trigger blocks.

More importantly, this attempt to use lots of memory is common, if not normal, for a Wordpress site. So causing a block here is a bad thing.

What I was asking for in my support case, but not explainling very well, was for a specific rule to be created for this particular suhosin alert, AND which takes precedence over the first time IDS event rule (20100), which is what triggered originally (and was a Level 8 and blocked the IP). It is not fatal, nor an indication of a real attack. Like I say, it is common for WP to trigger this suhosin alert.

What do you guys think?

Faris.

_________________
--------------------------------
<advert>
If you want to rent a UK-based VPS that comes with friendly advice and support from a fellow ART fan, please get in touch.
</advert>


Top
 Profile  
 
 Post subject: Re: Level 6 event causing a block
Unread postPosted: Wed Dec 14, 2011 9:31 pm 
Offline
Atomicorp Staff - Site Admin
Atomicorp Staff - Site Admin

Joined: Wed Dec 31, 1969 8:00 pm
Posts: 7428
Location: earth
Level 6 and up block. 7 is the default since 6's are where we put alerts we dont want to show by default because of volume.


Top
 Profile  
 
 Post subject: Re: Level 6 event causing a block
Unread postPosted: Wed Dec 14, 2011 9:45 pm 
Offline
Long Time Forum Regular
Long Time Forum Regular

Joined: Thu Dec 09, 2004 11:19 am
Posts: 1846
Well that doesn't seem like the right thing to do to me. Anything that blocks should be visible, surely? If there's going to be a lot of something, it shouldn't block by default, especially if it is "hidden" ?

_________________
--------------------------------
<advert>
If you want to rent a UK-based VPS that comes with friendly advice and support from a fellow ART fan, please get in touch.
</advert>


Top
 Profile  
 
 Post subject: Re: Level 6 event causing a block
Unread postPosted: Thu Dec 15, 2011 1:38 am 
Offline
Atomicorp Staff - Site Admin
Atomicorp Staff - Site Admin
User avatar

Joined: Thu Feb 07, 2008 7:49 pm
Posts: 3245
Location: Chantilly, VA
I can understand why you may want that. We took the approach that for some events you may not want to always see them by default, even if its shunned. For example, brute force attack alerts (before they get rolled up as a meta event), for example. Or really high volume events, like suhosin (you can get a HUGE stream of events from suhosin). Yes, it should tell you a brute force attack is under way, but may not ever single alert that lead ASL to that conclision.

We didn't want to overwhelm the user (and the GUI) right out of the box, otherwise you could end up DOSing the GUI or maybe even the person. So we have one level of shuns - the bulk ZOMG pre-rolled up non-meta events that dont show. The meta roll ups, like "hey you are in fact being hammered" is a 7+ - so you see that by default. Just not the "um, heres every hammer strike enjoy!". Sometimes something could be a 6 and just not rise to a hammer event. So its a bit of a toss up on some of those "noiser" events, like suhosin that can be a bit chatty. It might be a damn good idea to see all the hammer strikes, so its admittedly a compromise, we try to find a happy medium out of the box.

At least ASL takes it all in stride to protect you, it can handle the load, we just dont want to overwhelm the human! ;-)

So we appreciate the feedback, if theres a better way we can do this we definitely want to do it. Please toss out ideas, we're all ears and eyes. Maybe something in the GUI to explain their are shuns below your current "level of awareness" going on? The human factor is far more important in the GUI, so if we can help to present this information in more coherent way please let us know.

_________________
Michael Shinn
Atomicorp - Security For Everyone

Co-Author of Troubleshooting Linux Firewalls.


Top
 Profile  
 
 Post subject: Re: Level 6 event causing a block
Unread postPosted: Thu Dec 15, 2011 6:01 am 
Offline
Long Time Forum Regular
Long Time Forum Regular

Joined: Thu Dec 09, 2004 11:19 am
Posts: 1846
I don't see the difference between suhosin logging loads of somethings and mod_sec blocking the 100s of attempts I'm currently seeing by the bad guys trying to exploit an awstats vulnerability on every IP and domain name on our servers, over and over again.

If it gets blocked then it should be visible by default. Any rule capable of (or likely to be capable of) blocking a legit user must be visible by default.

I'd almost say that these Level 6 events should really be Level 8 or 9. They are "unusual" and therefore need more attention than the usual Level 7 ones. I know you say there can be lots of them, but I'm not seeing many here compared to Level 7.

At the very least give us an option for the default viewing level in the asl config file so people concerned about blocking their own users can view those events more easily, without having to remember to change the level in the GUI every time they login.

_________________
--------------------------------
<advert>
If you want to rent a UK-based VPS that comes with friendly advice and support from a fellow ART fan, please get in touch.
</advert>


Top
 Profile  
 
 Post subject: Re: Level 6 event causing a block
Unread postPosted: Thu Dec 15, 2011 10:11 am 
Offline
Atomicorp Staff - Site Admin
Atomicorp Staff - Site Admin

Joined: Wed Dec 31, 1969 8:00 pm
Posts: 7428
Location: earth
We've actually been pushing rules down from the default 7 catchall 60118 to lower level 6 events. WAF RBL events for example are 6's, as well as some meta-rules. Its a big list though, and I don't think we'll ever have to/need to map them all to HIDS Id's.

A lot of that pre-dated the rule manager too. You can certainly go into a rule now and change the level it runs at, disable/enable active response, "silence" the alert from logging or emailing, or force a rule that wouldnt normally block/email/alert to do that even if its at a lower level.


Top
 Profile  
 
 Post subject: Re: Level 6 event causing a block
Unread postPosted: Thu Dec 15, 2011 11:02 am 
Offline
Long Time Forum Regular
Long Time Forum Regular

Joined: Thu Dec 09, 2004 11:19 am
Posts: 1846
That all makes sense.

But next time please can you warn us users when this type of change happens? I'm sure I'm not the only one uncomfortable with blocking events happening that I wasn't aware of.

So can we solve my anguish in this specific case with a suhosin-specific rule?

Quote:
<rule id="101006" level="8" >
<match>suhosin</match>
<description>Suhosin Event</description>
</rule>

(1010xx is my local rule range)

But how do I get this to override other rules that might trigger, like 20101 (or is it 2010)?
For example, I might want to leave 20101 on blocking, but if the suhosin rule triggers I don't want to block.

_________________
--------------------------------
<advert>
If you want to rent a UK-based VPS that comes with friendly advice and support from a fellow ART fan, please get in touch.
</advert>


Top
 Profile  
 
 Post subject: Re: Level 6 event causing a block
Unread postPosted: Fri Dec 16, 2011 3:01 pm 
Offline
Atomicorp Staff - Site Admin
Atomicorp Staff - Site Admin

Joined: Wed Dec 31, 1969 8:00 pm
Posts: 7428
Location: earth
check out the <if_sid> examples in other rules


Top
 Profile  
 
 Post subject: Re: Level 6 event causing a block
Unread postPosted: Sat Dec 17, 2011 10:43 am 
Offline
Long Time Forum Regular
Long Time Forum Regular

Joined: Thu Dec 09, 2004 11:19 am
Posts: 1846
Ah! My old friend Sid. I hope he's well. I shall find out shortly.

_________________
--------------------------------
<advert>
If you want to rent a UK-based VPS that comes with friendly advice and support from a fellow ART fan, please get in touch.
</advert>


Top
 Profile  
 
 Post subject: Re: Level 6 event causing a block
Unread postPosted: Wed Dec 21, 2011 11:32 am 
Offline
Long Time Forum Regular
Long Time Forum Regular

Joined: Thu Dec 09, 2004 11:19 am
Posts: 1846
Well, Sid's no help to me really. In fact I've unFriended him.

Thankfully, there's already a suhosin decoder in OSSEC, with a "type" of "ids" in decoder.xml

Code:
<decoder name="suhosin">
  <program_name>^suhosin</program_name>
  <type>ids</type>
  <regex>^ALERT - (\.+) \(attacker '(\d+.\d+.\d+.\d+)', </regex>
  <order>id, srcip</order>
  <fts>name, location, id</fts>
</decoder>




[50_asl_]ids_rules.xms has two main rules that will trigger on suhosin events, and they are what's really causing the problem:

Code:
<group name="ids,">
  <rule id="20100" level="8">
    <category>ids</category>
    <if_fts></if_fts>
    <description>First time this IDS alert is generated.</description>
    <group>fts,</group>
  </rule>


  <rule id="20101" level="6">
    <category>ids</category>
    <check_if_ignored>srcip, id</check_if_ignored>
    <description>IDS event.</description>
  </rule>


The first one is a First Time Seen rule, default Level 8.
This means that any suhosin event that happens that's not been seen before (before when? -- I can't figure out where the FTS queue is held) will be Level 8 and will block.

Obviously this can be changed, but as I want to specifically target suhosin, we don't really want to change it. It is Level 8 for a reason, really.

Next, we have a Level 6 rule that will trigger if the suhosin event has been seen before. Again we don't want to touch that because it is a generic rule and we want to specifically target suhosin.

So, as far as I can see, the only solution to this is to modify the existing suhosin decoder and change <type>ids</type> to a custom value, such as "suhosin", when create the required rules in local_rules.xml - maybe a generic suhosin rule at level 8 and a specific rule matching the memory allocation rule at level 5.

The problem is that decoder.xml will get overwritten every time ossec us updated.

There is an option for local_decoder.xml or indeed to put a decoder file in decoders.d as has been done for the 01_asl_decoder.xml

So, I wonder if I can override an existing decoder by simply saving a local_decoder.xml file in decoders.d which redefines the "suhosin" decoder in decoder.xml?

I may try it later, but if anybody knows whether this will work or not then I'd appreciate it.

Faris.

_________________
--------------------------------
<advert>
If you want to rent a UK-based VPS that comes with friendly advice and support from a fellow ART fan, please get in touch.
</advert>


Top
 Profile  
 
 Post subject: Re: Level 6 event causing a block
Unread postPosted: Wed Dec 21, 2011 11:43 am 
Offline
Long Time Forum Regular
Long Time Forum Regular

Joined: Thu Dec 09, 2004 11:19 am
Posts: 1846
bah! The man from DelGoogle, he says "no!"

But it looks like I may have misunderstood how the rules work.

I figured that if there was a generic rule the triggered at Level X, any subsequent rules that use if_sid to chain off that rule would not prevent the original generic Level X rule triggering.

But looking at ids_rules in more detail, I see

Code:
 <!-- This rule ignores some Ids that cause too much
    -  false positives. Snort specific.
    -->
  <rule id="20102" level="0">
    <if_sid>20100, 20101</if_sid>
    <decoded_as>snort</decoded_as>
    <!-- 1:1852 -> robots.txt access
       - 1:368 - ICMP ping.
       - 1:384 - ICMP ping.
       - 1:366 - ICMP ping.
       - 1:399 - ICMP host unreachable
       - 1:402 - ICMP port unreachable
       - 1:408 - ICMP reply
       - 1:480 - ICMP ping speedera.
       - 1:1365 - RM commant attempt (too many false positives)
       - 1:2925 - web bug 0x0 gif attempt
       -->
    <id>^1:1852:|^1:368:|^1:384:|^1:366:|^1:402:|^1:408:|^1:1365:|</id>
    <id>^1:480:|^1:399:|^1:2925:</id>
    <description>Ignored snort ids.</description>
  </rule>


Which implies that I can cause the generic rule not to trigger if I get a match in my custom rule.

Hmm....

_________________
--------------------------------
<advert>
If you want to rent a UK-based VPS that comes with friendly advice and support from a fellow ART fan, please get in touch.
</advert>


Top
 Profile  
 
 Post subject: Re: Level 6 event causing a block
Unread postPosted: Wed Dec 21, 2011 12:07 pm 
Offline
Long Time Forum Regular
Long Time Forum Regular

Joined: Thu Dec 09, 2004 11:19 am
Posts: 1846
Sorted:

in /var/ossec/etc/rules.d/local_rules.xml


Code:
<group name="local,ids,">

<!-- First Time Suhosin event rule -->
  <rule id="101006" level="14">
    <if_sid>20100</if_sid>
    <decoded_as>suhosin</decoded_as>
    <description>First Time Suhosin Event</description>
  </rule>


<!-- Generic Suhosin event rule -->
  <rule id="101007" level="12">
    <if_sid>20101</if_sid>
    <decoded_as>suhosin</decoded_as>
    <description>Suhosin Event</description>
  </rule>


<!-- Specific Suhosin event rule -->
  <rule id="101008" level="5">
    <if_sid>101006,101007</if_sid>
    <match>script tried to increase memory</match>
    <description>Suhosin Memory Increase Event</description>
  </rule>


</group>


I'm not sure if I'm doing my <group> stuff correctly, but the ossec-logtest utility confirms it works as expected.

[EDITED - changed to enhance detection levels to include first time events]

_________________
--------------------------------
<advert>
If you want to rent a UK-based VPS that comes with friendly advice and support from a fellow ART fan, please get in touch.
</advert>


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic Share/Bookmark  [ 12 posts ] 

» Feed - Atomicorp

All times are UTC - 5 hours [ DST ]


Who is online

Users browsing this forum: Google [Bot] and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group