DedSec Application Security · · Updated
If a dynamic scanner is not logged in, it tests the login page, the public pages and whatever the API answers to anonymous callers, and the report still reads as a scan of the application. Getting it logged in is a choice between several mechanisms, and each one has a way of failing that looks exactly like a clean result.
Give the scanner its own test accounts in a staging environment: one per role you need to compare, at least two on each side of any tenant boundary, each with seeded data, and none of them production credentials. Then choose the login mechanism by how the application authenticates:
Then check, on every run, that the scan stayed logged in, as each identity you intended, for the whole run.
The rest of this post explains how each mechanism works, what breaks it, and which decisions need recording. Specifications are cited by section: RFC 6749 (OAuth 2.0), RFC 6750 (bearer tokens), RFC 7636 (PKCE), RFC 9700 (the OAuth 2.0 security best current practice), OpenID Connect Core 1.0, the OASIS SAML 2.0 Profiles specification, RFC 6238 (TOTP), and the OWASP Authentication and HTML5 Security cheat sheets, all read on 4 December 2026. No particular scanner's login behaviour is described; where a tool matters, the post says what the tool has to do, not how any one of them does it.
A session. Something the application accepts as proof of identity: a cookie, a bearer token, an API key.
The session for the whole scan. Tokens expire, applications enforce idle and absolute timeouts, and crawlers log themselves out. A scan that loses its session part-way through spends the rest of its time testing a login redirect, and why "the scan passed" is not "the scan ran" explains why the report looks clean anyway. Excluding logout and destructive links, refreshing rotating CSRF tokens on replay, configuring logged-in and logged-out indicators, and measuring which routes were reached are covered in the crawler-coverage post. This post assumes you do those things and concentrates on the login itself.
The right identities. One account in one role shows what that account can reach. It cannot show that it reaches something it should not, which is the whole class of authorisation bugs. That needs several identities, covered below.
| Mechanism | Fits | Can the scanner log in again by itself? | Typical silent failure |
|---|---|---|---|
| Form login performed by the scanner | Server-rendered applications with a username and password form | Yes, if it knows the form | Missing CSRF token or pre-login cookie; the test account locks |
| Pasted session cookie or bearer token | Any application, as a quick start | No | Expires mid-scan; everything after is anonymous |
| API key | APIs with service credentials | Not needed while the key is valid | The key is not a user, so user-level authorisation paths go untested |
| Scripted browser login | Single-page applications, JavaScript logins, redirects through an IdP | Yes, by re-running the script | The script breaks on a UI change; a token held in storage or memory never reaches the scanner's requests |
| OAuth client credentials | Machine-to-machine APIs | Yes | A machine identity: no user, no user roles |
| OAuth authorization code with PKCE | User-facing applications with an authorization server | Only through a browser step or a refresh token | Refresh-token rotation, consent screens, MFA at the provider |
| SAML SSO through the real IdP | Enterprise applications | Not reliably | MFA, conditional access and bot detection at the IdP; scanning a system you do not own |
| TOTP generated by the scanner | Authenticator-app MFA | Yes, with care at re-login | A code reused within one time step is refused; clock skew |
Automating a login form looks like one POST with a username and a password. Five details decide whether it works.
The field names are whatever the form says. username, email, login, user[email]. There may be hidden inputs the handler requires as well: a return URL, a tenant selector, a "remember me" flag that changes the session's lifetime. Copy the request a browser actually sends, from the developer tools network panel or a proxy, rather than rebuilding it from the visible fields.
The CSRF token comes from a GET before the POST. Many frameworks put an anti-CSRF token in a hidden input on the login page and tie it to a cookie set by the same response. The scanner has to request the login page, read the token from the body (or from the cookie, where the application uses a double-submit pattern) and send it with the POST from the same cookie jar. A recorded login replayed with yesterday's token is rejected, typically with a 403 or a redirect back to the form, and the scan carries on unauthenticated. Treat login as a two-request sequence.
Success has to be checked, not assumed. A failed login often answers 200 with an error on the same page and a successful one 302 to a dashboard, but some applications answer 302 to both. The status code is not evidence. After every login, check for something only a logged-in response contains: the account's name, or a who-am-I endpoint returning the expected user.
The test account has a lockout policy. The OWASP Authentication Cheat Sheet recommends that the failed-login counter be "associated with the account itself, rather than the source IP address". That is right for defence and awkward for scanning, because a scanner can lock its own account in at least three ways: retrying a login with a wrong or stale password; running login brute-force or rate-limit checks against the same account it authenticates with; and successfully fuzzing a password-change form, after which the stored password is wrong and every re-login fails. Keep the scanning account out of brute-force checks, exclude password-change and email-change forms from active testing or point them at a separate account, and know the lockout threshold and duration so a locked account is recognised instead of read as "no findings". Whether lockout and rate limiting work at all is a separate test with its own account; the login rate-limit post covers what that evidence has to show.
CAPTCHA has to be off in the test environment, and that has to be recorded. A scanner cannot solve a CAPTCHA and should not be made to try. Disable it in staging through configuration, not through a code path that could ship to production, and record three things: that it is disabled, that the scan therefore says nothing about whether CAPTCHA is present or effective, and how production is checked to still enforce it. The same goes for any bot-detection or risk-scoring layer in front of the login.
The fastest way to an authenticated scan is to log in by hand, copy the session cookie or the Authorization header from the browser, and paste it into the scanner. It works, with one structural problem: the scanner holds a credential it cannot renew.
It expires. A session cookie stops working at the application's idle or absolute timeout, whichever comes first, and a scanner that goes quiet between phases may not keep an idle timer alive. A bearer token stops at its expiry. For a JWT, read the exp claim before starting and compare it with the expected scan duration; for an opaque token, ask the application team or measure it. When the credential dies, the scanner keeps going without it. With no way to log in again, the only protection is detection: logged-out indicators and per-request evidence of the authenticated user, as the coverage post describes.
It is a live credential in a configuration file. Scan configurations, CI variables and scan logs are read by more people than production secrets are, and a pasted token is a session anyone who sees it can use until it expires. Log the session out on the server, or revoke the token, when the scan ends.
Send bearer tokens in a header, not the URL. RFC 6750 section 2.1 defines the Authorization: Bearer header, and section 2.3 a query-parameter form; its summary of recommendations, section 5.3, says bearer tokens "SHOULD NOT be passed in page URLs". RFC 9700 section 4.3.2 goes further: clients "MUST NOT pass access tokens in a URI query parameter" in that way. A scanner that can only add a token as a query parameter writes it into every access log the request passes through.
An API key is a different identity. A long-lived key solves expiry, but check what it authenticates as. In many applications an API key resolves to an organisation, a service account or an integration, and passes through different middleware from a user session: different scope checks, different rate limits, sometimes a different authorisation layer. A scan with an API key tests the API-key path. If the browser user's path is the one you care about, scan with a user session as well.
When the login is driven by JavaScript, or redirects through an identity provider, the dependable approach is to drive a real browser through it: open the login page, fill in the fields, submit, wait for a logged-in state, then hand the resulting credential to the scanner. That is a script, written or recorded, and it needs maintaining like test code. Select elements by stable attributes (an id, a name, or a test attribute added for the purpose) rather than by position or visible text, end with an explicit check that the login succeeded, and fail the scan loudly if it did not. A login script that quietly stopped working after a UI change produces an unauthenticated scan and a normal-looking report.
The harder question is what to hand over, and it depends on where the application keeps the credential after login.
In a cookie. The browser attaches it to every matching request by itself, so the scanner can take the cookies from the browser's cookie store and send them on its own requests. This is the easy case. An HttpOnly cookie is hidden from page script, not from the automation driving the browser, which can read the cookie store directly.
In localStorage or sessionStorage. The browser sends this nowhere by itself. The application's JavaScript reads it and adds an Authorization header to its API calls. A scanner that copies the cookie jar copies nothing useful here; it has to read the token out of storage, or out of the header on a captured API request, and add the same header itself. sessionStorage adds a constraint: the OWASP HTML5 Security Cheat Sheet notes that it "is available only to that window/tab until the window is closed", so a token there is gone when the script's browser closes. Capture it before that.
In memory only. Some applications keep the access token in a JavaScript variable and never write it to storage, often with a refresh token in an HttpOnly cookie that fetches a new access token on page load. There is nothing persistent to copy. Either the scanner captures the token from the network (the token endpoint's response, or the header on the first API call), or the scan runs inside the browser. A captured token still expires on its own schedule, and the refresh logic lives in the application's JavaScript, which the scanner's HTTP client is not running. Plan to re-run the login script when the token expires, and detect when that is needed.
Where the credential lives also changes what some checks mean. A token added to every request as a header is sent on requests the application's own page would never make, and it is not subject to the browser's cross-site cookie rules, so cross-site request findings from a header-token scan need reading with that in mind. Record which form the scan used.
OAuth is a delegation protocol, and how a scanner gets a token depends on the grant. The grant decides what identity the scan has, so it is not something to change for the scanner's convenience.
Authorization code with PKCE needs a browser. RFC 6749 section 4.1 calls the authorization code grant "a redirection-based flow", in which the client "must be capable of interacting with the resource owner's user-agent (typically a web browser)". The user authenticates at the authorization server, which redirects back with a code, and the client exchanges the code at the token endpoint. RFC 7636 adds PKCE: the client creates a code_verifier with "a minimum length of 43 characters and a maximum length of 128 characters" (section 4.1), sends a challenge derived from it with the authorization request, and the server checks the verifier at the token endpoint (section 4.6). RFC 9700 section 2.1.1 says public clients "MUST use PKCE" and recommends it for confidential clients. For a scanner, this means the login cannot be one replayed request. RFC 6749 section 4.1.2 says the code "MUST expire shortly after it is issued", recommends a maximum lifetime of ten minutes, and says the client "MUST NOT use the authorization code more than once"; and the verifier is new for every attempt. Script a browser through the user's login at the authorization server, let the application complete the exchange, and capture the session or token that results.
Client credentials gives you a machine, not a user. RFC 6749 section 4.4 describes the client credentials grant for a client "requesting access to the protected resources under its control". It needs no browser and the scanner can repeat it whenever its token expires, which makes it attractive. But the token represents the client application, not a user; typically it carries no user ID, user role or tenant membership of the kind a user session carries. On an API that serves users, a client-credentials scan tests what a trusted service can do, which is a different question from what a user can do. Use it for APIs that really are machine-to-machine. Registering a client-credentials client for the scanner on a user API, and calling the result an authenticated scan, tests the wrong identity.
The password grant is not the shortcut. Giving the scanner a username and password to POST to the token endpoint is tempting. RFC 9700 section 2.4 says the resource owner password credentials grant "MUST NOT be used", and notes that it "is not designed to work with two-factor authentication". If an authorization server still allows it for a test client, a scan through it tests a login path real users do not take.
Refresh tokens keep the session alive, and may rotate. A refresh token lets the scanner get new access tokens without a browser (RFC 6749 section 6), which solves expiry for long scans. In OpenID Connect, a refresh token for use while the user is not present is requested with the offline_access scope, and OpenID Connect Core section 11 says the provider "MUST always obtain consent" for it, which can put a one-time consent screen into the scripted login. Then find out whether the authorization server rotates refresh tokens. RFC 9700 section 4.14.2 describes rotation: a new refresh token with every refresh, the previous one invalidated, and, when an invalidated one is presented, the server "will revoke the active refresh token". For a scanner, a rotating refresh token must have exactly one holder. Two scan workers sharing it, or a tester who copies it into a second tool, will eventually present a stale one, and the authorization server can revoke the active refresh token mid-scan.
Re-authenticating without a prompt. OpenID Connect Core section 3.1.2.1 defines prompt=none, under which the provider "MUST NOT display any authentication or consent user interface pages" and returns an error, typically login_required, if the user is not already authenticated. A scripted re-login can use it to get a new token while the provider's session is still alive. The same section defines max_age, the longest time allowed since the user last actively authenticated, beyond which the provider "MUST attempt to actively re-authenticate the End-User". If the application sets it short, the scripted login will meet a full login prompt, and any MFA, more often than expected.
Vulnerabilities in the OAuth flow itself, such as redirect URI validation, state and PKCE downgrade, are a separate scan target; the OAuth post covers what those findings prove. Bearer tokens that are JWTs have their own validation failures, covered in the JWT post.
SAML SSO is where authenticated scanning most often goes wrong, because the login passes through a system the application team does not own.
Why a recorded SAML login cannot be replayed against a conforming service provider. In the Web Browser SSO profile, the identity provider sends a signed <Response> to the application's assertion consumer service, usually as a browser POST. The OASIS SAML 2.0 Profiles specification, section 4.1.4.3, requires the service provider to verify that NotOnOrAfter "has not passed" and that InResponseTo "equals the ID of its original <AuthnRequest> message". Section 4.1.4.5 says the service provider "MUST ensure that bearer assertions are not replayed, by maintaining the set of used ID values". A recorded SAML response is therefore expired, bound, in SP-initiated SSO, to an authentication request that is no longer pending, and already used. What the scanner needs is the application's own session, established after the assertion was accepted, and section 4.1.4.3 also says that session "SHOULD be discarded" at the assertion's SessionNotOnOrAfter time, where one is set, unless the user goes through SSO again.
Why scanning through the corporate IdP is fragile. Driving a browser through the real identity provider whenever the session expires means passing its MFA policy, conditional-access rules, device checks and bot detection, any of which can change without the application team hearing about it. It also brings the corporate directory into the scan: test accounts in the production IdP, scanner traffic in its sign-in logs, and lockouts on accounts in a directory shared with real staff.
The IdP is outside the scan's scope. It is a different system, often operated by a third party, and authorisation to test your application does not extend to it. Exclude the IdP's hosts from crawling and active testing explicitly, so that a crawler following the redirect to the IdP's login page does not go on to fuzz it. The scope is your application's hosts, including its assertion consumer service.
Three options work, each with a cost:
An application that requires a second factor at login needs a decision for each test account. There are two options.
The scanner generates TOTP codes. An authenticator app computes a time-based one-time password from a secret shared at enrolment. RFC 6238 builds TOTP on HOTP with a time step whose default is 30 seconds (section 4.1), and the shared secret is everything: whoever holds it can produce every future code. To let the scanner pass MFA, enrol the test account, keep the seed (the value encoded in the enrolment QR code), store it as a secret next to the password, and have the scanner compute the code at each login. This exercises the real login, MFA included. Three details matter:
MFA is exempted for the test account in staging. The application, or the test IdP, skips the second factor for a named account in a staging configuration. The login is simpler and nothing secret beyond the password is needed. The cost is that the scan does not test MFA at all, and the exemption is a bypass that must not exist in production. Make it per account and per environment rather than a global switch, record it, and check in production that the same account, if it exists there, is challenged.
Push approvals, SMS codes and hardware security keys cannot be completed by a scanner in a way worth trusting, so for those factors the choice is a staging exemption or a session handoff.
A scan as one user sends every request as that user. When a response comes back 200 with data, the scanner has no way to know whether that user was meant to get it. The BOLA and IDOR post explains why broken object-level authorisation is invisible to a single identity and describes a two-identity harness. Authenticated scanning is where the identities for that harness come from.
The minimum set follows the authorisation model:
Each identity needs data of its own, seeded with values you can recognise, such as a project named after the account, so that a response carrying another identity's marker is an unambiguous finding. Without seeded data, user A owns nothing that user B could wrongly see.
Identities also multiply every login problem above. Each needs its own credentials, its own TOTP seed if MFA is on, its own refresh token if tokens rotate, and its own lockout counter. Accounts cannot be shared between concurrent workers, for the TOTP and refresh-token reasons, and because some applications end a user's other sessions at a new login, as the single-session variant in the session management post did.
dast-tenant-a-user-1 makes scanner traffic obvious in application logs and makes it obvious what to disable.AppSecD's dynamic and API testing runs Nuclei, Dalfox, SQLMap, Commix, Katana, Arjun, FFuf and Interactsh for out-of-band detection, plus 150+ native checks and API discovery across 50+ web frameworks, against the deployed application. Scanning behind a login, through authentication profiles for SSO, OAuth, MFA and multiple roles, is included in some paid plans and not in the free evaluation; the pricing page shows which plans include it. The free evaluation includes one DAST scan and one SAST scan, and its DAST scan does not use authentication profiles. A free workspace also has to prove control of the domain before any DAST scan runs.
That is the whole claim. This post does not claim anything about how AppSecD stores passwords, TOTP seeds, tokens or session cookies; how it performs, scripts or records a login; whether it re-authenticates when a session expires, or detects that one has; how it handles CSRF tokens, refresh-token rotation, SAML responses or any particular identity provider; whether it compares responses between identities to find authorisation bugs; or which of the mechanisms in the table above it supports beyond the SSO, OAuth, MFA and multiple-role profiles named in its plan description. The mechanisms, trade-offs and checklist in this post are general practice and apply to any scanner, ours included.
Give the scanner dedicated test accounts in a staging environment and a way to log in that it can repeat: a configured form login, a scripted browser login for single-page applications and SSO redirects, or a token it can request again. A pasted session cookie works for a quick test but expires mid-scan, after which the scan is anonymous. Then confirm from the application's logs that the scan stayed authenticated throughout.
It can drive a browser through a SAML or OIDC login, but the real corporate identity provider brings MFA, conditional access and bot detection, and it is outside the scope you are authorised to test. A test identity provider you own, staging-only local accounts, or a session handed over after a manual login are more dependable. A recorded SAML response cannot be replayed against a conforming service provider: it is single-use, short-lived and, in SP-initiated SSO, bound to the request that asked for it.
Either enrol the test account with a TOTP authenticator, store the seed as a secret and have the scanner generate a code at each login, or exempt the test account from MFA in staging and record that the scan does not test MFA. With TOTP, logging in again within the same 30-second step reuses a code the server must refuse, so wait for the next step and do not share an account between parallel sessions.
Only for APIs that are machine-to-machine. Client credentials authenticates the client application, not a user, so a scan with it does not exercise user roles, tenant membership or object ownership. For a user-facing API, get a user's token through the authorization code flow with PKCE and renew it with the refresh token.
Often because it was not authenticated for most of the run: an expired token, a login that silently failed, a crawler that logged itself out, or a locked test account. Check the share of the scanner's requests answered as the logged-in user across the scan's duration before reading anything into the findings count.
It carries more risk than staging, because the scanner submits every form it can reach, with payloads, as the account it holds. If you must, use a low-privilege account in a dedicated test tenant, exclude destructive actions, and never use an administrator's credentials.
An authenticated scan is only as good as the identity it held for the whole run. Decide who the scanner is, how it proves it, and how you will know it stayed that way, before reading a single finding.