User can view/terminate active sessions remotely
Why it matters
Users who cannot see their active sessions cannot detect unauthorized access. If an attacker establishes a session from an unfamiliar IP or device, the account owner has no mechanism to discover it or revoke it — they must wait for the application to enforce concurrent session limits or for a timeout. CWE-613 and OWASP A07 identify session visibility as a component of proper session management. Giving users a self-service session management page transforms passive victims into active defenders: they can see an unexpected location, terminate the session, and change their credentials before the attacker completes a transaction.
Severity rationale
Low because the attacker still needs a valid session token to exploit the gap, but the absence of session visibility removes the user's only self-service mechanism for detecting and revoking unauthorized concurrent access.
Remediation
Add GET and DELETE endpoints in src/app/api/account/sessions/route.ts:
export async function GET(req: Request) {
const user = await getCurrentUser(req);
const sessions = await db.sessions.findMany({
where: { userId: user.id, expiresAt: { gt: new Date() } },
select: { id: true, device: true, location: true,
loginAt: true, lastActivityAt: true }
});
return Response.json(sessions);
}
export async function DELETE(req: Request) {
const { sessionId } = await req.json();
const user = await getCurrentUser(req);
// Verify ownership before terminating
await db.sessions.updateMany({
where: { id: sessionId, userId: user.id },
data: { terminatedAt: new Date() }
});
return Response.json({ ok: true });
}
The session list must show at least: device description, approximate location, login timestamp, and last-activity timestamp. Gate termination on userId ownership to prevent cross-user session deletion.
DetectionPro
The detection method for this pattern is part of AuditBuffet Pro.
The full method (what to look for, pass and fail conditions, and how results get reported) ships inside the Session Security Audit. The pattern definition, severity rationale, and remediation remain openly licensed under CC-BY-4.0.
External references
- cwe · CWE-613 — Insufficient Session Expiration
- owasp:2021 · A07
- nist:rev5 · AC-12 — Session Termination
Taxons
History
- 2026-04-18·v1.0.0·Initial import from finserv-session-security·automated