# Detecting https-tunneled ssh traffic

**URL:** <https://forum.suricata.io/t/detecting-https-tunneled-ssh-traffic/495>\
**Category:** Rules\
**Tags:** pfsense\
**Created:** [August 13, 2020, 11:51am UTC](https://forum.suricata.io/t/detecting-https-tunneled-ssh-traffic/495 "2020-08-13T11:51:47Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Coziac](https://avatars.discourse-cdn.com/v4/letter/c/c77e96/32.png) [@Coziac](https://forum.suricata.io/u/Coziac)\
**Post date:** [August 13, 2020, 11:51am UTC](https://forum.suricata.io/t/detecting-https-tunneled-ssh-traffic/495/1 "2020-08-13T11:51:47Z")

</div>

Hello Suricata community,

I am trying to write a rule that detects ssh traffic that is tunneled in https traffic with the program stunnel. I’ve found out that the datalength that is send from the ssh-client to the ssh-server is always the same in every transmitted https-packet, so I will count the occurrences of https packets within a certain time-window having the certain datalength using the dsize attribute.

My problem is that Suricata does not recognize this tls traffic at all. For testing purposes I’ve written the generic rule:

alert tls any any -\> any any (“msg: tls traffic detected”; sid:10000011;)

Connections to public https-capable websites are being detected. But the tunneled ssh traffic is not recognized. I’ve checked the wireshark output of the ssh-server and the ssh communication is indeed tunneled in https-packets but no alerts are raised. Does anybody know why this rule fails in my situation? I use suricata in pfsense.

Thank you!

---

<div class="post-metadata">

**Author:** ![Coziac](https://avatars.discourse-cdn.com/v4/letter/c/c77e96/32.png) [@Coziac](https://forum.suricata.io/u/Coziac)\
**Post date:** [August 13, 2020, 12:35pm UTC](https://forum.suricata.io/t/detecting-https-tunneled-ssh-traffic/495/2 "2020-08-13T12:35:43Z")

</div>

Now it works. I don’t know what was the issue. But now I have the problem that the dsize attribute does not match the packets. I tried to use length value that wireshark shows me.

---

<div class="post-metadata">

**Author:** ![Andreas\_Herz](https://yyz2.discourse-cdn.com/flex030/user_avatar/forum.suricata.io/andreas_herz/32/52_2.png) [@Andreas\_Herz](https://forum.suricata.io/u/Andreas_Herz)\
**Post date:** [August 20, 2020, 9:53pm UTC](https://forum.suricata.io/t/detecting-https-tunneled-ssh-traffic/495/3 "2020-08-20T21:53:50Z")

</div>

Do you have a pcap for that?  
You could try to run it on a dedicated system with `-r` to exclude any issue with the pfsense configuration.

---

<div class="post-metadata">

**Author:** ![shyang](https://avatars.discourse-cdn.com/v4/letter/s/a698b9/32.png) [@shyang](https://forum.suricata.io/u/shyang)\
**Post date:** [August 5, 2021, 4:07am UTC](https://forum.suricata.io/t/detecting-https-tunneled-ssh-traffic/495/4 "2021-08-05T04:07:49Z")

</div>

I have the same issue of ‘dsize’.

- [ssh dsize issue](https://forum.suricata.io/t/can-i-use-dsize-in-rules-when-ssh-is-enabled/1588)

from suricata guide,

- [Don’t Cross The Streams](https://suricata.readthedocs.io/en/suricata-6.0.3/rules/differences-from-snort.html?highlight=dsize#don-t-cross-the-streams)
