Which Windows policies and registry values decide what an anonymous null-session SMB client can reach on a file server, and what are their defaults?
answer
- unauthenticated sessions, restricted by default
- two lists of exceptions
- a registry value that is 0 or 1
- Everyone is not in the anonymous token
- Samba's setting has three values
basics
~20 sThe policy "Restrict anonymous access to Named Pipes and Shares" sets RestrictNullSessAccess (Enabled by default), limiting null sessions to the pipes and shares listed in NullSessionPipes and NullSessionShares. "Let Everyone permissions apply to anonymous users" is Disabled by default.
solid answer
~40 sFive Security Options policies matter. **Restrict anonymous access to Named Pipes and Shares** sets `RestrictNullSessAccess` under `LanManServer\Parameters`; it is Enabled by default, so null sessions reach only what `NullSessionPipes` and `NullSessionShares` list. **Named Pipes that can be accessed anonymously** and **Shares that can be accessed anonymously** are those lists; Microsoft recommends a null value, and the pipes list only takes effect when the restrict policy is enabled. **Let Everyone permissions apply to anonymous users** is Disabled by default, so the anonymous token has no Everyone SID, and **Do not allow anonymous enumeration of SAM accounts and shares** is also Disabled by default. On Samba, `restrict anonymous` (default 0) and `map to guest` (default Never) are the equivalents.
go deeper
Recall that anonymous null sessions are restricted by default and that Everyone does not cover anonymous users.
Name the restrict policy, RestrictNullSessAccess and the two lists, and say the pipes list needs the restrict policy enabled.
Audit an old server's registry values and 5140 events for anonymous use before restoring defaults, and flag the two Microsoft sources that disagree on pipes.
Decide whether a legacy application that needs anonymous pipe access justifies an exception, with an owner and an end date.
## What a null session is A **null session** is an SMB connection made with no credentials. Windows allows it for a few narrow purposes, and the settings below decide what such a session can reach. The job in a file-server migration is to find the settings an old server still carries and return them to the restrictive values. ## The Windows settings and their defaults All four are under Computer Configuration, Windows Settings, Security Settings, Local Policies, Security Options. | Policy | What it controls | Default per Microsoft's pages | |---|---|---| | Network access: **Restrict anonymous access to Named Pipes and Shares** | Sets `RestrictNullSessAccess` to 1 under `HKLM\System\CurrentControlSet\Services\LanManServer\Parameters`, limiting anonymous access to the pipes and shares in the two lists below. | **Enabled** on a stand-alone server, a member server, a client and a domain controller; the Default Domain Policy leaves it Not defined. | | Network access: **Named Pipes that can be accessed anonymously** | The `NullSessionPipes` list. Best practice is a null value. Takes effect only when the restrict policy is also enabled. | Null on a stand-alone server; `Netlogon, samr, lsarpc` on a domain controller; Not defined on member servers and clients. | | Network access: **Shares that can be accessed anonymously** | The `NullSessionShares` list. Best practice is a null value. | Not defined. | | Network access: **Let Everyone permissions apply to anonymous users** | Whether the Everyone SID is added to the token made for anonymous connections. | **Disabled**. | | Network access: **Do not allow anonymous enumeration of SAM accounts and shares** | Stops anonymous users listing account names and shared resources. No effect on domain controllers. | **Disabled**. | Two Microsoft sources disagree on the pipe list. The policy page gives `Netlogon, samr, lsarpc` as a domain controller default, while MS-SRVS's product notes say Windows Server 2008 R2 and Windows 7 and later allow no pipes anonymously. Do not choose between them from a document: read the registry values on the machine. ## Why the Everyone setting matters for shares A share with Everyone at Full or Read does not by default serve null sessions: Microsoft states that the anonymous token does not include the Everyone SID. If **Let Everyone permissions apply to anonymous users** is Enabled, the SID is added and anonymous users can access any resource the Everyone group has permissions on. Disabled is the best practice. ## What changes when you restrict - Applications that rely on unauthenticated access to named pipes stop working once the pipes list is empty. - With "Do not allow anonymous enumeration of SAM accounts and shares" Enabled, users who browse a file server anonymously cannot list its shares; they must authenticate first. ## Seeing it in the logs Event 5140 and 5145 include the account name. For well-known principals such as `ANONYMOUS LOGON`, the account domain field is `NT AUTHORITY`. Reading share-access events for that account on an old server shows whether anything still depends on anonymous access before you change the policy. ## Samba | Samba parameter | Meaning | Default | |---|---|---| | `restrict anonymous` | `1` disables anonymous SAMR access; `2` also disallows anonymous connections to the IPC$ share in general. | `0` | | `map to guest` | What to do with logins that match no valid user: `Never`, `Bad User`, `Bad Password` or `Bad Uid`. | `Never` | | `guest ok` | If yes for a share, no password is required. The manual says it nullifies the benefit of `restrict anonymous = 2`. | `no` | ## A review checklist for the old server 1. Read the four registry-backed values on the server: `RestrictNullSessAccess`, `NullSessionPipes`, `NullSessionShares` and the Everyone setting, and record each against the default in the table. 2. For each exception, name the application or device that needs it and its owner. 3. Check the share-access events for the anonymous account to see whether anything uses the exceptions at all. 4. Restore the restrictive values on a pilot, then widen, and keep a written exception for anything that must stay. 5. On any Samba server in the same migration, read `restrict anonymous`, `map to guest` and every `guest ok` in the configuration. ## Rate-limiting repeated failures Separately, **Windows Server 2025 and Windows 11, version 24H2** turn on an SMB authentication rate limiter by default: a 2-second delay after each failed NTLM or PKU2U sign-in attempt. `Set-SmbServerConfiguration -InvalidAuthenticationDelayTimeInMs` sets it from 0 to 10000 in steps of 100, with 0 disabling it. Kerberos is not affected.
- You set Restrict anonymous access to Named Pipes and Shares to Disabled on an old server. What changes?`RestrictNullSessAccess` is no longer 1, so null sessions are no longer limited to the pipes and shares in `NullSessionPipes` and `NullSessionShares`. Microsoft's best practice is Enabled, and the effective default on servers and clients is Enabled.
- What does the SMB authentication rate limiter do, on which releases, and what does it not cover?On Windows Server 2025 and Windows 11, version 24H2, it is on by default and delays each failed NTLM or PKU2U authentication by 2000 ms. Set `InvalidAuthenticationDelayTimeInMs` (multiples of 100, 0 to 10000; 0 disables it). Kerberos is not affected.
- A Samba share has guest ok = yes while restrict anonymous = 2 is set. What is the effect?The manual says `guest ok = yes` on any share removes the security advantage of `restrict anonymous = 2`. The share still serves password-less connections, so the global setting no longer closes anonymous access overall.
- Everyone permissions always include anonymous users
- RestrictNullSessAccess is off by default on current Windows
- The null-session pipe list should hold every pipe tools use
- Restricting anonymous access changes nothing for legacy applications
- Samba's restrict anonymous defaults to 2