Ausnahme gefangen: SSL certificate problem: certificate is not yet valid ๐Ÿ“Œ Ssh-Mitm - Ssh Mitm Server For Security Audits Supporting Public Key Authentication, Session Hijacking And File Manipulation

๐Ÿ  Team IT Security News

TSecurity.de ist eine Online-Plattform, die sich auf die Bereitstellung von Informationen,alle 15 Minuten neuste Nachrichten, Bildungsressourcen und Dienstleistungen rund um das Thema IT-Sicherheit spezialisiert hat.
Ob es sich um aktuelle Nachrichten, Fachartikel, Blogbeitrรคge, Webinare, Tutorials, oder Tipps & Tricks handelt, TSecurity.de bietet seinen Nutzern einen umfassenden รœberblick รผber die wichtigsten Aspekte der IT-Sicherheit in einer sich stรคndig verรคndernden digitalen Welt.

16.12.2023 - TIP: Wer den Cookie Consent Banner akzeptiert, kann z.B. von Englisch nach Deutsch รผbersetzen, erst Englisch auswรคhlen dann wieder Deutsch!

Google Android Playstore Download Button fรผr Team IT Security



๐Ÿ“š Ssh-Mitm - Ssh Mitm Server For Security Audits Supporting Public Key Authentication, Session Hijacking And File Manipulation


๐Ÿ’ก Newskategorie: IT Security Nachrichten
๐Ÿ”— Quelle: feedproxy.google.com


ssh-mitm is an intercepting (mitm) proxy server for security audits.

  • Redirect/mirror Shell to another ssh client supported in 0.2.8
  • Replace File in SCP supported in 0.2.6
  • Replace File in SFTP supported in 0.2.3
  • Transparent proxy support in 0.2.2! - intercepting traffic to other hosts is now possible when using arp spoofing or proxy is used as gateway.
  • Since release 0.2.0, SSH Proxy Server has full support for tty (shell), scp and sftp!

do not use this library in production environments! This tool is only for security audits!

Installation

pip install ssh-mitm


Start Proxy Server

Password authentication

Start the server:

ssh-mitm --remote-host 127.0.0.1

Connect to server:

ssh -p 10022 user@proxyserver

Public key authentication

When public key authentication is used, the agent is forwarded to the remote server.

Start the server:

ssh-mitm --forward-agent --remote-host 127.0.0.1

Connect to server:

ssh -A -p 10022 user@proxyserver

SSH MITM Attacks

SSH uses trust on first use. This means, that you have to accept the fingerprint if it is not known.

$ ssh -p 10022 hugo@localhost
The authenticity of host '[localhost]:10022 ([127.0.0.1]:10022)' can't be established.
RSA key fingerprint is SHA256:GIAALZgy8Z86Sezld13ZM74HGbE9HbWjG6T9nzja/D8.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '[localhost]:10022' (RSA) to the list of known hosts.

If a server fingerprint is known, ssh warns the user, that the host identification has changed.

$ ssh -p 10022 remoteuser@localhost
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@ WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED! @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
IT IS POSSIBLE THAT SOMEONE IS DOING SOMETHING NASTY!
Someone could be eavesdropping on you right now (man-in-the-middle attack)!
It is also possible that a host key has just been changed.
The fingerprint for the RSA key sent by the remote host is
SHA256:GIAALZgy8Z86Sezld13ZM74HGbE9HbWjG6T9nzja/D8.
Please contact your system administrator.
Add correct host key in /home/user/.ssh/known_hosts to get rid of this message.
Offending RSA key in /home/user/.ssh/known_hosts:22
remove with:
ssh-keygen -f "/home/user/.ssh/known_hosts" -R "[localhost]:10022"
RSA host key for [localhost]:10022 has changed and you have requested strict checking.
Host key verification failed.

If the victim accepts the (new) fingerprint, then the session can be intercepted.


Use-Case: Honey Pot

When ssh proxy server is used as a honey pot, attackers will accept the fingerprint, because he wants to attack this machine. An attacker also does not know if the fingerprint is correct and if the key has changed, perhaps it the server was reinstalled and a new keypair was generated.


User-Case: Security Audit

When trying to figure out the communication schematics of an application, intercepting ssh can be an invaluable tool.

For example, if you have an application, which connects to you local router via ssh, to configure the device, you can intercept those connections, if the application does not know the fingerprint and accepts it on first use.

If the application knows the fingerprint, then the same host key is used on every device. In this case, you have a good chance to extract the host key from a firmware updated and use it to trick the application.


Use-Case: Transparent Proxy

When the ssh proxy server needs to monitor general ssh communication in a network the transparent feature can be used.

To setup this feature correctly and intercept ssh traffic to multiple different hosts traffic needs to be routed through the ssh proxy server.

SSH packets that need to be audited can now be transparently processed and forwarded by the ssh proxy server making use of the TPROXY feature of the linux kernel.

For example, when traffic is routed through a CentOS 7 machine following configuration can be used:


With iptables
iptables -t mangle -A PREROUTING -p tcp --dport 22 -j TPROXY --tproxy-mark 0x1/0x1 --on-port=10022 --on-ip=127.0.0.1

# Saving the configuration permanently
yum install -y iptables-services
systemctl enable iptables
iptables-save > /etc/sysconfig/iptables
systemctl start iptables

With firewalld
# Making use of directly and permanently adding a rule to the iptables table
firewall-cmd --direct --permanent --add-rule ipv4 mangle PREROUTING 1 -p tcp --dport 22 --j TPROXY --tproxy-mark 0x1/0x1 --on-port=10022 --on-ip=127.0.0.1

:information: additional firewall rules may be necessary to maintain device management capabilities over ssh

To process the packets locally further routing needs to take place:

echo 100 tproxy >> /etc/iproute2/rt_tables
ip rule add fwmark 1 lookup tproxy
ip route add local 0.0.0.0/0 dev lo table tproxy

# Setting routes and policies persistent
echo 'from all fwmark 0x1 lookup tproxy' >> /etc/sysconfig/network-scripts/rule-lo
echo 'local default dev lo scope host table tproxy' >> /etc/sysconfig/network-scripts/route-lo

Now only the ssh proxy server needs to be started in transparent mode to be able to handle sockets that do not have local addresses:

ssh-mitm --transparent

https://powerdns.org/tproxydoc/tproxy.md.html


Available modules

The proxy can be configured and extended using command line arguments.

Some arguments accept Python-class names as string.

Loading a class from a package:

ssh-mitm --ssh-interface ssh_proxy_server.forwarders.ssh.SSHForwarder

โš ๏ธ
creating a pip package for custom classes is recommended, because loading from files has some bugs at the moment

Loading a class from a file (experimental):

ssh-mitm --ssh-interface /path/to/my/file.py:ExtendedSSHForwarder


SSH interface
  • cmd argument: --ssh-interface
  • base class: ssh_proxy_server.forwarders.ssh.SSHBaseForwarder
  • default: ssh_proxy_server.forwarders.ssh.SSHForwarder

Available forwarders:
  • ssh_proxy_server.forwarders.ssh.SSHForwarder - forwards traffic from client to remote server
  • ssh_proxy_server.plugins.ssh.sessionlogger.SSHLogForwarder - write the session to a file, which can be replayed with script
  • ssh_proxy_server.plugins.ssh.noshell.NoShellForwarder - keeps the session open, when used as master channel, but tty should not be possible to the remote server
  • ssh_proxy_server.plugins.ssh.mirrorshell.SSHMirrorForwarder - Mirror ssh session to another ssh client
  • ssh_proxy_server.plugins.ssh.injectorshell.SSHInjectableForwarder - Creates injection shells for listening on and writing to a ssh session

SCP interface
  • cmd argument: --scp-interface
  • base class: ssh_proxy_server.forwarders.scp.SCPBaseForwarder
  • default: ssh_proxy_server.forwarders.scp.SCPForwarder

Available forwarders:
  • ssh_proxy_server.forwarders.scp.SCPForwarder - transfer file between client and server
  • ssh_proxy_server.plugins.scp.store_file.SCPStorageForwarder - save file to file system
  • ssh_proxy_server.plugins.scp.replace_file.SCPReplaceFile - replace transfered file with another file

SFTP Handler
  • cmd argument: --sftp-handler
  • base class: ssh_proxy_server.forwarders.sftp.SFTPHandlerBasePlugin
  • default: ssh_proxy_server.forwarders.sftp.SFTPHandlerPlugin

Available forwarders:
  • ssh_proxy_server.forwarders.sftp.SFTPHandlerPlugin - transfer file between client and server
  • ssh_proxy_server.plugins.sftp.store_file.SFTPHandlerStoragePlugin - save file to file system
  • ssh_proxy_server.plugins.sftp_replace.SFTPProxyReplaceHandler - replace transfered file with another file

Authentication:
  • cmd argument: --authenticator
  • base class: ssh_proxy_server.authentication.Authenticator
  • default: ssh_proxy_server.authentication.AuthenticatorPassThrough

Available Authenticators:
  • ssh_proxy_server.authentication.AuthenticatorPassThrough - default authenticator, which can reuse credentials

Currently, only one authenticator (AuthenticatorPassThrough) exists, but it supports arguments to specify remote host, username and password, which shlould fit most scenarios. (public keys are on the roadmap)


Authors
  • Manfred Kaiser
  • Simon Bรถhm


...



๐Ÿ“Œ IBM Integration Bus up to 9.0/10.0 Session Timeout Session Hijacking weak authentication


๐Ÿ“ˆ 34.36 Punkte

๐Ÿ“Œ aio-libs aiohttp-session Session Session Fixation weak authentication


๐Ÿ“ˆ 32.71 Punkte

๐Ÿ“Œ Session Hijacking and Other Session Attacks


๐Ÿ“ˆ 30.38 Punkte

๐Ÿ“Œ Osprey Pump Controller 1.0.1 Predictable Session Token / Session Hijacking


๐Ÿ“ˆ 28.6 Punkte

๐Ÿ“Œ IBM Integration Bus bis 9.0/10.0 Session Timeout Session Hijacking schwache Authentisierung


๐Ÿ“ˆ 28.6 Punkte

๐Ÿ“Œ [CVE-2014-9015] Session hijacking used empty session keys


๐Ÿ“ˆ 28.6 Punkte

๐Ÿ“Œ US government orders States to conduct cyber security audits of public water systems


๐Ÿ“ˆ 27.22 Punkte

๐Ÿ“Œ Nextcloud Server up to 12.0.7/13.0.2 Session Session Fixation weak authentication


๐Ÿ“ˆ 27.1 Punkte

๐Ÿ“Œ CVE-2016-6290 | PHP up to 7.0.8 Session ext/session/session.c unserialize use after free (Nessus ID 119979 / ID 175796)


๐Ÿ“ˆ 26.95 Punkte

๐Ÿ“Œ CVE-2016-7125 | PHP up to 5.6.24/7.0.9 Session Name ext/session/session.c injection (ID 72681 / Nessus ID 93914)


๐Ÿ“ˆ 26.95 Punkte

๐Ÿ“Œ I got the cinemon session cinemon x Session cinemon session cinemon error


๐Ÿ“ˆ 26.95 Punkte

๐Ÿ“Œ PHP bis 5.6.24/7.0.9 Session Name Handler ext/session/session.c erweiterte Rechte


๐Ÿ“ˆ 26.95 Punkte

๐Ÿ“Œ PHP bis 5.6.24/7.0.9 Session Name Handler ext/session/session.c erweiterte Rechte


๐Ÿ“ˆ 26.95 Punkte

๐Ÿ“Œ aio-libs aiohttp-session Session Session Fixation schwache Authentisierung


๐Ÿ“ˆ 26.95 Punkte

๐Ÿ“Œ IBM Security Guardium 10.0 Session Session Fixation weak authentication


๐Ÿ“ˆ 25.65 Punkte

๐Ÿ“Œ G Data Security Guardium Big Data Intelligence 3.1 Session Session Fixation weak authentication


๐Ÿ“ˆ 25.65 Punkte

๐Ÿ“Œ IBM Security Access Manager up to 9.0.6 Session Expiration Session Token weak authentication


๐Ÿ“ˆ 25.65 Punkte

๐Ÿ“Œ EU To Give Free Security Audits To Apache HTTP Server and Keepass


๐Ÿ“ˆ 25.47 Punkte

๐Ÿ“Œ EU To Give Free Security Audits To Apache HTTP Server and Keepass


๐Ÿ“ˆ 25.47 Punkte

๐Ÿ“Œ Asus RT-AC53 3.0.0.4.380.6038 HTTP Header Session Hijacking weak authentication


๐Ÿ“ˆ 25.37 Punkte

๐Ÿ“Œ Open Ticket Request System up to 4.0.27/5.0.25/6.0.2 Cookie Session Hijacking weak authentication


๐Ÿ“ˆ 25.37 Punkte

๐Ÿ“Œ Pulse Secure Pulse Connect Secure up to 8.3R7.0/9.0R3.3 Session Hijacking weak authentication


๐Ÿ“ˆ 25.37 Punkte

๐Ÿ“Œ Cisco Small Business RV320/Small Business RV325 Web-based Interface HTTP Request Session Hijacking weak authentication


๐Ÿ“ˆ 25.37 Punkte

๐Ÿ“Œ WSO2 API Manager Carbon Management Console Request Session Hijacking improper authentication


๐Ÿ“ˆ 25.37 Punkte

๐Ÿ“Œ WSO2 API Manager Carbon Management Console Request Session Hijacking improper authentication


๐Ÿ“ˆ 25.37 Punkte

๐Ÿ“Œ GitHub - solokeys/solo: Solo: open security key supporting FIDO2 & U2F over USB + NFC


๐Ÿ“ˆ 24.58 Punkte

๐Ÿ“Œ RDPHijack-BOF - Cobalt Strike Beacon Object File (BOF) That Uses WinStationConnect API To Perform Local/Remote RDP Session Hijacking


๐Ÿ“ˆ 23.74 Punkte

๐Ÿ“Œ Revive Adserver up to 4.0.0 Session Session Fixation weak authentication


๐Ÿ“ˆ 23.73 Punkte

๐Ÿ“Œ Revive Adserver up to 3.2.2 Session Identifier Session Fixation weak authentication


๐Ÿ“ˆ 23.73 Punkte

๐Ÿ“Œ REST Client for Ruby up to 1.7.x Session Cookie Session Fixation weak authentication


๐Ÿ“ˆ 23.73 Punkte

๐Ÿ“Œ oVirt up to 3.5.0 restapi Session Session Token weak authentication


๐Ÿ“ˆ 23.73 Punkte











matomo