Skip to content

Comments

feat: [expansion] Add remote URL support to qrcode module with Security Hardening#761

Merged
adulau merged 2 commits intoMISP:mainfrom
nassima17:feature/qrcode-url-support
Feb 24, 2026
Merged

feat: [expansion] Add remote URL support to qrcode module with Security Hardening#761
adulau merged 2 commits intoMISP:mainfrom
nassima17:feature/qrcode-url-support

Conversation

@nassima17
Copy link

Description

This PR enhances the qrcode expansion module to support remote URLs as input.
Currently, the module only accepts file attachments. With the rise of Quishing (QR Code Phishing), analysts increasingly need to decode remote images hosted on external servers without manually downloading them.

Changes

  • Updated introspection to accept url and link attributes.
  • Implemented logic to fetch images using requests.
  • Refactored imports to fix non-standard numpy usage (import np -> import numpy as np).

Security Hardening (Audit & Fix)

Since this feature transforms the module into an active web client, I implemented specific security controls to mitigate risks:

  • Anti-SSRF: Added a DNS resolution check (is_safe_url) to block access to private/loopback IPs (e.g., 127.0.0.1, 192.168.x.x).
  • DoS Protection: Enforced a MAX_IMAGE_SIZE (10MB) and chunk-based streaming to prevent memory exhaustion attacks.
  • Anti-Cloaking: Implemented a mobile User-Agent (iPhone) to bypass basic anti-bot protections used by phishing kits.
  • SSL: Explicitly disabled SSL verification (verify=False) to ensure analysts can scan phishing domains with invalid certificates.

Quality Assurance

  • Bandit: Audited with 0 security issues.
  • Safety: Checked dependencies for known CVEs (0 vulnerabilities found).
  • Pylint: Rated 10/10 (PEP8 & Standards compliance).
  • Mypy: Static type checking validated.
  • Testing: Validated locally via Docker against both local attachments and remote API endpoints.

Related Issue

Fixes #757

@adulau adulau merged commit 4d01b86 into MISP:main Feb 24, 2026
5 checks passed
@adulau
Copy link
Member

adulau commented Feb 24, 2026

Thank you!

@nassima17
Copy link
Author

Happy to contribute!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Expansion] Enhancement of 'qrcode' module to support remote URLs (Anti-Quishing)

3 participants