T05 · Unauthorized Access and Privilege Escalation
- Location
crawl/scripts/crawl.sh:8- Finding
Recursive Enumeration of Shared MCP Credential Cache with Unverified JWT Claims
- Content
View full analysis
/dev/null } # Function to check if a JWT is valid for Tavily (not expired and correct issuer) is_valid_tavily_token() { local token="$1" local payload=$(decode_jwt_payload "$token") # Check if it's a Tavily token (exact issuer match for security) local iss=$(echo "$payload" | jq -r '.iss // empty' 2>/dev/null) if [ "$iss" != "https://mcp.tavily.com/" ]; then return 1 # Not a valid Tavily token fi # Check if expired local exp=$(echo "$payload" | jq -r '.exp // empty' 2>/dev/null) if [ -n "$exp" ] && [ "$exp" != "null" ]; then local current_time=$(date +%s) if [ "$current_time" -ge "$exp" ]; then return 1 # Expired fi fi return 0 # Valid Tavily token } # Function to find token from MCP auth cache get_mcp_token() { MCP_AUTH_DIR="$HOME/.mcp-auth" if [ -d "$MCP_AUTH_DIR" ]; then # Search recursively for *_tokens.json files while IFS= read -r token_file; do if [ -f "$token_file" ]; then token=$(jq -r '.access_token // empty' "$token_file" 2>/dev/null) if [ -n "$token" ] && [ "$token" != "null" ]; then # Check if valid Tavily token (correct issuer and not ...[truncated 3519 chars]- Remediation
View remediation
