MitM
Enable MitM to inspect or rewrite HTTPS requests and run scripts on them. You can generate a CA certificate in Stash or import your own. Your device must trust the certificate.
For data security and privacy reasons, you should never share certificates with others or use CA certificates provided on the Internet.

Configuring MitM using configuration files
Configuring the CA certificate
http:
# CA certificate encoded in PKCS #12 format
ca: ''
# Certificate passphrase
ca-passphrase: ''
# The device must trust this CA certificate for MitM decryption.Configuring the MitM list
http:
# Enable MitM decryption for these hosts using the trusted CA certificate.
mitm:
- g.cn
- '*.google.cn'
- weather-data.apple.com # Only enabled for port 443 by default
- weather-data.apple.com:* # Enable for all ports using wildcard
- '*.weather-data.apple.com' # Wildcards can also be used in domain namesFor hosts configured for MitM decryption, Stash refuses QUIC (HTTP/3) connections so apps can retry over TCP, where the HTTP Engine can decrypt them.BetaiOS/tvOS5.1+macOS5.1+
Host and Port Matching Syntax
BetaiOS/tvOS5.1+macOS5.1+The MitM host list supports flexible hostname wildcards and port matching rules:
- Wildcards:
*: Matches characters of any length, e.g.,*.google.comorweather-*.apple.com.?: Matches a single character, e.g.,test?.example.commatchestest1.example.com, but nottest12.example.com.
- Exclusion rules:
- Prefixing a hostname with
-excludes it, e.g.,-api.example.comor-*.apple.com:443. Exclusion rules take precedence over inclusion rules.
- Prefixing a hostname with
- Port matching:
- Port omitted: Matches port 443 only by default (e.g.,
example.comis equivalent toexample.com:443). - Specific port: Specify a port with
:port, e.g.,example.com:8443. - All ports: Use
host:*,host:0, orhost:to match all ports for that host, e.g.,example.com:*.
- Port omitted: Matches port 443 only by default (e.g.,
http:
mitm:
- '*.google.com'
- 'test?.example.com'
- 'example.com:8443'
- 'weather-data.apple.com:*'
- '-api.example.com' # Exclude this subdomainAny-Port Protocol Sniffing
iOS/tvOS5.0+macOS5.0+Stash automatically identifies the protocol on any port matched by the MitM list or force-http-engine, even when Sniff Domain is off. The HTTP Engine handles plain HTTP requests. With MitM enabled, Stash uses the configured CA certificate to decrypt HTTPS connections that match the MitM list and passes them to the HTTP Engine. It forwards other connections as usual.
Configure MitM in the iOS Visual Editor
You can generate the CA certificate and choose which hosts to decrypt in the profile’s visual editor.
Configuring the CA certificate
- In the profile’s visual editor, open CA Certificate and tap Generate a New CA Certificate.
- Once the active configuration uses this certificate, tap Install Certificate. In the browser, allow the configuration profile containing the certificate to download.
- In iOS, open Settings → General → VPN & Device Management. Select the downloaded profile and install it.
Configuring the MitM list
In the profile’s visual editor, open MitM Hosts and add the hostnames you want to decrypt. You can use wildcards such as *.example.com.
Trust the CA Certificate in iOS
After installing the profile, open Settings → General → About → Certificate Trust Settings. Enable full trust for the Stash CA certificate you just installed.