Executive brief
instagrapi is a Python library used to automate interactions with Instagram. A security flaw in how the library handles signup verification requests could allow a malicious actor to redirect sensitive session information to an unauthorized server. This could lead to the exposure of user session headers, potentially compromising the account being used by the library.
Technical details
instagrapi versions prior to 2.6.9 are vulnerable to Server-Side Request Forgery (SSRF) due to unsafe handling of server-supplied signup challenge paths. The library accepted these paths and used them to construct request URLs without first validating that they were relative paths within the legitimate Instagram API domain. An attacker capable of tampering with the challenge payload could provide an absolute URL or a malicious path, causing the client to send requests—including sensitive session headers—to an external, attacker-controlled host. This occurs during the processing of captchas or phone/SMS challenge forms. The issue is fixed in version 2.6.9, which implements path validation before URL construction.
Affected products
- subzeroid instagrapi < 2.6.9
Timeline
- 2026-05-17: disclosed: Advisory published by subzeroid
- 2026-05-23: advisory: GitHub Advisory published
- 2026-05-23: patched: Fix released in version 2.6.9