The vulnerability lies in the lack of validation of the payload_url for webhooks, leading to a Server-Side Request Forgery (SSRF) vulnerability. The analysis of the patches reveals two key locations where this vulnerability was addressed.
-
At Creation/Update Time: The Webhook.clean method in nautobot/extras/models/models.py is responsible for validating webhook data before it's saved. The patch adds a call to a new validation function, validate_webhook_url_format, within this method. Before this change, a user with permissions to manage webhooks could configure a payload_url pointing to a restricted internal network resource.
-
At Execution Time: The process_webhook function in nautobot/extras/tasks.py is the background task that sends the webhook. The patch adds a call to validate_webhook_url at the beginning of this function. This serves as a defense-in-depth measure, re-validating the URL and its resolved IP address right before the outbound request is made. This is crucial because the network environment of the Celery worker (which runs this task) might be different from the web server, and it also protects against DNS rebinding attacks and addresses webhooks created before the patch was applied.
The root cause was the trust placed in the user-provided payload_url without sufficient checks. An attacker with privileges to create or edit a webhook could make Nautobot send requests to any IP address and port accessible from the server, allowing them to scan internal networks, access sensitive internal services, or exfiltrate data.