T09 · Insecure Skill Coding Practices
- Location
scripts/main.py:67- Finding
Incomplete DICOM de-identification can leave PHI in generated output
- Content
View full analysis
Vulnerability Details
File Location:
scripts/main.py:67-167,scripts/main.py:397-402, andreferences/phi_tags.json:4-41
Vulnerability Type: Incomplete removal of sensitive medical information
Risk Level: HighRelevant Code
The executable anonymization policy is a fixed dictionary:
python # Standard PHI DICOM Tags to anonymize # Format: (Group, Element): (AttributeName, Action) PHI_TAGS = { # Patient Information (0x0010, 0x0010): ("PatientName", "clear"), (0x0010, 0x0020): ("PatientID", "hash"), (0x0010, 0x0030): ("PatientBirthDate", "clear"), (0x0010, 0x0032): ("PatientBirthTime", "clear"), # ... (0x0038, 0x0400): ("PatientAddress", "clear"), (0x0038, 0x0500): ("PatientMotherAddress", "clear"), # ... (0x0020, 0x4000): ("ImageComments", "clear"), (0x0040, 0x2400): ("ImagingServiceRequestComments", "clear"), }Anonymization iterates only over this fixed table and directly accesses the root dataset:
python # Anonymize PHI tags tags_anonymized = 0 for tag, (tag_name, action) in self.PHI_TAGS.items(): anon_record = self._anonymize_tag(dataset, tag, action, tag_name) if anon_record.action not in ["not_present", "preserved"]: result.anonymized_tags.append(anon_record) tags_anonymized += 1The project’s separate reference list identifies sensitive attributes that are absent from the executable policy:
python DEFAULT_PHI_TAGS = [ "PatientName", "PatientID", "PatientBirthDate", "PatientSex", "PatientAge", "PatientWeight", "PatientAddress", "PatientTelephoneNumbers", # ... "StudyDate", "StudyTime", "SeriesDate", "SeriesTime", "AcquisitionDate", "AcquisitionTime", "ContentDate", "ContentTime", "InstanceCreationDate", "InstanceCreationTime", "OverlayDate", "CurveDate" ...[truncated 2299 chars]- Remediation
View remediation
Remediation Suggestions
- Replace the ad hoc tag list with a reviewed implementation of the applicable DICOM PS3.15 confidentiality profile and clearly document enabled options.
- Recursively traverse all sequence items and apply de-identification rules to nested datasets.
- Cover all applicable direct identifiers, free-text attributes, person-name attributes, telephone numbers, addresses, dates, times, and UIDs.
- Implement a documented date strategy, such as consistent patient-specific date shifting where permitted, instead of retaining exact dates.
- Treat structured reports, encapsulated documents, overlays, annotations, and burned-in pixel text as separate high-risk content requiring specialized processing or rejection.
- Add a post-processing validator that scans the complete output recursively for prohibited tags and suspicious free text. Fail closed when residual PHI cannot be ruled out.
- Add regression fixtures containing PHI in root attributes, nested sequences, structured reports, private tags, and pixel annotations.
- Remove the “HIPAA Safe Harbor compliant” and “clinical-grade” claims until the implementation has undergone appropriate privacy, clinical, and legal validation.
- Require manual release review, particularly for secondary captures and images marked as containing burned-in annotations.
