Security recommendations
Some pieces of advice to improve your Opsec or digital security.
Author’s notes:
- I’m not a security expert. Learning about security can become very hard, specially when it comes to the more technical aspects of it. I have been a bit obsessed with privacy and security for a while, so all the information that I’m going to share with you is knowledge that I found from many different sources. I’m open to feedback, so feel free to email me if you feel like that something mentioned here isn’t accurate.
- Evaluate your threat model. Usually, improving your security comes at the cost of sacrificing some convenience.
- This article isn’t about how to secure your web services. DevSecOps is an entirely different beast and should belong in a different article. However, there’s one mention of programming languages in this article.
- Follow these recommendations at your own risk. Some of the recommendations are a bit too technical for some users.
- As always, do your own research.
Phishing
Social engineering is perhaps the most effective way of attacking someone, phishing being one of the most common.
Criminals are always getting more and more creative and coming up with new phishing methods that can be very sneaky sometimes. Some of them are still pretty obvious, but some others can be very sneaky.
You can find some examples here:
- https://github.com/SeanWrightSec/phishing-examples
- Email phishing: https://us.norton.com/blog/online-scams/phishing-email-examples
- The inception bar: https://jameshfisher.com/2019/04/27/the-inception-bar-a-new-phishing-method/
Recommendations
- Take the phishing test by Google: https://phishingquiz.withgoogle.com/
- Investigate and learn about different phishing methods that are used.
- Configure your web browser to warn you about dangerous sites.
- Use your common sense. Sometimes phishing can be quite obvious.
- Use an ad blocker such as uBlockOrigin (it may not have all features on Chromium-based browsers due to Manifest V3). You can also use the Brave Browser which comes with an adblocker built in.
- Some relatives of yours may struggle to detect fake stuff when browsing the web. Be patient with them and teach them about how to spot them.
- On Chromium-based web browsers, right click on the address bar, and click on “Always show full URLs”
Passwords
You should avoid reusing passwords whenever possible. Websites get hacked all the time, and a lot of them either store passwords in plain text, or with a very weak hashihg algorithm succeptible to password cracking.
Avoid storing them on a physical paper, or in an excel/word/plain text document. Doing this isn’t very practical anyway compared to other available options, and the catch with these two approaches is that your passwords are not protected by encryption. So anyone with access to it can read all your credentials.
You can use a Password Manager like KeePassXC for desktop PCs or KeePassDX for mobile devices. Any password manager is okay, as long as you make sure that they are following proper security standards.
One of the advantages of KeePass-based password managers is that they are usually free and open-source (you can audit the code yourself and make sure that it follows proper security standards, if you are into that), and that they are usually offline, they don’t require an Internet connection.
The advantage of an offline password manager is that you are reducing the attack surface by not exposing your password database to the Internet or a cloud service. This can be a bit less convenient if you want to sync your passwords across devices, but you can use tools like Syncthing for that.
Bitwarden is another commonly used open source password manager. It supports syncing, and you can optionally self-host it.
If you prefer CLI based password managers, there’s also the Unix standard password manager Pass
1Password is recommended. At the time of writing this article, 1Password hasn’t had any security incident or data breach. It’s worth noting that 1Password is closed-source, if that’s a concern for you.
LastPass isn’t necessarily a bad password manager, but it is worth mentioning that LastPass has a record of security incidents.
Remember, even though your passwords are in theory protected by encryption, keep in mind that you must use a strong master password to mitigate these security incidents. Your password database contains a lot of sensitive information. If this is a concern for you, consider using offline password managers. As mentioned before, you can reduce the attack surface by not exposing your passwords to a cloud or online service that is not under your control.
Important note: The whole purpose of using a password manager is letting your password manager generate secure and random passwords for you (Don’t just create passwords yourself).
Some websites have very dumb rules on the allowed characters for the password field, so parameterize the password generator of your password manager as you need.
It can take quite a bit of time to replace the passwords of all of your accounts, but it’s worth the time.
How to test how secure is your password:
- https://www.security.org/how-secure-is-my-password/
- If you don’t trust the previous website, you can try this open-source tool: https://github.com/dropbox/zxcvbn
- Password managers usually tell you when passwords are weak
Multi-factor authentication
Multi Factor Authentication prevents an attacker from accessing an account if the password gets compromised.
A fun fact about MFA that many people don’t know, most of the MFA codes that you receive on your phone (except SMS), are actually Time Based One Time Passwords, which is a standard that generates codes based on the time, and it doesn’t require any Internet connection, preventing man in the middle attacks.
That being said, in most cases (not always), you don’t need a specific app to have your OTPs configured, it only needs to support the TOPT RFC 6238 standard, which is the OTP algorithm that most apps use.
Recommendation
Don’t use SMS for MFA. Sadly, this is not always possible as some services still require SMS for MFA. But keep in mind that SMS is a completely broken protocol that shouldn’t be used anymore. Also, Your phone number is susceptible to SIM Swap attacks. This is how Jack Dorsey (ex Twitter CEO) got hacked.
You can use Aegis for Android or Raivo OTP for iOS. These are open-source alternatives, but you can use the one that you like and trust the most. You may want to avoid using Authy.
Considerations
Keep in mind that multi-factor is not a bullet proff method to prevent an attacker from accessing your accounts. An attacker can still steal your session tokens and bypass any login or multi-factor.
Security Questions
Don’t be honest answering security questions.
Security Questions are these basic questions about you (ie: “What’s your favorite food?”, “Where did you study for the first time?”, etc) that you can answer in case you forgot your password and you don’t have any other way to recover it.
This is extremely susceptible to Social Engineering attacks. If you are honest when answering security questions, an attacker can gather information about you or your relatives and very easily reset your password.
This is a broken system because you shouldn’t forget your passwords if you are using a Password Manager.
Always answer these questions with fake data. You can generate random passphrases with your Password Manager for this purpose.
IoT Devices
IoT devices, such as your Smart TV, Smart Fridge, Smart Watch, or even smart lightbulbs, are sometimes built with very poor security standards, and they get hacked all the time.
The more devices you have connected to the Internet, the more you increase the attack surface.
If some of these devices get hacked, it may not affect you directly, but a very common use case of hacking IoT devices is using them for a botnet of DDoS attacks.
Recommendations
- Reduce the attack surface by connecting the least amount of devices as possible to the Internet. Ask yourself it is really necessary to connect that smart lightbulb to the Internet.
- If it is absolutelly necessary for you to connect some IoT devices online, try to: 1. Keep them up to date if possible, and 2. configure security policies in your router to reduce the attack surface.
Wireless Devices
Wireless devices can be very convenient to use because cables can be annoying for some people. However, because you no longer need physical access to hijack the communication between devices, the attack surface is increased because someone nearby may be exploiting a vulnerability on your devices.
Bluetooth has always been insecure, and you may want to avoid using it if you can.
Consider using an Ethernet cable instead of a Wi-fi connection. Not only it is a bit more secure, you will also have a more stable connection.
Disable any wireless connection when not in use.
- BleedingTooth: Linux Bluetooth Zero-Click Remote Code Execution
- CVE-2019-13052 LOGITacker: Demo live decryption of Unifying keyboard after sniffed pairing.
- Tesla cars: https://trifinite.org/stuff/project_tempa/
Social Media
Social media is inherently susceptible to social engineering attacks. There are many pitfalls when it comes to privacy when using social media and it is preferable to just avoid using it if you can, or at the very least being careful with what you make public.
Chat Applications
Signal | Open Source server and client, but centralized server, requires phone number |
Matrix, XMPP | Federated/decentralized (sometimes not e2e encrypted due to federation issues) |
GNU/Jami, Tox, Session, Briar | Serverless |
SimpleX | E2E encrypted and P2P, although not 100% serverless |
iMessage, Whatsapp | E2E encrypted and proprietary |
Telegram | Open Source client, proprietary servers and not E2E encrypted by default |
Discord, Slack, Facebook Messenger, etc | Not E2E encrypted nor open source |
SMS | Don’t. |
Ransomware
Any operating system can be be affected by Ransomware.
Some Ransomware attacks can be so sophisticated that they can even detect backup drives and encrypt that as well.
Always make regular backups of your important files on different drives or clouds. Keep one backup on an external drive that is physically disconnected from any other device. Make backups within different time frames. For example, let’s say that the ransomware takes one week to encrypt all your files. If you back up your data daily, there’s a chance that some of the files that you are backing up are already encrypted by the ransomware. So, you can do a monthly backup + a separate weekly backup.
Web Browsers
- Update your web browser daily.
- Use multiple profiles, for example, one for personal related stuff, and another one for work related stuff.
- Disable JavaScript JIT. Many security vulnerabilities are JIT bugs. Note: You may notice that your browser is a bit slower after disabling JIT. It’s also hard to disable JIT on some browsers.
- Be careful with WebRTC. WebRTC has the potential of leaking your real IP address, even under a VPN. You can test it here.
- Enable HTTPS-only mode
- Avoid installing too many extensions. Keep it minimal.
VPNs
VPNs can be useful for privacy in some cases, but they don’t help much for security.
Most websites already protect the data with the HTTPS protocol. Web browsers also support an HTTPS-only mode. A VPN can prevent man-in-the-middle from sniffing a site’s data if you visit a non-HTTPS site, but once the requests leave the VPN servers, the data is no longer encrypted by the VPN protocol, so you should avoid visiting those sites anyway.
Also, many VPNs have lied about their no-log policies. Don’t think that this is only an issue with free VPNs and that it doesn’t happen with paid ones. Just because you gave money to a VPN provider isn’t any warranty that they are not going to give your data to someone else anyway. There’s no way to know if a VPN is collecting data about you, either intentionally or not.
There are legitimate use cases for VPNs, for example, if an organization has internal services that shouldn’t be accessible to the public, the organization can host an internal VPN to make IP whitelisting much easier. This was actually the intended use of VPNs when they were created.
If you don’t trust your network or your ISP, a VPN can prevent your network provider or your ISP from knowing what websites you are visiting, but keep in mind that you are essentially moving the problem from one place to another, now you have to trust on your VPN provider.
Home Routers
Update your router’s admin password. Not the Wi-Fi password. The router admin password.
A lot of routers have very basic admin username and passwords by default, like “admin / admin”, or “admin / admin1”, etc. Some of them have a random string in a sticker that you can find in the router itself, but those can still be a bit predictable sometimes. Some ISP companies assign similar passwords to a lot of the routers that they distribute, and you can find them online.
For example, you could go to someone else’s house who you know uses an specific ISP, search on the web for common admin passwords for that specific ISP, and log in to the admin panel.
With admin access, you can do anything with the router, such as, uploading an infected firmware without you ever noticing anything.
Recommendations
-
If you can, and if your ISP allows you to, change the admin password of your router. You can use your password manager for this and generate a random password.
-
If you can, build your own custom router. Apart from security, there are lots of other advantages of customizing your own router. If you build your own custom router, you are no longer under your ISP’s arbitrary restrictions or bad security practices. Your router can be as secure as you want.
-
If you are interested in building your own custom router, check these two videos:
Smartphones
Modern mobile operating systems often have plenty of security features. However, some smartphone users (especially Android ones) tend to worsen their security with some practices.
Recommendations
- Avoid Rooting (Android) or Jailbreak (iOS) your device. The reason why you don’t want to do this because you are increasing the chances of privilege escalation from a potential attacker by reducing the principle of least privilege. Also, in the case of Android, rooting your device usually requires disabling the bootloader, and thus, disabling verified boot.
- Install apps from trusted sources, and install only apps that you trust, don’t just install any random app that you find.
- Have a strong PIN code. It’s recommended to use a 6-digit random generated PIN code.
- Uninstall apps that you don’t need to reduce the attack surface. If you don’t want to delete the data of the apps that you don’t use, you can also disable them.
- Follow the principle of least privilege by giving apps only the permissions that they need at the moment.
- Keep your device up to date.
- Use different user profiles, as in, avoid using the same profile for everything. For example, you can have a personal profile and a work profile.
- Avoid using web views in any app. A lot of apps, specially TikTok, inject code into web views to add spyware and keyloggers. Copy the link to your clipboard, then open up an actual browser instance and paste the link. Avoid opening links by clicking on them inside the app itself.
- Use face unlock only if you are sure that your device has the proper hardware to support it, not just with a regular front camera. A lot of devices that “support” face unlock with just a normal front camera, are usually unlockable with a photo of the owner.
- Reboot your smartphone frequently. This mitigates malware that can only live temporally on RAM and is not persisted thanks to Verified Boot.
Android specific
Perhaps the most secure Android experience that you can have (or in smartphones in general for that matter), is using a Google Pixel with GrapheneOS. GrapheneOS has a lot of features to make Android as secure as possible without sacrificing convenience.
You can check GrapheneOS features to understand why it is so secure compared to other Android ROMs, and also why only Pixel phones are supported.
DivestOS can also be an option if your device doesn’t support GrapheneOS. It supports bootloader re-locking on 26 devices. You can check if your device is supported by DivestOS and if it supports bootloader re-locking here.
Be careful when using custom ROMs. With the exception of GrapheneOS, other custom ROMs such as LineageOS usually require you to keep the bootloader unlocked, which also disables Verified Boot. Verified Boot is essential for Android security.
You can read a more detailed explanation here about common bad security practices on Android.
Desktop Operating Systems
Desktop operating systems were not designed with security in mind, and they are usually more vulnerable than other operating systems.
Disk Encryption
Disk Encryption or Data at Rest Encryption is a preventive measure to protect your data if your device (hard drive, SSD, etc) is no longer with you. Even if you format your drive before giving it to someone else, the data is still recoverable.
- Windows: Enable Bitlocker.
- Go to Control Panel > System and Security > BitLocker Drive Encryption
- Click on “Turn on BitLocker”
- If you have Bitlocker enabled, you will see a lock icon on your
C:
drive under the “This PC” menu.
- MacOS: Any modern Apple desktop device supports hardware-based encryption. Make sure to enable FireVault.
- Linux: Linux users have many different disk encryption options. Here are a few alternatives:
- Installing Pop!_OS, which gives you the option of encrypting the disk during installation.
- Some installers allow you to encrypt the home folder. You can also encrypt an existing Home folder: https://wiki.archlinux.org/title/ECryptfs#Encrypting_a_home_directory
- Partition the drive yourself with dm-crypt and encrypted boot partition: https://wiki.archlinux.org/title/Dm-crypt/Encrypting_an_entire_system#Encrypted_boot_partition_(GRUB)
- Other disk encryption alternatives: https://wiki.archlinux.org/title/Data-at-rest_encryption#Available_methods
Secure boot
Secure Boot and TPM are technologies that allow you to mitigate Evil Maid Attacks.
Secure Boot and TPM are only effective if you protect the BIOS settings with a password. Otherwise, an attacker can just disable it.
If you use a modern Apple desktop device, you can read this article and skip the rest of this section: https://support.apple.com/guide/security/startup-security-utility-secc7b34e5b5/web
Note for Apple users: If you set a firmware password for your Mac device (Macbook, Mac Mini, etc), please remember to remove that password if you are not going to use that device anymore. We already have enough e-waste.
OS Specific recommendations
- Windows: If you got a brand-new laptop with Windows 10 or Windows 11, more than likely you already have Secure Boot and TPM enabled. Just remember that you need to protect the BIOS settings with a password.
- Linux: Linux users will have a hard time trying to get Secure Boot to even start up, not to mention all the struggles that you may have tried to make it effective.
- The reason why it is so hard to use Linux with Secure Boot is that motherboard manufacturers pre-load Microsoft’s signing keys by default, which are obviously not compatible with most Linux distributions.
- A recommendation is to install your Linux distribution with the above mentioned dm-crypt encrypted boot scheme and read this article: https://wiki.archlinux.org/title/Unified_Extensible_Firmware_Interface/Secure_Boot#PreLoader to evaluate the possible methods to enable Secure Boot for Linux.
- You can upload your own keys to your motherboard as mentioned in this guide: https://wiki.gentoo.org/wiki/User:Sakaki/Sakaki%27s_EFI_Install_Guide/Configuring_Secure_Boot but you can potentially brick your motherboard if you don’t know what you are doing.
- Effective TPM under Linux is even more complicated. You can know more about it here: https://wiki.archlinux.org/title/Trusted_Platform_Module, but since it’s so complicated, it’s recommended to just use full disk encryption + secure boot and set a password for your BIOS. This isn’t bulletproof against evil maid attacks, and an attacker may find a way around it, but it’s still better than nothing.
- Make sure that Meltdown/Spectre mitigations are enabled. You can check if you are vulnerable with this script
- Configure AppArmor profiles.
App Sandboxing
App Sandboxing is a security feature that provides an isolated runtime environment that limits the available resources of your system to the program.
Android and iOS have sandboxing features by default for every app that you install. Desktop operating systems are lacking in this regard.
- Windows users can use the Windows Sandbox utility to run untrusted programs.
- MacOS users already have their applications sandboxed if they were installed from the App Store: https://developer.apple.com/documentation/security/app_sandbox
- Linux users have different options: https://wiki.archlinux.org/title/Security#Sandboxing_applications.
- Avoid using Firejail. Firejail runs as root, and it increases the potential risk of privilege escalation.
- The recommended sandboxing utility for Linux is Bubblewrap. The catch is that Bubblewrap is not very friendly to use, but it’s far more secure and granular compared to other alternatives.
- A friendlier alternative is using Flatpaks which uses Bubblewrap underneath, and you can control the permissions of your applications with Flatseal. There, are, criticisms against Flatpak’s sandboxing features. However, using Flatpak + Flatseal is still far better than the traditional way of installing packages on Linux which doesn’t have any sandboxing at all.
Pirating software
Whether you consider piracy morally correct or wrong (which is an entirely separate debate), there’s always a risk when you pirate a specific piece of software or media. Not only you have to trust the authors of that software, you also have to trust the hacker (or hacker group) who tampered with the executable to bypass the DRM.
There are many examples of this, but the most recent and most popular one is the case of TLauncher, a Minecraft 3rd party launcher that allows you to play Java Minecraft for free. It was discovered that this launcher contains very sneaky malware.
Remember, this can happen with any software downloaded from an untrusted source, but this is more common with pirated software. For example, when you pirate a videogame, a Photoshop license, an Office license, etc.
At first, nothing appears to happen when you “crack” a piece of software, and you may think that nothing wrong is going on with your PC, but it’s probably running malware in the background. Your antivirus may also not able to detect it, either because some malware have the capability of being undetectable by antivirus software, and also, because usually these “cracks” require you to execute them as Administrator. If a piece of malware is running as admin, now it is able to do anything to the system, like disabling your antivirus.
If for some reason you want to run pirated software and reduce the risk of doing so, you can do it inside of a virtual machine, although this is obviously less convenient.
Windows specific
- Enable password for admin privileges:
- You can achieve this by hitting
Windows Key + R
, typingsecpol.msc
, then click on “Enter” or “OK”, On the left panel, click on “Local Policies” > “Security Options”. Double click on “User Account Control: Behavior of the elevation prompt for administrators in Admin Approval Mode”, and under the “Local Security Setting” section, select “Prompt for credentials” and persist the changes by clicking on “Apply” and “OK”. This prevents privilege escalation from an attacker if you leave the screen unlocked (it can also prevent some Rubber Ducky attacks). - If you find this inconvenient, you can revert it by following the same steps but selecting “Prompt for consent” instead.
- You can achieve this by hitting
- Avoid using activation tools such as KMSPico. The reason why is explained below under the “Pirating software” section. You can find legitimate Windows activation keys for very cheap. Also, a lot of motherboards and laptops nowadays already come with an OEM key preinstalled (UEFI).
- Use Windows Sandbox to run untrusted programs.
- Enable Bitlocker (how to do so is explained in the “Disk Encryption” section).
- If you want to download a Windows ISO, download it from Microsoft’s official website directly, not from any other source, that way you make sure that the ISO hasn’t been tampered with.
- Avoid using Windows 8.1 or lower. These systems are no longer supported by Microsoft and they are vulnerable. Consider upgrading to Windows 10 or higher.
- Enable filename extensions to be aware of what kind of software you are double clicking on.
Linux (desktop) specific
Some security researchers don’t consider Linux on the desktop to be secure. The technical reasons why are explained here.
There are some things that you can do to improve the security of your Linux installation:
- Use Wayland instead of Xorg/X11. Xorg is a program with a lot of ancient code, designed under a very ancient protocol (X11). Linux sandboxing is flawed mostly because of possible sandbox escapes through X11. The catch is that you may have compatibility issues with Wayland (ie: issues with screen sharing). However, Wayland’s development is improving with time.
- Use Pipewire instead of Pulseaudio. Pipewire provides better sandboxing and security features. Most Linux distributions are starting to ship Pipewire instead of Pulseaudio.
- Use hardened_malloc. This is a hardened memory allocator that mitigates memory corruption exploits. This is a bit more extreme, and it’s not recommended if you don’t know what you are doing, as some programs may break.
- Use doas instead of
sudo
.sudo
has had security vulnerabilities that took years to patch. Also,sudo
is a really big program, anddoas
is much smaller in comparison.doas
has fewer features thansudo
, but for desktop usage,doas
is usually more than enough. - Avoid using SystemD. Although this can be hard for most people due to compatibility issues with other init systems.
- Use the sandboxing utilities mentioned in the App Sandboxing section.
Electron Apps
Electron isn’t inherently insecure by itself. In fact, Electron has sandboxing features.
However, if you run an Electron app instead of the Web equivalent, you are running such software with higher privileges on your system. For example, an Electron app is able to read your whole home folder (if not properly sandboxed with another tool), and even use zero-day exploits to scale privileges, such as Pwnkit (Note: Pwnkit has already been patched, the point is to reduce the possibility of privilege escalation).
On the other hand, the Web equivalent is sandboxed within the actual browser’s environment, therefore, they are a bit more secure than using the Electron equivalent.
Also, many developers don’t regularly update the Electron version of their apps, so many Electron apps are using an old version of Chromium and Electron that doesn’t have the latest security patches.
For example, at the time of writing this article, Discord uses Chromium version 91, and Electron version 13. Whereas the latest stable Chromium version is 110, and the latest stable Electron release is 23. You can prove this by yourself with the Electron apps that you use with this method:
$ strings Discord | grep '^Chrome/[0-9.]* Electron/[0-9]'
> Chrome/91.0.4472.164 Electron/13.6.6
$ strings slack | grep '^Chrome/[0-9.]* Electron/[0-9]'
> Chrome/106.0.5249.168 Electron/21.2.2
Slack does a better job at keeping the Chromium and Electron engine up to date, but other apps such as Discord still fall behind. Still, if you run these apps in your browser, you don’t have to wait for the developers to update Chromium/Chrome as you can update it yourself, and as mentioned, the web version doesn’t have as much privileges on your system as the Electron equivalent.
Some examples of Electron apps that can be used within a web browser are Slack, Discord, Figma, Notion, Whatsapp Web, Zoom, and many others.
Cloud Storage
Cloud services are very convenient, but they could be susceptible to security incidents. You have to trust your cloud provider with the security of your files. If you want to upload to the cloud and you don’t want the file to be readable by your cloud provider (or a potential attacker), encrypt your files with a randomly generated password before uploading them to the cloud. You can use AES-256 or Cha Cha 20 or the encryption method of your preference. On Unix-like systems, you can run this command to encrypt a file with AES-256:
gpg --symmetric --no-symkey-cache --cipher-algo AES256 your-file
Memory Safety
Most of the security flaws come from memory safety issues, not just with Chromium, but with all kinds of other programs as well.
If you can, use programs that were written in memory safe languages, such as Rust.
If you are a software developer yourself, consider using Rust for writing your programs. But if you can’t, or you don’t want to, consider learning about Rust’s memory safety features and try to implement them in your programming language of preference.
Rust has a lot of features that prevent you from introducing bugs related to memory safety or mutability, such as the concept of Ownership and Borrowing, Lifetimes, no garbage collector, etc.
For example, the “null” value doesn’t exist in Rust, an “Enum” has to be used instead, forcing the developer to always handle a case when there’s no value.
Another example is that Rust has the concept of Ownership and Borrowing. You have to explicitly specify when a parameter should be mutable or not, and there are some rules on how you are allowed to mutate some values. This is usually optional in other programming languages (Javascript, Python, etc).
You can use some tools (linters, code smells, etc) with other languages to mitigate some of these issues, but Rust is built with safety in mind from the ground up.
Note: There are all kinds of security flaws that can happen with any programming language, even with Rust. This section is about memory safety specifically.
General recommendations for developers
- Be careful with installing a bunch of fancy extensions/plugins for your shell or terminal. There’s always the possibility of these running malicious code (either intentionally or not), and the code that they run has the same privileges as your current user, which can also be
root
. Keep it minimal.