Grpc api security

From xalgorix/xalgorix · View interactive version

Grpc api security is an AI agent skill from the GitHub repository xalgorix/xalgorix. gRPC API security testing covering reflection, service enumeration, method-level authorization, message tampering, and transcoded REST inconsistencies

How to use this skill

Skill file

gRPC API Security

Purpose

Test gRPC services for reflection exposure, method-level authorization, message tampering, and gateway/REST transcoding inconsistencies.

Preconditions

Attack Surface Signals

Methodology

Service Discovery via Reflection

# List services (if reflection is enabled)
grpcurl -plaintext TARGET:50051 list

# List methods for a service
grpcurl -plaintext TARGET:50051 list mypackage.MyService

# Get message descriptors
grpcurl -plaintext TARGET:50051 describe mypackage.MyService/GetUser

Direct Method Invocation

# Call a method with parameters
grpcurl -plaintext -d '{"id": "123"}' TARGET:50051 mypackage.MyService/GetUser

# Try calling admin methods with a regular user token
grpcurl -plaintext -H "authorization: Bearer USER_TOKEN" \
  -d '{"id": "123"}' TARGET:50051 mypackage.AdminService/DeleteUser

Method-Level Authorization Testing

# Test if per-method auth is enforced (not just per-service)
for method in GetUser ListUsers CreateUser DeleteUser UpdateUser; do
  result=$(grpcurl -plaintext -d '{}' TARGET:50051 "mypackage.UserService/$method" 2>&1)
  echo "[$method] $result" | head -1
done

# Test anonymous access
grpcurl -plaintext -d '{"id": "1"}' TARGET:50051 mypackage.UserService/GetUser

Message Tampering

# Object ID manipulation (BOLA in gRPC)
grpcurl -plaintext -H "authorization: Bearer USER_A_TOKEN" \
  -d '{"user_id": "USER_B_ID"}' TARGET:50051 mypackage.UserService/GetUser

# Property tampering (BOPLA in gRPC)
grpcurl -plaintext -H "authorization: Bearer USER_TOKEN" \
  -d '{"user_id": "123", "role": "admin", "is_verified": true}' TARGET:50051 mypackage.UserService/UpdateUser

Unknown / Extra Fields

# Some protobuf parsers accept unknown fields silently
# Try sending fields not in the schema (if the server deserializes into a dynamic message)
echo '{"id": "1", "unknown_field": "test", "debug": true}' | \
  grpcurl -plaintext -d @ TARGET:50051 mypackage.UserService/GetUser

Gateway/REST Transcoding Inconsistencies

# If the gRPC service is exposed via a REST gateway (gRPC transcoding):
# Test that authorization is consistent between the REST and gRPC paths

# REST path (through gateway)
curl -sk "https://TARGET/api/users/123" -H "Authorization: Bearer USER_TOKEN"

# Direct gRPC path (if accessible)
grpcurl -plaintext -H "authorization: Bearer USER_TOKEN" \
  -d '{"id": "123"}' TARGET:50051 mypackage.UserService/GetUser

# A finding: REST path returns 403 but gRPC path returns data

Oversized Messages / Resource Consumption

# Large payloads
python3 -c "print(json.dumps({'data': 'A' * 1000000}))" | \
  grpcurl -plaintext -d @ TARGET:50051 mypackage.UploadService/Process

Metadata Header Testing

# Test custom metadata
grpcurl -plaintext \
  -H "x-user-role: admin" \
  -H "x-internal: true" \
  -d '{}' TARGET:50051 mypackage.AdminService/ListAll

Evidence Contract

Common Misses

False Positives / Non-Findings

Xalgorix Tool Strategy

Stopping Rule

Exhaust every discovered service and method. Test read and write paths. Compare gRPC and REST gateway authorization.

Handoff

Report each confirmed gRPC issue with the service, method, the authorization context, and the concrete unauthorized data or action.

Use this skill with your AI agent: Open on Skill Issue to copy, download, or add to your library. Works with Claude, ChatGPT, Gemini, Cursor, Windsurf and more.