forked from droe/sslsplit
-
Notifications
You must be signed in to change notification settings - Fork 0
/
sslsplit.1.in
860 lines (855 loc) · 37.5 KB
/
sslsplit.1.in
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
.\"-
.\" SSLsplit - transparent SSL/TLS interception
.\" https://www.roe.ch/SSLsplit
.\"
.\" Copyright (c) 2009-2019, Daniel Roethlisberger <daniel@roe.ch>.
.\" All rights reserved.
.\"
.\" Redistribution and use in source and binary forms, with or without
.\" modification, are permitted provided that the following conditions are met:
.\" 1. Redistributions of source code must retain the above copyright notice,
.\" this list of conditions and the following disclaimer.
.\" 2. Redistributions in binary form must reproduce the above copyright notice,
.\" this list of conditions and the following disclaimer in the documentation
.\" and/or other materials provided with the distribution.
.\"
.\" THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDER AND CONTRIBUTORS ``AS IS''
.\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
.\" ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
.\" LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
.\" CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
.\" SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
.\" INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
.\" CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
.\" POSSIBILITY OF SUCH DAMAGE.
.TH "sslsplit" "1" "@@DATE@@" "sslsplit @@VERSION@@" "SSLsplit"
.SH NAME
sslsplit \-\- transparent SSL/TLS interception
.SH SYNOPSIS
.na
.B sslsplit
[\fB-kCKqwWOPZdDgGsrRxeumjplLSFXYyTIMiab\fP] \fB-c\fP \fIpem\fP
\fIproxyspecs\fP [...]
.br
.B sslsplit
[\fB-kCKqwWOPZdDgGsrRxeumjplLSFXYyTIMiab\fP] \fB-c\fP \fIpem\fP \fB-t\fP \fIdir\fP
\fIproxyspecs\fP [...]
.br
.B sslsplit
[\fB-OPZwWdDgGsrRxeumjplLSFXYyTIMiab\fP] \fB-t\fP \fIdir\fP
\fIproxyspecs\fP [...]
.br
.B sslsplit [\fB-kCKwWOPZdDgGsrRxeumjplLSFXYyTIMi\fP] -f \fIconffile\fP
.br
.B sslsplit -E
.br
.B sslsplit -V
.br
.B sslsplit -h
.br
.ad
.SH DESCRIPTION
SSLsplit is a tool for man-in-the-middle attacks against SSL/TLS encrypted
network connections. It is intended to be useful for network forensics,
application security analysis and penetration testing.
.LP
SSLsplit is designed to transparently terminate connections that are redirected
to it using a network address translation engine. SSLsplit then terminates
SSL/TLS and initiates a new SSL/TLS connection to the original destination
address, while logging all data transmitted.
Besides NAT based operation, SSLsplit also supports static destinations and
using the server name indicated by SNI as upstream destination.
SSLsplit is purely a transparent proxy and cannot act as a HTTP or SOCKS proxy
configured in a browser.
See NAT ENGINES and PROXY SPECIFICATIONS below for specifics on the different
modes of operation.
.LP
SSLsplit supports plain TCP, plain SSL, HTTP and HTTPS connections over both
IPv4 and IPv6. It also has the ability to dynamically upgrade plain TCP to SSL
in order to generically support SMTP STARTTLS and similar upgrade mechanisms.
SSLsplit fully supports Server Name Indication (SNI) and is able to work with
RSA, DSA and ECDSA keys and DHE and ECDHE cipher suites. Depending on the
version of OpenSSL, SSLsplit supports SSL 3.0, TLS 1.0, TLS 1.1 and TLS 1.2,
and optionally SSL 2.0 as well.
.LP
For SSL and HTTPS connections, SSLsplit generates and signs forged X509v3
certificates on-the-fly, mimicking the original server certificate's subject
DN, subjectAltName extension and other characteristics.
SSLsplit has the ability to use existing certificates of which the private key
is available, instead of generating forged ones. SSLsplit supports NULL-prefix
CN certificates but otherwise does not implement exploits against specific
certificate verification vulnerabilities in SSL/TLS stacks.
.LP
SSLsplit implements a number of defences against mechanisms which would
normally prevent MitM attacks or make them more difficult.
SSLsplit can deny OCSP requests in a generic way.
For HTTP and HTTPS connections, SSLsplit mangles headers to
prevent server-instructed public key pinning (HPKP),
avoid strict transport security restrictions (HSTS),
avoid Certificate Transparency enforcement (Expect-CT) and
prevent switching to QUIC/SPDY, HTTP/2 or WebSockets (Upgrade,
Alternate Protocols).
HTTP compression, encodings and keep-alive are disabled to make the logs more
readable.
.LP
Logging options include traditional SSLsplit connect and content log files as
well as PCAP files and mirroring decrypted traffic to a network interface.
Additionally, certificates, master secrets and local process information can be
logged.
.LP
In order to maximize the chances that a connection can be successfully split,
SSLsplit does not verify upstream server certificates by default. Instead, all
certificates including self-signed are accepted and if the expected hostname
signalled in SNI is missing from the server certificate, it will be added to
dynamically forged certificates.
.LP
SSLsplit does not automagically redirect any network traffic. To actually
implement an attack, you also need to redirect the traffic to the system
running \fBsslsplit\fP. Your options include running \fBsslsplit\fP on a
legitimate router, ARP spoofing, ND spoofing, DNS poisoning, deploying a rogue
access point (e.g. using hostap mode), physical recabling, malicious VLAN
reconfiguration or route injection, /etc/hosts modification and so on.
.SH OPTIONS
.TP
.B \-a \fIpemfile\fP
Use client certificate from \fIpemfile\fP when destination server requests a
client certificate.
.TP
.B \-A \fIpemfile\fP
Use private key, certificate and certificate chain from PEM file \fIpemfile\fP
as leaf certificate instead of generating a leaf certificate on the fly.
The PEM file must contain a single private key, a single certificate and
optionally intermediate and root CA certificates to use as certificate chain.
When using \fB-t\fP, SSLsplit will first attempt to use a matching certificate
loaded from \fIcertdir\fP.
If \fB-t\fP is also used and a connection matches any certificate in the
directory specified with the \fB-t\fP option, that matching certificate is used
instead, taking precedence over the certificate specified with \fB-A\fP.
.TP
.B \-b \fIpemfile\fP
Use client private key from \fIpemfile\fP when destination server requests a
client certificate.
.TP
.B \-c \fIpemfile\fP
Use CA certificate from \fIpemfile\fP to sign certificates forged on-the-fly.
If \fIpemfile\fP also contains the matching CA private key, it is also loaded,
otherwise it must be provided with \fB-k\fP.
If \fIpemfile\fP also contains Diffie-Hellman group parameters, they are also
loaded, otherwise they can be provided with \fB-g\fP.
If \fB-t\fP is also given, SSLsplit will only forge a certificate if there is
no matching certificate in the provided certificate directory.
.TP
.B \-C \fIpemfile\fP
Use CA certificates from \fIpemfile\fP as extra certificates in the certificate
chain. This is needed if the CA given with \fB-k\fP and \fB-c\fP is a sub-CA,
in which case any intermediate CA certificates and the root CA certificate must
be included in the certificate chain.
.TP
.B \-d
Detach from TTY and run as a daemon, logging error messages to syslog instead
of standard error.
.TP
.B \-D
Run in debug mode, log lots of debugging information to standard error. This
also forces foreground mode and cannot be used with \fB-d\fP.
.TP
.B \-e \fIengine\fP
Use \fIengine\fP as the default NAT engine for \fIproxyspecs\fP without
explicit NAT engine, static destination address or SNI mode.
\fIengine\fP can be any of the NAT engines supported by the system, as
returned by \fB-E\fP.
.TP
.B \-E
List all supported NAT engines available on the system and exit. See
NAT ENGINES for a list of NAT engines currently supported by SSLsplit.
.TP
.B \-f \fIconffile\fP
Read configuration from \fIconffile\fP.
.TP
.B \-F \fIlogspec\fP
Log connection content to separate log files with the given path specification
(see LOG SPECIFICATIONS below). For each connection, a log file will be
written, which will contain both directions of data as transmitted.
Information about the connection will be contained in the filename only.
Only one of \fB-F\fP, \fB-L\fP and \fB-S\fP may be used (last one wins).
.TP
.B \-g \fIpemfile\fP
Use Diffie-Hellman group parameters from \fIpemfile\fP for Ephemereal
Diffie-Hellman (EDH/DHE) cipher suites. If \fB-g\fP is not given, SSLsplit
first tries to load DH parameters from the PEM files given by \fB-K\fP,
\fB-k\fP or \fB-c\fP. If no DH parameters are found in the key files, built-in
group parameters are automatically used.
The \fB-g\fP option is only available if SSLsplit was built against a version
of OpenSSL which supports Diffie-Hellman cipher suites.
.TP
.B \-G \fIcurve\fP
Use the named \fIcurve\fP for Ephemereal Elliptic Curve Diffie-Hellman (ECDHE)
cipher suites. If \fB-G\fP is not given, a default curve (\fBprime256v1\fP) is
used automatically.
The \fB-G\fP option is only available if SSLsplit was built against a version
of OpenSSL which supports Elliptic Curve Diffie-Hellman cipher suites.
.TP
.B \-h
Display help on usage and exit.
.TP
.B \-i
For each connection, find the local process owning the connection. This makes
process information such as pid, owner:group and executable path for
connections originating on the same system as SSLsplit available to the
connect log and enables the respective \fB-F\fP path specification directives.
\fB-i\fP is available on Mac OS X and FreeBSD; support for other platforms has
not been implemented yet.
.TP
.B \-I \fIif\fP
Mirror connection content as emulated packets to interface \fIif\fP with
destination address given by \fB-T\fP. This option is not available if
SSLsplit was built without mirroring support. If \fB-T\fP is omitted, the
packets are blindly pushed to \fIif\fP.
.TP
.B \-j \fIjaildir\fP
Change the root directory to \fIjaildir\fP using chroot(2) after opening files.
Note that this has implications for \fBsni\fP \fIproxyspecs\fP.
Depending on your operating system, you will need to copy files such as
\fB/etc/resolv.conf\fP to \fIjaildir\fP in order for name resolution to work.
Using \fBsni\fP proxyspecs depends on name resolution.
Some operating systems require special device nodes such as \fB/dev/null\fP
to be present within the jail. Check your system's documentation for details.
.TP
.B \-k \fIpemfile\fP
Use CA private key from \fIpemfile\fP to sign certificates forged on-the-fly.
If \fIpemfile\fP also contains the matching CA certificate, it is also loaded,
otherwise it must be provided with \fB-c\fP.
If \fIpemfile\fP also contains Diffie-Hellman group parameters, they are also
loaded, otherwise they can be provided with \fB-g\fP.
If \fB-t\fP is also given, SSLsplit will only forge a certificate if there is
no matching certificate in the provided certificate directory.
.TP
.B \-K \fIpemfile\fP
Use private key from \fIpemfile\fP for the leaf certificates forged on-the-fly.
If \fB-K\fP is not given, SSLsplit will generate a random 2048 bit RSA key.
.TP
.B \-l \fIlogfile\fP
Log connections to \fIlogfile\fP in a single line per connection format,
including addresses and ports and some HTTP and SSL information, if available.
SIGUSR1 will cause \fIlogfile\fP to be re-opened.
.TP
.B \-L \fIlogfile\fP
Log connection content to \fIlogfile\fP. The content log will contain a
parsable log format with transmitted data, prepended with headers identifying
the connection and the data length of each logged segment.
SIGUSR1 will cause \fIlogfile\fP to be re-opened.
Only one of \fB-F\fP, \fB-L\fP and \fB-S\fP may be used (last one wins).
.TP
.B \-m
When dropping privileges using \fB-u\fP, override the target primary group
to be set to \fIgroup\fP.
.TP
.B \-M \fIlogfile\fP
Log master keys to \fIlogfile\fP in SSLKEYLOGFILE format as defined by Mozilla.
Logging master keys in this format allows for decryption of SSL/TLS traffic
using Wireshark.
Note that unlike browsers implementing this feature, setting the SSLKEYLOGFILE
environment variable has no effect on SSLsplit.
SIGUSR1 will cause \fIlogfile\fP to be re-opened.
.TP
.B \-O
Deny all Online Certificate Status Protocol (OCSP) requests on all
\fIproxyspecs\fP and for all OCSP servers with an OCSP response of
\fBtryLater\fP, causing OCSP clients to temporarily accept even revoked
certificates.
HTTP requests are being treated as OCSP requests if the method is \fBGET\fP
and the URI contains a syntactically valid OCSPRequest ASN.1 structure
parsable by OpenSSL, or if the method is \fBPOST\fP and the \fBContent-Type\fP
is \fBapplication/ocsp-request\fP.
For this to be effective, SSLsplit must be handling traffic destined to the
port used by the OCSP server. In particular, SSLsplit must be configured to
receive traffic to all ports used by OCSP servers of targeted certificates
within the \fIcertdir\fP specified by \fB-t\fP.
.TP
.B \-p \fIpidfile\fP
Write the process ID to \fIpidfile\fP and refuse to run if the \fIpidfile\fP
is already in use by another process.
.TP
.B \-P
Passthrough SSL/TLS connections which cannot be split instead of dropping them.
Connections cannot be split if \fB-c\fP and \fB-k\fP are not given and the
site does not match any certificate loaded using \fB-t\fP, or if the connection
to the original server gives SSL/TLS errors. Specifically, this happens if the
site requests a client certificate.
In these situations, passthrough with \fB-P\fP results in uninterrupted service
for the clients, while dropping is the more secure alternative if unmonitored
connections must be prevented.
Passthrough mode currently does not apply to SSL/TLS errors in the connection
from the client, since the connection from the client cannot easily be retried.
Specifically, \fB-P\fP does not currently work for clients that do not accept
forged certificates.
.TP
.B \-q \fIcrlurl\fP
Set CRL distribution point (CDP) \fIcrlurl\fP on forged leaf certificates.
Some clients, such as some .NET applications, reject certificates that do not
carry a CDP. When using \fB-q\fP, you will need to generate an empty CRL
signed by the CA certificate and key provided with \fB-c\fP and \fB-k\fP, and
make it available at \fIcrlurl\fP.
.TP
.B \-r \fIproto\fP
Force SSL/TLS protocol version on both client and server side to \fIproto\fP
by selecting the respective OpenSSL method constructor instead of the default
SSLv23_method() which supports all protocol versions.
This is useful when analyzing traffic to a server that only supports a specific
version of SSL/TLS and does not implement proper protocol negotiation.
Depending on build options and the version of OpenSSL that is used, the
following values for \fIproto\fP are accepted: \fBssl2\fP, \fBssl3\fP,
\fBtls10\fP, \fBtls11\fP and \fBtls12\fP.
Note that SSL 2.0 support is not built in by default because some servers
don't handle SSL 2.0 Client Hello messages gracefully.
.TP
.B \-R \fIproto\fP
Disable the SSL/TLS protocol version \fIproto\fP on both client and server
side by disabling the respective protocols in OpenSSL. To disable multiple
protocol versions, \fB-R\fP can be given multiple times. If \fI-r\fP is also
given, there will be no effect in disabling other protocol versions.
Disabling protocol versions is useful when analyzing traffic to a server that
does not handle some protocol versions well, or to test behaviour with
different protocol versions.
Depending on build options and the version of OpenSSL that is used, the
following values for \fIproto\fP are accepted: \fBssl2\fP, \fBssl3\fP,
\fBtls10\fP, \fBtls11\fP and \fBtls12\fP.
Note that SSL 2.0 support is not built in by default because some servers
don't handle SSL 2.0 Client Hello messages gracefully.
.TP
.B \-s \fIciphers\fP
Use OpenSSL \fIciphers\fP specification for both server and client SSL/TLS
connections. If \fB-s\fP is not given, a cipher list of \fBALL:-aNULL\fP is
used.
Normally, SSL/TLS implementations choose the most secure cipher suites, not the
fastest ones. By specifying an appropriate OpenSSL cipher list, the set of
cipher suites can be limited to fast algorithms, or \fBeNULL\fP cipher suites
can be added. Note that for connections to be successful, the SSLsplit cipher
suites must include at least one cipher suite supported by both the client and
the server of each connection.
See ciphers(1) for details on how to construct OpenSSL cipher lists.
.TP
.B \-S \fIlogdir\fP
Log connection content to separate log files under \fIlogdir\fP. For each
connection, a log file will be written, which will contain both directions of
data as transmitted. Information about the connection will be contained in
the filename only.
Only one of \fB-F\fP, \fB-L\fP and \fB-S\fP may be used (last one wins).
.TP
.B \-t \fIcertdir\fP
Use private key, certificate and certificate chain from PEM files in
\fIcertdir\fP for connections to hostnames matching the respective
certificates, instead of using certificates forged on-the-fly.
A single PEM file must contain a single private key, a single certificate and
optionally intermediate and root CA certificates to use as certificate chain.
When using \fB-t\fP, SSLsplit will first attempt to use a matching certificate
loaded from \fIcertdir\fP.
If \fB-A\fP is also given, when there is no match in \fIcertdir\fP, the default
key, certificate and certificate chain from the PEM file specified with the
\fB-A\fP option is used instead.
Otherwise, if \fB-c\fP and \fB-k\fP are also given, certificates will be forged
on-the-fly for sites matching none of the common names in the certificates
loaded from \fIcertdir\fP.
Otherwise, connections matching no certificate will be dropped, or if
\fB-P\fP is given, passed through without splitting SSL/TLS.
.TP
.B \-T \fIaddr\fP
Mirror connection content as emulated packets to destination address \fIaddr\fP
on the interface given by \fB-I\fP. Only IPv4 target addresses are currently
supported. This option is not available if SSLsplit was built without
mirroring support.
.TP
.B \-u \fIuser\fP
Drop privileges after opening sockets and files by setting the real,
effective and stored user IDs to \fIuser\fP and loading the appropriate
primary and ancillary groups. If \fB-u\fP is not given, SSLsplit will drop
privileges to the stored UID if EUID != UID (setuid bit scenario), or to
\fBnobody\fP if running with full \fBroot\fP privileges (EUID == UID == 0).
User \fIuser\fP needs to be allowed to make outbound TCP connections, and in
some configurations, to also perform DNS resolution.
Dropping privileges enables privilege separation, which incurs latency for
certain options, such as separate per-connection log files. By using
\fB-u root\fP, SSLsplit can be run as root without dropping privileges.
Due to an Apple bug, \fB-u\fP cannot be used with \fBpf\fP proxyspecs on
Mac OS X.
.TP
.B \-x \fIengine\fP
Use the OpenSSL engine with identifier \fIengine\fP as a default engine. The
engine must be available within the OpenSSL ecosystem under the specified
identifier, that is, they must be loaded from the global OpenSSL configuration.
If \fIengine\fP is an absolute path, it will be interpreted as path to an
engine dynamically linked library and loaded by path, regardless of global
OpenSSL configuration.
This option is only available if built against a version of OpenSSL with engine
support.
.TP
.B \-X \fIpcapfile\fP
Log connection content to \fIpcapfile\fP in PCAP format, with emulated TCP, IP
and Ethernet headers.
SIGUSR1 will cause \fIpcapfile\fP to be re-opened.
Only one of \fB-X\fP, \fB-Y\fP and \fB-y\fP may be used (last one wins).
.TP
.B \-Y \fIpcapdir\fP
Log connection content to separate PCAP files under \fIpcapdir\fP. For each
connection, a separate PCAP file will be written.
Only one of \fB-X\fP, \fB-Y\fP and \fB-y\fP may be used (last one wins).
.TP
.B \-y \fIpcapspec\fP
Log connection content to separate PCAP files with the given path specification
(see LOG SPECIFICATIONS below). For each connection, a separate PCAP file will
be written.
Only one of \fB-X\fP, \fB-Y\fP and \fB-y\fP may be used (last one wins).
.TP
.B \-V
Display version and compiled features information and exit.
.TP
.B \-w \fIgendir\fP
Write generated keys and certificates to individual files in \fIgendir\fP.
For keys, the key identifier is used as filename, which consists of the SHA-1
hash of the ASN.1 bit string of the public key, as referenced by the
subjectKeyIdentifier extension in certificates.
For certificates, the SHA-1 fingerprints of the original and the used (forged)
certificate are combined to form the filename.
Note that only newly generated certificates are written to disk.
.TP
.B \-W \fIgendir\fP
Same as \fB-w\fP, but also write original certificates and certificates not
newly generated, such as those loaded from \fB-t\fP.
.TP
.B \-Z
Disable SSL/TLS compression on all connections. This is useful if your
limiting factor is CPU, not network bandwidth.
The \fB-Z\fP option is only available if SSLsplit was built against a version
of OpenSSL which supports disabling compression.
.SH "PROXY SPECIFICATIONS"
Proxy specifications (\fIproxyspecs\fP) consist of the connection type, listen
address and static forward address or address resolution mechanism (NAT engine,
SNI DNS lookup):
.LP
.na
\fBhttps\fP \fIlistenaddr port\fP
[\fInat-engine\fP|\fIfwdaddr port\fP|\fBsni\fP \fIport\fP]
.br
\fBssl\fP \fIlistenaddr port\fP
[\fInat-engine\fP|\fIfwdaddr port\fP|\fBsni\fP \fIport\fP]
.br
\fBhttp\fP \fIlistenaddr port\fP
[\fInat-engine\fP|\fIfwdaddr port\fP]
.br
\fBtcp\fP \fIlistenaddr port\fP
[\fInat-engine\fP|\fIfwdaddr port\fP]
.br
\fBautossl\fP \fIlistenaddr port\fP
[\fInat-engine\fP|\fIfwdaddr port\fP]
.ad
.TP
\fBhttps\fP
SSL/TLS interception with HTTP protocol decoding, including the removal of
HPKP, HSTS, Upgrade and Alternate Protocol response headers.
This mode currently suppresses WebSockets and HTTP/2.
.TP
\fBssl\fP
SSL/TLS interception without any lower level protocol decoding; decrypted
connection content is treated as opaque stream of bytes and not modified.
.TP
\fBhttp\fP
Plain TCP connection without SSL/TLS, with HTTP protocol decoding, including
the removal of HPKP, HSTS, Upgrade and Alternate Protocol response headers.
This mode currently suppresses WebSockets and HTTP/2.
.TP
\fBtcp\fP
Plain TCP connection without SSL/TLS and without any lower level protocol
decoding; decrypted connection content is treated as opaque stream of bytes
and not modified.
.TP
\fBautossl\fP
Plain TCP connection until a Client Hello SSL/TLS message appears in the byte
stream, then automatic upgrade to SSL/TLS interception.
This is generic, protocol-independent STARTTLS support, that may erroneously
trigger on byte sequences that look like Client Hello messages even though
there was no actual STARTTLS command issued.
.TP
.I listenaddr port
IPv4 or IPv6 address and port or service name to listen on. This is the
address and port where the NAT engine should redirect connections to.
.TP
.I nat-engine
NAT engine to query for determining the original destination address and port
of transparently redirected connections.
If no engine is given, the default engine is used, unless overridden with
\fB-e\fP. When using a NAT engine, \fBsslsplit\fP needs to run on the same
system as the NAT rules redirecting the traffic to \fBsslsplit\fP.
See NAT ENGINES for a list of supported NAT engines.
.TP
.I fwdaddr port
Static destination address, IPv4 or IPv6, with port or service name. When this
is used, connections are forwarded to the given server address and port.
If \fIfwdaddr\fP is a hostname, it will be resolved to an IP address.
.TP
\fBsni\fP \fIport\fP
Use the Server Name Indication (SNI) hostname sent by the client in the
Client Hello SSL/TLS message to determine the IP address of the server to
connect to. This only works for \fBssl\fP and \fBhttps\fP \fIproxyspecs\fP and
needs a port or service name as an argument.
Because this requires DNS lookups, it is preferable to use NAT engine
lookups (see above), except when that is not possible, such as when there is
no supported NAT engine or when running \fBsslsplit\fP on a different system
than the NAT rules redirecting the actual connections.
Note that when using \fB-j\fP with \fBsni\fP, you may need to prepare
\fIjaildir\fP to make name resolution work from within the chroot directory.
.SH "LOG SPECIFICATIONS"
Log specifications are composed of zero or more printf-style directives;
ordinary characters are included directly in the output path.
SSLsplit current supports the following directives:
.TP
.I %T
The initial connection time as an ISO 8601 UTC timestamp.
.TP
.I %d
The destination host and port, separated by a comma, IPv6 addresses using
underscore instead of colon.
.TP
.I %D
The destination host, IPv6 addresses using underscore instead of colon.
.TP
.I %p
The destination port.
.TP
.I %s
The source host and port, separated by a comma, IPv6 addresses using
underscore instead of colon.
.TP
.I %S
The source host, IPv6 addresses using underscore instead of colon.
.TP
.I %q
The source port.
.TP
.I %x
The name of the local process.
Requires \fB-i\fP to be used.
If process information is unavailable,
this directive will be omitted from the output path.
.TP
.I %X
The full path of the local process.
Requires \fB-i\fP to be used.
If process information is unavailable,
this directive will be omitted from the output path.
.TP
.I %u
The username or numeric uid of the local process.
Requires \fB-i\fP to be used.
If process information is unavailable,
this directive will be omitted from the output path.
.TP
.I %g
The group name or numeric gid of the local process.
Requires \fB-i\fP to be used.
If process information is unavailable,
this directive will be omitted from the output path.
.TP
.I %%
A literal '%' character.
.LP
.SH "NAT ENGINES"
SSLsplit currently supports the following NAT engines:
.TP
.B pf
OpenBSD packet filter (pf) \fBrdr\fP/\fBrdr-to\fP NAT redirects, also available
on FreeBSD, NetBSD and Mac OS X.
Fully supported, including IPv6.
Note that SSLsplit needs permission to open \fB/dev/pf\fP for reading, which by
default means that it needs to run under \fBroot\fP privileges.
Assuming inbound interface \fBem0\fP, first in old (FreeBSD, Mac OS X),
then in new (OpenBSD 4.7+) syntax:
.LP
.RS
.nf
\fBrdr pass on em0 proto tcp from 2001:db8::/64 to any port 80 \\
-> ::1 port 10080\fP
\fBrdr pass on em0 proto tcp from 2001:db8::/64 to any port 443 \\
-> ::1 port 10443\fP
\fBrdr pass on em0 proto tcp from 192.0.2.0/24 to any port 80 \\
-> 127.0.0.1 port 10080\fP
\fBrdr pass on em0 proto tcp from 192.0.2.0/24 to any port 443 \\
-> 127.0.0.1 port 10443\fP
.fi
.RE
.LP
.RS
.nf
\fBpass in quick on em0 proto tcp from 2001:db8::/64 to any \\
port 80 rdr-to ::1 port 10080\fP
\fBpass in quick on em0 proto tcp from 2001:db8::/64 to any \\
port 443 rdr-to ::1 port 10443\fP
\fBpass in quick on em0 proto tcp from 192.0.2.0/24 to any \\
port 80 rdr-to 127.0.0.1 port 10080\fP
\fBpass in quick on em0 proto tcp from 192.0.2.0/24 to any \\
port 443 rdr-to 127.0.0.1 port 10443\fP
.fi
.RE
.TP
.B ipfw
FreeBSD IP firewall (IPFW) divert sockets, also available on Mac OS X.
Available on FreeBSD and OpenBSD using pf \fBdivert-to\fP.
Fully supported on FreeBSD and OpenBSD, including IPv6.
Only supports IPv4 on Mac OS X due to the ancient version of IPFW included.
First in IPFW, then in pf \fBdivert-to\fP syntax:
.LP
.RS
.nf
\fBipfw add fwd ::1,10080 tcp from 2001:db8::/64 to any 80\fP
\fBipfw add fwd ::1,10443 tcp from 2001:db8::/64 to any 443\fP
\fBipfw add fwd 127.0.0.1,10080 tcp from 192.0.2.0/24 to any 80\fP
\fBipfw add fwd 127.0.0.1,10443 tcp from 192.0.2.0/24 to any 443\fP
.fi
.RE
.LP
.RS
.nf
\fBpass in quick on em0 proto tcp from 2001:db8::/64 to any \\
port 80 divert-to ::1 port 10080\fP
\fBpass in quick on em0 proto tcp from 2001:db8::/64 to any \\
port 443 divert-to ::1 port 10443\fP
\fBpass in quick on em0 proto tcp from 192.0.2.0/24 to any \\
port 80 divert-to 127.0.0.1 port 10080\fP
\fBpass in quick on em0 proto tcp from 192.0.2.0/24 to any \\
port 443 divert-to 127.0.0.1 port 10443\fP
.fi
.RE
.TP
.B ipfilter
IPFilter (ipfilter, ipf), available on many systems, including FreeBSD, NetBSD,
Linux and Solaris.
Note that SSLsplit needs permission to open \fB/dev/ipnat\fP for reading, which
by default means that it needs to run under \fBroot\fP privileges.
Only supports IPv4 due to limitations in the SIOCGNATL ioctl(2) interface.
Assuming inbound interface \fBbge0\fP:
.LP
.RS
.nf
\fBrdr bge0 0.0.0.0/0 port 80 -> 127.0.0.1 port 10080\fP
\fBrdr bge0 0.0.0.0/0 port 443 -> 127.0.0.1 port 10443\fP
.fi
.RE
.TP
.B netfilter
Linux netfilter using the iptables REDIRECT target.
Fully supported including IPv6 since Linux v3.8-rc1; on older kernels only
supports IPv4 due to limitations in the SO_ORIGINAL_DST getsockopt(2)
interface.
.LP
.RS
.nf
\fBiptables -t nat -A PREROUTING -s 192.0.2.0/24 \\
-p tcp --dport 80 \\
-j REDIRECT --to-ports 10080\fP
\fBiptables -t nat -A PREROUTING -s 192.0.2.0/24 \\
-p tcp --dport 443 \\
-j REDIRECT --to-ports 10443\fP
\fB# please contribute a tested ip6tables config\fP
.fi
.LP
Note that SSLsplit is only able to accept incoming connections if it binds
to the correct IP address (e.g. 192.0.2.1) or on all interfaces (0.0.0.0).
REDIRECT uses the local interface address of the incoming interface as
target IP address, or 127.0.0.1 for locally generated packets.
.RE
.TP
.B tproxy
Linux netfilter using the iptables TPROXY target together with routing
table magic to allow non-local traffic to originate on local sockets.
Fully supported, including IPv6.
.LP
.RS
.nf
\fBip -f inet6 rule add fwmark 1 lookup 100\fP
\fBip -f inet6 route add local default dev lo table 100\fP
\fBip6tables -t mangle -N DIVERT\fP
\fBip6tables -t mangle -A DIVERT -j MARK --set-mark 1\fP
\fBip6tables -t mangle -A DIVERT -j ACCEPT\fP
\fBip6tables -t mangle -A PREROUTING -p tcp -m socket -j DIVERT\fP
\fBip6tables -t mangle -A PREROUTING -s 2001:db8::/64 \\
-p tcp --dport 80 \\
-j TPROXY --tproxy-mark 0x1/0x1 --on-port 10080\fP
\fBip6tables -t mangle -A PREROUTING -s 2001:db8::/64 \\
-p tcp --dport 443 \\
-j TPROXY --tproxy-mark 0x1/0x1 --on-port 10443\fP
\fBip -f inet rule add fwmark 1 lookup 100\fP
\fBip -f inet route add local default dev lo table 100\fP
\fBiptables -t mangle -N DIVERT\fP
\fBiptables -t mangle -A DIVERT -j MARK --set-mark 1\fP
\fBiptables -t mangle -A DIVERT -j ACCEPT\fP
\fBiptables -t mangle -A PREROUTING -p tcp -m socket -j DIVERT\fP
\fBiptables -t mangle -A PREROUTING -s 192.0.2.0/24 \\
-p tcp --dport 80 \\
-j TPROXY --tproxy-mark 0x1/0x1 --on-port 10080\fP
\fBiptables -t mangle -A PREROUTING -s 192.0.2.0/24 \\
-p tcp --dport 443 \\
-j TPROXY --tproxy-mark 0x1/0x1 --on-port 10443\fP
.fi
.LP
Note that return path filtering (rp_filter) also needs to be disabled on
interfaces which handle TPROXY redirected traffic.
.RE
.SH SIGNALS
A running \fBsslsplit\fP accepts SIGINT and SIGTERM for a clean shutdown and
SIGUSR1 to re-open the single-file log files (such as \fB-l\fP, \fB-L\fP and
\fB-X\fP). The canonical way to rotate or post-process logs is to rename the
active log file, send SIGUSR1 to the PID in the PID file given by \fB-p\fP,
give SSLsplit some time to flush buffers after closing the old file, and then
post-process the renamed log file.
Per-connection log files (such as \fB-S\fP and \fB-F\fP) are not re-opened
because their filename is specific to the connection.
.SH "EXIT STATUS"
The \fBsslsplit\fP process will exit with 0 on regular shutdown
(SIGINT, SIGTERM), and 128 + signal number on controlled shutdown based on
receiving a different signal such as SIGHUP. Exit status in the range 1..127
indicates error conditions.
.SH EXAMPLES
Matching the above NAT engine configuration samples, intercept HTTP and HTTPS
over IPv4 and IPv6 using forged certificates with CA private key \fBca.key\fP
and certificate \fBca.crt\fP, logging connections to \fBconnect.log\fP and
connection data into separate files under \fB/tmp\fP (add \fB-e\fP
\fInat-engine\fP to select the appropriate engine if multiple engines are
available on your system):
.LP
.nf
\fBsslsplit -k ca.key -c ca.crt -l connect.log -S /tmp \\
https ::1 10443 https 127.0.0.1 10443 \\
http ::1 10080 http 127.0.0.1 10080\fP
.fi
.LP
If the Linux netfilter engine is used with the iptables REDIRECT target, it is
important to listen to the correct IP address (e.g. 192.0.2.1) or on all
interfaces (0.0.0.0), otherwise SSLsplit is not able to accept incoming
connections.
.LP
Intercepting IMAP/IMAPS using the same settings:
.LP
.nf
\fBsslsplit -k ca.key -c ca.crt -l connect.log -S /tmp \\
ssl ::1 10993 ssl 127.0.0.1 10993 \\
tcp ::1 10143 tcp 127.0.0.1 10143\fP
.fi
.LP
A more targeted setup, HTTPS only, using certificate/chain/key files from
\fB/path/to/cert.d\fP and statically redirecting to \fBwww.example.org\fP
instead of querying a NAT engine:
.LP
.nf
\fBsslsplit -t /path/to/cert.d -l connect.log -S /tmp \\
https ::1 10443 www.example.org 443 \\
https 127.0.0.1 10443 www.example.org 443\fP
.fi
.LP
The original example, but using plain ssl and tcp proxyspecs to avoid header
modifications, and logging to a single PCAP file for post-processing with an
external tool. To facilitate log rotation via SIGUSR1, \fB-p\fP is also given,
so external log rotation tools or scripts can read the PID from the PID file.
.LP
.nf
\fBsslsplit -k ca.key -c ca.crt -X log.pcap -p /var/run/sslsplit.pid \\
ssl ::1 10443 ssl 127.0.0.1 10443 \\
tcp ::1 10080 tcp 127.0.0.1 10080\fP
.fi
.LP
The original example, but using SSL options optimized for speed by disabling
compression and selecting only fast cipher cipher suites and using a
precomputed private key \fBleaf.key\fP for the forged certificates. Most
significant speed increase is gained by choosing fast algorithms and small
keysizes for the CA and leaf private keys. Check \fBopenssl speed\fP for
algorithm performance on your system. Note that clients may not support all
algorithms and key sizes. Also, some clients warn their users about cipher
suites they consider weak.
.LP
.nf
\fBsslsplit -Z -s NULL:RC4:AES128:-DHE -K leaf.key \\
-k ca.key -c ca.crt -l connect.log -S /tmp \\
https ::1 10443 https 127.0.0.1 10443 \\
http ::1 10080 http 127.0.0.1 10080\fP
.fi
.LP
The original example, but running as a daemon under user \fBsslsplit\fP and
writing a PID file:
.LP
.nf
\fBsslsplit -d -p /var/run/sslsplit.pid -u sslsplit \\
-k ca.key -c ca.crt -l connect.log -S /tmp \\
https ::1 10443 https 127.0.0.1 10443 \\
http ::1 10080 http 127.0.0.1 10080\fP
.fi
.LP
To generate a CA private key \fBca.key\fP and certificate \fBca.crt\fP using
OpenSSL:
.LP
.nf
\fBcat >x509v3ca.cnf <<'EOF'\fP
[ req ]
distinguished_name = reqdn
[ reqdn ]
[ v3_ca ]
basicConstraints = CA:TRUE
subjectKeyIdentifier = hash
authorityKeyIdentifier = keyid:always,issuer:always
\fBEOF\fP
\fBopenssl genrsa -out ca.key 2048\fP
\fBopenssl req -new -nodes -x509 -sha256 -out ca.crt -key ca.key \\
-config x509v3ca.cnf -extensions v3_ca \\
-subj '/O=SSLsplit Root CA/CN=SSLsplit Root CA/' \\
-set_serial 0 -days 3650\fP
.fi
.SH NOTES
SSLsplit is able to handle a relatively high number of listeners and
connections due to a multithreaded, event based architecture based on libevent,
taking advantage of platform specific select() replacements such as kqueue.
The main thread handles the listeners and signaling, while a number of worker
threads equal to twice the number of CPU cores is used for handling the actual
connections in separate event bases, including the CPU-intensive SSL/TLS
handling.
.LP
Care has been taken to choose well-performing data structures for caching
certificates and SSL sessions. Logging is implemented in separate disk writer
threads to ensure that socket event handling threads don't have to block on
disk I/O.
DNS lookups are performed asynchronously.
SSLsplit uses SSL session caching on both ends to minimize the amount of full
SSL handshakes, but even then, the limiting factor in handling SSL connections
are the actual bignum computations.
.LP
For high performance and low latency and when running SSLsplit as root or
otherwise in a privilege separation mode, avoid using options which require a
privileged operation to be invoked through privilege separation for each
connection. These are currently all per-connection log types:
content log to per-stream file in dir or filespec (\fB-F\fP, \fB-S\fP),
content log to per-stream PCAP in dir or filespec (\fB-Y\fP, \fB-y\fP), and
generated or all certificates to files in directory (\fB-w\fP, \fB-W\fP).
Instead, use the respective single-file variants where available.
It is possible, albeit not recommended, to bypass the default privilege
separation when run as root by using \fB-u root\fP, thereby bypassing
privilege separation entirely.
.SH "SEE ALSO"
sslsplit.conf(5), openssl(1), ciphers(1), speed(1),
pf(4), ipfw(8), iptables(8), ip6tables(8), ip(8),
hostapd(8), arpspoof(8), parasite6(8), yersinia(8),
.I https://www.roe.ch/SSLsplit
.SH AUTHORS
SSLsplit was written by Daniel Roethlisberger <daniel@roe.ch>.
SSLsplit is currently maintained by Daniel Roethlisberger and Soner Tari.
The following individuals have contributed code or documentation, in
chronological order of their first contribution:
Steve Wills, Landon Fuller, Wayne Jensen, Rory McNamara, Alexander Neumann,
Adam Jacob Muller, Richard Poole, Maciej Kotowicz, Eun Soo Park, Christian
Groschupp, Alexander Savchenkov, Soner Tari, Petr Vanek, Hilko Bengen,
Philip Duldig, Levente Polyak, Nick French, Cihan Komecoglu and Sergey Pinaev.
SSLsplit contains work sponsored by HackerOne.
.SH BUGS
Use Github for submission of bug reports or patches:
.LP
.RS
.I https://github.com/droe/sslsplit
.RE
.LP