Skip to content

Insecure use of Rails parameters with _json

Description

The Rails parameters (`params`) are using the `_json` parameter, which is subject to parser juggling. This may allow an attacker to exploit differences in parameter processing at different points in the request processing lifecycle.

Examples

Insecure Code

ruby
params[:_json]

Secure Code

ruby
JSON.parse(params[:json])

Remediation

Avoid using the `_json` parameter directly. Instead, use a secure method to parse JSON parameters, such as using the `JSON.parse` method or a library like `json_parser`.

Rule Details

FieldValue
IDCODE-0635
CategoryInjection
SeverityHIGH
CWECWE-843
ConfidenceLOW
ImpactHIGH
LikelihoodMEDIUM
ExploitabilityMODERATE
Tagsrails, json, parser juggling
OWASPN/A

References