I just found you can transfer files between host and guest using netcat. It should be preinstalled in Ubuntu.
Let the host has IP address 10.0.1.12 and I randomly choose port 8080 to communicate.
Guest → Host
On guest (mine is macOS 15, the port might be specified using -p 8080 in other OS):
nc -l 8080 < my-file.txt
On host (mine is Ubuntu 24.04)
nc 10.0.1.12 8080 > my-file.txt
then Ctrl+C to kill the netcat (there is no progressbar and it does not quit on completion)
Host → Guest
On guest
nc -l 8080 > my-file.txt
On host (mine is Ubuntu 24.04)
nc 10.0.1.12 8080 < my-file.txt
Using ssh could be problematic since the host is behind NAT and you have to forward ports. For some simple transfers this could be the most simple solution :)
Note that this is not limited to guest / host. You can do that between any computers on network. Just be warned that it sends data without any encryption.