VAITP Dataset

← Back to the dataset

CVE-2026-46556

FlaskBB SSRF allows authenticated users to scan internal networks.

  • CVSS 6.5
  • CWE-918
  • Input Validation and Sanitization
  • Remote

FlaskBB is a Forum Software written in Python using the micro framework Flask. Prior to version 2.2.1, a Server-Side Request Forgery (SSRF) vulnerability in get_image_info() allows any authenticated user to force the server to send HTTP requests to arbitrary internal endpoints, including cloud metadata services. This is a blind SSRF with confirmed internal port scanning and internal API triggering capabilities. Version 2.2.1 patches the issue.

CVSS base score
6.5
Published
2026-07-21
OWASP
A10 Server-Side Request Forgery (SSRF)
Orthogonal defect classification
Checking
Code defect classification
Missing Check
Category
Input Validation and Sanitization
Subcategory
Server-Side Request Forgery (SSRF)
Accessibility scope
Remote
Impact
Information Disclosure
Affected component
FlaskBB
Fixed by upgrading
Yes

Solution

Upgrade FlaskBB to version 2.2.1 or later.

Vulnerable code sample

import requests
from io import BytesIO
from PIL import Image

def get_image_info(image_url: str):
    """
    Fetches an image from a URL and extracts its information.
    This is the vulnerable function where image_url is not validated.
    """
    try:
        # The user-provided 'image_url' is used directly without validation.
        # This allows an attacker to specify internal addresses like
        # 'http://127.0.0.1:8000' or 'http://169.254.169.254/'.
        response = requests.get(image_url, timeout=4, stream=True)
        response.raise_for_status()

        # Read a limited amount of data to parse for image info
        content = response.raw.read(2 * 1024 * 1024, decode_content=True)
        
        image = Image.open(BytesIO(content))
        image.verify()  # Verify that this is a valid image file

        return {
            "format": image.format,
            "width": image.width,
            "height": image.height
        }
    except (requests.exceptions.RequestException, IOError, ValueError):
        # Errors are handled generically. An attacker cannot see the direct
        # response from the internal endpoint but can infer information based
        # on timing differences (e.g., connection refused vs. timeout)
        # or by triggering an action on an internal API.
        return None

Patched code sample

import ssrf_requests
import requests
from PIL import Image
from io import BytesIO

# The vulnerability existed because a user-supplied URL was fetched directly.
# The fix involves using a library that validates the URL and blocks requests
# to internal or private IP addresses, thus preventing SSRF.
#
# The code below represents a fixed version of such a function.

def get_image_info(image_url: str):
    """
    Safely fetches an image from a URL and returns its dimensions.

    This function uses the `ssrf_requests` library to prevent Server-Side
    Request Forgery (SSRF) attacks by ensuring the requested URL does not
    point to an internal or private network resource.
    """
    # Use a session that blocks SSRF attempts by default.
    session = ssrf_requests.Session()

    try:
        # The `session.get` call will raise an `ssrf_requests.exceptions.SSRFException`
        # if the URL targets a private/reserved IP address.
        with session.get(image_url, stream=True, timeout=5) as response:
            response.raise_for_status()
            
            # Process the image only if the request was safe and successful
            image = Image.open(BytesIO(response.content))
            return {
                "width": image.width,
                "height": image.height,
                "format": image.format,
            }
    except (requests.RequestException, ssrf_requests.exceptions.SSRFException) as e:
        # Handle exceptions from both network errors and detected SSRF attempts
        print(f"Could not retrieve or process image from {image_url}: {e}")
        return None

Payload

http://169.254.169.254/latest/meta-data/

Cite this entry

@misc{vaitp:cve202646556,
  title        = {{FlaskBB SSRF allows authenticated users to scan internal networks.}},
  author       = {Bogaerts, Fr\'ed\'eric and Ivaki, Naghmeh and Fonseca, Jos\'e},
  year         = {2026},
  note         = {VAITP Python Vulnerability Dataset, entry CVE-2026-46556},
  howpublished = {\url{https://netpack.pt/vaitp/vulnerability/CVE-2026-46556/}}
}
Introducing the "VAITP dataset": a specialized repository of Python vulnerabilities and patches, meticulously compiled for the use of the security research community. As Python's prominence grows, understanding and addressing potential security vulnerabilities become crucial. Crafted by and for the cybersecurity community, this dataset offers a valuable resource for researchers, analysts, and developers to analyze and mitigate the security risks associated with Python. Through the comprehensive exploration of vulnerabilities and corresponding patches, the VAITP dataset fosters a safer and more resilient Python ecosystem, encouraging collaborative advancements in programming security.

The supreme art of war is to subdue the enemy without fighting.

Sun Tzu – “The Art of War”

:: Shaping the future through research and ingenuity ::