Added [in-progress] Developer Guides
[AGL/documentation.git] / docs / 2_Architecture_Guides / 2.2_Security_Blueprint / 4_Kernel / 1.2.4.3_Consoles.md
1 ---
2 title: Consoles
3 ---
4
5 # Serial
6
7 ## Disable serial console
8
9 The serial console should be disabled to prevent an attacker from accessing this
10 powerful interface.
11
12 <!-- section-config -->
13
14 Domain                   | `Config` name                | `Value`
15 ------------------------ | ---------------------------- | -------
16 Kernel-Consoles-Serial-1 | `CONFIG_SERIAL_8250`         | `n`
17 Kernel-Consoles-Serial-2 | `CONFIG_SERIAL_8250_CONSOLE` | `n`
18 Kernel-Consoles-Serial-3 | `CONFIG_SERIAL_CORE`         | `n`
19 Kernel-Consoles-Serial-4 | `CONFIG_SERIAL_CORE_CONSOLE` | `n`
20
21 <!-- end-section-config -->
22
23 --------------------------------------------------------------------------------
24
25 ## Bake-in the kernel command-line
26
27 The kernel command-line is used to control many aspects of the booting kernel,
28 and is prone to tampering as they are passed in RAM with little to no reverse
29 validation on these parameters. To prevent this type of attack, the kernel shall
30 be configured to ignore commands line arguments, and use pre-configured (compile
31 time) options instead.
32
33 Set the kernel command line in the `CONFIG_CMDLINE KConfig` item and then pass
34 no arguments from the bootloader.
35
36 <!-- section-config -->
37
38 Domain                        | `Config` name             | `Value`
39 ----------------------------- | ------------------------- | -----------------------------------
40 Kernel-Consoles-CommandLine-1 | `CONFIG_CMDLINE_BOOL`     | `y`
41 Kernel-Consoles-CommandLine-2 | `CONFIG_CMDLINE`          | `"insert kernel command line here"`
42 Kernel-Consoles-CommandLine-3 | `CONFIG_CMDLINE_OVERRIDE` | `y`
43
44 <!-- end-section-config -->
45
46 It is recommended that any per-device settings (e.g: MAC addresses, serial
47 numbers, etc.) be stored and accessed from read-only memory (or files), and that
48 any such parameters be verified (signature checking) prior to their use.
49
50 --------------------------------------------------------------------------------
51
52 ## Disable KGDB
53
54 The Linux kernel supports KGDB over USB and console ports. These mechanisms are
55 controlled by the `kgdbdbgp` and `kgdboc` kernel command-line parameters. It is
56 important to ensure that no shipping product contains a kernel with KGDB
57 compiled-in.
58
59 <!-- section-config -->
60
61 Domain                 | `Config` name | `Value`
62 ---------------------- | ------------- | -------
63 Kernel-Consoles-KDBG-1 | `CONFIG_KGDB` | `n`
64
65 <!-- end-section-config -->
66
67 --------------------------------------------------------------------------------
68
69 ## Disable magic sysrq support
70
71 On a few architectures, you can access a powerful debugger interface from the
72 keyboard. The same powerful interface can be present on the serial console
73 (responding to serial break) of Linux on other architectures. Disable to avoid
74 potentially exposing this powerful backdoor.
75
76 <!-- section-config -->
77
78 Domain                  | `Config` name        | `Value`
79 ----------------------- | -------------------- | -------
80 Kernel-Consoles-SysRQ-1 | `CONFIG_MAGIC_SYSRQ` | `n`
81
82 <!-- end-section-config -->
83
84 --------------------------------------------------------------------------------
85
86 ## Disable support for binary formats other than ELF
87
88 This will make possible to plug wrapper-driven binary formats into the kernel.
89 It enables support for binary formats other than ELF. Providing the ability to
90 use alternate interpreters would assist an attacker in discovering attack
91 vectors.
92
93 <!-- section-config -->
94
95 Domain                         | `Config` name        | `Value`
96 ------------------------------ | -------------------- | -------
97 Kernel-Consoles-BinaryFormat-1 | `CONFIG_BINFMT_MISC` | `n`
98
99 <!-- end-section-config -->