Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
A very simple pump from stdin to a remote file via sftp. Useful for when one cannot just pipe over ssh to cat
or dd
, for example. when remote sftp provider is limited to sftp-only, like OpenSSH
with ChrootDirectory
and internal-sftp
, an rclone serve sftp
or proftpd
with mod_sftp
,
I had a need to make a efficient backups of virtual machines disk images, which means copy-on-write snapshot of disk image, then transfer over the network while applying compression, without the need to first locally save compressed disk image and without blocking the host system or guest virtual machine during the process. The solution for that is to use reflinks as a copy-on-write snapshots, and then stream the content of reflinked disk image while compressing in between, to remote server. Sadly, neither scp
nor sftp
support reading from pipe., dropping not a file' error
. This way the source image is not blocked and is immutable during the backup process regardless how how long all of the compression and transfer take, at no point in tiem I have a whole copy of the disk image and there's no need to write whole image compressed to disk before transfer.
Make zero-copy snapshot of the Virtual Machine disk image::
cp -a --reflink=always vm_1.qcow2 vm_1.qcow2_snapshot
And upload it over the network, while adding compression to remote file::
zstd -6 < vm_1.qcow2_snapshot |
stdin2sftp
-u backupuser
-H backuphost.example.com
-f "/mnt/backups/vm_dumps/vm_1/$(date '+%Y-%m-%d_%H-%M-%S').qcow2.zstd"
And if one is worried about saturating network link, an bandwidth limit can be applied with pv
. Since with reflink, the source disk image is not blocked regardless of how long the transfer takes::
zstd -6 < vm_1.qcow2_snapshot |
pv -L 64M |
stdin2sftp
-u backupuser
-H backuphost.example.com
-f "/mnt/backups/vm_dumps/vm_1/$(date '+%Y-%m-%d_%H-%M-%S').qcow2.zstd"
after which the snapshot can be discarded::
rm -f vm_1.qcow2_snapshot
FAQs
stdin to sftp pump
We found that stdin2sftp demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.