Sender Policy Framework
   HOME

TheInfoList



OR:

Sender Policy Framework (SPF) is an
email authentication Email authentication, or validation, is a collection of techniques aimed at providing verifiable information about the origin of email messages by validating the domain ownership of any message transfer agents (MTA) who participated in transferrin ...
method designed to detect forging sender addresses during the delivery of the email. SPF alone, though, is limited to detecting a forged sender claim in the envelope of the email, which is used when the mail gets bounced. Only in combination with DMARC can it be used to detect the forging of the visible sender in emails (
email spoofing Email spoofing is the creation of email messages with a forged sender address. The term applies to email purporting to be from an address which is not actually the sender's; mail sent in reply to that address may bounce or be delivered to an unr ...
), a technique often used in
phishing Phishing is a type of social engineering where an attacker sends a fraudulent (e.g., spoofed, fake, or otherwise deceptive) message designed to trick a person into revealing sensitive information to the attacker or to deploy malicious softwa ...
and
email spam Email spam, also referred to as junk email, spam mail, or simply spam, is unsolicited messages sent in bulk by email (spamming). The name comes from a Monty Python sketch in which the name of the canned pork product Spam is ubiquitous, unavoida ...
. SPF allows the receiving mail server to check during mail delivery that a mail claiming to come from a specific domain is submitted by an IP address authorized by that domain's administrators. The list of authorized sending hosts and IP addresses for a domain is published in the DNS records for that domain. Sender Policy Framework is defined in RFC 7208 dated April 2014 as a "proposed standard".


History

The first public mention of the concept was in 2000 but went mostly unnoticed. No mention was made of the concept again until a first attempt at an SPF-like specification was published in 2002 on the
IETF The Internet Engineering Task Force (IETF) is a standards organization for the Internet and is responsible for the technical standards that make up the Internet protocol suite (TCP/IP). It has no formal membership roster or requirements an ...
"namedroppers" mailing list by Dana Valerie Reese, who was unaware of the 2000 mention of the idea. The very next day,
Paul Vixie Paul Vixie is an American computer scientist whose technical contributions include Domain Name System (DNS) protocol design and procedure, mechanisms to achieve operational robustness of DNS implementations, and significant contributions to open ...
posted his own SPF-like specification on the same list. These posts ignited a lot of interest, led to the forming of the IETF Anti-Spam Research Group (ASRG) and their mailing list, where the SPF idea was further developed. Among the proposals submitted to the ASRG were "Reverse MX" (RMX) by Hadmut Danisch, and "Designated Mailer Protocol" (DMP) by Gordon Fecyk. In June 2003, Meng Weng Wong merged the RMX and DMP specifications and solicited suggestions from others. Over the next six months, a large number of changes were made and a large community had started working on SPF. Originally SPF stood for ''Sender Permitted From'' and was sometimes also called ''SMTP+SPF''; but its name was changed to ''Sender Policy Framework'' in February 2004. In early 2004, the IETF created the
MARID ''Marid'' ( ar, مارد ') is a type of devil in Islamic traditions. The Arabic word meaning ''rebellious'' is applied to such supernatural beings. In Arabic sources Etymology The word ''mārid'' is an active participle of the root ''m-r-d'' ...
working group and tried to use SPF and Microsoft's CallerID proposal as the basis for what is now known as Sender ID; but this collapsed due to technical and licensing conflicts. The SPF community returned to the original "classic" version of SPF. In July 2005, this version of the specification was approved by the
IESG The Internet Engineering Task Force (IETF) is a standards organization for the Internet and is responsible for the technical standards that make up the Internet protocol suite (TCP/IP). It has no formal membership roster or requirements and a ...
as an IETF ''experiment'', inviting the community to observe SPF during the two years following publication. On April 28, 2006, the SPF RFC was published as experimental RFC 4408. In April 2014
IETF The Internet Engineering Task Force (IETF) is a standards organization for the Internet and is responsible for the technical standards that make up the Internet protocol suite (TCP/IP). It has no formal membership roster or requirements an ...
published SPF in RFC 7208 as a "proposed standard".


Principles of operation

The
Simple Mail Transfer Protocol The Simple Mail Transfer Protocol (SMTP) is an Internet standard communication protocol for electronic mail transmission. Mail servers and other message transfer agents use SMTP to send and receive mail messages. User-level email clients typica ...
permits any computer to send email claiming to be from any source address. This is exploited by spammers and scammers who often use forged
email addresses An email address identifies an email box to which messages are delivered. While early messaging systems used a variety of formats for addressing, today, email addresses follow a set of specific rules originally standardized by the Internet Engine ...
, making it more difficult to trace a message back to its source, and easy for spammers to hide their identity in order to avoid responsibility. It is also used in
phishing Phishing is a type of social engineering where an attacker sends a fraudulent (e.g., spoofed, fake, or otherwise deceptive) message designed to trick a person into revealing sensitive information to the attacker or to deploy malicious softwa ...
techniques, where users can be duped into disclosing private information in response to an email purportedly sent by an organization such as a bank. SPF allows the owner of an Internet domain to specify which computers are authorized to send mail with envelope-from addresses in that domain, using
Domain Name System The Domain Name System (DNS) is a hierarchical and distributed naming system for computers, services, and other resources in the Internet or other Internet Protocol (IP) networks. It associates various information with domain names assigned t ...
(DNS) records. Receivers verifying the SPF information in
TXT record A TXT record (short for text record) is a type of resource record in the Domain name system (DNS) used to provide the ability to associate arbitrary text with a host or other name, such as human readable information about a server, network, data c ...
s may reject messages from unauthorized sources before receiving the body of the message. Thus, the principles of operation are similar to those of DNS-based blackhole lists ( DNSBL), except that SPF uses the authority delegation scheme of the Domain Name System. Current practice requires the use of TXT records, just as early implementations did. For a while a new record type (SPF, type 99) was registered and made available in common DNS software. Use of TXT records for SPF was intended as a transitional mechanism at the time. The experimental RFC, RFC 4408, section 3.1.1, suggested "an SPF-compliant domain name SHOULD have SPF records of both RR types". The proposed standard, RFC 7208, says "use of alternative DNS RR types was supported in SPF's experimental phase but has been discontinued". The envelope-from address is transmitted at the beginning of the SMTP dialog. If the
server Server may refer to: Computing *Server (computing), a computer program or a device that provides functionality for other programs or devices, called clients Role * Waiting staff, those who work at a restaurant or a bar attending customers and su ...
rejects the domain, the unauthorized
client Client(s) or The Client may refer to: * Client (business) * Client (computing), hardware or software that accesses a remote service on another computer * Customer or client, a recipient of goods or services in return for monetary or other valuabl ...
should receive a rejection message, and if that client was a relaying
message transfer agent Within the Internet email system, a message transfer agent (MTA), or mail transfer agent, or mail relay is software that transfers electronic mail messages from one computer to another using SMTP. The terms mail server, mail exchanger, and MX host ...
(MTA), a
bounce message A bounce message or just "bounce" is an automated message from an email system, informing the sender of a previous message that the message has not been delivered (or some other delivery problem occurred). The original message is said to have "bou ...
to the original envelope-from address may be generated. If the server accepts the domain, and subsequently also accepts the recipients and the body of the message, it should insert a Return-Path field in the message header in order to save the envelope-from address. While the address in the Return-Path often matches other originator addresses in the mail header such as the ''header-from'', this is not necessarily the case, and SPF does not prevent forgery of these other addresses such as ''sender'' header. Spammers can send email with an SPF PASS result if they have an account in a domain with a sender policy, or abuse a compromised system in this domain. However, doing so makes the spammer easier to trace. The main benefit of SPF is to the owners of email addresses that are forged in the Return-Path. They receive large numbers of unsolicited error messages and other auto-replies. If such receivers use SPF to specify their legitimate source IP addresses and indicate FAIL result for all other addresses, receivers checking SPF can reject forgeries, thus reducing or eliminating the amount of
backscatter In physics, backscatter (or backscattering) is the reflection of waves, particles, or signals back to the direction from which they came. It is usually a diffuse reflection due to scattering, as opposed to specular reflection as from a mirror, a ...
. SPF has potential advantages beyond helping identify unwanted mail. In particular, if a sender provides SPF information, then receivers can use SPF PASS results in combination with an allow list to identify known reliable senders. Scenarios like compromised systems and shared sending mailers limit this use.


Reasons to implement

If a domain publishes an SPF record, spammers and phishers are less likely to forge emails pretending to be from that domain, because the forged emails are more likely to be caught in spam filters which check the SPF record. Therefore, an SPF-protected domain is less attractive to spammers and phishers. Because an SPF-protected domain is less attractive as a spoofed address, it is less likely to be denylisted by spam filters and so ultimately the legitimate email from the domain is more likely to get through.


FAIL and forwarding

SPF breaks plain message forwarding. When a domain publishes an SPF FAIL policy, legitimate messages sent to receivers forwarding their mail to third parties may be rejected and/or bounced if all of the following occur: # The forwarder does not rewrite the
Return-Path {{No footnotes, date=June 2016 A bounce address is an email address to which bounce messages are delivered. There are many variants of the name, none of them used universally, including return path, reverse path, envelope from, envelope sender, M ...
, unlike mailing lists. # The next hop does not allowlist the forwarder. # This hop checks SPF. This is a necessary and obvious feature of SPF – checks ''behind'' the "border" MTA ( MX) of the receiver cannot work directly. Publishers of SPF FAIL policies must accept the risk of their legitimate emails being rejected or bounced. They should test (e.g., with a SOFTFAIL policy) until they are satisfied with the results. See below for a list of alternatives to plain message forwarding.


HELO tests

For an empty Return-Path as used in error messages and other auto-replies, an SPF check of the HELO identity is mandatory. With a bogus HELO identity the result NONE would not help, but for valid host names SPF also protects the HELO identity. This SPF feature was always supported as an option for receivers, and later SPF drafts including the final specification recommend to check the HELO always. This allows receivers to allowlist sending mailers based on a HELO PASS, or to reject all mails after a HELO FAIL. It can also be used in
reputation system Reputation systems are programs or algorithms that allow users to rate each other in online communities in order to build trust through reputation. Some common uses of these systems can be found on E-commerce websites such as eBay, Amazon.com, ...
s (any allow or deny list is a simple case of a reputation system).


Implementation

Compliance with SPF consists of three loosely related tasks: * Publishing a policy: Domains and hosts identify the machines authorized to send email on their behalf. They do this by adding additional records to their existing DNS information: every
domain name A domain name is a string that identifies a realm of administrative autonomy, authority or control within the Internet. Domain names are often used to identify services provided through the Internet, such as websites, email services and more. As ...
or host that has an
A record This list of DNS record types is an overview of resource records (RRs) permissible in zone file A Domain Name System (DNS) zone file is a text file that describes a DNS zone. A DNS zone is a subset, often a single domain, of the hierarchical ...
or MX record should have an SPF record specifying the policy if it is used either in an email address or as HELO/EHLO argument. Hosts which do not send mail should have an SPF record published which indicate such ("v=spf1 -all"). * Checking and using SPF information: Receivers use ordinary DNS queries, which are typically cached to enhance performance. Receivers then interpret the SPF information as specified and act upon the result. * Revising mail forwarding: Plain mail forwarding is not allowed by SPF. The alternatives are: ** Remailing (i.e., replacing the original sender with one belonging to the local domain) ** Refusing (e.g., answering 551 User not local; please try ) ** Allowlisting on the target server, so that it will not refuse a forwarded message **
Sender Rewriting Scheme The Sender Rewriting Scheme (SRS) is a scheme for bypassing the Sender Policy Framework's (SPF) methods of preventing forged sender addresses. Forging a sender address is also known as email spoofing. Background In a number of cases, including ...
, a more complicated mechanism that handles routing non-delivery notifications to the original sender Thus, the key issue in SPF is the specification for the new DNS information that domains set and receivers use. The records laid out below are in typical DNS syntax, for example: "v=spf1 ip4:192.0.2.0/24 ip4:198.51.100.123 a -all" "v=" defines the version of SPF used. The following words provide ''mechanisms'' to use to determine if a domain is eligible to send mail. The "ip4" and "a" specify the systems permitted to send messages for the given domain. The "-all" at the end specifies that, if the previous ''mechanisms'' did not match, the message should be rejected.


Mechanisms

Eight ''mechanisms'' are defined:


Qualifiers

Each ''mechanism'' can be combined with one of four ''qualifiers'': * + for a PASS result. This can be omitted; e.g., +mx is the same as mx. * ? for a NEUTRAL result interpreted like NONE (no policy). * ~ (tilde) for SOFTFAIL, a debugging aid between NEUTRAL and FAIL. Typically, messages that return a SOFTFAIL are accepted but tagged. * - (minus) for FAIL, the mail should be rejected (see below).


Modifiers

The ''modifiers'' allow for future extensions to the framework. To date only the two ''modifiers'' defined in the RFC 4408 have been widely deployed: *exp=some.example.com gives the name of a domain with a DNS TXT record (interpreted using SPF's macro language) to get an explanation for FAIL results—typically a URL which is added to the SMTP error code. This feature is rarely used. *redirect=some.example.com can be used instead of the ALL-''mechanism'' to link to the policy record of another domain. This ''modifier'' is easier to understand than the somewhat similar INCLUDE-''mechanism''.


Error handling

As soon as SPF implementations detect syntax errors in a sender policy they must abort the evaluation with result PERMERROR. Skipping erroneous ''mechanisms'' cannot work as expected, therefore include:bad.example and redirect=bad.example also cause a PERMERROR. Another safeguard is the maximum of ten mechanisms querying DNS, i.e. any mechanism except from IP4, IP6, and ALL. Implementations can abort the evaluation with result TEMPERROR when it takes too long or a DNS query times out or they can continue pretending that the query returned no data —which is called a "void lookup". However, they must return PERMERROR if the policy directly or indirectly needs more than ten queries for ''mechanisms''. In addition, they should return PERMERROR as soon as more than two "void lookups" have been encountered. Any redirect= also counts towards this ''processing limits''. A typical SPF HELO policy v=spf1 a mx ip4:192.0.2.0 -all may execute four or more DNS queries: (1) TXT record (SPF type was obsoleted by RFC 7208), (2) A or AAAA for mechanism a, (3) MX record and (4+) A or AAAA for each MX name, for mechanism mx. Except the first one, all those queries count towards the limit of 10. In addition if, for example, the sender has an IPv6 address, while its name and its two MX names have only IPv4 addresses, then the evaluation of the first two mechanisms already results in more than two void lookups and hence PERMERROR. Note that mechanisms ip4, ip6 and all need no DNS lookup.


Issues


DNS SPF Records

To enable rapid testing and deployment, initial versions of SPF checked for its setting in the DNS TXT record of the sending domain - even though this record was traditionally supposed to be free-form text with no semantics attached.Steve Bellovin expresses doubts
(Jan 2004)
Although in July 2005,
IANA The Internet Assigned Numbers Authority (IANA) is a standards organization that oversees global IP address allocation, autonomous system number allocation, root zone management in the Domain Name System (DNS), media types, and other Interne ...
assigned a specific Resource Record type 99 to SPF the uptake of was never high, and having two mechanisms was confusing for users. In 2014 the use of this record was discontinued after the SPFbis working group concluded that ''" ...significant migration to the SPF RR type in the foreseeable future was very unlikely and that the best solution for resolving this interoperability issue was to drop support for the SPF RR type."''


Header limitations

As SPF increasingly prevents spammers from spoofing the envelope-from address, many have moved to only spoof the address in the From field of the mail header, which is actually displayed to the recipient rather than only processed by the recipient's
message transfer agent Within the Internet email system, a message transfer agent (MTA), or mail transfer agent, or mail relay is software that transfers electronic mail messages from one computer to another using SMTP. The terms mail server, mail exchanger, and MX host ...
(MTA). SPF (or
DKIM DomainKeys Identified Mail (DKIM) is an email authentication method designed to detect forged sender addresses in email (email spoofing), a technique often used in phishing and email spam. DKIM allows the receiver to check that an email claimed ...
) can be used together with DMARC though, to also check the From field of the mail header. This is called 'identifier alignment'. Custom proprietary implementations are required to protect against such display name spoofing and cannot utilize SPF.


Deployment

Anti-spam software such as
SpamAssassin Apache SpamAssassin is a computer program used for e-mail spam filtering. It uses a variety of spam-detection techniques, including DNS and fuzzy checksum techniques, Bayesian filtering, external programs, blacklists and online databases. It i ...
version 3.0.0 and ASSP implement SPF. Many
mail transfer agent The mail or post is a system for physically transporting postcards, letters, and parcels. A postal service can be private or public, though many governments place restrictions on private systems. Since the mid-19th century, national postal syst ...
s (MTAs) support SPF directly such as
Courier A courier is a person or organisation that delivers a message, package or letter from one place or person to another place or person. Typically, a courier provides their courier service on a commercial contract basis; however, some couriers are ...
, CommuniGate Pro,
Wildcat The wildcat is a species complex comprising two small wild cat species: the European wildcat (''Felis silvestris'') and the African wildcat (''F. lybica''). The European wildcat inhabits forests in Europe, Anatolia and the Caucasus, while th ...
, MDaemon, and Microsoft Exchange, or have patches or plug-ins available that support SPF, including Postfix,
Sendmail Sendmail is a general purpose internetwork email routing facility that supports many kinds of mail-transfer and delivery methods, including the Simple Mail Transfer Protocol (SMTP) used for email transport over the Internet. A descendant of the ...
, Exim,
qmail qmail is a mail transfer agent (MTA) that runs on Unix. It was written, starting December 1995, by Daniel J. Bernstein as a more secure replacement for the popular Sendmail program. Originally license-free software, qmail's source cod ...
, and
Qpsmtpd qpsmtpd is an SMTP daemon written in Perl. It was originally designed to be a drop-in replacement for ''qmail-smtpd'', the SMTP component of qmail, and it is now also compatible with Postfix, Exim, sendmail and virtually any software that "spea ...
. As of 2017, more than eight million domains publish SPF FAIL -all policies. In a survey published in 2007, 5% of the .com and .net domains had some kind of SPF policy. In 2009, a continuous survey run at Nokia Research reports that 51% of the tested domains specify an SPF policy. These results can include trivial policies like v=spf1 ?all. In April 2007, BITS, a division of the Financial Services Roundtable, published email security recommendations for its members including SPF deployment. In 2008, the Messaging Anti-Abuse Working Group (MAAWG) published a paper about
email authentication Email authentication, or validation, is a collection of techniques aimed at providing verifiable information about the origin of email messages by validating the domain ownership of any message transfer agents (MTA) who participated in transferrin ...
covering SPF, Sender ID, and DomainKeys Identified Mail (DKIM). In their "Sender Best Communication Practices" the MAAWG stated: "At the very least, senders should incorporate SPF records for their mailing domains". In 2015, the Messaging Anti-Abuse Working Group (MAAWG) revised a paper about
email authentication Email authentication, or validation, is a collection of techniques aimed at providing verifiable information about the origin of email messages by validating the domain ownership of any message transfer agents (MTA) who participated in transferrin ...
covering SPF, DomainKeys Identified Mail (DKIM), and DMARC (DMARC). In their revised "Sender Best Communication Practices" the MAAWG stated: "Authentication supports transparency by further identifying the sender(s) of a message, while also contributing to the reduction or elimination of spoofed and forged addresses".


See also

* DomainKeys Identified Mail (DKIM) * Author Domain Signing Practices * DMARC


References

{{Reflist, 2, refs= {{ Cite web , url = https://www.digitalocean.com/community/tutorials/how-to-use-an-spf-record-to-prevent-spoofing-improve-e-mail-reliability , title = How To use an SPF Record to Prevent Spoofing & Improve E-mail Reliability , access-date = 2019-09-23 , first = Pablo , last = Carranza , date = 2013-07-16 , website =
DigitalOcean DigitalOcean Holdings, Inc. () is an American multinational technology company and cloud service provider. The company is headquartered in New York City, New York, USA, with 15 globally distributed data centers worldwide. DigitalOcean provide ...
, quote = A carefully tailored SPF record will reduce the likelihood of your domain name getting fraudulently spoofed and keep your messages from getting flagged as spam before they reach your recipients. Email spoofing is the creation of email messages with a forged sender address; something that is simple to do because many mail servers do not perform authentication. Spam and phishing emails typically use such spoofing to mislead the recipient about the origin of the message. , archive-url = https://web.archive.org/web/20150420105102/https://www.digitalocean.com/community/tutorials/how-to-use-an-spf-record-to-prevent-spoofing-improve-e-mail-reliability , archive-date = 2015-04-20 , df = dmy-all


External links

* IETF RFC4408: Sender Policy Framework (SPF) for Authorizing Use of Domains in Email, Version 1 EXPERIMENTAL (2006) * IETF RFC6652: Sender Policy Framework (SPF) Authentication Failure Reporting Using the Abuse Reporting Format, PROPOSED STANDARD (2012) * IETF RFC7208: Sender Policy Framework (SPF) for Authorizing Use of Domains in Email, Version 1, PROPOSED STANDARD (2014)
libspf2 – An Open Source Implementation of the SPF Protocol
(2010) *https://senderpolicyframework.com/ and https://www.spfwizard.net/ (tools for the generation, validation and configuration of the SPF record) Email authentication Internet architecture Internet governance Internet protocols Network addressing Spam filtering