Join our Newsletter — 33% off our NHI Course
Home› Guides› SMTP 535 5.7.8: Authentication Credentials Invalid and SMTP…
Guide Email & Communications Security

SMTP 535 5.7.8: Authentication Credentials Invalid and SMTP AUTH Spraying

PDF for newsletter subscribers · free to read online

← All guides
By NHI Mgmt Group, under the editorial direction of Lalit Choda Updated 27 November 2026 14 min read
On this page

A "535 5.7.8 Authentication credentials invalid" reply means a mail server refused the username and password an SMTP client offered, and the same line appears whether a scanner has a stale password or an attacker is spraying thousands of mailboxes. Telling the two apart quickly matters, because a single broken device is a help desk ticket while a burst of 535 replies across many accounts is a credential attack against one of the last places Basic authentication still survives. This guide explains what the code means in the standards, triages the benign causes, shows the log fields that reveal spraying, and sets out how to shut the door by disabling Basic SMTP AUTH. It is for email administrators and SOC analysts running Exchange Online, Google Workspace or self-hosted mail servers such as Postfix. It is defensive only: it describes how spraying looks in logs, not how to perform it.

Key takeaways

  • 535 5.7.8 is a permanent credential failure. RFC 4954 defines it as authentication failing because of invalid or insufficient credentials, and tells the client to ask the user for new ones rather than retry silently.
  • Most single-account failures are benign. Changed passwords, MFA enrolment, disabled Basic authentication and wrong usernames account for the majority of one-off 535 replies from known devices.
  • The pattern, not the code, reveals spraying. Many distinct usernames failing from one source, or one password tried across many accounts at a slow rate, is the signature of ATT&CK T1110.003 Password Spraying.
  • Disabling Basic SMTP AUTH removes the target. In Exchange Online an authentication policy blocks Basic authentication before the request reaches the identity provider, so sprayed passwords are never even tested.
  • The senders that remain are non-human identities. Printers, applications and app passwords that still use SMTP AUTH need an owner, a single mailbox, OAuth or a relay, and monitoring.

What 535 5.7.8 means

An SMTP reply carries two codes. The three digit basic code (535) comes from SMTP itself and the enhanced status code (5.7.8) adds detail in the class.subject.detail format registered by IANA. Class 5 is a permanent failure, so the server is saying that resending the same thing will not work. Subject 7 covers security or policy, and detail 8 is "Authentication credentials invalid", defined in RFC 4954, the SMTP Service Extension for Authentication (Standards Track, July 2007, which obsoletes RFC 2554). The IANA registry lists 535 and 554 as the basic codes that may accompany X.7.8.

The code is only returned in response to the AUTH command. The client offers a SASL mechanism (typically PLAIN or LOGIN for passwords, XOAUTH2 for OAuth tokens), the server sends 334 challenges, and the exchange ends with 235 2.7.0 on success or a failure code. RFC 4954 says that after 535 5.7.8 the client should ask the user for new credentials, for example with a password dialog. Unattended devices cannot do that, which is why a failing scanner may retry in a loop and generate the same volume of failures an attacker would.

Related AUTH reply codes

ReplyMeaning (RFC 4954 / RFC 5248)What it usually tells you
235 2.7.0Authentication succeededA successful AUTH; after a run of 535 replies from the same source, treat it as a possible compromise
535 5.7.8Authentication credentials invalidWrong password or username, or the server's policy refuses the credential type
534 5.7.9Authentication mechanism is too weakServer policy needs a stronger mechanism for that user; the client should retry with one
454 4.7.0Temporary authentication failureServer side fault such as a back-end directory being unreachable; the client should not reprompt for a password
530 5.7.0Authentication requiredThe client tried to send (MAIL FROM) without authenticating first
538 5.7.11Encryption required for the mechanismKept for historical purposes; modern servers should not advertise plaintext mechanisms before TLS
525 5.7.13User account disabledAn administrator disabled the account (RFC 5248)
535 5.7.14Trust relationship requiredThe submission server needs a configured trust with a third party server (RFC 5248, replacing an earlier use of X.7.8)

Providers add their own text and sometimes their own detail codes after the number. Exchange Online, for instance, returns 535 5.7.3 Authentication unsuccessful when an OAuth SMTP sign-in fails. Read the full reply text, not just the number, and record it in the ticket.

Benign causes

Start every investigation of a single account by assuming a configuration fault, then rule it out. The table covers the causes seen most often in practice.

CauseClue in the logs or replyFix
Password changed or expired, device not updatedOne account, one known source IP, failures start on the day of a resetMove the sender to OAuth or a relay rather than typing the new password into the device
Basic authentication disabled for the tenant or mailboxStarted after a policy change or a provider retirement date; Exchange may return its own 5.7.x textUse OAuth (XOAUTH2) or a relay; see the Exchange Online SMTP AUTH Basic Auth Retirement
MFA enforced on the accountCorrect password still rejected; sign-in log shows an MFA or Conditional Access interruptionDo not exclude the account from MFA; move the device off password authentication
Wrong username formatDevice sends a short name or a display name instead of the full addressUse the full user principal name or email address
App password revoked or not createdAccount has 2-Step Verification and the device uses the normal passwordPrefer OAuth or relay; if an app password is unavoidable, issue one per device and record it
Provider retired username and password sign-inGoogle Workspace: from 1 May 2025 less secure apps and devices that sign in with a username and password are no longer supportedOAuth, the Workspace SMTP relay service (IP authenticated) or smtp.gmail.com with an app password
Account locked or disabledSign-in log shows a lockout error; or 525 5.7.13 from servers that use RFC 5248Find what locked it before unlocking; a lockout can be the first sign of spraying
Wrong mechanism or TLS orderClient sends AUTH before STARTTLS and the server does not advertise PLAIN or LOGIN yetConfigure the client for STARTTLS on 587 or implicit TLS on 465

A benign cause has a recognisable shape: one account, one source the organisation owns, and a start time that lines up with a change. Anything that breaks that shape moves to the next section.

Spraying and brute force patterns

SMTP AUTH attracts password attacks because it often accepts a plain username and password, is reachable from the internet on ports 587 and 465, and in many tenants sits on accounts excluded from MFA so devices keep working. MITRE ATT&CK describes the relevant behaviours under T1110 Brute Force.

PatternATT&CKHow it shows up in 535 data
Password sprayingT1110.003Many different usernames, few attempts each, often one password per round, spread over hours from one IP or a rotating pool
Password guessingT1110.001One username, many different passwords in a short window, frequently ending in a lockout
Credential stuffingT1110.004Username and password pairs from breach lists; low failure rate per account, scattered successes, addresses that include former staff and aliases
Use of a valid cloud accountT1078.004A 235 2.7.0 or successful sign-in after failures, followed by sending from an unusual location or volume
Remote email collectionT1114.002After a spray succeeds, the same credential used on IMAP, POP or web mail to read the mailbox

Three signals separate a spray from a broken device. Breadth: the number of distinct usernames failing from one source per hour. Unknown targets: attempts against addresses that do not exist, former employees or role aliases nobody signs in to. Source: hosting provider or residential proxy ranges instead of your office or a known vendor. Attackers deliberately stay below lockout thresholds, so a quiet, wide pattern is more worrying than a loud, narrow one. See the Password Spraying and Credential Stuffing Defence Guide for the wider defence.

Detection in mail and sign-in logs

Collect three sources: the mail server or provider's SMTP log, the identity provider's sign-in log, and any SMTP client report the provider offers. The fields below are the ones to keep in your SIEM.

SourceFields to keepUse
Microsoft Entra sign-in logs (interactive and non-interactive)Client app, Sign-in error code and failure reason, IP address, Location, Conditional Access status, isInteractiveFilter Client app for legacy protocols; "Not Applied" Conditional Access on a legacy sign-in shows a policy gap
Exchange Online SMTP AUTH clients reportSender address, Authentication Protocol (Basic or Modern), TLS version, volume, up to 90 daysInventory of who still authenticates, and new senders that appear without a ticket
Postfix and similar MTAsSASL failure lines with client hostname and IP, SASL username, mechanism, TLS stateCount distinct usernames per client IP; flag AUTH attempted without TLS
Firewall or load balancerConnections to 587 and 465 by source, geolocation, ASNSpot new sources hitting submission ports and rate limit them
Help desk and lockout recordsLockout events and reset requests by accountClusters of lockouts across unrelated users point to spraying

Run detections such as these, tuned to your baseline:

  1. Breadth rule: more than a set number of distinct usernames with 535 or a failed legacy sign-in from one IP in an hour.
  2. Success after failures: a successful SMTP AUTH or sign-in for an account within a short window after failures from the same source. Escalate immediately.
  3. Unknown account targeting: failures for usernames that do not exist in the directory.
  4. New legacy client: a first-seen account using a legacy Client app value, or a new sender in the SMTP AUTH clients report.
  5. Policy drift: changes to SmtpClientAuthenticationDisabled, authentication policies or Conditional Access exclusions.

For KQL against Entra logs, see How to detect password spraying in Entra ID sign-in logs with KQL, and for broader field coverage the Entra ID Sign-In and Audit Log Detection Guide.

Mitigation: disable SMTP AUTH, modern auth, lockout

Exchange Online

  • Organisation switch: Microsoft recommends turning SMTP AUTH off for the organisation and on only for mailboxes that still need it: Set-TransportConfig -SmtpClientAuthenticationDisabled $true. A per mailbox value set with Set-CASMailbox overrides the organisation, and $null means the mailbox follows the organisation.
  • Authentication policy: New-AuthenticationPolicy creates a policy with every AllowBasicAuth switch off, including AllowBasicAuthSmtp. Assign it with Set-User -AuthenticationPolicy or make it the default with Set-OrganizationConfig -DefaultAuthenticationPolicy. Microsoft documents that a blocked Basic request is stopped at the first pre-authentication step, before it reaches Entra ID or an on-premises identity provider, so spray attempts do not test passwords or trigger lockouts. Changes take up to 24 hours unless you force a refresh.
  • Federated caveat: for usernames that do not exist in Exchange Online, requests are still forwarded to on-premises AD FS during a spray, so keep AD FS extranet lockout in place.
  • Conditional Access: a policy that blocks the Exchange ActiveSync clients and Other clients conditions stops legacy authentication; create it in report-only mode first and exclude only emergency access accounts. See the Conditional Access Guide.
  • Security defaults: when Entra security defaults are on, SMTP AUTH and Basic authentication are already disabled.
  • Lockout: Entra smart lockout defaults to 10 failed attempts and a 60 second first lockout in Azure Public tenants, keeps separate counters for familiar and unfamiliar locations, and does not count repeats of the same bad password. It slows guessing but is not a fix for spraying, which stays under the threshold.

Google Workspace

  • OAuth or relay: username and password sign-in for less secure apps ended on 1 May 2025. Devices should use OAuth, the SMTP relay service at smtp-relay.gmail.com authenticated by IP address, or smtp.gmail.com with an app password where 2-Step Verification is on.

Self-hosted servers (Postfix example)

  • TLS before AUTH: set smtpd_tls_auth_only = yes so AUTH is offered only inside TLS.
  • Mechanism policy: include noanonymous in smtpd_sasl_security_options and keep noplaintext for unencrypted sessions; RFC 4954 requires servers to support a configuration with no plaintext mechanisms outside TLS.
  • Scope AUTH: offer SASL (smtpd_sasl_auth_enable) only on the submission service, not on port 25 inbound MX.
  • Rate limit and ban: throttle connections and AUTH attempts per client and block sources that exceed a failure threshold.

Implementation order

  1. Export 90 days of SMTP AUTH and legacy sign-in data and list every sender that still uses a password.
  2. Assign each sender an owner and a destination: OAuth SMTP, a relay connector, a high volume or relay service, or an API such as Microsoft Graph.
  3. Deploy the blocking Conditional Access or authentication policy in report-only mode or to a pilot group, and watch for 535 and failed sign-ins from known senders.
  4. Disable SMTP AUTH per mailbox as each sender moves, then at organisation level.
  5. Remove the MFA and Conditional Access exclusions that existed for those mailboxes, and reset their passwords.
  6. Rollback: re-enable SMTP AUTH on the single affected mailbox with a dated exception and owner, never tenant-wide.

Where identity fits

Every remaining SMTP AUTH sender is a non-human identity: a service mailbox in a printer, an application's password, or an app password. Each needs one purpose, one mailbox, an owner, a credential expiry and a review date. App passwords bypass MFA by design, and Microsoft notes that blocking Basic authentication also blocks app passwords, so plan their replacement. See the App Passwords Security Guide.

Common failure patterns

  • Treating 535 as noise: teams suppress the alert because devices fail all day, and miss the day the breadth tripled.
  • Tenant-wide re-enable: one broken printer leads to SMTP AUTH being turned back on for the whole organisation, reopening every mailbox.
  • MFA exclusions for devices: service mailboxes kept outside MFA and Conditional Access are the easiest accounts to spray and are rarely watched.
  • Lockout as the only control: thresholds stop guessing against one account but sprays stay below them, and aggressive lockout turns a spray into a denial of service.
  • Only watching interactive sign-ins: legacy protocol attempts often appear in non-interactive logs; filtering one tab hides them.
  • Ignoring the success after the failures: a 235 or successful sign-in following a burst of 535 replies is the event that matters and needs a password reset and session revocation straight away. Follow the Password Spraying Attack Response Playbook.

Measurement and framework mapping

  • Basic SMTP AUTH senders: count trending to zero.
  • Mailboxes with SMTP AUTH enabled: every one matched to a register entry with an owner.
  • Distinct usernames failing per source per day: baseline and alert on spikes.
  • Time to contain: from first success after failures to password reset and session revocation.
  • MFA exclusions for mail senders: trending to zero.
FrameworkReferenceHow it applies
NIST CSF 2.0PR.AA-03, DE.CM-03, DE.AE-02Senders authenticated with strong methods; usage monitored; failures analysed
NIST SP 800-53 Rev. 5AC-7, IA-2, IA-5, CM-7, AU-6, SI-4Unsuccessful logon handling, authentication, authenticator management, disabling unneeded protocols, log review, monitoring
MITRE ATT&CKT1110.003, T1110.001, T1110.004, T1078.004Spraying, guessing, stuffing and valid account use against SMTP AUTH

Practitioner checklist

  • Record the full reply text and source IP for every 535 5.7.8 investigation.
  • Run the benign cause triage before escalating a single account failure.
  • Alert on distinct usernames failing per source and on success after failures.
  • Collect both interactive and non-interactive sign-in logs and the SMTP AUTH clients report.
  • Disable SMTP AUTH at organisation level and enable it per mailbox only with an owner.
  • Apply an authentication policy or Conditional Access block for Basic and legacy authentication, piloted in report-only mode.
  • Move devices and applications to OAuth, relay or an API, and remove their MFA exclusions.
  • Require TLS before AUTH and no plaintext mechanisms on self-hosted submission services.
  • Register every remaining sending identity and app password with an expiry and review date.

Standards and references

Related NHI Mgmt Group resources: Exchange Online SMTP AUTH Basic Auth Retirement · Password Spraying and Credential Stuffing Defence Guide · Exchange Online Security Guide · App Passwords Security Guide

PDF for subscribers

Take this guide with you

Every section, table and checklist in one PDF, with links to the sources and related guides. Subscribe to our weekly NHI & AI Identity Journal and we’ll email you a download link.

Free weekly newsletter

Subscribe to the NHI & AI Identity Journal

The latest on NHI and Agentic AI security – articles, research, breaches, news and events every week.

Bonus 33% off our NHI Course when you subscribe.

PDF Downloads for Newsletter Subscribers

Get the guide

Enter your details and we’ll email you a download link.

The full guide is free to read online. The PDF is a thank you for subscribing.

Fill in all fields marked * and tick both boxes to continue.