Auditing your own system? Hackerbane runs AI security audits. Request an audit.
Hackerbane
Mistral AI
Assessment Report

Mistral AI
mistral-common image URL loading

mistral-common is the tokenizer library for Mistral models, used by vLLM and the Hugging Face Transformers MistralCommonBackend. image_from_chunk resolves an ImageURLChunk on the public encode path, and the URL comes from the request. This assessment covers image URL loading in mistralai/mistral-common at f469a42770517baafec6d688abc4a6f39250c447. Review ran 7-21 September 2026. The image findings were fixed in PR 308, merged as 8909d36.

0Critical
1High
1Medium
1Low
1Info
DocumentHACK-AR-2026-MISTRAL-COMMON-IMAGE-URL  /  AI/ML review (targeted)
Systemmistralai/mistral-common / image URL loading
Scopeimage_from_chunk, download_image, experimental tokenize handlers, Audio.from_url (see 2.4)
Review commitf469a42770517baafec6d688abc4a6f39250c447 · fix 8909d36
UpstreamPR 308 / issue 307 (merged)
ReviewSeptember 7th, 2026 - September 21st, 2026
AuthorHackerbane
hackerbane.com hello@hackerbane.com HACK-AR-2026-MISTRAL-COMMON-IMAGE-URL
Hackerbane · Assessment Report HACK-AR-2026-MISTRAL-COMMON-IMAGE-URL

Contents

  1. -Document revision history
  2. -Contacts
  3. 1Executive overview
  4. 1.1Introduction
  5. 1.2What we found
  6. 1.3How this review was done
  7. 2Scoring (BVSS)
  8. 2.1Exploitability
  9. 2.2Impact
  10. 2.3Severity coefficient
  11. 2.4Scope
  12. 3Findings overview
  13. 4Findings
  14. 4.1(HACK-01) DOWNLOAD_IMAGE CALLS REQUESTS.GET WITH NO TIMEOUT ON THE PUBLIC ENCODE PATH
  15. 5Recommendations
  16. 6Fuzz testing
  17. 7Static analysis
  18. 8Remediation record
  19. 9Exhibit B

Document revision history

VersionModificationDate
0.4Assessment09/21/2026
1.0Remediation review. Confirmed PR 308 merged as 8909d36. Ran tests/test_image.py and direct probes on the parent and merged trees.09/21/2026
1.1Document ID changed from HB-AR-2026.12 to HACK-AR-2026-MISTRAL-COMMON-IMAGE-URL. No other changes.10/05/2026

Contacts

ContactCompanyEmail
HackerbaneHackerbanehello@hackerbane.com

1   Executive overview

1.1   Introduction

mistral-common tokenizes chat completion requests for Mistral models. Image content arrives as an ImageURLChunk whose url field is attacker-supplied. On the encode path, ImageEncoder.__call__ calls image_from_chunk (src/mistral_common/tokens/tokenizers/image.py), which reaches download_image (src/mistral_common/image.py) for http and https URLs. That path is what vLLM and the Transformers MistralCommonBackend run through MistralTokenizer.encode_chat_completion.

Hackerbane reviewed image URL loading at f469a42770517baafec6d688abc4a6f39250c447. Report date is 21 September 2026. Review ran 7 September 2026 (issue 307) through the merge of PR 308 on 21 September 2026. Scope, commit, and file list are in section 2.4.

1.2   What we found

download_image called requests.get with no timeout. A client that supplies an image URL pointing at a server that accepts the connection and then never responds pins the encode worker on that request. requests has no default timeout, so the call blocks until the socket is torn down by something outside the library. On a serving stack that runs encode in the request path, that removes a worker until it is restarted (HACK-01, High).

image_from_chunk gated the local-file branch on url.startswith("file"), which matches any URL beginning with the four letters file, not only the file:// scheme. A URL such as file-collision.png or file/../secret.png was opened relative to the process working directory, and the file handle was never closed (HACK-02, Medium). A data URL with no comma raised IndexError from split(",")[1], and an empty payload failed deep in PIL. The experimental tokenize handlers only convert ValueError on the request-normalization path, so the IndexError surfaced as an unhandled 500 (HACK-03, Low).

All three were fixed in PR 308: download_image takes a timeout that defaults to 10 seconds and is overridable through MISTRAL_COMMON_IMAGE_DOWNLOAD_TIMEOUT; the local-file branch requires file:// and opens inside a with block; the data URL is split with partition and raises a typed error when there is no payload. Audio.from_url carries the same missing-timeout pattern and was left out of PR 308 as follow-up (HACK-04, Informational). The rest of the detail is chapters 3 through 5.

1.3   How this review was done

Line-by-line read of image URL loading at f469a42770517baafec6d688abc4a6f39250c447, following the encode path from ImageEncoder.__call__ to the network. The read and the checks covered:

No fuzz harness was run. No standalone static analyzer was run. See chapters 6 and 7.

2   Scoring (BVSS)

Each finding gets a BVSS vector. Exploitability is Attack Origin, Attack Cost, and Attack Complexity. Impact is Confidentiality, Integrity, Availability, Deposit, and Yield. The coefficient is Reversibility times Scope. The printed score is min(10, E * I * C * 10), rounded up to one decimal.

S = min(10, E * I * C * 10)

2.1   Exploitability

E is the product of Attack Origin (AO), Attack Cost (AC), and Attack Complexity (AX).

MetricValueNumeric
Attack Origin (AO)Arbitrary (AO:A) / Specific (AO:S)1 / 0.2
Attack Cost (AC)Low / Medium / High1 / 0.67 / 0.33
Attack Complexity (AX)Low / Medium / High1 / 0.67 / 0.33

AO:A means any request can carry the input. AC is cost relative to one request. AX is conditions beyond the attacker.

2.2   Impact

Confidentiality (C), Integrity (I), Availability (A), Deposit (D), and Yield (Y). Integrity and Availability exclude impact already counted under Deposit or Yield.

NoneLowMediumHighCritical
C / I / A / D / Y00.250.50.751

I = max(mI) + (sum(mI) - max(mI)) / 4

2.3   Severity coefficient

CoefficientValueNumeric
Reversibility (R)None / Partial / Full1 / 0.5 / 0.25
Scope (S)Changed / Unchanged1.25 / 1

C = R * S

BandScore
Critical9.0 - 10.0
High7.0 - 8.9
Medium4.5 - 6.9
Low2.0 - 4.4
Informational0.0 - 1.9

HACK-01 sets A:H because a single attacker-controlled URL removes an encode worker for as long as the peer holds the connection open, with no cost beyond one request. HACK-02 sets C:M because a name that starts with file opens a working-directory file into the image pipeline, and A:L for the leaked handle; the confidentiality payoff needs a decodable image at the resolved path, which is why exploitability stays AX:L on the open itself. HACK-03 sets A:L: the malformed data URL is a per-request 500, not a persistent outage. HACK-04 is Informational: it names the same missing-timeout pattern in Audio.from_url, which PR 308 left out of scope.

2.4   Scope

Code repository:

1. mistralai/mistral-common image URL loading

Files in scope:

Out of scope:

3   Findings overview

CriticalHighMediumLowInformational
0 1 1 1 1
Security analysisRisk levelRemediation
(HACK-01) DOWNLOAD_IMAGE CALLS REQUESTS.GET WITH NO TIMEOUT ON THE PUBLIC ENCODE PATHHigh (7.5)Remediated (#308)
(HACK-02) IMAGE_FROM_CHUNK TREATS ANY "FILE" PREFIX AS A LOCAL PATH AND LEAKS THE HANDLEMedium (5.7)Remediated (#308)
(HACK-03) MALFORMED DATA URL RAISES INDEXERROR AND ESCAPES AS AN UNHANDLED 500Low (2.5)Remediated (#308)
(HACK-04) AUDIO.FROM_URL DOWNLOADS WITH NO TIMEOUTInformational (0.0)Open (follow-up)

4   Findings

4.1 (HACK-01) DOWNLOAD_IMAGE CALLS REQUESTS.GET WITH NO TIMEOUT ON THE PUBLIC ENCODE PATH

High (7.5)image URL loadingAvailability / DoSRemediated
Description

download_image in src/mistral_common/image.py issues requests.get(url, headers=headers) with no timeout. requests applies no default timeout, so the call blocks until the connection is closed by the peer or by the operating system. The URL comes from an ImageURLChunk, which is request content on the encode path: ImageEncoder.__call__ to image_from_chunk to download_image, reached by MistralTokenizer.encode_chat_completion. vLLM and the Transformers MistralCommonBackend call that method on user requests.

A client that sends an image URL pointing at a server that accepts the TCP connection and then withholds the response body holds the encode worker on that request. On a serving stack that runs encode inline, the worker is unavailable until it is restarted or killed. Cost to the attacker is one request; no authentication beyond whatever the tokenize endpoint already requires.

Code location

Listing 1: src/mistral_common/image.py (Lines 12, 21-32) at f469a42

12def download_image(url: str) -> Image.Image:
21 headers = {"User-Agent": f"mistral-common/{__version__}"}
22 try:
23 # Make a request to download the image
24 response = requests.get(url, headers=headers)
25 response.raise_for_status() # Raise an error for bad responses (4xx, 5xx)
26
27 # Convert the image content to a PIL Image
28 img = Image.open(io.BytesIO(response.content))
29 return img
30
31 except requests.exceptions.RequestException as e:
32 raise RuntimeError(f"Error downloading the image from {url}: {e}.")

Listing 2: src/mistral_common/tokens/tokenizers/image.py (Lines 72-83) at f469a42

72 if isinstance(chunk, ImageChunk):
73 return chunk.image
74 if chunk.get_url().startswith("data:image"):
75 data = chunk.get_url().split(",")[1]
76 image_data = base64.b64decode(data)
77 return Image.open(BytesIO(image_data))
78 if chunk.get_url().startswith("file"):
79 return Image.open(open(chunk.get_url().replace("file://", ""), "rb"))
80 if chunk.get_url().startswith("http"):
81 return download_image(chunk.get_url())
82
83 raise RuntimeError(f"Unsupported image url scheme {chunk.get_url()}")
Proof of concept
  1. On a worktree of f469a42, patch mistral_common.image.requests.get with a mock and call image_from_chunk(ImageURLChunk(image_url="http://example.invalid/x.png")).
  2. The recorded call is requests.get('http://example.invalid/x.png', headers={'User-Agent': 'mistral-common/1.11.7'}). There is no timeout keyword, so against a real slow server the call does not return.
  3. On the merged commit 8909d36 the same probe records timeout=10.0 in the kwargs.
BVSS

AO:A/AC:L/AX:L/C:N/I:N/A:H/D:N/Y:N/R:N/S:U (7.5)

Recommendation

Pass a timeout to requests.get. Make it configurable so a heavy image pipeline can raise the cap without threading a parameter through the tokenizer, and give a clear error when it fires.

Remediation plan

Remediated in PR 308 (8909d36). download_image(url, timeout) resolves timeout from MISTRAL_COMMON_IMAGE_DOWNLOAD_TIMEOUT when None (default 10 seconds), passes it to requests.get, and on requests.exceptions.Timeout raises a message naming both the timeout argument and the environment variable.

4.2 (HACK-02) IMAGE_FROM_CHUNK TREATS ANY "FILE" PREFIX AS A LOCAL PATH AND LEAKS THE HANDLE

Medium (5.7)image URL loadingScheme confusion / fd leakRemediated
Description

image_from_chunk gated the local-file branch on chunk.get_url().startswith("file"). That matches any URL whose first four characters are file, not only the file:// scheme. replace("file://", "") is a no-op when there is no file:// prefix, so a URL such as file-collision.png is passed straight to open() and resolved against the process working directory. A URL such as file/../secret.png resolves through the working directory as well. The handle from the inner open(...) is passed to Image.open and never closed.

The intended behavior is that only file:// URIs load a local file and any other unknown scheme raises the unsupported-scheme error. Because the guard is a prefix test on the bare word, a request whose image URL happens to start with file reads a working-directory file into the image pipeline when a decodable image sits at the resolved path, and leaks a file descriptor on every such call.

Code location

See Listing 2 (src/mistral_common/tokens/tokenizers/image.py Lines 78-79 at f469a42): the startswith("file") branch and the unclosed open().

Proof of concept
  1. On a worktree of f469a42, write a small PNG to the process working directory as file-collision.png.
  2. Call image_from_chunk(ImageURLChunk(image_url="file-collision.png")). It returns the decoded image (size (2, 2) in the probe), so the bare name was opened as a local file rather than rejected.
  3. On the merged commit 8909d36 the same call raises ValueError: Unsupported image url scheme file-collision.png.
BVSS

AO:A/AC:L/AX:L/C:M/I:N/A:L/D:N/Y:N/R:N/S:U (5.7)

Recommendation

Require the file:// prefix before treating a URL as a local path, so bare names fall through to the unsupported-scheme error. Open the file inside a with block and force the pixels to load before the block closes.

Remediation plan

Remediated in PR 308 (8909d36). The branch is now url.startswith("file://"), opens inside with open(url.removeprefix("file://"), "rb") as file, calls image.load() before the handle closes, and bare names reach raise ValueError(f"Unsupported image url scheme {url}").

4.3 (HACK-03) MALFORMED DATA URL RAISES INDEXERROR AND ESCAPES AS AN UNHANDLED 500

Low (2.5)image URL loadingError handlingRemediated
Description

For a data:image URL, image_from_chunk ran chunk.get_url().split(",")[1]. A data URL with no comma, for example data:image/png;base64, makes split(",") return a one-element list, and the index raises IndexError. An empty payload, data:image/png;base64,, passes an empty string to base64.b64decode and then fails inside PIL.

The experimental tokenize server (src/mistral_common/experimental/app/routers.py) only wraps the OpenAI request conversion in except (ValidationError, ValueError). The call to encode_chat_completion that reaches image_from_chunk is not wrapped, and there is no application-level exception handler, so an IndexError from a bad data URL is an unhandled 500 rather than a client error. The exception type is also wrong: the function documents unsupported input as its own error family, not a raw IndexError from a list index.

Code location

See Listing 2 (src/mistral_common/tokens/tokenizers/image.py Lines 74-76 at f469a42): the split(",")[1] on the data URL branch.

Listing 3: src/mistral_common/experimental/app/routers.py (Lines 34-52) at f469a42

34@tokenize_router.post("/")
35async def tokenize_request(
36 request: ChatCompletionRequest | OpenAIChatCompletionRequest,
37 settings: Annotated[Settings, Depends(get_settings)],
38) -> list[int]:
39 r"""Tokenize a chat completion request."""
40 if isinstance(request, OpenAIChatCompletionRequest):
41 try:
42 request.drop_extra_fields()
43 request = ChatCompletionRequest.from_openai(**request.model_dump())
44 except (ValidationError, ValueError) as e:
45 raise HTTPException(status_code=400, detail=str(e))
46
47 if request.messages == []:
48 raise HTTPException(status_code=400, detail="Messages list cannot be empty.")
49
50 tokenized = settings.tokenizer.encode_chat_completion(request)
51 assert isinstance(tokenized, Tokenized), type(tokenized)
52 return tokenized.tokens
Proof of concept
  1. On a worktree of f469a42, call image_from_chunk(ImageURLChunk(image_url="data:image/png;base64")).
  2. It raises IndexError: list index out of range from split(",")[1]. Because line 50 above is not wrapped and no handler is registered, that surfaces as a 500.
  3. On the merged commit 8909d36 the same input raises ValueError with the message Invalid image data URL ...: expected a base64 payload after a comma.
BVSS

AO:A/AC:L/AX:L/C:N/I:N/A:L/D:N/Y:N/R:N/S:U (2.5)

Recommendation

Split the data URL on the first comma with partition and raise a typed error when there is no payload, so a malformed data URL is a defined exception the caller can map to a 4xx instead of an opaque IndexError.

Remediation plan

Remediated in PR 308 (8909d36). The branch uses _, _, data = url.partition(",") and raises ValueError when data is empty, covering both the missing comma and the empty payload. A new ImageDecodeException was added for decode failures.

4.4 (HACK-04) AUDIO.FROM_URL DOWNLOADS WITH NO TIMEOUT

Informational (0.0)audio URL loadingAvailability / follow-upOPEN
Description

Audio.from_url in src/mistral_common/tokens/tokenizers/audio.py downloads with requests.get(url) and no timeout, the same pattern HACK-01 fixes for images. Audio URL content reaches this on the same request-driven path when a request carries an AudioURLChunk with an http or https URL. Assessed as its own finding, the availability impact matches HACK-01. It is recorded here as Informational because PR 308 scoped itself to image loading and flagged the audio timeout as follow-up in issue 307. The audio grammar differs (base64, file URI, http), so a fix is a separate change, not a line moved from the image patch.

Code location

Listing 4: src/mistral_common/tokens/tokenizers/audio.py (Lines 96-120) at 8909d36

96 @staticmethod
97 def from_url(url: str, strict: bool = True) -> "Audio":
98 r"""Create an Audio instance from a URL.
112 """
113 try:
114 response = _requests_lib.get(url)
115 response.raise_for_status()
116 return Audio.from_bytes(response.content, strict=strict)
117 except _requests_lib.RequestException as e: # Something went wrong with the request.
118 raise ValueError(f"Failed to download audio from URL: {url}") from e
119 except Exception as e: # Something went wrong with the audio file.
120 raise ValueError(f"Failed to create Audio instance from URL: {url} .") from e
BVSS

AO:A/AC:L/AX:L/C:N/I:N/A:N/D:N/Y:N/R:N/S:U (0.0)

Recommendation

Give Audio.from_url the same timeout treatment as download_image: a configurable timeout with a default, and a clear error when it fires.

Remediation plan

Open. Out of scope for PR 308, flagged in issue 307 as follow-up.

5   Recommendations

Same order as chapter 4, grouped by band. Each row is the change for that HACK id. HACK-01 through HACK-03 are remediated in PR 308 (8909d36); HACK-04 is open.

High

IDRiskRecommendationStatus
HACK-01High (7.5)Pass a configurable timeout to requests.get in download_image, defaulting through MISTRAL_COMMON_IMAGE_DOWNLOAD_TIMEOUT, and raise a clear error when it fires.Remediated (#308)

Medium

IDRiskRecommendationStatus
HACK-02Medium (5.7)Require the file:// prefix for the local-file branch so bare names fall through to the unsupported-scheme error, and open the file in a with block with load() before close.Remediated (#308)

Low

IDRiskRecommendationStatus
HACK-03Low (2.5)Split the data URL with partition and raise a typed error on an empty payload so callers can map it to a 4xx.Remediated (#308)

Informational

IDRiskRecommendationStatus
HACK-04Informational (0.0)Apply the same configurable timeout to Audio.from_url.Open (follow-up)

6   Fuzz testing

No fuzz harness was run for this review. The scheme dispatch in image_from_chunk and the requests.get call in download_image were checked by reading the sources and by direct probes on the parent and merged trees. tests/test_image.py was executed on the merged commit (52 passed with the opencv extra), which includes the PR 308 regression cases for the malformed data URL, the bare file name, the file:// URI, and the timeout reaching requests.get.

7   Static analysis

No standalone static analyzer was run by Hackerbane on this tree. The timeout, the scheme prefix test, and the data URL split were checked by reading the sources and are filed as HACK ids. The repository's own ruff and mypy gates run in PR CI and passed on the changed files; that is the project's tooling, not a separate Hackerbane run.

8   Remediation record

Report date 21 September 2026. PR 308 merged as 8909d36 on 21 September 2026. HACK-01, HACK-02, and HACK-03 are fixed in that commit and confirmed against the merged tree. HACK-04 is open.

DateIDsCommit / statementIndependent confirmMerge
09/21/2026 HACK-01, HACK-02, HACK-03 8909d36 (PR 308). Timeout added and default resolved from the environment; file:// required and the handle closed; data URL split with partition raising a typed error. Yes. Probes on parent and merged trees; tests/test_image.py 52 passed. Merged
09/21/2026 HACK-04 Open. Audio.from_url still calls requests.get with no timeout. Out of scope for PR 308, flagged in issue 307 as follow-up. Yes. Read at 8909d36. Open

9   Exhibit B

Severity words for this Assessment Report, plus the as-is cap. Services agreement terms apply when one exists.

All services, the assessment report, work product, or other materials are provided "as is" and "as available" and with all faults and defects without warranty of any kind. To the maximum extent permitted under applicable law, Hackerbane disclaims all warranties, express, implied, or statutory, including merchantability, fitness for a particular purpose, title, and non-infringement. Hackerbane makes no warranty that the services or the report will meet any person's requirements, achieve any intended result, be secure, accurate, complete, free of harmful code, or error-free, or that any error can or will be corrected.

No third party is a beneficiary of this report. This report is not financial, tax, legal, or regulatory advice.

Severity words used in the Report

CriticalFunds or safety, exploitable as scoped. An attacker with the access the threat model grants can take value or break a safety property now.
HighSerious, less immediate than critical. Exploitable with a precondition that is realistic but not free: a specific role, a market state, a second bug.
MediumBounded loss or a broken assumption that does not yet have an exploit path in scope. Fix before the next release.
LowDefense in depth. No direct loss path today; removes a step from a future one.
InformationalAn observation with no security impact as scoped. Hygiene, clarity, or a note for the next reviewer.
hackerbane.com hello@hackerbane.com HACK-AR-2026-MISTRAL-COMMON-IMAGE-URL