Protecting email from spam and phishing: current threats and advanced solutions. Basic methods of protection against spam Spam and methods of protection against it


According to statistics, more than 80 percent of malware penetrates the local network through email. The mail server itself is also a tasty morsel for hackers - having gained access to its resources, the attacker gets full access to archives of emails and lists of email addresses, which allows them to obtain a lot of information about the life of the company, projects and work carried out in it. After all, even lists of email addresses and contacts can be sold to spammers or used to discredit a company by launching attacks on those addresses or composing fake emails.

At first glance, spam is a much lesser threat than viruses. But:

  • A large flow of spam distracts employees from performing their tasks and leads to an increase in non-production costs. According to some data, after reading one letter, an employee needs up to 15 minutes to get into a working rhythm. If more than a hundred unwanted messages arrive per day, then their need to view them significantly disrupts current work plans;
  • spam facilitates the penetration of malware into the organization, disguised as archives or exploiting vulnerabilities of email clients;
  • a large flow of letters passing through the mail server not only degrades its performance, but also leads to a decrease in the available part of the Internet channel and an increase in the cost of paying for this traffic.

Spam can also be used to carry out some types of attacks using social engineering methods, in particular phishing attacks, when the user receives letters disguised as messages from completely legal individuals or organizations, asking them to perform some action - for example, enter a password for their account. bank card.

In connection with all of the above, the email service requires protection without fail and first of all.

Description of the solution

The proposed solution for protecting an enterprise's email system provides:

  • protection against computer viruses and other malicious software distributed via email;
  • protection against spam, both arriving to the company by e-mail and distributed over the local network.

Modules can be installed as additional modules of the protection system;

  • protection against network attacks on the mail server;
  • anti-virus protection of the mail server itself.

Solution Components

The mail service protection system can be implemented in several ways. The choice of the appropriate option is based on:

  • the information security policy adopted by the company;
  • operating systems, management tools, security systems used in the company;
  • budget restrictions.

The right choice allows you not only to build a reliable protection scheme, but also to save a significant amount of money.

As examples, we give the options “Economy” and “Standard”

The “Economy” option is built on the Linux operating system and makes maximum use of free products. Composition of the variant:

  • anti-virus and anti-spam subsystem based on products from Kaspersky Lab, Dr.Web, Symantec. If your company uses a demilitarized zone, it is recommended to move the mail traffic protection system into it. It should be noted that products designed to work in the demilitarized zone have greater functionality and greater capabilities for detecting spam and attacks than standard ones, which improves network security;
  • firewall subsystem based on iptables2 firewall and management tools standard for the Linux operating system;
  • attack detection subsystem based on Snort.

Mail server security analysis can be done using Nessus

The solution based on the “Standard” option includes the following subsystems:

  • subsystem for protecting mail server and mail gateway services from malware based on solutions from Kaspersky Lab, Dr.Web, Eset, Symantec or Trend Micro;
  • firewall and attack detection subsystem based on Kerio Firewall or Microsoft ISA.

Mail server security analysis can be done using XSpider

Both options above do not include instant messaging and webmail security modules by default
Both the “Economic” option and the “Standard” option can be implemented on the basis of software products certified by the FSB and FSTEC, which allows them to be supplied to government agencies and companies with an increased level of security requirements.

Advantages of the proposed solution

  • the solution provides reliable protection against the penetration of malware and spam;
  • Optimal selection of products allows you to implement a protection scheme that takes into account the needs of a specific client.

It should be noted that a full-fledged security system can only function if the company has an information security policy and a number of other documents. In this regard, Azone IT offers services not only for the implementation of software products, but also for the development of regulatory documents and auditing.

You can obtain more detailed information about the services provided by contacting the specialists of our company.

Introduction to the problem

We all know what spam is because we have either encountered it or read about it. We all know how spammers collect email addresses. It is also no secret that spam cannot be completely defeated. The problem is how to maximally protect users who leave their contact details on your website with minimal effort.

Previously tested methods of protection

The biggest threat to mailboxes comes from programs that download websites and take mailing addresses from the text of pages. They either download only your site, or roam, like search engines, throughout the entire network. If your site is small, the following text auto-replacement protection is quite sufficient:

]+href=)([""]?)mailto:(+)()@".
"()(+.(2,4))2([ >])~i", "1"mailto: [email protected]"
onMouseover="this.href="mai" + "lto:3" + "4" + "%40" + "5" + "6";"7", $text); ?>

Unfortunately, it won't work if you have a large site. Let's say spectator.ru, whose author was one of the first to use this method. If I were a spammer, I would go into personal settings, check the “do not show ears” checkbox, 1000 reviews on the page, and catch cookies with Proxomitron. Then, using a rocker or a PHP script, I would download pages with comments (substituting cookies with settings) and use a regular expression to catch the addresses. I would get a small base for advertising mailings.

There were a couple more protection methods in which the mailto: link was automatically replaced with some other one, but the effect remained the same - when you clicked on it, the system client would create a letter to the desired address. Both of them did not stand up to criticism.

Meet the hedgehogs

Obviously, it is difficult to come up with another method of protection other than what has already been tested - providing a form on the site for sending a message. Let's start designing it. The advantages of this method are obvious: no one will be able to get addresses for their spam database from your website. It will not be possible to send messages by hiding your address, as spammers do - the web server will record its IP address. Lists of public anonymous proxy servers are regularly updated, and it is easy to block access from them.

Form sender

Let's start with this, because this is the most difficult part.

When installing a form sender on a site, it is important to protect it from hooligan attacks, which can be no easier than spam. Therefore, we will have to make great efforts in this direction.

First, let's protect ourselves from stupid double clicks and sending many identical requests. The idea is this: the message will not be sent if the user has not previously opened the page with the form, and by opening the page with the form, the message can be sent only once. This can be done using sessions built into PHP. When opening a page with a form, we will launch a session in which we will save a variable, say $flag. We will display the session ID as a hidden element at the very end of the form. The user enters a message and submits the form. Upon receiving the form, the script starts a session and checks the presence and value of the $flag variable. If the variable does not exist, then this is a repeated click, the letter is not sent and an error message is displayed. If the variable exists, and the form data suits us (the required fields are filled in), the script sends a letter and deletes the session.

Secondly, let’s protect ourselves from smart hooligans by recording message logs. If the user submits a correctly filled out form, the script will look at the logs and check what is there. Yes, it should be banned

* send messages to the same address more often than a certain period
* send the same text to different addresses
* and simply use the form sender too often - say, no more than 10 messages per day per user

We display the session ID at the very end of the form, so that the hacker would need to download the entire form and parse it, which is more complicated than simply sending HTTP requests. Naturally, the form sender will issue messages about errors in writing the message, a requirement to indicate a return address, etc.

The resulting form sender code turned out to be too large to include in the text. It has been archived on the website. It seems that the script is working and sending messages.

Replacing addresses in text

Now the form sender is ready, and you need to replace all emails with links to it. Of course, you shouldn't do this manually. For myself, I wrote a script that automatically replaces addresses with links to the form sender.

...Disadvantages: more time for arranging links (compensated by the directory of links), the user, when hovering the cursor over a link, does not see what address he will go to. (Dmitry Smirnov, “Ideal author’s project, hypertextuality”)

All the mentioned disadvantages can be easily eliminated if you use code similar to the one I will now describe and show.

There is nothing complicated here; if these are links, then “more time for arrangement” is not required. On my site I use an engine script that is called by all pages, so it’s not a problem to add code to it or call it from it that replaces addresses. Mailing addresses were and are written directly in the text of the pages, but before being displayed to the user they are replaced with the required text. Compiling a database of links or email addresses is not a problem.

So what does an address replacer do? It searches for “mailto:” links in the text, selects addresses from them, sends a query to the database to count (count(*)) how many addresses from those on the page are in a special table. If there are new addresses on the page, then their number will be greater than the query result. In this case, a query is made in which address values ​​are selected, and those already existing in the table are excluded from the list. The remaining list is sent to the table using an INSERT query.

As for ID addresses, in my opinion it is better to use something that a site visitor could not find. Can you imagine the link /email.php?id=10 leading to the form sender? What a temptation to put 11, 12, etc. there. and try sending them all a message. Therefore, I decided to use the md5 hash of the addresses as identifiers. It’s unlikely that anyone will undertake to select the hash. In the case of a directory of links, you can get by with ID, but then you have to select all the values ​​from the database, and replacing addresses with their hashes is much simpler.

A command of the form is executed

]+href=)". "([""]?)mailto:(+@+". ".(2,4))2(.*?>)~ie", ""12"/email.php ?email=". urlencode(md5("3")). ""4"", $text); ?>

...which replaces addresses with their hashes. I did not dare replace the remaining addresses in the text with links, but made a simple replacement with addresses like vasya_at_pupkin_dot_ru. The autoreplacement code is also in the archive.

Bottom line

Hiding email addresses from visitors is quite easy. The autocorrect mechanism does not require additional effort, and you can continue writing site pages as if nothing had happened. Difficulties arise when protecting the form sender from web hooligans. This protection requires a lot of effort and complex code, so I have not yet used written code on the site. You can download an archive with an address substitute and a form sender, but I ask you very much: do not put it on your site in the form in which you downloaded it, I myself don’t know how reliably it works.

What methods are there to combat spam?

There are two main methods of protecting a mail server from spam: protecting against spam when it is received by the mail server, and separating spam from the rest of the mail after it is received by the mail server.

Among the first method, the most popular methods are the use of DNS Black List (DNSBL), Greylisting and various delays when sending mail; using various technical means, such as checking the existence of a user on the sending side (callback), checking the “correctness” of the sending server using methods such as the presence of a record in the reverse DNS zone, the legality of the name when setting up an SMTP session (helo), checking the SPF record (for work This means that the DNS entry for the host uses the corresponding entry for the legitimate sending servers).

Among the methods for analyzing the content of a letter, the most popular methods are checking using various algorithms, such as searching for special advertising keywords or based on Bayes’ theorem. The algorithm based on Bayes' theorem contains elements of probability theory, is initially trained by the user on messages that, in his opinion, are spam, and subsequently separates messages that contain spam based on characteristic features.

So, let's take a closer look at these email filtering methods.

Black lists or DNSBL (DNS Black Lists)

Blacklists include addresses from which spam is sent. Widely used lists are “open relays” and “open proxies”, and various lists of dynamic addresses that are allocated by providers to end users. Due to their ease of implementation, the use of these blacklists is done through the DNS service.

Gray lists or greylisting

The operating principle of greylisting is based on spamming tactics. As a rule, spam is sent in a very short time in large quantities from some server. The work of a gray list is to deliberately delay the receipt of letters for some time. In this case, the address and time of forwarding are entered into the gray list database. If the remote computer is a real mail server, then it must store the letter in a queue and resend it within five days. Spambots, as a rule, do not save letters in the queue, so after a short time they stop trying to forward the letter. It has been experimentally established that on average the time it takes to send spam is just over an hour. When resending a letter from the same address, if the required amount of time has passed since the first attempt, the letter is accepted and the address is added to the local white list for a sufficiently long period.

Performance Analysis

The first two methods allow you to filter out about 90% of spam at the stage of delivery to the mailbox. Already delivered mail can be marked by means of analyzing the contents of the letter, for example, using the SpamAssassin program. This product allows, based on special algorithms, to add corresponding lines to the headers of letters, and the user, based on mail filters in the mail client, can filter mail into the necessary folders of the mail program.

Conclusion

Of course, there are other ways to protect against spam, the most effective, unfortunately, at the moment are preventive measures, such as not leaving your real email address on websites, forums and message boards, using temporary addresses for such needs, which are subsequently can be deleted, if it is necessary to publish the mailbox on the site, use a graphic image and similar measures instead of text.

You can connect and configure GreyListing through the ISPmanager panel in the "Features" section

You can find out more about setting up anti-spam methods through the control panel here DNSBL and here Greylisting.

Blacklists

Blacklists include IP addresses from which spam is sent.

To configure, go to the section Spam protection-> Blacklists and click the "Create" button. In field Sender specify the IP address of the mail server (or the first digits of this address), the mail domain, or a separate email address for which mail forwarding will be prohibited (depending on the installed mail client, the entry formats will vary).

Greylisting

The principle of operation of gray lists is based on spamming tactics. As a rule, spam is sent in a very short time in large quantities from some server. The work of a gray list is to deliberately delay the receipt of letters for some time. In this case, the address and time of forwarding are entered into the gray list database. If the remote computer is a real mail server, then it must store the letter in a queue and resend it within five days. Spambots, as a rule, do not save letters in the queue, so after a short time they stop trying to forward the letter. When resending a letter from the same address, if the required amount of time has passed since the first attempt, the letter is accepted and the address is added to the local white list for a sufficiently long period. One of the disadvantages of the method is the possibility of a mail delivery delay of 15 minutes or more, depending on the sender’s server settings.

Greylisting is configured in the Greylisting module, where you need to specify the required parameters. Greylisting in the ISPmanager panel works through two applications - Milter-greylisting and Postgrey, which must first be activated in the Features section.

dnslb blocking

DNSBL (DNS blacklist) - lists of hosts stored using the DNS system. The mail server contacts the DNSBL and checks it for the IP address from which it is receiving the message. If the address is in this list, then it is not accepted by the server, and a corresponding message is sent to the sender

In chapter Spam protection Select dnsbl blocking, click the New button and add a new dnsbl blocking list. In field Block list specify the block list domain name. This server will request information about the presence of a particular mail server on the black list.

Here you can find the most common block lists: http://www.dnsbl.info/dnsbl-list.php

Message limit

Another way to combat spam is to set a limit on the number of messages.

This functionality is available if you have Exim installed.

SpamAssasin

The SpamAssasin (SA) program allows you to analyze the contents of an already delivered letter. You can add appropriate lines to the letter headers, and the user, based on mail filters in the mail client, can filter mail into the necessary folders of the mail program.

To be able to use SA in the ISPmanager panel, activate it in the Capabilities module. By default, after activation, the automatic self-learning function will be enabled, but, in addition, the effectiveness of spam retention can be significantly increased using “manual” filter training.

Setting up a mailbox and mail domain

To completely disable Greylisting checking for any recipient address or domain (for example, if you do not want the mail to be subject to this check), go to the module

The following technologies are used to protect mail servers:

There are two main methods of protecting spam: protecting against the arrival of spam when the mail is received by the server, and separating spam from the rest of the mail after receipt.

Blacklists. IP addresses from which spam is sent are blacklisted.

Gray lists or greylisting. The principle of operation of gray lists is based on spamming tactics. As a rule, spam is sent in a very short time in large quantities from some server. The work of a gray list is to deliberately delay the receipt of letters for some time. In this case, the address and time of forwarding are entered into the gray list database. If the remote computer is a real mail server, then it must store the letter in a queue and resend it within five days. Spambots, as a rule, do not save letters in the queue, so after a short time they stop trying to forward the letter. When resending a letter from the same address, if the required amount of time has passed since the first attempt, the letter is accepted and the address is added to the local white list for a sufficiently long period.

DNSBL (DNS blacklist)– lists of hosts stored using the DNS system. The mail server contacts the DNSBL and checks it for the IP address from which it is receiving the message. If the address is in this list, then it is not accepted by the server, and a corresponding message is sent to the sender

Message limit. Setting a limit on the number of messages.

Program SpamAssasin(SA) allows you to analyze the contents of an already delivered letter. SpamAssassin comes with a large set of rules that determine which emails are spam and which are not. Most rules are based on regular expressions that are matched against the message body or header, but SpamAssassin also uses other techniques. In the SpamAssassin documentation these rules are called "tests".

Each test has some "cost". If the message passes the test, this "cost" is added to the overall score. The value can be positive or negative, positive values ​​are called "spam", negative values ​​are called "ham". The message goes through all the tests and a total score is calculated. The higher the score, the more likely the message is spam.

SpamAssassin has a configurable threshold, above which a letter will be classified as spam. Typically the threshold is such that the letter must meet several criteria; triggering only one test is not enough to exceed the threshold.

The following technologies are used to protect websites from spam:

1. Captcha picture. Those. the user is shown arbitrary text that the user must enter to perform some action.

2. Text captchas– the subscriber must enter the answer to the proposed question to confirm his actions.

3. Interactive captcha– a less common, but very useful type of protection. For example, to confirm actions, the user will be asked to solve an easy puzzle - for example, assemble a picture from three or four parts.







2024 gtavrl.ru.