A precise and practical demonstration of surgical system hardening that transforms abstract security concepts into a tangible defense strategy. It highlights the essential trade-off between absolute process isolation and functional stability.
Deep Dive
Prerequisite Knowledge
- No data available.
Where to go next
- No data available.
Deep Dive
I Blocked Dangerous Linux Syscalls with SeccompAdded:
This Linux machine is vulnerable to copyfail.
But if we run the exploit, nothing happens.
Dropping to root didn't succeed.
We are still using a non-privileged user.
In this video, I will show you how seccomp can prevent dangerous exploits from working. Seccomp stands for secure computing.
It filters system calls and decide whether to allow it or not. Rather than reading this whole man page, let's go and see some practical examples.
Seccomp works on syscalls. Whenever we execute a program or binary, it calls different functions in the background.
Those are the system calls. To see them, we can use the s trace command.
Here are the typical system calls you will see.
This output is often hard to parse. So, if we want to see a better view, we can run s trace like this.
Here is a summary output about the different syscalls invoked when running ls command. As an example, execve is a common system call that runs a binary on a particular path. The easiest way to demonstrate how seccomp filters syscalls is through firejail.
We already have a previous video about firejail, but for the sake of others, let's do a quick recap. Firejail is a sandboxing tool. If we run it, we will be dropped inside a restricted environment.
Inside this, we cannot run privileged commands.
Most binaries are also missing.
Now, let's find out how seccomp works through firejail.
Let's say we want a restricted shell that will prevent running the execve syscall. We would run it like this.
The seccomp drop parameter is added, specifying the syscall we want to remove. If there are multiple syscalls we want to target, we can just separate them by commas.
Once we are inside, we won't be able to run commands that rely on that syscall.
It is also important to note that not all commands rely on execve.
Take a look at this one.
Why did it work? The reason is that PWD command is a shell built-in. That means the program code is already in memory and it no longer needs to invoke execve to call a separate binary on disk.
Let's have another example.
We have here a file that is owned by my current user, meaning I can delete it or modify it in any way I want. If we want to block file deletions even for a file you owned, we can do that by dropping the unlinkat syscall.
Now, if we try to remove it, it says operation not permitted. This can be a neat strategy if you want to maintain the immutability of a file. For example, if you have a critical configuration that you want to defend against attackers trying to delete it, this can be a good way to do it. We can see the underlying syscall being blocked in action if we use strace. But by default, firejail prevents the use of debuggers.
What we can do is to rerun firejail, but this time we add the allow debuggers flag.
If we run again rm with strace, we would see the actual syscall being denied.
The error returned can also be customized. For instance, we can make it appear as no such file or directory rather than permission denied.
We just put a colon followed by the official error code. In this case, the official error code for no such file or directory is error no entry.
Let's try to delete the file.
There is no error, but the file is still there.
This confirms the seccomp filter took effect. Just to see it again under the hood, let's run it with strace.
This line clearly shows us that the unlinkat syscall didn't succeed followed by error no entry.
We can also use seccomp programmatically using the libseccomp library. To demonstrate this, let's try blocking the copy fail exploit.
If your system is vulnerable to copy fail, an attacker will be able to run a small shellcode to drop to a root shell.
So, here's a way to prevent this attack.
Using the libseccomp, we can create a small wrapper program like this.
The copy fail vulnerability works by cloning a process while sending data to AF_ALG socket type. So, the goal of this program is to prevent those unusual cloning of processes. At the top, we need to import the seccomp header file.
Next to that is to define the type of clones we want to block.
Inside the main function, we need to initialize the seccomp context.
Then we also have a process control line here that tells the kernel not to let the process gain new privileges.
The next two lines would be the actual seccomp filters we want.
The first parameter is the seccomp context. Then next is the action we want, which is to deny it. Third is the syscall we want to block, which is clone. The clone syscall accepts a parameter, so we will tell seccomp to look into the first one.
The last part is checking whether the clone VM bit is present when invoking the clone system call.
The next line is similar, but here we also filter the clone 3 syscall, which is a modern version of clone. Once the seccomp filters are defined, we can now load the context.
Lastly, we call bin bash through execve.
What happens after this is that any process launched within this shell will automatically inherit the seccomp rules above.
Let's compile the program. To do that, we use GCC but with the following flag.
This tells the compiler to use the seccomp link library.
Once that is compiled, we can run that to drop us to a restricted shell.
We are currently still running as some user account. To confirm that the seccomp filters worked, we shouldn't be dropping to root when we execute the copy fail exploit.
As we expected, we remained on our current user, effectively blocking the exploit. So, seccomp is an alternative way of stopping different attacks. The important thing is you know what system calls to block. Else, you might break legitimate programs from running.
Aside from firejail and using as a program wrapper, seccomp is also used in different services such as containers and systemd. Using seccomp to block attacks can be a more precise solution.
The downside is that it can get complicated if you are working on a large amount of system calls. You need to do thorough testing to make sure normal programs will continue to work without issues. I hope you learned something today. If you find my content valuable, please support me by liking this video and subscribing to my channel. See you on the next one.
Related Videos
Agentforce NOW AMA: Build with React and Salesforce Multi-Framework
SalesforceDevs
490 viewsβ’2026-05-28
How agent o11y differs from traditional o11y β Phil Hetzel, Braintrust
aiDotEngineer
450 viewsβ’2026-05-28
WEB TECHNOLOGIES UNIT-2 | Degree 4th sem BCOM Computers web technologies unit-2 full explanationπ―β
LearnwithSahera
1K viewsβ’2026-05-29
More tests are always better? How to use AI to identify tests that bring little value
Alliance4Qualification
335 viewsβ’2026-05-29
Search Algorithms Explained in 60 Seconds! π€π¨
samarthtuliofficial
218 viewsβ’2026-06-01
People of Game of Thrones using JavaScript DOM
AltCampus
296 viewsβ’2026-05-30
Introduction to Problem Solving Part - 1 | Lecture 1 | Intermediate DSA
ascensionix
107 viewsβ’2026-05-29
So What's Odin Lang Even Good For
TechOverTea
131 viewsβ’2026-06-01











