
Security News
Another Round of TEA Protocol Spam Floods npm, But It’s Not a Worm
Recent coverage mislabels the latest TEA protocol spam as a worm. Here’s what’s actually happening.
Harden your Python code by with rule-based file system access restrictions.
Let's write a simple HTTP server that serves files in the local directory.
from http.server import HTTPServer, SimpleHTTPRequestHandler
server = HTTPServer(("", 8000), SimpleHTTPRequestHandler)
server.serve_forever()
But if there's a symlink in the local directory, the program can "escape".
$ ln -s /etc oops
$ python3 test.py &
[1] ...
$ curl localhost:8000
...
$ curl localhost:8000/oops/passwd
uh oh
$ kill $!
[1]+ Terminated python3 test.py
Now let's harden our server with Landlock!
from http.server import HTTPServer, SimpleHTTPRequestHandler
from landlock import Ruleset
server = HTTPServer(("", 8000), SimpleHTTPRequestHandler)
# the ruleset by default disallows all filesystem access
rs = Ruleset()
# explicitly allow access to the local directory hierarchy
rs.allow(".")
# turn on protections
rs.apply()
server.serve_forever()
And now we get a permission denied error if we try and access files outside the current directory, even via a symlink:
$ python3 test.py &
[1] ...
$ curl localhost:8000
...
$ curl localhost:8000/oops/
127.0.0.1 - - [DD/MMM/YYYY HH:MM:SS] code 404, message No permission to list directory
...
$ kill $!
[1]+ Terminated python3 test.py
Success! Instead of dumping the password file, we instead get a permission error!
Landlock is great for hardening applications against both accidental programming mistakes, and attacks. It won't prevent an exploited application from all malicious behavior, but it can stop it reading with the filesystem and interacting with device files.
| Landlock ABI Version | Feature | Supported |
|---|---|---|
| 1 | Initial support | ✅ |
| 2 | File renaming and linking | ✅ |
| 3 | File truncation | ✅ |
| 4 | TCP bind and connect | ❌ |
| 5 | Device IOCTL | ✅ |
| 6 | Abstract UNIX socket | ❌ |
| 7 | Linux audit logging | ❌ |
For more information about what these features are, please see the Landlock user documentation section Previous Limitations.
Tests are run using pytest. Each test is run in a separate subprocess using pytest-forked so Landlock rules don't conflict.
FAQs
Python interface to the Landlock Linux Security Module.
We found that landlock 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.

Security News
Recent coverage mislabels the latest TEA protocol spam as a worm. Here’s what’s actually happening.

Security News
PyPI adds Trusted Publishing support for GitLab Self-Managed as adoption reaches 25% of uploads

Research
/Security News
A malicious Chrome extension posing as an Ethereum wallet steals seed phrases by encoding them into Sui transactions, enabling full wallet takeover.