Mailing List Archive

[clamav-users] Scanning PDF for phishing links
Lately I am receiving a lot of Spams originating within MS
networks with attached PDF's that basically contain an image with a
link.

The body of the message is 7-8 random words such as: moka bu fyno da
zosi ku xiqy zy


These prove particularly difficult to filter and I'm thinking maybe
running the PDF's links through the phishing checks might help.


Is that possible or does anyone have other solutions for these
messages ?


Thanks!
Re: [clamav-users] Scanning PDF for phishing links [ In reply to ]
Hi there,

On Tue, 29 Jun 2021, Scott Q. via clamav-users wrote:

> Lately I am receiving a lot of Spams originating within MS networks

I feel your pain. At present I'm seeing 40,000 to 50,000 attempts per
month by Microsoft servers to send us spam. It's gone from really bad
to almost unbelievable in the space of just a few weeks. When it was
only a thousand or so I decided we'd live with it, but now the only
answer has been to blacklist AS8075 entirely and forward it all to the
spam reporting services. I'm starting to see some results from that.
Having said that I'm not seeing the same sorts of thing that you are,
if you'd like to send me a sample privately I'll happily look at it.

> with attached PDF's that basically contain an image with a link.
>
> The body of the message is 7-8 random words such as: moka bu fyno da
> zosi ku xiqy zy
>
> These prove particularly difficult to filter and I'm thinking maybe
> running the PDF's links through the phishing checks might help.
>
>
> Is that possible or does anyone have other solutions for these
> messages ?

Steve at Sansecurity might be able to come up with something if you
submit a few samples to him.

For things like this I don't rely entirely on ClamAV and signatures,
but on a milter which dismantles the MIME parts and passes them to
clamd separately with a bit of extra logic. Without something like
that you'll probably need to do a bit more work on the matching, as
you'll have to work with the whole message body and it might be big.

It should be possible to match the body with Yara rules, you might get
somewhere with a fairly simple regex along the lines of matching the
header parts enclosing the short text with one expression and the text
itself with another expression. This is just a guess at the sort of
thing which might work, adjust the character ranges to suit the spam.
Just put this in a file called something.yar in the ClamAV database
directory and restart clamd (I'm assuming you're using clamav-milter
and clamd).

rule Microsoft_spam
{
strings:
$body_1 = /content-type.{10,500}content-type.{10,100}application\/pdf/ nocase ascii
$body_2 = /content-type: text\/plain.{20,70}(([a-z]{1,6})\s){6,8}/ nocase ascii
conditions:
all of them
}

The first regex matches the bit of the MIME-formatted message which
contains header of the first part, the first body part, and just the
header of the second part. I've assumed that the text precedes the
PDF part, it's usually that way but you'd have to tweak it if that's
not the case. The second regex matches the first header (again) and
something resembling 6 to 8 space-separated words of 1-6 alphabetic
characters. There are 20-70 characters of wiggle-room betweeb the
content-type field and this group of words to allow for the rest of
the first header after the content-type field. Again it might be
necessary to adjust that, but you'll probably find that the messages
aren't very creative and once it's set up it will match all of the
little blighters.

You could do much the same sort of thing with ClamAV signatures but
for this kind of thing Yara rules are a lot more readable and much
easier to tweak when you're experimenting. The one drawback at the
moment is that it's fairly easy to crash clamd with bad Yara rules.
On the bright side it seems OK with complex regexes and it's unlikely
that a crash would be exploitable, as it seems to crash as soon as it
tries to parse the bad rules rather than waiting until it comes across
a malicious bit of data.

It's important to avoid running into efficiency issues by having the
regexes attempt (and eventually fail) to match large chunks of what is
potentially a very large document many times over. I don't know how
well the untested attempts above will achieve that.

HTH


--

73,
Ged.

_______________________________________________

clamav-users mailing list
clamav-users@lists.clamav.net
https://lists.clamav.net/mailman/listinfo/clamav-users


Help us build a comprehensive ClamAV guide:
https://github.com/vrtadmin/clamav-faq

http://www.clamav.net/contact.html#ml
Re: [clamav-users] Scanning PDF for phishing links [ In reply to ]
How many of you are present members of either phishtank.com or spamcop.net? Both of which are ran by Talos, and both of which feed the same intel system that ClamAV can read from?

--
Joel Esler
Manager, Communities Division
Cisco Talos Intelligence Group
https://www.talosintelligence.com | https://www.snort.org | https://www.clamav.net

> On Jun 29, 2021, at 3:21 PM, G.W. Haywood via clamav-users <clamav-users@lists.clamav.net> wrote:
>
> Hi there,
>
> On Tue, 29 Jun 2021, Scott Q. via clamav-users wrote:
>
>> Lately I am receiving a lot of Spams originating within MS networks
>
> I feel your pain. At present I'm seeing 40,000 to 50,000 attempts per
> month by Microsoft servers to send us spam. It's gone from really bad
> to almost unbelievable in the space of just a few weeks. When it was
> only a thousand or so I decided we'd live with it, but now the only
> answer has been to blacklist AS8075 entirely and forward it all to the
> spam reporting services. I'm starting to see some results from that.
> Having said that I'm not seeing the same sorts of thing that you are,
> if you'd like to send me a sample privately I'll happily look at it.
>
>> with attached PDF's that basically contain an image with a link.
>>
>> The body of the message is 7-8 random words such as: moka bu fyno da
>> zosi ku xiqy zy
>> These prove particularly difficult to filter and I'm thinking maybe
>> running the PDF's links through the phishing checks might help.
>>
>>
>> Is that possible or does anyone have other solutions for these
>> messages ?
>
> Steve at Sansecurity might be able to come up with something if you
> submit a few samples to him.
>
> For things like this I don't rely entirely on ClamAV and signatures,
> but on a milter which dismantles the MIME parts and passes them to
> clamd separately with a bit of extra logic. Without something like
> that you'll probably need to do a bit more work on the matching, as
> you'll have to work with the whole message body and it might be big.
>
> It should be possible to match the body with Yara rules, you might get
> somewhere with a fairly simple regex along the lines of matching the
> header parts enclosing the short text with one expression and the text
> itself with another expression. This is just a guess at the sort of
> thing which might work, adjust the character ranges to suit the spam.
> Just put this in a file called something.yar in the ClamAV database
> directory and restart clamd (I'm assuming you're using clamav-milter
> and clamd).
>
> rule Microsoft_spam
> {
> strings:
> $body_1 = /content-type.{10,500}content-type.{10,100}application\/pdf/ nocase ascii
> $body_2 = /content-type: text\/plain.{20,70}(([a-z]{1,6})\s){6,8}/ nocase ascii
> conditions:
> all of them
> }
>
> The first regex matches the bit of the MIME-formatted message which
> contains header of the first part, the first body part, and just the
> header of the second part. I've assumed that the text precedes the
> PDF part, it's usually that way but you'd have to tweak it if that's
> not the case. The second regex matches the first header (again) and
> something resembling 6 to 8 space-separated words of 1-6 alphabetic
> characters. There are 20-70 characters of wiggle-room betweeb the
> content-type field and this group of words to allow for the rest of
> the first header after the content-type field. Again it might be
> necessary to adjust that, but you'll probably find that the messages
> aren't very creative and once it's set up it will match all of the
> little blighters.
>
> You could do much the same sort of thing with ClamAV signatures but
> for this kind of thing Yara rules are a lot more readable and much
> easier to tweak when you're experimenting. The one drawback at the
> moment is that it's fairly easy to crash clamd with bad Yara rules.
> On the bright side it seems OK with complex regexes and it's unlikely
> that a crash would be exploitable, as it seems to crash as soon as it
> tries to parse the bad rules rather than waiting until it comes across
> a malicious bit of data.
>
> It's important to avoid running into efficiency issues by having the
> regexes attempt (and eventually fail) to match large chunks of what is
> potentially a very large document many times over. I don't know how
> well the untested attempts above will achieve that.
>
> HTH
>
>
> --
>
> 73,
> Ged.
>
> _______________________________________________
>
> clamav-users mailing list
> clamav-users@lists.clamav.net
> https://lists.clamav.net/mailman/listinfo/clamav-users
>
>
> Help us build a comprehensive ClamAV guide:
> https://github.com/vrtadmin/clamav-faq
>
> http://www.clamav.net/contact.html#ml
Re: [clamav-users] Scanning PDF for phishing links [ In reply to ]
Hi there,

On Tue, 29 Jun 2021, Joel Esler (jesler) via clamav-users wrote:

> How many of you are present members of either phishtank.com or
> spamcop.net? Both of which are ran by Talos, and both of which feed
> the same intel system that ClamAV can read from?

We send reports to both (and a few others).

--

73,
Ged.

_______________________________________________

clamav-users mailing list
clamav-users@lists.clamav.net
https://lists.clamav.net/mailman/listinfo/clamav-users


Help us build a comprehensive ClamAV guide:
https://github.com/vrtadmin/clamav-faq

http://www.clamav.net/contact.html#ml
Re: [clamav-users] Scanning PDF for phishing links [ In reply to ]
Awesome


Sent from my ? iPad

> On Jun 29, 2021, at 18:04, G.W. Haywood via clamav-users <clamav-users@lists.clamav.net> wrote:
>
> Hi there,
>
>> On Tue, 29 Jun 2021, Joel Esler (jesler) via clamav-users wrote:
>>
>> How many of you are present members of either phishtank.com or
>> spamcop.net? Both of which are ran by Talos, and both of which feed
>> the same intel system that ClamAV can read from?
>
> We send reports to both (and a few others).
>
> --
>
> 73,
> Ged.
>
> _______________________________________________
>
> clamav-users mailing list
> clamav-users@lists.clamav.net
> https://lists.clamav.net/mailman/listinfo/clamav-users
>
>
> Help us build a comprehensive ClamAV guide:
> https://github.com/vrtadmin/clamav-faq
>
> http://www.clamav.net/contact.html#ml
Re: [clamav-users] Scanning PDF for phishing links [ In reply to ]
Joel,

If that question was addressed to all on this list, then yes, I forward all spam to SpamCop and everything suspected as a phish to phishtank (among others). But it's low volume, just from my wife and my's accounts.

Sent from my iPad

-Al-

> On Jun 29, 2021, at 12:48, Joel Esler (jesler) via clamav-users <clamav-users@lists.clamav.net> wrote:
>
> How many of you are present members of either phishtank.com or spamcop.net? Both of which are ran by Talos, and both of which feed the same intel system that ClamAV can read from?
>
> --
> Joel Esler
Re: [clamav-users] Scanning PDF for phishing links [ In reply to ]
Yes. I was just addressing everyone


Sent from my ? iPad

> On Jun 30, 2021, at 00:35, Al Varnell via clamav-users <clamav-users@lists.clamav.net> wrote:
>
> Joel,
>
> If that question was addressed to all on this list, then yes, I forward all spam to SpamCop and everything suspected as a phish to phishtank (among others). But it's low volume, just from my wife and my's accounts.
>
> Sent from my iPad
>
> -Al-
>
>>> On Jun 29, 2021, at 12:48, Joel Esler (jesler) via clamav-users <clamav-users@lists.clamav.net> wrote:
>>>
>> How many of you are present members of either phishtank.com or spamcop.net? Both of which are ran by Talos, and both of which feed the same intel system that ClamAV can read from?
>>
>> --
>> Joel Esler
>
> _______________________________________________
>
> clamav-users mailing list
> clamav-users@lists.clamav.net
> https://lists.clamav.net/mailman/listinfo/clamav-users
>
>
> Help us build a comprehensive ClamAV guide:
> https://github.com/vrtadmin/clamav-faq
>
> http://www.clamav.net/contact.html#ml
Re: [clamav-users] Scanning PDF for phishing links [ In reply to ]
On 30.06.21 20:41, Joel Esler (jesler) via clamav-users wrote:
>Yes. I was just addressing everyone

I have used to forward spam to spamcop, maybe I should start again?

I'm thinking about phishtank (well, they refuse my seamonkey so...)

Are you just curious or is there something behind your questions?

>> On Jun 30, 2021, at 00:35, Al Varnell via clamav-users
>> <clamav-users@lists.clamav.net> wrote: If that question was addressed to
>> all on this list, then yes, I forward all spam to SpamCop and everything
>> suspected as a phish to phishtank (among others). But it's low volume,
>> just from my wife and my's accounts.

>>>> On Jun 29, 2021, at 12:48, Joel Esler (jesler) via clamav-users <clamav-users@lists.clamav.net> wrote:
>>> How many of you are present members of either phishtank.com or
>>> spamcop.net? Both of which are ran by Talos, and both of which feed the
>>> same intel system that ClamAV can read from?

--
Matus UHLAR - fantomas, uhlar@fantomas.sk ; http://www.fantomas.sk/
Warning: I wish NOT to receive e-mail advertising to this address.
Varovanie: na tuto adresu chcem NEDOSTAVAT akukolvek reklamnu postu.
The only substitute for good manners is fast reflexes.

_______________________________________________

clamav-users mailing list
clamav-users@lists.clamav.net
https://lists.clamav.net/mailman/listinfo/clamav-users


Help us build a comprehensive ClamAV guide:
https://github.com/vrtadmin/clamav-faq

http://www.clamav.net/contact.html#ml
Re: [clamav-users] Scanning PDF for phishing links [ In reply to ]
> On Jul 1, 2021, at 8:25 AM, Matus UHLAR - fantomas <uhlar@fantomas.sk> wrote:
>
> On 30.06.21 20:41, Joel Esler (jesler) via clamav-users wrote:
>> Yes. I was just addressing everyone
>
> I have used to forward spam to spamcop, maybe I should start again?
>
> I'm thinking about phishtank (well, they refuse my seamonkey so...)
>
> Are you just curious or is there something behind your questions?

Curious, as I said, ClamAV, SpamCop, and Phishtank are all ran by us. They feed the same ecosystem. Leveraging one to power the other is important.
Re: [clamav-users] Scanning PDF for phishing links [ In reply to ]
>> On 30.06.21 20:41, Joel Esler (jesler) via clamav-users wrote:
>>> Yes. I was just addressing everyone

>> On Jul 1, 2021, at 8:25 AM, Matus UHLAR - fantomas <uhlar@fantomas.sk> wrote:
>> I have used to forward spam to spamcop, maybe I should start again?
>>
>> I'm thinking about phishtank (well, they refuse my seamonkey so...)
>>
>> Are you just curious or is there something behind your questions?

On 01.07.21 14:07, Joel Esler (jesler) via clamav-users wrote:
>Curious, as I said, ClamAV, SpamCop, and Phishtank are all ran by us. They feed the same ecosystem. Leveraging one to power the other is important.

I'd be glad to help here, however in addition to block SeaMonkey, user
registration is disabled currently...

so while I receive some phish, can't report ich much...

--
Matus UHLAR - fantomas, uhlar@fantomas.sk ; http://www.fantomas.sk/
Warning: I wish NOT to receive e-mail advertising to this address.
Varovanie: na tuto adresu chcem NEDOSTAVAT akukolvek reklamnu postu.
42.7 percent of all statistics are made up on the spot.

_______________________________________________

clamav-users mailing list
clamav-users@lists.clamav.net
https://lists.clamav.net/mailman/listinfo/clamav-users


Help us build a comprehensive ClamAV guide:
https://github.com/vrtadmin/clamav-faq

http://www.clamav.net/contact.html#ml