Skip to content

Fix invalid shadowsocks ciphers crashing the app#10284

Open
rablador wants to merge 1 commit intomainfrom
fix-invalid-shadowsocks-ciphers-crashing
Open

Fix invalid shadowsocks ciphers crashing the app#10284
rablador wants to merge 1 commit intomainfrom
fix-invalid-shadowsocks-ciphers-crashing

Conversation

@rablador
Copy link
Copy Markdown
Contributor

@rablador rablador commented Apr 23, 2026

Sending an invalid shadowsocks cipher to the Rust layer causes a crash. This PR fixes this by validating the ciphers before initializing stored custom access methods.


This change is Reviewable

@rablador rablador requested a review from pinkisemils April 23, 2026 08:11
@rablador rablador self-assigned this Apr 23, 2026
@rablador rablador added bug iOS Issues related to iOS labels Apr 23, 2026
@rablador rablador force-pushed the fix-invalid-shadowsocks-ciphers-crashing branch from aca5811 to 7c78e43 Compare April 23, 2026 08:24
@github-actions
Copy link
Copy Markdown

🚨 End to end tests failed. Please check the failed workflow run.

Copy link
Copy Markdown
Collaborator

@pinkisemils pinkisemils left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@pinkisemils reviewed 7 files and all commit messages, and made 1 comment.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on rablador).


ios/MullvadRustRuntime/MullvadConnectionModeProvider.swift line 11 at r1 (raw file):

import MullvadTypes

public func initAccessMethodSettingsWrapper(methods: [PersistentAccessMethod], validShadowsocksCiphers: [String])

I wonder, could we add a unit test here that would've crashed before and wouldn't crash now?

Further, is there any risk in calling into rust to fetch the valid ciphers here instead of receiving the validShadowsocksCiphers argument? Feels a bit whack to pipe it all the way through.

Further, maybe it'd be best to do the filtering of the access methods in a function that is separate from all the low-level bit twiddling of pointers?

Copy link
Copy Markdown
Contributor Author

@rablador rablador left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rablador made 1 comment.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on pinkisemils).


ios/MullvadRustRuntime/MullvadConnectionModeProvider.swift line 11 at r1 (raw file):

Previously, pinkisemils (Emīls Piņķis) wrote…

I wonder, could we add a unit test here that would've crashed before and wouldn't crash now?

Further, is there any risk in calling into rust to fetch the valid ciphers here instead of receiving the validShadowsocksCiphers argument? Feels a bit whack to pipe it all the way through.

Further, maybe it'd be best to do the filtering of the access methods in a function that is separate from all the low-level bit twiddling of pointers?

  1. We could I think. Let me have a look.
  2. No risk, but it boils down to the same discussion we had some time ago when the new cipher functionality was first introduced. Do we simply fetch it when needed (basically statically) or do we inject it "traditionally" from some shared origin.
  3. Sure

Copy link
Copy Markdown
Collaborator

@pinkisemils pinkisemils left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@pinkisemils made 1 comment.
Reviewable status: all files reviewed, 1 unresolved discussion (waiting on rablador).


ios/MullvadRustRuntime/MullvadConnectionModeProvider.swift line 11 at r1 (raw file):

Previously, rablador (Jon Petersson) wrote…
  1. We could I think. Let me have a look.
  2. No risk, but it boils down to the same discussion we had some time ago when the new cipher functionality was first introduced. Do we simply fetch it when needed (basically statically) or do we inject it "traditionally" from some shared origin.
  3. Sure

Well, for testing purposes, providing a list of valid ciphers makes sense, so I retract that specific ask.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug iOS Issues related to iOS

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants