ssh hangs in Kubuntu 24.04, Ubuntu 24.01

I am running Kubuntu 24.04 and Ubuntu 24.01 in VirtualBox, hosted on Mint 20.2. On these two virtual machines, ssh hangs when I try to connect to my Amazon EC2 instance, but I can ssh to another machine on my local network. ssh works fine on the host, and on two or three other devices. I tried Fedora 40 in VirtualBox, and ssh works correctly there. I did disable the firewall. Is there a bug in recent Debina-based systems? What am I missing?