skip to content
Back to GitHub.com
Home Bounties Research Advisories CodeQL Wall of Fame Get Involved Events
December 1, 2023

GHSL-2023-185: Server-Side Request Forgery (SSRF) in Posthog - CVE-2023-46746

Sylwia Budzynska

Coordinated Disclosure Timeline

Summary

A server-side request forgery (SSRF), which can only be exploited by authenticated users, was found in Posthog.

Product

posthog/posthog

Tested Version

1.43.1

Details

SSRF in test_slack_webhook method (GHSL-2023-185)

The test_slack_webhook method in posthog/api/user.py does not validate the user-controlled webhook variable and uses it to send POST requests on line 283, which leads to server-side request forgery.

def test_slack_webhook(request):
    """Test webhook."""
    try:
        body = json.loads(request.body)
    except (TypeError, json.decoder.JSONDecodeError):
        return JsonResponse({"error": "Cannot parse request body"}, status=400)

    webhook = body.get("webhook")

    if not webhook:
        return JsonResponse({"error": "no webhook URL"})
    message = {"text": "_Greetings_ from PostHog!"}
    try:
        response = requests.post(webhook, verify=False, json=message)

This issue was found using CodeQL’s Request Forgery query.

Impact

The SSRF allows for forging POST requests from the PostHog server.

CVE

Credit

This issue was discovered and reported by GHSL team member @sylwia-budzynska (Sylwia Budzynska).

Contact

You can contact the GHSL team at securitylab@github.com, please include a reference to GHSL-2023-185 in any communication regarding this issue.