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.
Bridging FTP servers and cloud storage.
FsTPy brings together the power and scalability of pyftpdlib (https://github.com/giampaolo/pyftpdlib) with the flexibility and abstraction provided by PyFilesystem2 (https://github.com/PyFilesystem/pyfilesystem2).
It allows to build custom FTP and FTPS servers on abstracted filesystem (local or cloud such as S3 or Dropbox or Google Drive)
Install from pypi with pip:
pip3 install FsTPy
The package comes with an executable server which can be used as a starting point for custom solutions. The script reqires to be executed in a folder containing three files
Server key and certificate can be generated following the guide https://httpd.apache.org/docs/2.4/ssl/ssl_faq.html#selfcert or any similar proecdure.
The credentials file credentials.txt should be formatted as follows
This files contains a column separated list of username, md5 password hash, root directory, user permissions permissions and optional login and logout messages. Different lines can be defined in order to define different user credentials.
The following example of credentials.txt defines two users with the same password (12345) but different permissions.
user1;827ccb0eea8a706c4c34a16891f84e7b;/;elradfmwMT;Welcome, user1!;Bye, bye user1
user2;827ccb0eea8a706c4c34a16891f84e7b;/;elr;Welcome, user2!;Bye, bye user2
Permission argument is a string referencing the user's permissions explained below:
Read permissions:
Write permissions:
Once installed, the server can be run simply by providing the PyFilesystem2 URL of the desired filesystem .
The server binds to 0.0.0.0:2121. See help to change the address and port arguments:
fstpyd --help
In order to start an S3 backed FTPS server on bucket my-bucket:
pip3 install fs-s3fs
fstpyd 's3://AWS_ACCESS_KEY_ID:AWS_SECRET_ACCESS_KEY@my-bucket/'
Run the server on a given root directory:
fstpyd 'osfs://path/to/rootdir/'
The API is pretty simple. It extends some classes of the pyftpdlib library (https://github.com/giampaolo/pyftpdlib). The fstpyd script (https://github.com/desmoteo/FsTPy/blob/main/scripts/fstpyd) can be used to understand basic usage, in combination with the rich documentation of pyftpdlib (https://pyftpdlib.readthedocs.io/en/latest/index.html) and PyFilesystem2 (https://docs.pyfilesystem.org/en/latest/index.html)
There are just a couple of differences with respect to the original pyftpdlib.
The authorizers from fstpy.authorizers, DummyAuthorizer and MD5Authorizer repalce the corresponfing classes of pyftpdlib. They take two arguments , the URL of the filesystem in PyFilesystem2 format, and the path to the credentials file.
DummyAuthorizer expects a credentials file with plain passwords. MD5Authorizer expects a credentials file with MD5 hashes of the passwords.
from fstpy.authorizers import MD5Authorizer
authorizer = MD5Authorizer('s3://my-bucket', 'credentials.txt')
FsTPy Abstracted filesystem in fstpy.filesystems should replace the native abstracted_fs of pyftpdlib handlers
from fstpy.filesystems import AbstractedFS
from pyftpdlib.handlers import TLS_FTPHandler
handler = TLS_FTPHandler
handler.abstracted_fs = AbstractedFS
FAQs
Bridging FTP and cloud storage
We found that fstpy 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.