190 points · by choult · 2w ago · 150 comments
"Can't do math" (off-by-1 errors etc)
"Sanitize your inputs" (escape sequences, parsing etc)
"What are you referencing?" (null pointers, use-after-free etc)
and error handling. Plain error codes bubbling up a call stack, or bypassing that somehow which may violate program structure.
How many of these fundamental issues are there?
OWASP already covers this
CWE does what OP is alluding to though.
1. Failure to differentiate data from instructions
2. Business logic flaws
3. Insecure operating environment
4. Incorrect use of cryptography
It's what still trips half the people working on security of LLM applications.
Execute without read is not supported so much though.
Aside from language level enforcement (Java/Rust/...)
I mean, I'm kinda kidding, but #1 is #1.
1. Error that causes security problems
What is being secured (as in, whose interests), and from who?
Security is all nice until one day you find yourself being seen as threat actor. See e.g. all the modern computing devices you "own".
"escape your outputs" works for all data and is actually achievable. It means even escaping data that was never an "input" from the outside the system, even developer-created data, which absolutely can (and does) cause problems to ignore.
MITRE has Common Weakness Enumerations (CWEs) which are categories of programming errors.
You are wise to identify this, but other people beat you to it by a few decades.
But root cause is a flawed concept, there's almost never one root cause.
It's almost always memory safety violations. The rest are basically application-level bugs, like not properly checking inputs.
CVEs are a big deal, but humans are the real vulnerability
I'd phrase that as "know your data access ordering," and include races.
Synology isn't a panacea (they put themselves in an awkward position with their btrfs fork, with constraints them to stay on an obsolete kernel branch and do a ton of patch shuffling and backporting), but is a much better posture to start homelabing from than, say, a raspbian in a shoebox.
I would assert that if you exposed any services directly to the internet without a justifiable reason. I don't think exposing a NAS management interface to the public internet is justifiable.
Most non-security/networking appliances don't take security seriously enough to even contemplate it.
Most NAS protocols and their implementations have an awful track record and assume to be operating on a secure local network, e.g. SMB and NFS.
My rule is that appliances should never be accessible from untrusted networks and regular server systems (e.g. debian) only expose the minimum set of services that must be publicly accessible, like a public website.
Everything else, all management web uis and other non-public services are only accessible via Wireguard or mTLS as a fallback option when supported by client software.
Synology was a perfect solution. Low-cost unit, stick a 15gb drive in it and do again for second unit. DSM is a breeze to work with and the built in rsync was pretty easy to setup and has been working seamlessly for a year now.
Just free willy opening ports and sticking a default setup NAS to the internet, I agree, is asking to be hacked. Tailscale was my preferred way to get them connected but there is no Tailscale Synology client, and if I remember, would required hacks to get one on it and working. Use long passwords for the user is first start. Then on both use the security settings to only accept the ONE IP from each other, even though only one of them is actually exposed to the internet. Also select the settings to install any security updates automatically. Logs show this has all been working good to protect the units. The only catch so far is the IP of his house changed once in the year, being it isn't static, but simply changing it on the sending unit to new one fixed it in about 3 minutes.
I'm thinking of replicating this setup for myself to backup all PC's and phones in my household and syncing to another unit I set up at my relative's house in another state while I visit over the holidays. It pays for itself in short time compared to a cloud provider.
I'm curious now after this CVE how long it will take the units to auto update to newest version after it becomes available to manually install.
Anyway, I bought one for a client past year, and I won't buy nor recommend one ever again. It's a mess security and technically wise.
They're on a 4.4 kernel (even on recent devices), supposedly backporting security bugfixes. That also means that on a kernel so old you don't have the networking performance improvements and features of the last 10 years.
They're using a btrfs version they forked 10 years ago that they're maintaining out of tree, that also doesn't have any of the new features, and that's not compatible with recent btrfs versions. On top of that, they self built a super messy ACL system that's using a vmtouch version also from 10 years ago.
They always have super outdated libraries. They've been using PHP7.4 (EOLed 4 years ago) until past winter, and PHP8.1 until this summer.
I take a look to the running daemons and... their SMB daemon is based on 4.15.13 (from 2022). Nginx 1.23.1 (from 2022). chrony (it just says DEVELOPMENT version). net-snmp 5.9.3 (2022). rsync 3.1.2 (2015). Postgres 11.11 (2021). Not fun.
And I'm talking about a supported device that got a major OS upgrade this summer.
With this wave of AI security attacks, they don't have much time until something huge appears. Either that, or they use that AI to accelerate going back to mainline versions of the software they use.
--
0: https://tailscale.com/docs/integrations/synologyThe thing even self-updates.
I think the answer is mTLS.
Unfortunately, Synology apps don't support it.
Generate the config, one per client, setup the client to only route specific RFC1918 networks and disable on well known wifi networks, and that's it. It literally works for years without any maintenance.
Tailscale is easier (presumably), but also puts a corporate entity between you and your data.
I don't work with computers professionally, at all. It still only took me about 2 hours to get the VPS, get Debian going on it, set up headscale, and connect to it from home. Do I still use corporate Tailscale? Yes, it has some features that aren't beautifully supported on headscale, and so for the moment I'm fine with that. But I do have my backup plan in place if I need it.
The VPN companies are prime targets and have large attack surface. Even bigger companies are frequently compromised. It's a matter of time before it becomes publicly known.
mTLS is a better option for distributed systems (service to service mesh networks for attestation of workload identities) instead of for human users.
Do I turn on the VPN when I take a picture and turn it off when finished? Every time?
What if I need multiple VPN's? Living in a country that has a bad geoip reputation, it's already a struggle of switching on and off for individual websites to work.
Now if you're going to use mTLS as the basis for mature authn/authz, that's a different story. But I never see anyone do that.
If the operator wants to provide admin access after mTLS is established as you described, then that may be a design decision, but that’s not on mTLS fault and the same can be said about other forms of identity authn (password, certificates, biometric, etc)
mTLS prevents connecting to the application without valid cert.
Sure the reverse proxy handling the mtls can be exploited, but so can any VPN server as well.
AFAIK the SSH server MUST give a response[2], so network scanners can still find their targets. DoS mitigation is generally performed by a hosting provider or an upstream service.
[0]: https://www.wireguard.com/protocol/#dos-mitigation
[1]: https://www.wireguard.com/papers/wireguard.pdf (5.1 Silence is a Virtue)
I've been using Synology for ~12 years, and I've never exposed my NAS to the Internet.
Let the family members have their own Linux ISO collections or let them pay streaming scammers.
I am not a big family guy as you can notice. But in my defense no one really cares about my photo albums or ISO files I like.
I personally think Synology are mostly at most fault here though - they shouldn’t be making it so easy for clueless users to do this. It’s basically advertised as a feature.
Very, very few consumer products make it that easy to set up and tie your own noose.
> CWE-88: Improper Neutralization of Argument Delimiters in a Command
So, they were building shell commands from some kind of user input in the OAuth API? system("getent passwd " . $_GET['user']);Prepare and parameterize statements you guys.
Wrong idea: not even a few hours later was it mining bitcoins.
Fortunately only the system partition was affected and I could restore it fully.
I've never used OAuth, it looked completely unconfigured. But it's the subject of this CVE and seems to be installed by default .
Thats one simple way, another way is to use the built-in synology reverse proxy but... that has also had a vulnerability this week.
I have a DNS wildcard in cloudflare and a more complicated setup with plex on a subdomain, and authelia integrated into NPM to authenticate users before they get through the npm rule.
* Plex packages on Plex are more-or-less current, but you can probably better stay current on a non-DSM OS. * If you're exposing Plex to the internet, the relevant surface area is basically just Plex itself. You can probably better manage defense-in-depth of the underlying system on a non-DSM OS in the case of a Plex vulnerability.
I just recently took a 415+ off the internet (it had Photo Station and Apache only exposed to the outside). I did the "resistor mod" on its JTAG connector to save its Atom from literally frying itself and it's also still working fine. As usual, the hardware far outlives the software.
Does anyone know of any UGREEN UGOS alternatives? I don't mind the terminal but friends prefer a web GUI and for some mundane stuff I too have started to (begrudgingly) prefer it.
https://www.reddit.com/r/synology_service/comments/1ohptep/w...
I'm curious if they support mTLS too?
That's never the answer.