#47729 [W&A-Insight] Insecure Token Storage in SessionStorage

Submitted on Jun 19th 2025 at 10:19:57 UTC by @Opzteam for IOP | Zano Trade

  • Report ID: #47729

  • Report Type: Websites & Apps

  • Report severity: Insight

  • Target: https://github.com/PRavaga/zano-p2p/tree/master/src/pages/dex

  • Impacts:

Description

  • The application stores JWT authentication tokens in browser sessionStorage across the entire frontend codebase, creating a critical security vulnerability where any Cross-Site Scripting (XSS) attack could immediately compromise user accounts and financial data. With over 25 instances of sessionStorage.getItem("token") throughout the codebase and no security headers implemented, a single XSS vulnerability would grant attackers persistent access to user wallet addresses, trading capabilities, and administrative functions. In a financial trading platform handling cryptocurrency transactions, this represents a severe risk that could lead to unauthorized trades, fund theft, and complete account takeover.

  • The vulnerability stems from the application's reliance on sessionStorage for JWT token persistence, which is accessible to any JavaScript code running in the browser context:

// ConnectButton.tsx - Token is stored after successful authentication
sessionStorage.setItem("token", result?.data);
  • Token Retrieval (Throughout Application):

// useUpdateUser.ts - User authentication check
if (!sessionStorage.getItem("token")) return false;

// utils/methods.ts - Every API call includes token from sessionStorage
export async function getUser(): Promise<ErrorRes | GetUserRes> {
    return await axios.post("/api/user/get-user", {
        token: sessionStorage.getItem("token")  // Exposed to XSS
    }).then(res => res.data);
}

// Similar pattern in 25+ other functions
  • JWT tokens contain critical user information:

  • The Next.js configuration lacks security headers that could mitigate XSS attacks:

Proof of Concept

Proof of Concept

  • Malicious browser extensions can access sessionStorage

  • XSS Malicious Script Injection

Token Extraction via XSS

FIX:

  1. Implement HTTP-Only Cookies:

  1. Add Security Headers:

Was this helpful?