{{Header}} {{#seo: |description=Firmware Security and Updating Issues |image=Firmwareupdate.jpg }} {{boot_firmware}} [[File:Firmwareupdate.jpg|thumb|200px]] {{intro| Firmware Security and Updating Issues }} = Introduction = {{mbox | type = notice | image = [[File:Ambox_notice.png|40px|alt=Info]] | text = This chapter contains general security advice and is unspecific to {{project_name_long}}. }} Due to the difficulty of this topic and the specificity of hardware and host OS firmware, this issue is generally outside the scope of {{project_name_short}} documentation. The links provided further below may not be the most relevant to the end user, necessitating further individual research. = Firmware on Personal Computers = Firmware is generally defined as the type of software that provides control, monitoring and data manipulation of engineered products. https://en.wikipedia.org/wiki/Firmware In the case of computers, firmware is held in non-volatile memory devices such as [https://en.wikipedia.org/wiki/Read-only_memory ROM], [https://en.wikipedia.org/wiki/Eprom EPROM] or [https://en.wikipedia.org/wiki/Flash_memory flash memory] and is associated with: https://en.wikipedia.org/wiki/Firmware#Computers https://en.wikipedia.org/wiki/Firmware#Other_examples https://www.darkreading.com/intel/raising-the-stakes-when-software-attacks-hardware https://www.fsf.org/campaigns/priority-projects/hardware-firmware-drivers
* [https://en.wikipedia.org/wiki/BIOS BIOS] [https://wiki.gentoo.org/wiki/BIOS_Update updates]. * [https://en.wikipedia.org/wiki/Binary_blob Non-free] drivers or [https://packages.debian.org/stable/firmware-linux-nonfree firmware]. * [https://en.wikipedia.org/wiki/Microcode Processor microcode] [https://wiki.archlinux.org/title/Microcode updates]: ** On Debian systems, depending on the processor it is either the [https://packages.debian.org/stable/intel-microcode intel-microcode] or [https://packages.debian.org/stable/amd64-microcode amd-microcode] package. * Firmware in storage devices like harddrives, DVD drives, and flash storage. * All computer peripherals like printers, scanners and cameras / webcams. * [https://help.ubuntu.com/community/BIOSUpdate UEFI] compliant firmware. * [https://en.wikipedia.org/wiki/Firmware#Examples Routers and firewalls]. * Network adapters, IO controllers, power management and graphics processing units. * 3-D graphics engines.
= Firmware Updating and Security Problems = == Introduction == The major problem with updating firmware is that it cannot be done automatically in most cases. Therefore, it is difficult to fix functionality or security issues after the hardware has shipped. While utility programs are often available to update BIOS, firmware in other devices is rarely updated and mechanisms for detecting and updating firmware are not standardized. If firmware can be upgraded, this is usually possible via a program created by the provider. Old firmware should always be saved before upgrading. If the process fails or the newer version performs worse, the process can be reverted. https://en.wikipedia.org/wiki/Firmware#Flashing Updating firmware may or may not improve security. On the one hand, it may fix vulnerabilities, but on the other hand, an update may introduce a new backdoor. Unfortunately, most end users must blindly trust the hardware producer, so it is probably better to install non-free updates rather than risk being vulnerable to known attacks in the wild. Also see this debian-security mailing list thread: [https://lists.debian.org/debian-security/2013/09/msg00027.html How secure is an installation with no non-free packages?] Until these re-writable firmware areas are locked down or the code is open-sourced and vastly simplified, it is likely to remain a rich environment for malicious adversaries. https://www.darkreading.com/intel/raising-the-stakes-when-software-attacks-hardware Mark Shuttleworth, founder of the Ubuntu Linux distribution, has described [https://web.archive.org/web/20230323204330/https://www.markshuttleworth.com/archives/1332 proprietary firmware as a security risk], stating "firmware on your device is the NSA's best friend" and calling firmware "a trojan horse of monumental proportions". The reality is that advanced adversaries are routinely hacking the firmware of [https://www.wired.com/2013/09/nsa-router-hacking/ Internet routers, switches and firewalls], along with [https://www.wired.com/2015/02/nsa-firmware-hacking/ harddrive firmware], and [https://wikileaks.org/vault7/#Dark%20Matter UEFI/EFI and ethernet adapters]. The number of targets is already in the tens of thousands on an annual basis. Subverting firmware in this manner provides a stealthy and persistent presence that can eavesdrop on or re-route all network data, or access information in invisible storage areas that are unencrypted (bypassing disk encryption). Worst of all, firmware sabotage is believed to survive software updates or complete operating system re-installations. Attacks may also be designed to corrupt firmware so machines are prevented from booting, even with an external drive. == Attacks == * [https://web.archive.org/web/20150611225402/http://legbacore.com/Research_files/HowManyMillionBIOSesWouldYouLikeToInfect_Whitepaper_v1.pdf How many million BIOSes would you like to infect?] https://media.kasperskycontenthub.com/wp-content/uploads/sites/43/2015/03/20082025/HowManyMillionBIOSWouldYouLikeToInfect_Full2.pdf https://www.theregister.com/2015/08/11/memory_hole_roots_intel_processors/ == Supply Chain Attacks == Compromising a computing company's infrastructure is an advanced attack methodology that has risen to prominence over the last ten years: https://www.vice.com/en/article/d3y48v/what-is-a-supply-chain-attack
Supply chain attacks can happen when hackers gain access to a software company's infrastructure—development environment, build servers, update servers, etc.—and are able to inject malware into new software releases or security updates.
A recent example of malware that successfully targeted computer firmware is the late-2018 "Operation ShadowHammer" attack, which affected an estimated half a million Windows users utilizing ASUS hardware. In this case, the [https://www.shouldiremoveit.com/ASUS-Live-Update-5823-program.aspx ASUS Live Update Utility] -- which is responsible for automatically updating components like BIOS, UEFI, drivers, and applications -- was compromised. It was discovered that the backdoored utility actually targeted the MAC addresses of a few hundred users, which were actually hard-coded into the trojan samples analyzed. The implication is that an advanced nation state attacker was willing to infect an untold number of innocent users for their targeted operations on a far smaller subset. https://securelist.com/operation-shadowhammer/89992/ This sophisticated supply chain attack involved several steps: https://motherboard.vice.com/en_us/article/pan9wn/hackers-hijacked-asus-software-updates-to-install-backdoors-on-thousands-of-computers * The ASUS server which served the live update tool was compromised. * The malicious file was signed with ''legitimate'' ASUS digital certificates so the software appeared genuine. Reinforcing the notion that digital certificates are an imperfect security mechanism. The file was actually a three-year-old binary containing harmful code. * Users downloaded the malicious, backdoored utility through the ASUS update server. * The trojan utility searched for targets using a set of unique MAC addresses. MD5 hash values were hard-coded and found to correspond to unique MAC addresses for network adapter cards. This indicates the attackers knew the MAC addresses of their targets in advance. * Once located, a command-and-control server under the attacker's control installed additional malware on the machine. Another relatively recent example concerns backdoors that were built into Android mobile firmware in 2017. In this case, Google researchers confirmed the advanced backdoors were preinstalled on devices before they left manufacturer factories: https://arstechnica.com/information-technology/2019/06/google-confirms-2017-supply-chain-attack-that-sneaked-backdoor-on-android-devices/
Triada first came to light in 2016 in articles published by Kaspersky [https://www.kaspersky.com/blog/triada-trojan/11481/ here] and [https://securelist.com/everyone-sees-not-what-they-want-to-see/74997/ here], the first of which said the malware was "one of the most advanced mobile Trojans" the security firm's analysts had ever encountered. Once installed, Triada's chief purpose was to install apps that could be used to send spam and display ads. It employed an impressive kit of tools, including rooting exploits that bypassed security protections built into Android and the means to modify the Android OS' all-powerful Zygote process. That meant the malware could directly tamper with every installed app. Triada also connected to no fewer than 17 command and control servers. In July 2017, security firm Dr. Web reported that its researchers had found Triada [https://news.drweb.com/show/?i=11390&lng=en built into the firmware of several Android devices], including the Leagoo M5 Plus, Leagoo M8, Nomu S10, and Nomu S20. The attackers used the backdoor to surreptitiously download and install modules. Because the backdoor was embedded into one of the OS libraries and located in the system section, it couldn't be deleted using standard methods, the report said.
This malicious Android firmware was primarily adware and focused on allowing code to be injected into the system user interface to display advertisements, the downloading and installation of applications of the attackers' choice, and encrypted communications with command and control servers. Nevertheless, it further demonstrates the weaknesses that exist in the global supply chain for various devices. These attacks are concerning because they reveal adversaries are prepared to undermine the security underpinning the entire supply chain for their purposes, whether it is manufactured/assembled components or via breaches of trusted vendor software channels. As most users of specific computer/device hardware trust the manufacturing company, this is a very difficult problem to address, particularly since it can remain undiscovered for a long period. In addition, this mode of attack suggests that overall improvements in computing security are forcing sophisticated attackers to "raise their game," because in general they choose the path of least resistance when attempting to infiltrate the systems of targets. For further reading on this topic, see: * [https://www.wired.com/2013/03/flame-windows-update-copycat/ Flame spy tool] * [https://www.microsoft.com/security/blog/2017/05/04/windows-defender-atp-thwarts-operation-wilysupply-software-supply-chain-cyberattack/ Operation WilySupply] * [[Malware_and_Firmware_Trojans#Watering_Hole_Attacks|Watering Hole Attacks]] * [https://www.vice.com/en/article/d3y48v/what-is-a-supply-chain-attack What is a Supply Chain Attack?] == Processor Microcode Updates == One recent example of a firmware vulnerability is the processor microcode update for modern chips to address [https://security-tracker.debian.org/tracker/CVE-2018-3620 speculative] [https://security-tracker.debian.org/tracker/CVE-2018-3646 execution flaws]. The [https://www.debian.org/security/2018/dsa-4279 Debian package] is non-freedom software, therefore only available in the Debian "nonfree" repository. {{project_name_short}} recommends to [[avoid nonfreedom software]] but in this case idealism would result in insecurity. Platform specific notice: * '''A)''' Host operating system: Processor microcode updates should always be applied on the host operating system (for processors by Intel or AMD) ARM and POWER found to be as well affected, but less than what found in Intel and AMD. . See: https://forums.whonix.org/t/whonix-vulerable-due-to-missing-processor-microcode-packages/5739 * '''B)''' VMs: It is unnecessary to apply these updates in standard {{project_name_short}} and [[Qubes|{{qubes_project_name}}]] guest VMs, as they do not have the ability to alter the microcode. === Microcode Package Check === In the following checks, the package is not installed if there is no output. To check whether the microcode package is installed. ==== Debian based ==== On the host. Run. {{CodeSelect|code= dpkg -l {{!}} grep microcode }} ==== Qubes ==== In dom0. Run. {{CodeSelect|code= dnf list {{!}} grep microcode }} The Qubes check should confirm the microcode_ctl.x86_64 package is already installed. This package is installed by default in Qubes to automatically protect users against hardware threats. === Install Microcode Package === {{Tab |type=controller |content= {{Tab |title= == Kicksecure == |image= |addToClass=info-box |active=true |content= Installed by default in Kicksecure. }} {{Tab |title= == Other Debian Based Distributions == |image= |addToClass=info-box |content= ==== Intel ==== {{Install Package|package= intel-microcode }} ==== AMD ==== {{Install Package|package= amd64-microcode }} }} }} === spectre-meltdown-checker === It is possible to check if the system is vulnerable to the [https://arstechnica.com/gadgets/2018/01/meltdown-and-spectre-every-modern-processor-has-unfixable-security-flaws/ Spectre] and [https://meltdownattack.com/ Meltdown] attacks, which use flaws in modern chip design to bypass system protections. ==== Installation ==== {{Install Package |package_name=Spectre Meltdown Checker |package=spectre-meltdown-checker }} ==== Usage ==== {{CodeSelect|code= sudo spectre-meltdown-checker --paranoid ; echo $? }} === Forum Discussion === See: https://forums.whonix.org/t/whonix-vulerable-due-to-missing-processor-microcode-packages/5739 = Firmware Update Manager (fwupd) = == Introduction == [https://github.com/fwupd/fwupd fwupd]: Is a system daemon to allow session software to update firmware. Mainly using LVFS (Linux Vendor Firmware Service) to deliver firmware updates. [https://fwupd.org/ LVFS]: Is a centralized service where hardware vendors upload their firmware updates, which are then distributed to Linux systems using fwupd. === Debian === ==== Installation ==== {{Install_Package_Host|package= fwupd-signed }} ==== Usage ==== ===== List a summary of the security status for the firmware installed ===== {{CodeSelect|code= sudo fwupdmgr security }} ===== List available firmware updates ===== {{CodeSelect|code= sudo fwupdmgr get-updates }} ===== Install firmware updates ===== {{CodeSelect|code= sudo fwupdmgr update }} === Qubes === Notes: * The Update-Qube (appvm) for dom0 (which is most likely sys-firewall/sys-net) must have fwupd package installed https://github.com/QubesOS/qubes-issues/issues/9214#issuecomment-2105430931 (it comes installed by default in full/normal template). ** To install it on Fedora minimal template:(A system restart is better to be performed after installation) {{CodeSelect|code= dnf install --setopt=install_weak_deps=False fwupd-qubes-vm }} * There is no significant difference in usage between debian commands and qubes, just add qubes- to fwupdmgr. This is --help output:
[user@dom0 ~]$ sudo qubes-fwupdmgr --help
======================================================================
Usage:				
======================================================================
	Command:			qubes-fwupdmgr [OPTION…][FLAG..]
	Example:			qubes-fwupdmgr refresh --whonix --url=

Options:			
======================================================================
	get-devices:			Get all devices that support firmware updates
	get-updates:			Get the list of updates for connected hardware
	refresh:			Refresh metadata from remote server
	update:				Update chosen device to latest firmware version
	update-heads:			Updates heads firmware to the latest version (EXPERIMENTAL, not fully supported yet)
	downgrade:			Downgrade chosen device to chosen firmware version
	clean:				Delete all cached update files

Flags:				
======================================================================
	--whonix:			Download firmware updates via Tor
	--device:			Specify device for heads update (default - x230)
	--url:				Address of the custom metadata remote server

Help:				
======================================================================
	-h --help:			Show help options

[user@dom0 ~]$ 
* At the moment of writing there is not yet Qubes detailed documentation about this tool https://github.com/QubesOS/qubes-issues/issues/8813. Example for command usage: {{CodeSelect|code= sudo qubes-fwupdmgr get-devices }} {{CodeSelect|code= sudo qubes-fwupdmgr update }} == Troubleshoot == === You are using legacy BIOS ===
user@host:~$ sudo fwupdmgr security 
WARNING: UEFI firmware can not be updated in legacy BIOS mode
See https://github.com/fwupd/fwupd/wiki/PluginFlag:legacy-bios for more information.
HSI unavailable for hypervisor
user@host:~$
=== Your UEFI doesnt support this method of update ===
[user@dom0 ~]$ sudo qubes-fwupdmgr refresh
WARNING: UEFI capsule updates not available or enabled in firmware setup
See https://github.com/fwupd/fwupd/wiki/PluginFlag:capsules-unsupported for more information.
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  2230  100  2230    0     0  50444      0 --:--:-- --:--:-- --:--:-- 50681
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 1216k  100 1216k    0     0  20.0M      0 --:--:-- --:--:-- --:--:-- 20.1M
Validating directories
WARNING: UEFI capsule updates not available or enabled in firmware setup
See https://github.com/fwupd/fwupd/wiki/PluginFlag:capsules-unsupported for more information.
Successfully refreshed metadata manually
[user@dom0 ~]$
= See Also = * [[Malware_and_Firmware_Trojans#Firmware_Trojans|Firmware Trojans]] * [[Open-source Hardware]] = References = {{reflist|close=1}} {{Footer}} [[Category:Documentation]]