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.
Catflap provides firewall level protection of multiple ports with a password protected web gateway to allow developers and/or site demo/stage reviewers to request entry after providing valid authentication credentials. Currently Catflap supports Linux running the NetFilter (iptables) kernel-level firewall. However, firewall specific implementations are provided as firewall plugin drivers and it should be possible to write a separate plugin for the ipfw firewall on Mac OSX and other FreeBSD derivatives.
Essentially, it is a more user-friendly form of "port knocking". The original proof-of-concept implementation was run for almost three years by Demotix, to protect development and staging servers from search engine crawlers and other unwanted traffic.
Catflap is available as a ruby gem and can be installed with:
gem install catflap
You may also want to download the generic Linux init script (https://github.com/nyk/catflap/blob/master/etc/init.d/catflap) and place that in /etc/init.d/.
It is advisable to create a configuration file: /usr/local/etc/catflap.yaml (this is the default location referenced by the init script, but you can specify the location of your configuration file with the --config-file parameter to the catflap command line tool.
This configuration file is a YAML file and the default configuration is listed below:
server:
listen_addr: '0.0.0.0' # What ip address the catflap server should listen on.
port: 4777 # The TCP port that the catflap server listens on.
docroot: './ui' # You can override the ui location.
endpoint: '/catflap' # The endpoint for the REST API.
passfile: './etc/passfile.yaml' # Pass phrases are stored here in this file.
token_ttl: 15 # Expire tokens after 15 seconds.
firewall:
plugin: 'netfilter' # Options are netfilter or iptables.
dports: '80,443' # Lock multiple ports separating them by commas.
options: # Options are specific to each firewall plugin driver.
chain: 'CATFLAP' # Two chains will be created <chain>-ALLOW & <chain>-DENY.
log_rejected: true # Enable logging of rejected requests.
accept_local: true # This is only set to false only when developers are testing catflap.
Once your configuration is in place you will then want to install the rules and initialize catflap. This can be done with the command line tool:
sudo catflap -f /etc/catflap.yaml install
Catflap has a command line tool that you can use to add or remove addresses from the access chain and other household maintenance. Just run 'catflap help' to see the available options.
Now you will want to start the service. If you are using the init.d script this is easy:
sudo service catflap start
If not you will need to start it with the command line directly (useful for testing and debugging issues):
sudo catflap -f /etc/catflap.yaml start
Addresses and address ranges can be added using the command line with the 'add' command, but remote users can request that their current IP address be granted access by visiting the URL of the website that is being catflapped with their web-browser. Catflap will redirect the target port (e.g. port 80) to the Catflap port (e.g. 4777), so they will see the Catflap login screen. Once they provide a valid pass phrase, their browser will refresh and they will see the target website.
This is the default configuration, provided by the 'netfilter' driver, which uses NAT on the firewall to forward the ports. You can use the 'ipfilter' driver instead, if you want to reject or drop packets rather than automatically redirect to the Catflap login. The user would instead have to go to the Catflap URL directly. However, the default 'netfilter' driver is recommended if you want the best and most seamless end-user experience.
Although we have been careful to avoid application level security vulnerabilities, such as shell injection attacks, and no web user submitted data is passed to the operating system without being sanitized (i.e. IP addresses are validated as being valid IP addresses before being sent to the firewall interface), there are still some areas of security concern to be aware of:
FAQs
Unknown package
We found that catflap demonstrated a not healthy version release cadence and project activity because the last version was released 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.