StackHawk Documentation StackHawk Logo HawkDocs

No results found

Try different keywords or check your spelling

Search documentation

Find guides, API references, and more

esc

JSON-RPC Configuration

Introduction

JSON-RPC is a stateless, lightweight remote procedure call protocol that uses JSON as its data format. JSON-RPC APIs expose named methods with structured parameters over HTTP, and are commonly used in blockchain platforms, IoT systems, and microservice architectures. HawkScan can discover and scan JSON-RPC 2.0 endpoints for security vulnerabilities by enumerating methods and fuzzing their parameters.

Configuring HawkScan for scanning JSON-RPC applications

To scan a JSON-RPC application using HawkScan, configure the app.jsonRpcConf section in your stackhawk.yml. You can provide an OpenRPC schema file that describes your API’s methods and parameters:

# stackhawk.yml
app:
  jsonRpcConf:
    enabled: true
    endpoint: /jsonrpc
    filePath: '/path/to/openrpc.json'

If you don’t have an OpenRPC schema file, you can point HawkScan at the JSON-RPC endpoint and it will attempt to discover methods automatically:

# stackhawk.yml
app:
  jsonRpcConf:
    enabled: true
    endpoint: /jsonrpc

Configuration Options

OptionTypeDefaultDescription
enabledbooleanfalseEnable JSON-RPC scan support
endpointstring/The JSON-RPC endpoint path relative to the target host
filePathstringPath to a local OpenRPC schema file (JSON format)
maxDepthint3Maximum depth for generated nested objects
fakerEnabledbooleanfalseEnable faker for generating realistic parameter values
requestTimeoutint30000HTTP request timeout in milliseconds
excludeMethodslist[]Regex patterns for method names to exclude from scanning

Using Custom Variable Injection

Custom variables let you specify values for specific method parameters. This is useful when your API requires valid data formats or specific values that random fuzzing wouldn’t produce.

# stackhawk.yml
app:
  jsonRpcConf:
    enabled: true
    endpoint: /jsonrpc
    filePath: '/path/to/openrpc.json'
    customVariables:
      - field: userId
        values:
          - user-123
          - user-456
      - field: user.address.city
        values:
          - Denver
          - Boulder

Use dot notation to target nested object fields (e.g., user.address.city).

Filtering by Method Name

You can restrict custom variables to specific methods using the path field with a regex pattern:

app:
  jsonRpcConf:
    enabled: true
    endpoint: /jsonrpc
    customVariables:
      - field: accountId
        path: "accounts\\..*"
        values:
          - acct-001
          - acct-002

In this example, the accountId variable is only injected for methods matching accounts.* (e.g., accounts.get, accounts.update).

Generating Smart Values for Parameters

By enabling faker, HawkScan can generate realistic values for parameters when the OpenRPC schema includes format hints or when you specify faker expressions in custom variables. Use the $faker prefix with a format type:

app:
  jsonRpcConf:
    enabled: true
    endpoint: /jsonrpc
    fakerEnabled: true
    customVariables:
      - field: customerEmail
        values:
          - $faker:email
      - field: customerPhone
        values:
          - $faker:phone
      - field: transactionId
        values:
          - $faker:uuid

Excluding Methods from Scanning

Use excludeMethods to skip methods that shouldn’t be scanned, such as admin-only or destructive operations:

app:
  jsonRpcConf:
    enabled: true
    endpoint: /jsonrpc
    excludeMethods:
      - "admin\\..*"
      - "system\\.shutdown"

Running the Scan

Once configured, run the scan like any other application type:

hawk scan

HawkScan will connect to the JSON-RPC endpoint, discover available methods, and scan them for security vulnerabilities.

Your privacy settings

We use first and third party cookies to ensure that we give you the best experience on our website and in our products.