A comprehensive browser-based JavaScript toolkit for security testing and reconnaissance. Load a single script into your browser console to access powerful pentesting utilities.
β οΈ For educational and authorized testing purposes only
Only use this toolkit on systems you own or have explicit permission to test.
- Copy the contents of
JSBank.js - Open your browser's Developer Console (F12)
- Paste and execute the script
- Type
pentestHelp()to see all available commands
// In browser console
pentestHelp() // Display command referenceinspectVariables()- Inspect all user-defined global JavaScript variablesinspectVariables({ showWindow: true })- Include window propertiesinspectVariables({ filterPattern: "user" })- Filter by patterninspectVariables({ obj: myObject })- Inspect specific objectlistAllGlobals()- Quick list of all global variable namesinspectStorage()- View localStorage and sessionStorage contents
findAPIEndpoints()- Discover ALL URLs, endpoints, and GraphQL operationsfindAPIEndpoints({ includeExternalResources: true })- Include static resourcesfindAllHrefLinks()- Discover and categorize all href linksextractAllURLs()- Extract and categorize all URLs from page source
testGraphQLIntrospection(endpoint)- Test if GraphQL introspection is enabledtestGraphQLIntrospection("/graphql", { tryAlternatives: false })- Quick introspection testenumerateGraphQLSchema(endpoint)- Enumerate schema when introspection is blockedenumerateGraphQLSchema("/graphql", { probeSubfields: true })- Auto-probe complex fieldsprobeGraphQLSubfields(endpoint, "fieldName")- Discover subfields of complex types
findAllForms()- Find all forms and their fieldsfindHiddenFields()- Find hidden input fields and CSS-hidden elementsfindDataAttributes()- Find all data-* attributesfindEventListeners()- Find all event listeners on the page
scanSensitiveData()- Scan DOM, storage, and logs for potential secretsscanSensitiveData({ customPatterns })- Add custom regex signatures to the scanner
testXSSInputs()- Test all input fields with XSS payloadstestXSSInputs({ autoSubmit: true })- Test with automatic form submissiontestXSSInputs({ clearAfter: false })- Keep payloads in fieldstestURLXSS()- Test URL parameters for XSS reflectionfindXSSSinks()- Find potential XSS injection points (innerHTML, event handlers, etc.)
checkSecurityHeaders()- Check HTTP security headers (CSP, HSTS, X-Frame-Options, etc.)inspectCookies()- Analyze cookie security and detect session tokenstestCookieManipulation(name, value)- Test cookie manipulation
analyzeCSRFProtection()- Score each form for CSRF defensesreplayFormWithoutCSRF(index, options)- Resubmit forms with tokens stripped/modified
findJWTTokens()- Find and decode JWT tokens in storage, cookies, and JSON objects (searches for accessToken, idToken, refreshToken, and more)findMSALTokens()- Find Microsoft MSAL (Microsoft Authentication Library) tokens, accounts, and credentialsdecodeJWT(token)- Decode a specific JWT tokenfindAuthHeaders()- Instructions for discovering authorization headersjwtLab.forgeNoneVariant(token, overrides)- Buildalg:nonetest tokensjwtLab.modifyClaims(token, claims)- Tamper with payload claimsjwtLab.replayRequestWithToken(logIndex, token, options)- Replay captured requests with modified tokens
showRequestLog()- View all intercepted fetch/XHR requestsshowFormLog()- View all form submissionsclearLogs()- Clear request and form logsshowRealtimeLog()- Inspect WebSocket/EventSource trafficlistRealtimeChannels()- List active realtime channels with IDsinjectWebSocketMessage(id, payload)- Send custom frames into a captured WebSocketcloseRealtimeChannel(id, code, reason)- Close a WebSocket/EventSource cleanlyclearRealtimeLog()- Clear realtime channel logs
// Get overview of page variables
listAllGlobals()
// Find all API endpoints and URLs
findAPIEndpoints()
// Check security headers
checkSecurityHeaders()
// Find JWT tokens
findJWTTokens()
// Find Microsoft MSAL tokens
findMSALTokens()// Test all inputs for XSS
testXSSInputs()
// Check URL parameters
testURLXSS()
// Find potential injection points
findXSSSinks()// Test introspection
testGraphQLIntrospection('/graphql')
// Enumerate schema if introspection is disabled
enumerateGraphQLSchema('/graphql', {
probeSubfields: true,
delay: 100
})
// Probe specific field
probeGraphQLSubfields('/graphql', 'users')// Find all forms
findAllForms()
// Find hidden fields
findHiddenFields()
// Monitor form submissions
showFormLog()// View intercepted requests
showRequestLog()
// Requests are automatically logged when the script loads
// Make some requests on the page, then:
showRequestLog()// Score all forms for CSRF defenses
analyzeCSRFProtection()
// Replay the first form without its token to test enforcement
await replayFormWithoutCSRF(0)// Watch WebSocket/EventSource traffic live
listRealtimeChannels()
showRealtimeLog()
// Inject a custom payload into a captured WebSocket (use returned ID)
injectWebSocketMessage('ws-1', JSON.stringify({ op: 'ping' }))// Run default signatures
scanSensitiveData()
// Add custom regex patterns
scanSensitiveData({
customPatterns: [
{ name: 'Internal Project Code', regex: /PRJ-[0-9]{4}/g, severity: 'info' }
]
})// Finds JWTs in storage, cookies, and nested JSON objects
// Automatically searches for: accessToken, idToken, refreshToken,
// access_token, id_token, refresh_token, token, jwt, secret, etc.
const tokens = findJWTTokens()
// Example output shows location: sessionStorage["AuthUser"].idToken
const forged = jwtLab.forgeNoneVariant(tokens[0].token, { role: 'admin' })
// Replay the first captured request with the forged token
await jwtLab.replayRequestWithToken(0, forged)// Find all Microsoft Authentication Library (MSAL) tokens
// Detects: MSAL accounts, access tokens, ID tokens, refresh tokens
// Searches localStorage and sessionStorage for MSAL-specific keys
const msalData = findMSALTokens()
// Returns structured data:
// - accounts: MSAL account objects
// - accessTokens: Access tokens with decoded JWTs
// - idTokens: ID tokens with decoded JWTs
// - refreshTokens: Refresh token credentials
// - decodedTokens: All discovered JWTs with full details
// Access specific token types
console.log(msalData.accounts) // User accounts
console.log(msalData.accessTokens) // Access tokens
console.log(msalData.idTokens) // ID tokens
console.log(msalData.decodedTokens) // All JWTs foundThe toolkit automatically intercepts:
fetch()requestsXMLHttpRequestcalls- Form submissions
All intercepted data is logged and can be viewed with showRequestLog() and showFormLog().
The findAPIEndpoints() function discovers:
- All HTTP/HTTPS URLs in page source
- Relative endpoint paths
- GraphQL operations and queries
- API endpoints (categorized)
- Internal vs external URLs
- REST-like endpoints
Advanced GraphQL testing capabilities:
- Full introspection testing
- Partial introspection detection
- Field suggestion discovery
- Schema enumeration without introspection
- Automatic subfield probing
- Common field name testing
- Detects authentication cookies
- Shows cookie details and security flags
- Provides recommendations for secure cookie usage
- Hooks WebSocket and EventSource traffic
- Provides channel IDs for injection/closure
- Logs inbound/outbound frames for auditing
- Scores forms for CSRF indicators (tokens, methods, origin)
- Replays original submissions with tokens removed/overridden
- Highlights forms that need server-side review
- Sweeps DOM text, inline scripts, storage, and captured requests
- Built-in signatures for API keys, JWTs, bearer tokens, emails, private IPs
- Accepts custom regex patterns for environment-specific secrets
- Generates
alg:nonevariants automatically - Modifies claims (roles, expiration, etc.) without re-copying boilerplate
- Replays captured requests with forged tokens straight from the log
- Automatically detects Microsoft Authentication Library (MSAL) storage patterns
- Identifies MSAL accounts, access tokens, ID tokens, and refresh tokens
- Searches for keys containing 'msal', 'login.windows.net', or 'login.microsoftonline.com'
- Extracts and decodes JWTs from MSAL credential objects
- Provides structured output with token types and account information
JSBank combines multiple specialized modules:
- VarInspector - Variable and object inspection
- Recon - DOM, endpoint, and GraphQL reconnaissance
- XSS - Cross-site scripting testing utilities
- HeadCookieInspector - Security headers and cookie analysis
- FormDataNetworkRequest - Form and network request logging
- JWT - JWT token discovery and decoding
All modules are bundled into a single JSBank.js file for easy deployment.
const customPayloads = [
'<img src=x onerror=alert(document.domain)>',
'<svg onload=alert(document.cookie)>',
// ... your payloads
];
testXSSInputs({ payloads: customPayloads })// Find all variables containing "auth"
inspectVariables({ filterPattern: "auth" })
// Inspect specific object deeply
inspectVariables({ obj: window.myApp })enumerateGraphQLSchema('/graphql', {
testMutations: true, // Test mutation fields
testSubscriptions: false, // Skip subscriptions
customFields: ['myField'], // Add custom field names to test
delay: 100, // Delay between requests (ms)
probeSubfields: true // Automatically probe complex fields
})- Authorization Required: Only use on systems you own or have permission to test
- Non-Destructive: Most functions are read-only and non-invasive
- Rate Limiting: Use
delayparameters to avoid triggering rate limits - Legal Compliance: Ensure compliance with applicable laws and regulations
- Ensure you copied the entire
JSBank.jsfile - Check browser console for errors
- Try refreshing the page and reloading
- Verify the page is fully loaded
- Check if Content Security Policy (CSP) is blocking execution
- Try in an incognito/private window
- Increase the
delayparameter to avoid rate limiting - Use
probeSubfields: falseto skip automatic probing - Test fewer fields with
customFieldsoption
π‘οΈ Security Headers Check
β
Content Security Policy: default-src 'self'
β X-Frame-Options: MISSING
β
HTTP Strict Transport Security (HSTS): max-age=31536000
π JWT Token Discovery
Found potential JWT in localStorage["auth_token"]
π Decoded Tokens (1):
Header: { alg: "HS256", typ: "JWT" }
Payload: { sub: "1234567890", name: "John Doe", iat: 1516239022 }
β° Expiration: 12/31/2024, 11:59:59 PM
β
Token is still valid
π MSAL Token Discovery
π¦ Checking localStorage for MSAL data...
Found MSAL key: d2fb3cf0-bb11-4a9f-8ee0-5014b70b21ab.4aaa468e-93ba-4ee3-ab9f-6a247aa3ade0-login.windows.net-accesstoken-...
ββ Contains JWT in 'secret' field
Found MSAL key: msal.account.keys
Found MSAL key: msal.token.keys.{clientId}
βββββββββββββββββββββββββββββββββββββββββββ
π MSAL DISCOVERY SUMMARY
βββββββββββββββββββββββββββββββββββββββββββ
π Accounts: 2
π« Access Tokens: 3
π ID Tokens: 2
π Refresh Tokens: 1
π Other MSAL Keys: 5
π― Total JWTs Found: 5
π Decoded JWT Tokens:
Token 1 [Access Token] from localStorage (MSAL)["..."].secret
Header: { typ: "JWT", alg: "RS256", kid: "..." }
Payload: { aud: "...", iss: "https://sts.windows.net/...", ... }
β° Expiration: 11/25/2025, 3:30:00 PM
β
Token is still valid
π€ MSAL Accounts:
Account 1: user@example.com
homeAccountId: d2fb3cf0-bb11-4a9f-8ee0-5014b70b21ab
username: user@example.com
name: John Doe
π Complete URL & Endpoint Discovery
π API Endpoints (5)
https://api.example.com/v1/users
https://api.example.com/v1/posts
...
π Relative Endpoints (3)
/api/login
/api/logout
/api/profile
This is a personal pentesting toolkit. Feel free to fork and customize for your needs.
For educational and authorized testing purposes only.
- Start with reconnaissance - Run
listAllGlobals()andfindAPIEndpoints()first - Check security basics - Use
checkSecurityHeaders()andinspectCookies()early - Monitor traffic - Let the script run while you navigate to capture all requests
- Test incrementally - Start with non-invasive tests before trying XSS payloads
- Document findings - Copy console output for your security reports
- Respect rate limits - Use delay parameters when testing APIs
// 1. Load toolkit
pentestHelp()
// 2. Basic reconnaissance
listAllGlobals()
findAPIEndpoints()
checkSecurityHeaders()
// 3. Authentication analysis
findJWTTokens()
findMSALTokens() // For Microsoft-authenticated apps
inspectCookies()
// 4. Form analysis
findAllForms()
findHiddenFields()
// 5. Monitor traffic
// (Navigate the app)
showRequestLog()
showFormLog()// 1. Test introspection
testGraphQLIntrospection('/graphql')
// 2. If blocked, enumerate manually
const schema = await enumerateGraphQLSchema('/graphql', {
probeSubfields: true,
delay: 100
})
// 3. Test discovered fields
probeGraphQLSubfields('/graphql', 'users')// 1. Find potential sinks
findXSSSinks()
// 2. Test URL parameters
testURLXSS()
// 3. Test input fields
testXSSInputs()
// 4. Check for reflected parameters
// (Review console output for reflections)// 1. Enumerate forms and score protections
analyzeCSRFProtection()
// 2. Replay interesting forms without/with modified tokens
await replayFormWithoutCSRF(2, { overrides: { amount: '9999' } })
// 3. Review server-side behavior and log results
showRequestLog({ urlIncludes: '/transfer' })// 1. Capture some authenticated traffic
showRequestLog()
// 2. Forge a token that elevates privileges
const forged = jwtLab.modifyClaims(existingToken, { role: 'super-admin' })
// 3. Replay the captured request with the new token
await jwtLab.replayRequestWithToken(3, forged)// 1. Discover all MSAL tokens and accounts
const msalData = findMSALTokens()
// 2. View account information
console.table(msalData.accounts)
// 3. Extract and decode access tokens
msalData.accessTokens.forEach(token => {
console.log('Access Token:', token.key)
if (token.data.secret) {
decodeJWT(token.data.secret)
}
})
// 4. Check ID tokens
msalData.idTokens.forEach(token => {
console.log('ID Token:', token.key)
if (token.data.secret) {
decodeJWT(token.data.secret)
}
})
// 5. Test with modified tokens (combine with JWT tampering)
const msalTokens = findMSALTokens()
if (msalTokens.decodedTokens.length > 0) {
const forged = jwtLab.modifyClaims(
msalTokens.decodedTokens[0].token,
{ roles: ['Admin'] }
)
await jwtLab.replayRequestWithToken(0, forged)
}Version: 1.0
Last Updated: November 2025
Happy (ethical) hacking! π