jackson-injection-security
Security considerations for Jackson @JacksonInject - preventing JSON input from overriding injected values, covering CVE patterns and defense strategies.
- License 许可
- MIT
- 最近更新
- 2026-10-02
- Stars
- ★ 93
- Forks
- 8
01 前言 Front Matter
- name
- jackson-injection-security
- description
- Security considerations for Jackson @JacksonInject - preventing JSON input from overriding injected values, covering CVE patterns and defense strategies.
03 SKILL.md 正文
Jackson @JacksonInject Security
The Vulnerability Pattern
When a @JsonCreator constructor uses @JacksonInject without useInput = OptBoolean.FALSE,
Jackson can fall back to JSON input to provide the injectable value. This is exploitable when:
- The injectable ID (default: empty string
"") matches a JSON property key - The JSON property contains a deserializable value of the expected type
- This overrides the server-configured injected value (e.g., security settings)
Example Vulnerable Code
@JsonCreator
public SomeFilter(
@JsonProperty("dimension") String dimension,
@JacksonInject SecurityConfig config // VULNERABLE: can be overridden via JSON ""
)
Exploit Pattern
{
"dimension": "value",
"": {"securityEnabled": false} // Empty key "" overrides @JacksonInject default id
}
The Fix
Option 1: useInput = OptBoolean.FALSE (Recommended for Jackson 2.9+)
import com.fasterxml.jackson.annotation.OptBoolean;
@JsonCreator
public SomeFilter(
@JsonProperty("dimension") String dimension,
@JacksonInject(useInput = OptBoolean.FALSE) SecurityConfig config // FIXED
)
This tells Jackson: NEVER use JSON to provide this value, ALWAYS use InjectableValues only.
Option 2: Explicit Injectable ID (prevents empty string match)
@JacksonInject("securityConfig") // Named ID that won't match "" key
SecurityConfig config
Option 3: Server-side validation before processing
// Validate BEFORE Jackson deserialization or AFTER using Guice-injected config
@Inject
public MyService(SecurityConfig trustedConfig) {
this.trustedConfig = trustedConfig; // From Guice, not from Jackson
}
@JacksonInject Behavior Summary
useInput value |
Behavior |
|---|---|
OptBoolean.DEFAULT |
Use InjectableValues if present; may fall back to JSON |
OptBoolean.TRUE |
JSON input takes precedence over InjectableValues |
OptBoolean.FALSE |
ONLY use InjectableValues; NEVER read from JSON |
Druid-Specific Context
In Apache Druid, Jackson InjectableValues are configured via Guice's GuiceInjectableValues.
The injectable ID lookup uses the parameter type's class name by default.
When @JacksonInject.value() is "" (empty string default), Jackson may use the empty string
as the lookup key, which fails to find the Guice-bound value, causing fallback to JSON.
Detection
Look for @JacksonInject without useInput = OptBoolean.FALSE in @JsonCreator constructors
where the injected value controls security behavior.
04 同仓库更多 Skills
object_counter
Count occurrences of an object in the image using computer vision algorithm.
travel-planning-workflow
Invoke this skill when performing travel planning. It defines a structured workflow for generating itineraries. Following this workflow is essential to ensure the final plan satisfies user requirements.
bundled-dataset-search-tool
invoke this skill when you need to perform database search for travel planning. This skill provides some useful pre-packaged tools to look up accommodations, attractions, cities, driving distance, flights, and restaurants from the bundled dataset.
glm-output
Output-processing guidance for GLM tasks. Especially useful after glm-basics and glm-calibration when you need verifier-matching metrics from output.nc and a final /root/metrics.json.
glm-calibration
Calibration guidance for GLM tasks. Often most effective after glm-basics has clarified the setup; glm-output is the companion skill for exact final metric computation.
glm-basics
A good starting point for GLM calibration tasks. Use to inspect glm3.nml, confirm how GLM runs, and identify the relevant files before moving on to calibration and output evaluation.