Summary
In affected dcmjs versions, DecimalString and IntegerString values may be converted to JavaScript numbers without fully validating that they follow DICOM rules or produce finite values. When applications process untrusted DICOM data, invalid numbers such as Infinity or NaN, or out-of-range integers, could corrupt calculations or disrupt processing.
In affected dcmjs versions, DecimalString and IntegerString values may be converted to JavaScript numbers without fully validating that they follow DICOM rules or produce finite values. When applications process untrusted DICOM data, invalid numbers such as Infinity or NaN, or out-of-range integers, could corrupt calculations or disrupt processing.
Affected context
The issue occurs in dcmjs parsing of DICOM DecimalString (DS) and IntegerString (IS) values. Before version 0.52.0, the parsing logic used permissive text sanitization followed by JavaScript number conversion without checking finiteness or enforcing all relevant value-representation constraints. Risk depends on whether an application processes untrusted or malformed DICOM data and relies on the parsed values.
The issue occurs in dcmjs parsing of DICOM DecimalString (DS) and IntegerString (IS) values. Before version 0.52.0, the parsing logic used permissive text sanitization followed by JavaScript number conversion without checking finiteness or enforcing all relevant value-representation constraints. Risk depends on whether an application processes untrusted or malformed DICOM data and relies on the parsed values.
Exploit preconditions
- Attack surface: An application parses DICOM data using the affected DS or IS implementations.
- Required access: An attacker needs a way to provide or influence the DICOM input; direct access to the application is not implied.
- Trigger point: Parsing a DS or IS field containing a value that overflows, converts to NaN, or violates the applicable DICOM constraints.
- Why exploitation is possible: The parser converts permissively sanitized text to a JavaScript number without validating finiteness and the full DS or IS rules.
- Attack surface: An application parses DICOM data using the affected DS or IS implementations.
- Required access: An attacker needs a way to provide or influence the DICOM input; direct access to the application is not implied.
- Trigger point: Parsing a DS or IS field containing a value that overflows, converts to NaN, or violates the applicable DICOM constraints.
- Why exploitation is possible: The parser converts permissively sanitized text to a JavaScript number without validating finiteness and the full DS or IS rules.
Why this happens
The parser treats syntactically permissive text as a valid numeric value without checking the result or enforcing the constraints of the DICOM value representation. JavaScript number conversion can produce Infinity or NaN, and IS parsing can accept exponent notation or values outside the signed 32-bit range. This is an input-validation weakness (CWE-20) involving inadequate validation of a specified quantity (CWE-1284).
The parser treats syntactically permissive text as a valid numeric value without checking the result or enforcing the constraints of the DICOM value representation. JavaScript number conversion can produce Infinity or NaN, and IS parsing can accept exponent notation or values outside the signed 32-bit range. This is an input-validation weakness (CWE-20) involving inadequate validation of a specified quantity (CWE-1284).
Potential impact
- Invalid values could propagate into spatial geometry, windowing, dose scaling, frame counts, rescaling, or volume reconstruction.
- Calculations or displayed results could be incorrect.
- Processing could be disrupted when downstream components encounter unexpected numeric values.
- Data derived from affected values could be unreliable.
- Invalid values could propagate into spatial geometry, windowing, dose scaling, frame counts, rescaling, or volume reconstruction.
- Calculations or displayed results could be incorrect.
- Processing could be disrupted when downstream components encounter unexpected numeric values.
- Data derived from affected values could be unreliable.
General mitigation guidance
Defensive patterns include validating numeric input against the complete rules for its DICOM value representation before accepting or using it. Parsing should reject non-finite results, malformed values, and IS values outside the permitted signed 32-bit range rather than silently coercing them. Applications can also reduce trust in external DICOM data, validate values at ingestion and before sensitive calculations, handle parse failures safely, and limit the privileges and operational impact of processing components.
Defensive patterns include validating numeric input against the complete rules for its DICOM value representation before accepting or using it. Parsing should reject non-finite results, malformed values, and IS values outside the permitted signed 32-bit range rather than silently coercing them. Applications can also reduce trust in external DICOM data, validate values at ingestion and before sensitive calculations, handle parse failures safely, and limit the privileges and operational impact of processing components.
How teams detect issues like this
- Use static analysis to locate permissive numeric sanitization followed by direct number conversion.
- Review parser code for missing finiteness checks and missing DS/IS-specific format, length, or range validation.
- Test parsing boundaries and malformed values, including overflow, sign-only strings, exponent notation, and out-of-range integers.
- Apply ingestion policies that reject invalid DICOM values and monitor for parse errors or unexpected non-finite numbers.
Automated code review tools may help identify conversion paths that lack validation.
- Use static analysis to locate permissive numeric sanitization followed by direct number conversion.
- Review parser code for missing finiteness checks and missing DS/IS-specific format, length, or range validation.
- Test parsing boundaries and malformed values, including overflow, sign-only strings, exponent notation, and out-of-range integers.
- Apply ingestion policies that reject invalid DICOM values and monitor for parse errors or unexpected non-finite numbers.
Automated code review tools may help identify conversion paths that lack validation.

