Практические приёмы работы в Wireshark / Хабр

Практические приёмы работы в Wireshark / Хабр Сертификаты

Application Data Flow

Once the entire TLS Handshake is successfully completed and the peers validated, the applications on the peers can begin communicating with each other.The article gives a brief explanation of how the TLS Protocol works and the analysis of the TLS handshake using a powerful tool like Wireshark.

One important thing to note is applications should not rely on TLS to create the strongest secure connection between the peers as it is possible for a hacker to make the peers drop down to the least secure connection. Also, the use of TSL/SSL could impact performance (explained here). Hence, a clear understanding of the protocol will help evaluate its advantages and vulnerabilities.

Read the ebook Monitoring Network Protocols to learn Digital Experience Monitoring can help improve network performance.

Capinfos


В комплекте с Wireshark поставляется удобный инструмент командной строки

capinfos

. Эта утилита генерирует статистику пакетного дампа, с временем начала/окончания записи и другими подробностями. С опцией

-T

она выдаёт текст с табуляцией — он подходит для импорта в электронные таблицы или анализа в консоли.

test@ubuntu:~$ capinfos test.pcap
File name:           test.pcap
File type:           Wireshark/tcpdump/... - pcap
File encapsulation:  Ethernet
File timestamp precision:  microseconds (6)
Packet size limit:   file hdr: 262144 bytes
Number of packets:   341 k
File size:           449 MB
Data size:           444 MB
Capture duration:    3673.413779 seconds
First packet time:   2021-12-01 11:26:53.521929
Last packet time:    2021-12-01 12:28:06.935708
Data byte rate:      120 kBps
Data bit rate:       967 kbps
Average packet size: 1300.72 bytes
Average packet rate: 93 packets/s
SHA256:              989388128d676c329ccdbdec4ed221ab8ecffad81910a16f473ec2c2f54c5d6e
RIPEMD160:           0742b6bbc79735e57904008d6064cce7eb95abc9
SHA1:                d725b389bea044d6520470c8dab0de1598b01d89
Strict time order:   True
Number of interfaces in file: 1

Configure wireshark to decrypt ssl

Once your browser is logging pre-master keys, it’s time to configure Wireshark to use those logs to decrypt SSL.
Wireshark Protocols

Open Wireshark and click Edit, then Preferences. The Preferences dialog will open, and on the left, you’ll see a list of items. Expand Protocols, scroll down, then click SSL.

In the list of options for the SSL protocol, you’ll see an entry for (Pre)-Master-Secret log filename. Browse to the log file you set up in the previous step, or just paste the path.

When you’ve finished setting the (Pre)-Master-Secret log filename, click OK and return to Wireshark. You’re ready to move on.

Related post:How to use Wireshark

Launch your browser and check for the log file

Before you launch Wireshark and configure it to decrypt SSL using a pre-master key, you should start your browser and confirm that the log file is being used.

In order to populate the log, it’s important that you visit a site that has SSL enabled. I’m using my own Apache server for testing, but any site will work. One of the biggest benefits of using a pre-master shared key is you don’t need access to the server to decrypt SSL.

After you’ve visited a SSL-enabled website, check the file for data. In Windows, you can use Notepad. In Linux or Mac, use the following command:

cat ~/.ssl-log.key

On any operating system, your file should look like mine does above. After you’ve confirmed that your browser is logging pre-master keys in the location you selected, you can configure Wireshark to use those keys to decrypt SSL.

Using a pre-master secret key to decrypt ssl and tls

Using a pre-master secret key to decrypt SSL in Wireshark is the recommended method.

A pre-master secret key is generated by the client and used by the server to derive a master key that encrypts the session traffic. It’s the current standard in cryptography and is usually implemented via Diffie-Hellman.

Your browser can be made to log the pre-master secret key, which Wireshark uses to decrypt SSL and TLS sessions.

Here are the steps to decrypting SSL and TLS with a pre-master secret key:

  • Set an environment variable
  • Launch your browser
  • Configure Wireshark
  • Capture and decrypt the session keys

When you’re finished, you’ll be able to decrypt SSL and TLS sessions in Wireshark without needing access to the target server.

Using an rsa key to decrypt ssl

You might have noticed earlier that Wireshark has a field that allows you to upload your RSA keys and use them to decrypt SSL. In practice, RSA key decryption is deprecated.

The reason decrypting SSL with an RSA key isn’t commonly used anymore is that Perfect Forward Encryption (PFE) has made it obsolete. Sessions negotiated with Diffie-Hellman don’t use the RSA key directly; instead they generate a one-time key, stored only in RAM, that is encrypted using the key on disk.

If you were previously using an RSA key to decode traffic, and it stopped working, you can confirm that the target machine is using Diffie-Hellman exchanges by enabling SSL logging.

To turn on logging, click Edit from the toolbar menu and select Preferences. Expand the Protocols menu item on the left and scroll down to SSL. From here, you can click the Browse button and set the location of your SSL log.

Once the location is set, all SSL interactions will be logged in the specified file.

Capture a session with your SSL-enabled host, then check the logs. Specifically, you should scroll until you find the frame that the TLS handshake was negotiated on. It’s likely that you’ll see a telltale DHE entry in the cipher string.

That means Diffie-Hellman key exchanges are enabled. In my case, Apache is specifically using Diffie-Hellman with elliptic-curve keys, which is denoted by the string ECDHE.

Scroll a little further and you’re likely to see that the master secret cannot be found.

If your logs look like that, and you can’t decrypt data using an RSA key, you have no choice but to switch over to the pre-master secret method above.

Since PFE is becoming standard practice, with TLSv1.3 likely forcing the issue, simple RSA key decryption is deprecated and should not be used.

Wireshark · display filter reference: secure sockets layer

Display Filter Reference: Secure Sockets Layer

Protocol field name: ssl

Versions: 1.0.0 to 2.6.20

Back to Display Filter Reference

Field nameDescriptionTypeVersions
pct.handshake.certCertUnsigned integer, 2 bytes1.0.0 to 1.12.13
pct.handshake.certspecCert SpecLabel1.0.0 to 1.12.13
pct.handshake.cipherCipherUnsigned integer, 2 bytes1.0.0 to 1.12.13
pct.handshake.cipherspecCipher SpecLabel1.0.0 to 1.12.13
pct.handshake.exchExchangeUnsigned integer, 2 bytes1.0.0 to 1.12.13
pct.handshake.exchspecExchange SpecLabel1.0.0 to 1.12.13
pct.handshake.hashHashUnsigned integer, 2 bytes1.0.0 to 1.12.13
pct.handshake.hashspecHash SpecLabel1.0.0 to 1.12.13
pct.handshake.server_certServer CertLabel1.0.0 to 1.12.13
pct.handshake.sigSig SpecUnsigned integer, 2 bytes1.0.0 to 1.12.13
pct.msg_error_codePCT Error CodeUnsigned integer, 2 bytes1.0.0 to 1.12.13
ssl.alert_messageAlert MessageLabel1.0.0 to 2.6.20
ssl.alert_message.descDescriptionUnsigned integer, 1 byte1.0.0 to 2.6.20
ssl.alert_message.levelLevelUnsigned integer, 1 byte1.0.0 to 2.6.20
ssl.app_dataEncrypted Application DataSequence of bytes1.0.0 to 2.6.20
ssl.change_cipher_specChange Cipher Spec MessageLabel1.0.0 to 2.6.20
ssl.connection_id_dataConnection ID DataSequence of bytes2.0.0 to 2.6.20
ssl.early_data.max_early_data_sizeMaximum Early Data SizeUnsigned integer, 4 bytes2.4.0 to 2.6.20
ssl.extension.draft_version_tls13Draft version of TLS 1.3Unsigned integer, 2 bytes2.4.0 to 2.6.20
ssl.extension.oid_filters.oidCertificate Extension OIDASN.1 object identifier2.4.0 to 2.6.20
ssl.extension.oid_filters.oid_lengthCertificate Extension OID LengthUnsigned integer, 1 byte2.4.0 to 2.6.20
ssl.extension.oid_filters.values_lengthCertificate Extension Values LengthUnsigned integer, 2 bytes2.4.0 to 2.6.20
ssl.extension.oid_filters_lengthOID Filters LengthUnsigned integer, 2 bytes2.4.0 to 2.6.20
ssl.extension.psk_ke_modePSK Key Exchange ModeUnsigned integer, 1 byte2.4.0 to 2.6.20
ssl.extension.psk_ke_modes_lengthPSK Key Exchange Modes LengthUnsigned integer, 1 byte2.4.0 to 2.6.20
ssl.handshakeHandshake ProtocolLabel1.0.0 to 2.6.20
ssl.handshake.cert_statusCertificate StatusLabel1.6.0 to 2.4.16
ssl.handshake.cert_status_lenCertificate Status LengthUnsigned integer, 3 bytes1.6.0 to 2.4.16
ssl.handshake.cert_status_typeCertificate Status TypeUnsigned integer, 1 byte1.6.0 to 2.4.16
ssl.handshake.cert_typeCertificate TypeUnsigned integer, 1 byte1.0.0 to 2.6.20
ssl.handshake.cert_type.typeCertificate TypeUnsigned integer, 1 byte1.12.0 to 2.6.20
ssl.handshake.cert_type.typesCertificate Type ListLabel1.12.0 to 2.6.20
ssl.handshake.cert_type.types_lenCertificate Type List LengthUnsigned integer, 1 byte1.12.0 to 2.6.20
ssl.handshake.cert_typesCertificate typesLabel1.0.0 to 2.6.20
ssl.handshake.cert_types_countCertificate types countUnsigned integer, 1 byte1.0.0 to 2.6.20
ssl.handshake.cert_url.paddingPaddingLabel1.12.0 to 2.6.20
ssl.handshake.cert_url.sha1SHA1 HashSequence of bytes1.12.0 to 2.6.20
ssl.handshake.cert_url.urlURLCharacter string2.2.0 to 2.6.20
ssl.handshake.cert_url.url_hashURL and HashLabel1.12.0 to 2.6.20
ssl.handshake.cert_url.url_hash_lenURL and Hash list LengthUnsigned integer, 2 bytes1.12.0 to 2.6.20
ssl.handshake.cert_url.url_lenURL LengthUnsigned integer, 2 bytes1.12.0 to 2.6.20
ssl.handshake.cert_url_typeCertificate Chain TypeUnsigned integer, 1 byte1.12.0 to 2.6.20
ssl.handshake.certificateCertificateSequence of bytes1.0.0 to 2.6.20
ssl.handshake.certificate_lengthCertificate LengthUnsigned integer, 3 bytes1.0.0 to 2.6.20
ssl.handshake.certificate_request_contextCertificate Request ContextSequence of bytes2.4.0 to 2.6.20
ssl.handshake.certificate_request_context_lengthCertificate Request Context LengthUnsigned integer, 1 byte2.4.0 to 2.6.20
ssl.handshake.certificatesCertificatesLabel1.0.0 to 2.6.20
ssl.handshake.certificates_lengthCertificates LengthUnsigned integer, 3 bytes1.0.0 to 2.6.20
ssl.handshake.challengeChallengeLabel1.0.0 to 2.6.20
ssl.handshake.challenge_lengthChallenge LengthUnsigned integer, 2 bytes1.0.0 to 2.6.20
ssl.handshake.cipher_spec_lenCipher Spec LengthUnsigned integer, 2 bytes1.0.0 to 2.6.20
ssl.handshake.cipher_suites_lengthCipher Suites LengthUnsigned integer, 2 bytes1.0.0 to 2.6.20
ssl.handshake.cipher_suites_length.mult2Expert InfoLabel1.12.0 to 2.2.17
ssl.handshake.cipherspecCipher SpecUnsigned integer, 3 bytes1.0.0 to 2.6.20
ssl.handshake.ciphersuiteCipher SuiteUnsigned integer, 2 bytes1.0.0 to 2.6.20
ssl.handshake.ciphersuitesCipher SuitesLabel1.0.0 to 2.6.20
ssl.handshake.clear_key_dataClear Key DataLabel1.0.0 to 2.6.20
ssl.handshake.clear_key_lengthClear Key Data LengthUnsigned integer, 2 bytes1.0.0 to 2.6.20
ssl.handshake.client_cert_vrfy.sigSignatureSequence of bytes1.12.0 to 2.6.20
ssl.handshake.client_cert_vrfy.sig_lenSignature lengthUnsigned integer, 2 bytes1.12.0 to 2.6.20
ssl.handshake.client_pointPubkeySequence of bytes1.8.0 to 2.6.20
ssl.handshake.client_point_lenPubkey LengthUnsigned integer, 1 byte1.8.0 to 2.6.20
ssl.handshake.comp_methodCompression MethodUnsigned integer, 1 byte1.0.0 to 2.6.20
ssl.handshake.comp_methodsCompression MethodsLabel1.0.0 to 2.6.20
ssl.handshake.comp_methods_lengthCompression Methods LengthUnsigned integer, 1 byte1.0.0 to 2.6.20
ssl.handshake.connection_idConnection IDLabel1.0.0 to 2.6.20
ssl.handshake.connection_id_lengthConnection ID LengthUnsigned integer, 2 bytes1.0.0 to 2.6.20
ssl.handshake.dnameDistinguished NameLabel1.0.0 to 2.6.20
ssl.handshake.dname_lenDistinguished Name LengthUnsigned integer, 2 bytes1.0.0 to 2.6.20
ssl.handshake.dnamesDistinguished NamesLabel1.0.0 to 2.6.20
ssl.handshake.dnames_lenDistinguished Names LengthUnsigned integer, 2 bytes1.0.0 to 2.6.20
ssl.handshake.encrypted_keyEncrypted KeyLabel1.0.0 to 2.6.20
ssl.handshake.encrypted_key_lengthEncrypted Key Data LengthUnsigned integer, 2 bytes1.0.0 to 2.6.20
ssl.handshake.epmsEncrypted PreMasterSequence of bytes1.8.0 to 2.6.20
ssl.handshake.epms_lenEncrypted PreMaster lengthUnsigned integer, 2 bytes1.8.0 to 2.6.20
ssl.handshake.exponentExponentSequence of bytes1.8.0 to 2.6.20
ssl.handshake.exponent_lenExponent LengthUnsigned integer, 2 bytes1.8.0 to 2.6.20
ssl.handshake.extension.dataDataSequence of bytes1.0.0 to 2.6.20
ssl.handshake.extension.heartbeat.modeModeUnsigned integer, 1 byte1.8.0 to 2.6.20
ssl.handshake.extension.lenLengthUnsigned integer, 2 bytes1.0.0 to 2.6.20
ssl.handshake.extension.typeTypeUnsigned integer, 2 bytes1.0.0 to 2.6.20
ssl.handshake.extensions.cookieCookieSequence of bytes2.4.0 to 2.6.20
ssl.handshake.extensions.cookie_lenCookie lengthUnsigned integer, 2 bytes2.4.0 to 2.6.20
ssl.handshake.extensions.psk.bindersPSK BindersLabel2.4.0 to 2.6.20
ssl.handshake.extensions.psk.binders_lenPSK Binders lengthUnsigned integer, 2 bytes2.4.0 to 2.6.20
ssl.handshake.extensions.psk.identities.lengthIdentities LengthUnsigned integer, 2 bytes2.4.0 to 2.6.20
ssl.handshake.extensions.psk.identity.identityIdentitySequence of bytes2.4.0 to 2.6.20
ssl.handshake.extensions.psk.identity.identity_lengthIdentity LengthUnsigned integer, 2 bytes2.4.0 to 2.6.20
ssl.handshake.extensions.psk.identity.obfuscated_ticket_ageObfuscated Ticket AgeUnsigned integer, 4 bytes2.4.0 to 2.6.20
ssl.handshake.extensions.psk.identity.selectedSelected IdentityUnsigned integer, 2 bytes2.4.0 to 2.6.20
ssl.handshake.extensions.supported_versionSupported VersionUnsigned integer, 2 bytes2.4.3 to 2.6.20
ssl.handshake.extensions.supported_versionsSupported VersionsUnsigned integer, 2 bytes2.4.0 to 2.4.2
ssl.handshake.extensions.supported_versions_lenSupported Versions lengthUnsigned integer, 1 byte2.4.0 to 2.6.20
ssl.handshake.extensions_alpn_lenALPN Extension LengthUnsigned integer, 2 bytes1.12.0 to 2.6.20
ssl.handshake.extensions_alpn_listALPN ProtocolLabel1.12.0 to 2.6.20
ssl.handshake.extensions_alpn_strALPN Next ProtocolCharacter string1.12.0 to 2.6.20
ssl.handshake.extensions_alpn_str_lenALPN string lengthUnsigned integer, 1 byte1.12.0 to 2.6.20
ssl.handshake.extensions_ec_point_formatEC point formatUnsigned integer, 1 byte1.4.0 to 2.6.20
ssl.handshake.extensions_ec_point_formatsEC point formatsLabel2.4.0 to 2.6.20
ssl.handshake.extensions_ec_point_formats_lengthEC point formats LengthUnsigned integer, 1 byte1.4.0 to 2.6.20
ssl.handshake.extensions_elliptic_curveElliptic curveUnsigned integer, 2 bytes1.4.0 to 2.2.17
ssl.handshake.extensions_elliptic_curvesElliptic Curves ListLabel1.4.0 to 2.2.17
ssl.handshake.extensions_elliptic_curves_lengthElliptic Curves LengthUnsigned integer, 2 bytes1.4.0 to 2.2.17
ssl.handshake.extensions_key_share_client_lengthClient Key Share LengthUnsigned integer, 2 bytes2.4.0 to 2.6.20
ssl.handshake.extensions_key_share_groupGroupUnsigned integer, 2 bytes2.4.0 to 2.6.20
ssl.handshake.extensions_key_share_key_exchangeKey ExchangeSequence of bytes2.4.0 to 2.6.20
ssl.handshake.extensions_key_share_key_exchange_lengthKey Exchange LengthUnsigned integer, 2 bytes2.4.0 to 2.6.20
ssl.handshake.extensions_key_share_selected_groupSelected GroupUnsigned integer, 2 bytes2.4.0 to 2.6.20
ssl.handshake.extensions_lengthExtensions LengthUnsigned integer, 2 bytes1.0.0 to 2.6.20
ssl.handshake.extensions_npnNext ProtocolCharacter string1.8.0 to 2.6.20
ssl.handshake.extensions_npn_lengthNPN extension lengthUnsigned integer, 2 bytes1.8.0 to 1.8.3
ssl.handshake.extensions_npn_str_lenProtocol string lengthUnsigned integer, 1 byte1.8.0 to 2.6.20
ssl.handshake.extensions_paddingPaddingLabel1.12.0 to 2.0.5, 2.2.0
ssl.handshake.extensions_padding_dataPadding DataSequence of bytes1.12.0 to 2.6.20
ssl.handshake.extensions_padding_lenPadding lengthUnsigned integer, 2 bytes1.12.0 to 2.0.5, 2.2.0
ssl.handshake.extensions_reneg_infoRenegotiation infoSequence of bytes2.0.0 to 2.6.20
ssl.handshake.extensions_reneg_info_lenRenegotiation info extension lengthUnsigned integer, 1 byte1.8.0 to 2.6.20
ssl.handshake.extensions_server_nameServer NameCharacter string1.8.0 to 2.6.20
ssl.handshake.extensions_server_name_lenServer Name lengthUnsigned integer, 2 bytes1.8.0 to 2.6.20
ssl.handshake.extensions_server_name_list_lenServer Name list lengthUnsigned integer, 2 bytes1.8.0 to 2.6.20
ssl.handshake.extensions_server_name_typeServer Name TypeUnsigned integer, 1 byte1.8.0 to 2.6.20
ssl.handshake.extensions_status_request_exts_lenRequest Extensions LengthUnsigned integer, 2 bytes1.12.0 to 2.6.20
ssl.handshake.extensions_status_request_lenCertificate Status LengthUnsigned integer, 2 bytes1.12.0 to 2.6.20
ssl.handshake.extensions_status_request_list_lenCertificate Status List LengthUnsigned integer, 2 bytes2.6.0 to 2.6.20
ssl.handshake.extensions_status_request_responder_ids_lenResponder ID list LengthUnsigned integer, 2 bytes1.12.0 to 2.6.20
ssl.handshake.extensions_status_request_typeCertificate Status TypeUnsigned integer, 1 byte1.12.0 to 2.6.20
ssl.handshake.extensions_supported_groupSupported GroupUnsigned integer, 2 bytes2.4.0 to 2.6.20
ssl.handshake.extensions_supported_groupsSupported Groups ListLabel2.4.0 to 2.6.20
ssl.handshake.extensions_supported_groups_lengthSupported Groups List LengthUnsigned integer, 2 bytes2.4.0 to 2.6.20
ssl.handshake.ggSequence of bytes1.8.0 to 2.6.20
ssl.handshake.g_leng LengthUnsigned integer, 2 bytes1.8.0 to 2.6.20
ssl.handshake.hintHintSequence of bytes1.12.0 to 2.6.20
ssl.handshake.hint_lenHint LengthUnsigned integer, 2 bytes1.12.0 to 2.6.20
ssl.handshake.identityIdentitySequence of bytes1.12.0 to 2.6.20
ssl.handshake.identity_lenIdentity LengthUnsigned integer, 2 bytes1.12.0 to 2.6.20
ssl.handshake.key_argKey ArgumentLabel1.0.0 to 2.6.20
ssl.handshake.key_arg_lengthKey Argument LengthUnsigned integer, 2 bytes1.0.0 to 2.6.20
ssl.handshake.key_update.request_updateKey Update RequestUnsigned integer, 1 byte2.4.0 to 2.6.20
ssl.handshake.lengthLengthUnsigned integer, 3 bytes1.0.0 to 2.6.20
ssl.handshake.md5_hashMD5 HashLabel1.0.0 to 2.6.20
ssl.handshake.modulusModulusSequence of bytes1.8.0 to 2.6.20
ssl.handshake.modulus_lenModulus LengthUnsigned integer, 2 bytes1.8.0 to 2.6.20
ssl.handshake.npn_paddingPaddingSequence of bytes1.12.0 to 2.6.20
ssl.handshake.npn_padding_lenPadding LengthUnsigned integer, 1 byte1.12.0 to 2.6.20
ssl.handshake.npn_selected_protocolSelected ProtocolCharacter string1.12.0 to 2.6.20
ssl.handshake.npn_selected_protocol_lenSelected Protocol LengthUnsigned integer, 1 byte1.12.0 to 2.6.20
ssl.handshake.ocsp_response_lenOCSP Response LengthUnsigned integer, 3 bytes2.6.0 to 2.6.20
ssl.handshake.ocsp_response_list_lenOCSP Response List LengthUnsigned integer, 3 bytes2.6.0 to 2.6.20
ssl.handshake.ppSequence of bytes1.8.0 to 2.6.20
ssl.handshake.p_lenp LengthUnsigned integer, 2 bytes1.8.0 to 2.6.20
ssl.handshake.randomRandomSequence of bytes2.0.0 to 2.6.20
ssl.handshake.random_bytesRandom BytesSequence of bytes1.0.0 to 1.12.13, 2.4.0 to 2.6.20
ssl.handshake.random_timeGMT Unix TimeDate and time1.0.0 to 2.6.20
ssl.handshake.server_curve_typeCurve TypeUnsigned integer, 1 byte1.8.0 to 2.6.20
ssl.handshake.server_named_curveNamed CurveUnsigned integer, 2 bytes1.8.0 to 2.6.20
ssl.handshake.server_pointPubkeySequence of bytes1.8.0 to 2.6.20
ssl.handshake.server_point_lenPubkey LengthUnsigned integer, 1 byte1.8.0 to 2.6.20
ssl.handshake.session_idSession IDSequence of bytes1.0.0 to 2.6.20
ssl.handshake.session_id_hitSession ID HitBoolean1.0.0 to 2.6.20
ssl.handshake.session_id_lengthSession ID LengthUnsigned integer, 2 bytes1.0.0 to 2.6.20
ssl.handshake.session_id_length.errorSession ID length errorLabel1.12.0 to 2.6.20
ssl.handshake.session_ticketSession TicketSequence of bytes1.8.0 to 2.6.20
ssl.handshake.session_ticket_age_addSession Ticket Age AddUnsigned integer, 4 bytes2.4.0 to 2.6.20
ssl.handshake.session_ticket_lengthSession Ticket LengthUnsigned integer, 2 bytes1.8.0 to 2.6.20
ssl.handshake.session_ticket_lifetime_hintSession Ticket Lifetime HintUnsigned integer, 4 bytes1.8.0 to 2.6.20
ssl.handshake.session_ticket_nonceSession Ticket NonceSequence of bytes2.4.0 to 2.6.20
ssl.handshake.session_ticket_nonce_lengthSession Ticket Nonce LengthUnsigned integer, 1 byte2.4.0 to 2.6.20
ssl.handshake.sha_hashSHA-1 HashLabel1.0.0 to 2.6.20
ssl.handshake.sigSignatureSequence of bytes1.8.0 to 2.6.20
ssl.handshake.sig_hash_algSignature AlgorithmUnsigned integer, 2 bytes1.4.3 to 2.6.20
ssl.handshake.sig_hash_alg_lenSignature Hash Algorithms LengthUnsigned integer, 2 bytes1.4.3 to 2.6.20
ssl.handshake.sig_hash_alg_len.mult2Expert InfoLabel1.12.0 to 2.2.17
ssl.handshake.sig_hash_algsSignature AlgorithmsLabel1.4.3 to 2.6.20
ssl.handshake.sig_hash_algs.mult2Expert InfoLabel2.0.0 to 2.2.17
ssl.handshake.sig_hash_hashSignature Hash Algorithm HashUnsigned integer, 1 byte1.4.3 to 2.6.20
ssl.handshake.sig_hash_sigSignature Hash Algorithm SignatureUnsigned integer, 1 byte1.4.3 to 2.6.20
ssl.handshake.sig_lenSignature LengthUnsigned integer, 2 bytes1.8.0 to 2.6.20
ssl.handshake.status_request.undecodedResponder ID list or Request Extensions are not implemented, contact Wireshark developers if you want this to be supportedLabel1.12.0 to 2.6.20
ssl.handshake.typeHandshake Message TypeUnsigned integer, 1 byte1.0.0 to 2.6.20
ssl.handshake.verify_dataVerify DataLabel1.0.0 to 2.6.20
ssl.handshake.versionVersionUnsigned integer, 2 bytes1.0.0 to 2.6.20
ssl.handshake.ycPubkeySequence of bytes1.8.0 to 2.6.20
ssl.handshake.yc_lenPubkey LengthUnsigned integer, 2 bytes1.8.0 to 2.6.20
ssl.handshake.ysPubkeySequence of bytes1.8.0 to 2.6.20
ssl.handshake.ys_lenPubkey LengthUnsigned integer, 2 bytes1.8.0 to 2.6.20
ssl.heartbeat_messageHeartbeat MessageLabel1.8.0 to 2.6.20
ssl.heartbeat_message.paddingPayload LengthSequence of bytes1.8.0 to 2.6.20
ssl.heartbeat_message.payloadPayload LengthSequence of bytes1.8.0 to 2.6.20
ssl.heartbeat_message.payload_lengthPayload LengthUnsigned integer, 2 bytes1.8.0 to 2.6.20
ssl.heartbeat_message.payload_length.invalidInvalid heartbeat payload lengthLabel1.12.0 to 2.6.20
ssl.heartbeat_message.typeTypeUnsigned integer, 1 byte1.8.0 to 2.6.20
ssl.ignored_unknown_recordIgnored Unknown RecordLabel2.0.0 to 2.6.20
ssl.malformed.buffer_too_smallMalformed message, not enough data is availableLabel2.4.0 to 2.6.20
ssl.malformed.trailing_dataUndecoded trailing data is presentLabel2.4.0 to 2.6.20
ssl.malformed.vector_lengthVariable vector length is outside the permitted rangeLabel2.4.0 to 2.6.20
ssl.pct.cert_specs_lengthCERT_SPECS LengthUnsigned integer, 2 bytes2.0.0 to 2.6.20
ssl.pct.ch_offsetCH_OFFSETUnsigned integer, 2 bytes2.0.0 to 2.6.20
ssl.pct.ch_offset.invalidCH_OFFSET invalidLabel2.0.0 to 2.6.20
ssl.pct.challenge_dataChallenge DataSequence of bytes2.0.0 to 2.6.20
ssl.pct.cipher_specs_lengthCIPHER_SPECS LengthUnsigned integer, 2 bytes2.0.0 to 2.6.20
ssl.pct.clear_key_dataClear Key dataSequence of bytes2.0.0 to 2.6.20
ssl.pct.clear_key_lengthClear Key LengthUnsigned integer, 2 bytes2.0.0 to 2.6.20
ssl.pct.client_cert_lengthClient Cert LengthUnsigned integer, 2 bytes2.0.0 to 2.6.20
ssl.pct.client_cert_specsClient CERT_SPECSSequence of bytes2.0.0 to 2.6.20
ssl.pct.client_cert_specs_lengthClient CERT_SPECS LengthUnsigned integer, 2 bytes2.0.0 to 2.6.20
ssl.pct.client_certificate_dataClient Certificate dataSequence of bytes2.0.0 to 2.6.20
ssl.pct.client_session_id_dataClient Session ID DataSequence of bytes2.0.0 to 2.6.20
ssl.pct.client_sig_specs_lengthClient SIG_SPECS LengthUnsigned integer, 2 bytes2.0.0 to 2.6.20
ssl.pct.client_signatureClient SignatureSequence of bytes2.0.0 to 2.6.20
ssl.pct.client_versionClient VersionUnsigned integer, 2 bytes2.0.0 to 2.6.20
ssl.pct.client_version.invalidClient Version invalidLabel2.0.0 to 2.6.20
ssl.pct.encrypted_key_dataEncrypted Key dataSequence of bytes2.0.0 to 2.6.20
ssl.pct.encrypted_key_lengthEncrypted Key LengthUnsigned integer, 2 bytes2.0.0 to 2.6.20
ssl.pct.encryption_key_lengthEncryption key lengthUnsigned integer, 1 byte2.0.0 to 2.6.20
ssl.pct.error_information_dataError Information dataSequence of bytes2.0.0 to 2.6.20
ssl.pct.error_information_lengthError Information LengthUnsigned integer, 2 bytes2.0.0 to 2.6.20
ssl.pct.exch_specs_lengthEXCH_SPECS LengthUnsigned integer, 2 bytes2.0.0 to 2.6.20
ssl.pct.handshake.certCertUnsigned integer, 2 bytes2.0.0 to 2.6.20
ssl.pct.handshake.certspecCert SpecLabel2.0.0 to 2.6.20
ssl.pct.handshake.cipherCipherUnsigned integer, 2 bytes2.0.0 to 2.6.20
ssl.pct.handshake.cipherspecCipher SpecLabel2.0.0 to 2.6.20
ssl.pct.handshake.exchExchangeUnsigned integer, 2 bytes2.0.0 to 2.6.20
ssl.pct.handshake.exchspecExchange SpecLabel2.0.0 to 2.6.20
ssl.pct.handshake.hashHashUnsigned integer, 2 bytes2.0.0 to 2.6.20
ssl.pct.handshake.hashspecHash SpecLabel2.0.0 to 2.6.20
ssl.pct.handshake.server_certServer CertSequence of bytes2.0.0 to 2.6.20
ssl.pct.handshake.sigSig SpecUnsigned integer, 2 bytes2.0.0 to 2.6.20
ssl.pct.hash_specs_lengthHASH_SPECS LengthUnsigned integer, 2 bytes2.0.0 to 2.6.20
ssl.pct.iv_dataIV dataSequence of bytes2.0.0 to 2.6.20
ssl.pct.iv_lengthIV LengthUnsigned integer, 2 bytes2.0.0 to 2.6.20
ssl.pct.mac_key_length_in_bitsMAC key length in bitsUnsigned integer, 1 byte2.0.0 to 2.6.20
ssl.pct.msg_error_codePCT Error CodeUnsigned integer, 2 bytes2.0.0 to 2.6.20
ssl.pct.padPADSequence of bytes2.0.0 to 2.6.20
ssl.pct.response_dataResponse dataSequence of bytes2.0.0 to 2.6.20
ssl.pct.response_lengthResponse LengthUnsigned integer, 2 bytes2.0.0 to 2.6.20
ssl.pct.server_certificate_lengthServer Certificate LengthUnsigned integer, 2 bytes2.0.0 to 2.6.20
ssl.pct.server_responseServer ResponseSequence of bytes2.0.0 to 2.6.20
ssl.pct.server_response_lengthServer Response LengthUnsigned integer, 2 bytes2.0.0 to 2.6.20
ssl.pct.server_session_id_dataServer Session ID dataSequence of bytes2.0.0 to 2.6.20
ssl.pct.server_versionServer VersionUnsigned integer, 2 bytes2.0.0 to 2.6.20
ssl.pct.server_version.invalidServer Version invalidLabel2.0.0 to 2.6.20
ssl.pct.sh_client_auth_req_flagSH_CLIENT_AUTH_REQ flagUnsigned integer, 1 byte2.0.0 to 2.6.20
ssl.pct.sh_restart_session_ok_flagSH_RESTART_SESSION_OK flagUnsigned integer, 1 byte2.0.0 to 2.6.20
ssl.pct.specs_mismatch_certSPECS_MISMATCH_CERTUnsigned integer, 1 byte2.0.0 to 2.6.20
ssl.pct.specs_mismatch_cipherSPECS_MISMATCH_CIPHERUnsigned integer, 1 byte2.0.0 to 2.6.20
ssl.pct.specs_mismatch_client_certSPECS_MISMATCH_CLIENT_CERTUnsigned integer, 1 byte2.0.0 to 2.6.20
ssl.pct.specs_mismatch_client_sigSPECS_MISMATCH_CLIENT_SIGUnsigned integer, 1 byte2.0.0 to 2.6.20
ssl.pct.specs_mismatch_exchSPECS_MISMATCH_EXCHUnsigned integer, 1 byte2.0.0 to 2.6.20
ssl.pct.specs_mismatch_hashSPECS_MISMATCH_HASHUnsigned integer, 1 byte2.0.0 to 2.6.20
ssl.pct.verify_prelude_dataVerify Prelude dataSequence of bytes2.0.0 to 2.6.20
ssl.pct.verify_prelude_lengthVerify Prelude LengthUnsigned integer, 2 bytes2.0.0 to 2.6.20
ssl.pct_handshake.typeHandshake Message TypeUnsigned integer, 1 byte1.0.0 to 2.6.20
ssl.quic.initial_versionInitial VersionUnsigned integer, 4 bytes2.6.0 to 2.6.20
ssl.quic.lenParameters LengthUnsigned integer, 2 bytes2.6.0 to 2.6.20
ssl.quic.negotiated_versionNegotiated VersionUnsigned integer, 4 bytes2.6.0 to 2.6.20
ssl.quic.parameterParameterLabel2.6.0 to 2.6.20
ssl.quic.parameter.ack_delay_exponentack_delay_exponentUnsigned integer, 1 byte2.6.0 to 2.6.20
ssl.quic.parameter.idle_timeoutidle_timeoutUnsigned integer, 2 bytes2.6.0 to 2.6.20
ssl.quic.parameter.initial_max_datainitial_max_dataUnsigned integer, 4 bytes2.6.0 to 2.6.20
ssl.quic.parameter.initial_max_stream_datainitial_max_stream_dataUnsigned integer, 4 bytes2.6.0 to 2.6.20
ssl.quic.parameter.initial_max_stream_id_bidiinitial_max_stream_id_bidiUnsigned integer, 4 bytes2.6.0 to 2.6.20
ssl.quic.parameter.initial_max_stream_id_uniinitial_max_stream_id_uniUnsigned integer, 4 bytes2.6.0 to 2.6.20
ssl.quic.parameter.lengthLengthUnsigned integer, 2 bytes2.6.0 to 2.6.20
ssl.quic.parameter.max_packet_sizemax_packet_sizeUnsigned integer, 2 bytes2.6.0 to 2.6.20
ssl.quic.parameter.stateless_reset_tokenstateless_reset_tokenSequence of bytes2.6.0 to 2.6.20
ssl.quic.parameter.typeTypeUnsigned integer, 2 bytes2.6.0 to 2.6.20
ssl.quic.parameter.valueValueSequence of bytes2.6.0 to 2.6.20
ssl.quic.supported_versionsSupported VersionsUnsigned integer, 4 bytes2.6.0 to 2.6.20
ssl.quic.supported_versions.lenSupported Versions LengthUnsigned integer, 2 bytes2.6.0 to 2.6.20
ssl.reassembled.dataReassembled PDU dataSequence of bytes1.10.0 to 2.6.20
ssl.reassembled.lengthReassembled PDU lengthUnsigned integer, 4 bytes1.4.0 to 2.6.20
ssl.reassembled_inReassembled PDU in frameFrame number1.0.0 to 2.6.20
ssl.recordRecord LayerLabel1.0.0 to 2.6.20
ssl.record.content_typeContent TypeUnsigned integer, 1 byte1.0.0 to 2.6.20
ssl.record.is_escapeIs EscapeBoolean1.0.0 to 2.6.20
ssl.record.lengthLengthUnsigned integer, 2 bytes1.0.0 to 2.6.20
ssl.record.length.invalidRecord fragment length is too largeLabel2.4.0 to 2.6.20
ssl.record.opaque_typeOpaque TypeUnsigned integer, 1 byte2.4.0 to 2.6.20
ssl.record.padding_lengthPadding LengthUnsigned integer, 1 byte1.0.0 to 2.6.20
ssl.record.versionVersionUnsigned integer, 2 bytes1.0.0 to 2.6.20
ssl.resumedThis session reuses previously negotiated keys (Session resumption)Label2.0.0 to 2.6.20
ssl.sct.sct_extensionsExtensionsLabel2.4.0 to 2.6.20
ssl.sct.sct_extensions_lengthExtensions lengthUnsigned integer, 2 bytes2.4.0 to 2.6.20
ssl.sct.sct_lengthSerialized SCT LengthUnsigned integer, 2 bytes2.4.0 to 2.6.20
ssl.sct.sct_logidLog IDSequence of bytes2.4.0 to 2.6.20
ssl.sct.sct_signatureSignatureSequence of bytes2.4.0 to 2.6.20
ssl.sct.sct_signature_lengthSignature LengthUnsigned integer, 2 bytes2.4.0 to 2.6.20
ssl.sct.sct_timestampTimestampDate and time2.4.0 to 2.6.20
ssl.sct.sct_versionSCT VersionUnsigned integer, 1 byte2.4.0 to 2.6.20
ssl.sct.scts_lengthSerialized SCT List LengthUnsigned integer, 2 bytes2.4.0 to 2.6.20
ssl.segmentSSL segmentFrame number1.0.0 to 2.6.20
ssl.segment.countSegment countUnsigned integer, 4 bytes1.6.0 to 2.6.20
ssl.segment.dataSSL segment dataSequence of bytes1.10.0 to 2.6.20
ssl.segment.errorReassembling errorFrame number1.0.0 to 2.6.20
ssl.segment.multipletailsMultiple tail segments foundBoolean1.0.0 to 2.6.20
ssl.segment.overlapSegment overlapBoolean1.0.0 to 2.6.20
ssl.segment.overlap.conflictConflicting data in segment overlapBoolean1.0.0 to 2.6.20
ssl.segment.toolongfragmentSegment too longBoolean1.0.0 to 2.6.20
ssl.segmentsReassembled SSL segmentsLabel1.0.0 to 2.6.20
ssl.unexpected_messageUnexpected messageLabel2.4.0 to 2.6.20
Про сертификаты:  Как сгенерировать самоподписанный сертификат с помощью OpenSSL на Linux | UNLIX

Анализ pcap-файлов

Обычно я использую Wireshark для выяснения причин сетевых неполадок. Последовательность действий, выполняемая в ходе решения подобных задач, выглядит так:

  1. Захват пакетов с помощью tcpdump (обычно — с помощью команды наподобие sudo tcpdump port 443 -w output.pcap).
  2. Копирование pcap-файла на рабочий ноутбук (scp host:~/output.pcap .).
  3. Открытие pcap-файла с помощью Wireshark (wireshark output.pcap).


Как видите, всё очень просто. Однако, после того, как pcap-файл открыт в программе, у вас может возникнуть закономерный вопрос о том, что со всем этим делать. Поговорим об этом.

Анализ tcp-соединений

Часто, когда я анализирую в Wireshark некую ситуацию, мне нужно проверить какое-то конкретное TCP-соединение, с которым, по какой-то причине, что-то не так. Благодаря Wireshark можно проанализировать весь жизненный цикл отдельного TCP-соединения и выяснить причины неправильного поведения системы.

Сделать это можно, щёлкнув правой кнопкой мыши по интересующему вас пакету и выбрав в контекстном меню команду Conversation filter > TCP.

Начало анализа TCP-соединения

После этого Wireshark покажет другие пакеты из того же TCP-соединения, к которому принадлежит тот пакет, по которому вы щёлкнули. На рисунке ниже можно видеть пример успешного SSL-соединения — тут присутствуют пакеты client hello, service hello, certificate, server key exchange, которые используются для установления SSL-соединений.

Анализ TCP-соединения

Рассматриваемую здесь методику анализа TCP-пакетов мне пришлось использовать в день написания этой статьи, на работе. Некоторые соединения сбрасывались, и я заметила, что после отправки пакета client hello клиент отправлял пакет FIN ACK, который завершал TLS-соединение.

Выше описана весьма типичная для меня схема работы с Wireshark. Обычно в соединении участвуют клиент и сервер, и что-то идёт не так либо на клиенте, либо на сервере. Это может быть, например, какой-нибудь сбой или ошибка в настройках системы. В результате Wireshark оказывает мне просто бесценную помощь в деле определения виновника проблем, помогая выяснить — клиент это или сервер.

Про сертификаты:  Настройка SSO аутентификации в интегрированной системе проверки подлинности FreeIPA. — документация Traffic Inspector Next Generation 1.8.0

Анализ трафика в wireshark

В большинстве случаев (почти всегда) анализ перехваченного трафика происходит в оффлайн-режиме. Т.е. ты сначала перехватываешь трафик, потом сохраняешь его в файл перехвата (File->Save). Потом опять перехватываешь и опять сохраняешь, потом объединяешь все файлы перехвата в один (File->Merge).

И только потом, в комфортных условиях, анализируешь весь трафик скопом. И, кстати, эти функции, с сохранением и объединением, ты будешь использовать гораздо чаще чем ты думаешь. С сохранением, потому что получить с первого раза сведения которые тебе нужны удаётся далеко не всегда.

Как ты наверняка заметил файлы перехвата содержат огромное количество строк, и что бы быстро в них ориентироваться нужно научится делать несколько вещей:

  1. Поиск по пакетам. При нажатии комбинации клавиш Ctrl F открывается панель поиска. Там есть несколько вариантов поиска, но на данном этапе тебе достаточно будет использовать Display filter который позволяет создать фильтр, чтобы найти только те пакеты, которые отвечают заданному в нем выражению и String — осуществляет поиск в строках по указанным символам (поиск вперед Ctrl N, поиск назад Ctrl B;
  2. Отметка пакетов. Очень часто бывает что ты нашел нужный пакет, но есть необходимость вернуться к нему позже, для этого этот пакет можно отметить, нажми правой кнопкой на нужный пакет в Packet List и выбери Mark Packet или нажми Ctrl M, отмечать можно любое количество пактов, а чтобы перемещаться между отмеченными пакетами используются комбинации клавиш Shift Ctrl N — следующий и Shift Ctrl B — предыдущий.
  3. Фильтры. Фильтр — это выражение, в котором задаются критерии для включения или исключения пакетов из анализа. В Wireshark выделяют два вида фильтров: фильтры перехвата и фильтры отображения. Мы рассмотрим некоторые примеры применения фильтров, но про сами фильтры я сделаю отдельную статью. Потому, что там надо будет изучить довольно большой объём информации: логику применения, синтаксис, операторы. Короче это отдельная большая тема.

Интерфейс wireshark

Перед нами появится основное окно программы с которым мы будем проводить больше всего времени. И сразу начнут перехватываться данные. Пока что нажмём «Стоп» (красный квадратик в левом верхнем углу) и порассматриваем интерфейс программы.

Пройдёмся по интерфейсу сверху вниз:

  • В самом верху, под главным меню, находится панель с кнопками — это Main Toolbar. Здесь находятся основные элементы управления программой — старт/стоп и настройки захвата, открытие/закрытие файлов захвата, навигация по пакетам и управлением размером текста;
  • Сразу под ней находится — Filter Toolbar — здесь мы будем вписывать фильтры и операторы, но об этом чуть позже;
  • Ещё ниже находится — Packet List . Это таблица в которой отображаются все пакеты из текущей сессии перехвата или из открытого файла перехвата;
  • Под ним — Packet Details — здесь отображаются сведения о выбранном пакете (выбирать пакеты можно в Packet List);
  • И самое нижнее окошко — Packet Bytes. Здесь показаны исходные данные пакета в необработанном виде, т.е. в том виде, в каком пакет передаётся по сети. (Сейчас бы начать тебе про интерпретацию пакетов рассказывать, но это в другой раз)

Использование wireshark для изучения сетевых протоколов

В этом материале встречаются некоторые термины, которые можно отнести к чему-то вроде жаргона сетевых специалистов. Например — кадр (frame), TCP-порт (TCP port), DNS-ответ (DNS response), IP-адрес источника (source IP address), пакет

client hello

SSL-соединения (SSL client hello). Одной из причин их использования является тот факт, что Wireshark, определённо, не пытается оградить пользователя от тонкостей внутреннего устройства сетевых технологий. Новичка такое положение дел может, поначалу, заставить задуматься о том, что Wireshark — это программа не для него, а лишь для опытных сетевых специалистов.

У такой ориентированности Wireshark на низкоуровневые сетевые механизмы, однако, есть серьёзный плюс. Дело в том, что работая с этой программой, можно узнать что-то новое о сетевых протоколах. Например, я не особенно много знаю о внутренних механизмах протокола TLS/SSL.

Про сертификаты:  Требования к реализации бахчевых культур | Управление Роспотребнадзора по Калининградской области

Однако, анализируя трафик в Wireshark, я обратила внимание на то, что первые два пакета SSL-соединения — это client hello и server hello. В результате протокол, который, если не вникать в детали его работы, кажется чем-то таинственным и недоступным для понимания, начинает обретать более понятную форму, превращается в нечто такое, что можно понять и проанализировать.

Как расшифровать ssl в wireshark?

если себя снифаешь ну или свои устройства, подписывай сертификат, инсталь на устройства, далее в акуле есть в меню пунктик декрипта пакета на основе ключей, грубо говоря хендшейка, на хабре неоднократно об этом писалось, посмотри статью где перехват трафика покер рума делается

А изи хак конечно же как выше предложено – fiddler, исталишь в настройках https галочку на декрипте, добавляешь серт в доверенные, и уже с устройства на котором снифаешь топаешь с включенным фидлером ipv4.fiddler:8888 (порт дефолтный, если меняешь – указываешь тот который в роли дебаг прокси) и на этой страничке исталишь сертификат. Далее выполняешь задачу требуемую
Если же с компа снифвешь, там через winnt ставится прокси, ну подробнее можешь в faq на сайте почитать, если нужно приложение отснифать которое не поддерживает установку прокси, любым софтом можно завернуть траф в твой дебаг прокси = профит

Настройка wireshark

Общие параметры самого приложения WIreshark находятся во вкладке Edit->Preferences. Их можно настроить в зависимости от своих потребностей или предпочтений. Но я бы, на стадии знакомства с программой, не рекомендовал туда лезть. С опытом использования программы и работы с трафиком, понимание что тебе нужно подкрутить для удобства придет само. А потому просто кратко перечислим какие здесь есть разделы:

  • Appearance (Внешний вид). Грубо говоря здесь определяется внешний вид программы. Положение окон, расположение основных панелей, расположение полосы прокрутки и столбцов в панели Packet List, шрифты, а также цвета фона и шрифтов.
  • Capture (Перехват). В этом разделе можно настроить порядок перехвата пакетов. В том числе стандартный интерфейс для перехвата, параметры обновления панели Packet List в реальном времени.
  • Filter Expressions (Фильтрующие выражения). Здесь можно создавать фильтры сетевого трафика и управлять ими. Этот момент мы обсудим отдельно.
  • Name Resolution (Преобразование имен). В этом разделе активируются средства Wireshark, позволяющие преобразовывать адреса в имена, более удобные для понимания. В том числе адреса канального, сетевого и транспортного уровня. А также можно указывать максимальное количество параллельных запросов на преобразование имен.
  • Protocols (Протоколы). В этом разделе находятся параметры, влияющие на перехват и отображение различных пакетов, которые Wireshark может декодировать. Правда настраивать параметры можно далеко не для всех протоколов. Да и в большинстве случаев, без острой на то необходимости, менять здесь ничего не надо.
  • Statistics (Статистика). Название раздела говорит само за себя, здесь находятся параметры отображения и ведения статистики.
  • Advanced (Продвинутый). Параметры которые не вошли не в одну из перечисленных категорий, либо предназначены для более тонкой настройки функционала. Вот сюда точно лезть не нужно.

Если ты планируешь в большей мере работать с трафиком беспроводных сетей, то есть смысл немного кастомизировать рабочие области Wireshark для большего удобства. А именно добавить несколько дополнительных столбцов, информация из которых поможет значительно сэкономить время.

Перейдем в Edit->Preferences и во вкладке Appearance выберем раздел Columns. Здесь жмем на плюсик и добавляем такие колонки, с такими параметрами:

  • Title: Channel, Type: Custom, Fields: wlan_radio.channel — будет показывать нам канал в котором перехвачен пакет;
  • Title: Signal Strenght, Type: Custom, Fields: wlan_radio.signal_dbm — покажет мощность сигнала в канале в момент перехвата пакета.

Перехват handshake

Как узнать пароль wi-fi сети я статью уже писал, поэтому примем за аксиому что он у тебя есть. А SSID и канал мы и так видим в Wireshark, вопрос остаётся только в PTK. Соответственно нужно перехватить рукопожатие и не какое-нибудь, а именно то которое произошло между интересующим нас клиентом и точкой доступа непосредственно перед обменом интересующей нас информацией.

Можем сразу открываем терминал и запускаем перехват рукопожатия:

sudo airodump-ng wlan0mon --channel 11 --write 123

ждать повторных подключений мы не будем, поэтому помогаем отключится всем устройствам в сети:

aireplay-ng --deauth 100 -a 3c:15:c2:f0:b8:4c wlan0mon

и спустя небольшой промежуток времени видим в правом верхнем углу нашего терминала появилась надпись: WPA handshake

это означает, что рукопожатие мы получили, а значит успех близок. Вернемся в Wireshark.

В Filter Toolbar нужно написать:

eapol

Это необходимо что бы убедится что рукопожатие действительно у нас, если это так — можем продолжать. Теперь сделаем то, что я чуть раньше предупреждал не делать, а именно поменяем настройки протоколов. Идём Edit-> Preferences и выбираем вкладку Protocols. В ней нам надо найти IEEE 802.11 и поставить галку Enable decryption после чего нажать Edit

в появившемся окне жмём « » и там где Key type выбрать wpa-pwd. А там где Key нужно ввести через двоеточие «пароль:имя сети». Потом нажать ОК и сохранить изменения в настройках протокола.

сразу после этого захваченный трафик будет расшифрован и начнет приобретать более вразумительный и понятный вид.

Поиск пакетов


Wireshark поддерживает мощный язык запросов. Это значительно упрощает поиск конкретных пакетов в списках. Обычно я, при работе с программой, использую очень простые запросы. Вот несколько примеров:

Язык запросов Wireshark обладает гораздо большими возможностями, нежели язык запросов

tcpdump

(и, кроме того, поддерживает автозавершение по нажатию клавиши TAB). В результате часто я применяю следующую последовательность действий: захватываю большой объём пакетов с помощью

tcpdump

(скажем, нечто вроде всех пакетов с 443-го порта), а затем тщательно изучаю их с использованием Wireshark.

Практика анализа трафика беспроводных сетей

Я уже упоминал, что для сбора трафика в беспроводной сети нужно использовать режим мониторинга сетевого адаптера, но в этом режиме будет работать именно наш сетевой адаптер. Но при этом, для понимания ситуации в целом, неплохо бы знать в каких вообще режимах могут работать сетевые адаптеры:

  • Управляемый режим (Managed mode). Применяется в том случае, если клиент беспроводной сети подключается непосредственной к точке беспроводного доступа. В подобных случаях программный драйвер, связанный с адаптером беспроводной связи, использует точку беспроводного доступа для управления всем процессом обмена данными по беспроводной сети.
  • Режим прямого подключения (Ad-hoc mode). Применяется в том случае, если организована беспроводная сеть, в которой устройства подключаются непосредственно друг к другу. В этом режиме два клиента беспроводной сети, которым требуется обмениваться данными друг с другом, разделяют обязанности, которые обычно возлагаются на точку беспроводного доступа.
  • Ведущий режим (Master mode). Некоторые адаптеры беспроводной связи поддерживают также ведущий режим. В этом режиме адаптеру беспроводной связи разрешается работать вместе со специальным программным драйвером, чтобы компьютер, на котором установлен этот адаптер, действовал в качестве точки беспроводного доступа для других устройств.
  • Режим мониторинга, его ещё называю режим контроля (Monitor mode). Это тот самый режим который мы будем использовать для перехвата и анализа пакетов. Позволяет прослушивать пакеты, распространяемые в эфире. Для полноценного перехвата и анализа пакетов адаптер вместе с программным драйвером должен поддерживать режим текущего контроля, называемый также режимом RFMON, т.е. режимом радиочастотного контроля.

Схематично принцип действия режимов можно нарисовать так:

Просмотр содержимого пакетов

В Wireshark имеется просто восхитительный режим просмотра подробных сведений о пакете, с помощью которого можно разобраться в содержимом любого пакета. Возьмём, например, пакет с сообщением

client hello

из предыдущего примера. Это — первый пакет SSL-соединения, клиент с его помощью как бы говорит: «Привет! Вот он я!».

Wireshark даёт сетевому администратору два невероятно полезных инструмента для исследования содержимого пакетов. Первый — это режим просмотра, в котором можно раскрывать заголовки, имеющиеся у пакета (например — Ethernet-заголовок, IP-заголовок, TCP-заголовок) и просматривать их содержимое.

Анализ заголовков пакета

Работа с географической базой geoip

Если Wireshark скомпилирован с поддержкой GeoIP и у вас есть бесплатные базы Maxmind, то программа может определять местоположение компьютеров по их IP-адресам. Проверьте в

About | Wireshark

, что программа скомпилирована с той версией, какая у вас в наличии. Если GeoIP присутствует в списке, то проверьте наличие на диске баз GeoLite City, Country и ASNum. Укажите расположение баз в меню

Edit | Preferences | Name Resolution

Проверьте систему на дампе трафика, выбрав опцию Statistics | Endpoints | IPv4. В колонках справа должна появиться информация о местоположении и ASN для IP-адреса.

Другая функция GeoIP — фильтрация трафика по местоположению с помощью фильтра ip.geoip. Например, так можно исключить трафик из конкретной ASN. Нижеуказанная команда исключает пакеты от сетевого блока ASN 63949 (Linode).

ip and not ip.geoip.asnum == 63949

Конечно, тот же фильтр можно применить

. Удалите шум и оставьте только действительно интересный трафик.

Фильтрация по идентификатору

Wireshark собирает данные всех сетей находящихся в радиусе действия сетевого адаптера, поэтому наиболее логично первоначально отфильтровать трафик конкретной сети, которая нас интересует. Сделать это можно по имени беспроводной сети (SSID):

wlan.ssid == имя_сети 

хотя наиболее корректно будет отфильтровать по bssid. BSSID — это идентификатор базового набора услуг (Basic Service Set Identifier). Он присваивается каждой точке и идентифицирует её, при этом он посылается в каждом беспроводном пакете управления и пакете данных из передающей точки доступа.

wlan.bssid == 3c:15:c2:f0:b8:4c

Часто используемые фильтры wireshark

Не менее полезным, в некоторых ситуациях будет отфильтровать трафик по используемому каналу связи:

wlan_radio.channel == 10

Используя фильтр:

arp

можно увидеть трафик передаваемый по протоколу ARP, это даст возможность понять какие устройства в данный момент подключены к локальной сети, увидеть их MAC и IP адреса.

Также довольно часто используются такие фильтры:

dns

покажет отправленные dns-запросы, так можно узнать какие сайты посещал пользователь и какими онлайн-ресурсами пользовался.

ip.addr == 192.168.183.129

отфильтрует трафик связанный с конкретным IP (где он был получателем или отправителем).

tcp

покажет tcp трафик, по такому же принципу можно отфильтровать трафик по любому другому протоколу, например udp или icmp.

Оцените статью
Мой сертификат
Добавить комментарий