Browse Source

working on IMA

master
Michael Preisach 5 years ago
parent
commit
ee396a5d62
  1. 52
      resources/integrity-log.fig
  2. BIN
      resources/integrity-log.pdf
  3. 113
      thesis/02_concept.tex
  4. BIN
      thesis/MAIN.pdf

52
resources/integrity-log.fig

@ -0,0 +1,52 @@
#FIG 3.2 Produced by xfig version 3.2.8
Landscape
Center
Inches
Letter
100.00
Single
-2
1200 2
6 2175 6075 2775 7125
2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 6
2775 6075 2775 6900 2175 6900 2175 6225 2325 6075 2775 6075
2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 3
2175 6225 2325 6225 2325 6075
2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2
2325 6525 2625 6525
2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2
2325 6450 2625 6450
2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 2
2325 6375 2625 6375
4 1 0 50 -1 4 10 0.0000 0 120 225 2475 7125 File\001
-6
2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 1 0 2
2 0 1.00 120.00 180.00
2775 6525 4275 6525
2 2 1 1 0 7 50 -1 -1 4.000 0 0 -1 0 0 5
4275 6375 5775 6375 5775 6675 4275 6675 4275 6375
2 2 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 5
3975 6300 7350 6300 7350 6750 3975 6750 3975 6300
2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 1 0 2
2 0 1.00 120.00 180.00
7350 6525 8325 6525
2 2 1 1 0 7 50 -1 -1 4.000 0 0 -1 0 0 5
8325 6375 9975 6375 9975 6675 8325 6675 8325 6375
2 2 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 5
3900 6150 10050 6150 10050 6900 3900 6900 3900 6150
2 1 0 1 0 7 50 -1 -1 0.000 0 0 -1 1 0 2
2 0 1.00 120.00 180.00
9975 6525 11175 6525
2 2 0 1 0 7 50 -1 -1 0.000 0 0 -1 0 0 5
11175 6300 12225 6300 12225 6750 11175 6750 11175 6300
4 1 0 50 -1 4 14 0.0000 0 180 1455 5025 6600 Filedata hash\001
4 1 0 50 -1 4 10 0.0000 0 120 615 3375 6450 SHA1 or\001
4 1 0 50 -1 4 10 0.0000 0 120 600 3375 6750 SHA256\001
4 1 0 50 -1 4 14 0.0000 0 135 150 6000 6600 +\001
4 1 0 50 -1 4 14 0.0000 0 180 1020 6675 6600 Metadata\001
4 1 0 50 -1 4 10 0.0000 0 120 420 7800 6450 SHA1\001
4 1 0 50 -1 4 14 0.0000 0 240 1620 9150 6600 Template hash\001
4 1 0 50 -1 4 10 0.0000 0 120 480 10500 6450 extend\001
4 1 0 50 -1 4 14 0.0000 0 180 870 11700 6600 PCR 10\001
4 1 0 50 -1 4 10 0.0000 0 120 315 11700 7125 TPM\001
4 0 0 50 -1 4 10 0.0000 0 150 840 4050 7125 Integrity log\001

BIN
resources/integrity-log.pdf

Binary file not shown.

113
thesis/02_concept.tex

@ -1,5 +1,6 @@
\chapter{Background}%
\label{cha:background}
\ToDo{TPM beschreiben und chain of trust herleiten, }
In this Chapter we describe three main concepts which contribute the fundamentals for this thesis.
\emph{Trusted Boot} and the \emph{Integrity Measurement Architecture} (IMA) are two approaches to generate trust on a system from the hardware level up to the Operating System.
@ -13,6 +14,9 @@ During these early steps, the hardware components of the platform are initialize
This is controlled by either the BIOS (for legacy platforms) or the UEFI firmware.
In this common boot procedure exists no source of trust and hence no check for integrity or intended execution.
\subsection{Platform Configuration Register}%
\label{sub:platform_configuration_register}
The \emph{Trusted Computing Group} (TCG) introduced in 2004 their first standard for a new {Trusted Computing Module} (TPM).
As part in this standard, TCG defined a procedure, where every step in the early boot process is measured and saved in a \emph{Platform Configuration Register} (PCR).
\emph{Measuring} means in this context a simple cryptographic extension function which works described in formula \ref{form:PCR-measurement}
@ -20,7 +24,7 @@ As part in this standard, TCG defined a procedure, where every step in the early
\text{new\_PCR} = hash(\text{old\_PCR}\,||\,\text{data})
\label{form:PCR-measurement}
\end{equation}
The function of || represents a concatenation of two binary strings and the hash function is either SHA1 or SHA256 hash.
The function of $||$ represents a concatenation of two binary strings and the hash function is either SHA1 or SHA256 hash.
In recent TPM-platforms, both hashing algorithms can be performed for each measurement.
Consequently, both hash results are available for further computations.
@ -32,16 +36,18 @@ The procedure of measurements is available since the first public standard of TP
For the recent TPM2.0 standard, the process was only extended with the support for the newer SHA256 standard.
A PCR is now useful for a sequence of measurements with similar purpose.
When, for example, a new bootloader is installed on the main disk, we want to detect this with a separate PCR value.
When, for example, a new bootloader is installed on the main disk, the user wants to detect this with a separate PCR value.
The measured firmware BLOBs may be still the same.
So the TPM standard defines 24 PCRs for the PC platform.
So the TPM standard defines 24 PCRs for the PC platform, each with a special role and slightly different feature set.
The purpose of every PCR is well defined in Section 2.3.3 of the \emph{TCG PC Client Platform Firmware Profile}\cite{tcg-pc19} and shown in table \ref{tab:PCR}.
Especially those PCRs involved in the boot process must only be reset according to a platform reset.
During booting and running the system these registers can only be \emph{extended} with new measurements.
\begin{table}[ht]
\centering
\begin{sffamily}
\caption{Usage of PCRs during an UEFI trusted boot process} \label{tab:PCR}
%\rowcolors{2}{lightgray}{white}
\begin{small}
\begin{tabular}{rl}
\toprule
\multicolumn{1}{c}{\textit{PCR}} & \multicolumn{1}{p{5.8cm}}{\textit{Explanation}}\\
@ -56,9 +62,10 @@ The purpose of every PCR is well defined in Section 2.3.3 of the \emph{TCG PC Cl
7 & Secure Boot Policy \\
8-15 & Defined for use by the static OS \\
16 & Debug \\
17-23 & Application\\
17--23 & Application\\
\bottomrule
\end{tabular}
\end{small}
\end{sffamily}
\end{table}
@ -66,6 +73,9 @@ When TCG introduced Trusted Boot in 2004, UEFI was not yet available for the ord
Consequently, TCG standardized the roles of every PCR only for the BIOS platform.
Later, when UEFI became popular, the PCR descriptions got adopted for the new platform.
\subsection{Static Root of Trust for Measurement}%
\label{sub:static_root_of_trust_for_measurement}
The standard furthermore defines which part of the platform or firmware has to perform the measurement.
Since the TPM itself is a purely passive element, executing instructions provided by the CPU, the BIOS\,/\,UEFI firmware has to initiate the measurement beginning by the binary representation of the firmware itself.
This procedure is described in the TCG standard and the platform user has to \emph{trust} the manufacturer, that it is performed as expected.
@ -78,7 +88,10 @@ It furthermore must measure all platform initialization code like embedded drive
If these measurements cannot be performed, the chain of trust is broken and consequently the platform cannot be trusted.
One may see a zeroed PCR[0] or a value representing a hashed string of zeros as a strong indicator of a broken chain of trust.
The BIOS or UEFI performs then the next measurements until PCRs 1-7 are filled.
\subsection{Platform handover to OS}%
\label{sub:platform_handover_to_os}
The BIOS or UEFI performs the next measurements according to table \ref{tab:PCR} until PCRs 1--7 are written accordingly.
Before any further measurements are done, the control of the platform is handed over to the first part of the OS, which is usually the bootloader either in the Master Boot Record or provided as EFI BLOB in the EFI boot partition.
It is noteworthy that the bootloader itself and its configuration payload is measured in PCR 4 and 5 before the handover is done.
This guarantees that the chain of trust keeps intact when the bootloader takes control.
@ -87,7 +100,93 @@ The Bootloader has then to continue the chain of trust by measuring the Kernel a
The support and the way of how the measurements are done is not standardized.
GRUB, for example, measures all executed grub commands, the kernel command line and the module command line into PCR 8, whereas any file read by GRUB will be measured into PCR 9\cite{grub19}.
\ToDo{Überleitung zu IMA und IMA beschreiben. Danach DAA theoretisch beschreiben, kopie aus dem Seminarpaper. Erwähnung, dass die PCR-Register nur bei neustart zurückgesetzt werden können}
The whole process from initialization over measuring all software parts until the OS is started, is called \emph{Trusted Boot}.
The user can check the resulting values in the written PCR registers against known values.
These values can either be precomputed or just the result of a previous boot.
If all values match the expectations, the chain of trust exists between the SRTM and the Kernel.
\section{Integrity Measurement Architecture}%
\label{sec:integrity_measurement_architecture}
The \emph{Integrity Measurement Architecture} (IMA) is a Linux kernel extension to extend the chain of trust to the running application.
IMA is officialy supported by RedHat and Ubuntu and there exists documentation to enable IMA on Gentoo as well.
Other OS providers may not use a kernel with the required compile flags and\,/\,or lack of supporting software outside the kernel.
The IMA project page describes the required Kernel features for full support in their documentation\footnote{\url{https://sourceforge.net/p/linux-ima/wiki/Home/\#configuring-the-kernel}, last visited on March 30, 2021}.
The process of keeping track of system integrity becomes compared to the boot process far more complex on the OS level.
First, there are far more file system resources involved in running a system.
Even a minimal setup of a common Linux Distribution like Ubuntu or RedHat will load several hundred files until the kernel has completed its boot process.
Second, all these files will be loaded in parallel to make effective use of the available CPU resources.
It is clear that parallelism introduces non-determinism to the order of executing processes and of course the corresponding system log files.
Hence when using PCRs, this non-determinism results in different values, as stated in \autoref{sub:platform_configuration_register}.
The system, however, might still be in a trustworthy state.
Finally, the user might know some additional data to the current value in the PCR register.
Since the value itself does not tell anything to the user, a measurement log must be written for every operation on this PCR index.
IMA comes with three property variables which set the behaviour of the architecture:
\begin{itemize}
\item \texttt{ima\_template} sets the format of the produced log.
\item \texttt{ima\_appraise} changes the behaviour when a file is under investigation.
\item \texttt{ima\_policy} finally defines which resources should be analzyed.
\end{itemize}
These settings will be discussed in more detail in the following.
\subsubsection{Integrity Log}%
\label{ssub:integrity_log}
IMA uses the emph{integrity log} do keep track of any changes of local filesystem resources.
This is a virtual file that holds every measurement that leads to a change on the IMA PCR.
When IMA is active on the system, the integrity log can be found in \texttt{/sys/kernel/security/ima/ascii\_runtime\_measurements}.
Before a file is accessed by the kernel, IMA creates an integrity log entry as it is shown in \autoref{fig:integrity-log-entry}.
\begin{figure}
\centering
\includegraphics[width=0.9\textwidth]{../resources/integrity-log.pdf}
\caption[Integrity log entry]{Overview of generating an entry in the integrity log}
\label{fig:integrity-log-entry}
\end{figure}
Depending on the settings for IMA, a SHA1 or SHA256 hash is created for the file content.
The resulting \emph{filedata hash} will be concatenated with the corresponding metadata.
This concatenation will again be hashed into the so called \emph{template hash}.
Finally the template hash is the single value of the whole computation that will be extended into the PCR.
The integrity log holds at the end the filedata hash, the metadata and the template hash as well as the PCR index and the logfile format.
IMA knows three different file formats, where two of them can be used in recent applications.
The only difference between these formats lie in the used and logged metadata:
\begin{itemize}
\item \texttt{ima-ng} uses besides the filedata hash also the filedata hash length, the pathname length and the pathname to create the template hash.
\item \texttt{ima-sig} uses the same sources as ima-ng.
When available, it writes also signatures of files into the log and includes them for calculating the template hash.
\end{itemize}
The older template \texttt{ima} uses only SHA1 and is fully replaceyble with the \texttt{ima-ng} template.
Therefore, it should not be used for newer applications.
\ToDo{boot aggregate beschreiben}
\subsubsection{IMA Appraisal}%
\label{ssub:ima_appraisal}
IMA comes with four different runtime modes.
These modes set the behaviour especially when there exists no additional information about the file in question.
\begin{itemize}
\item \texttt{off}: IMA is completely shut down. The integrity log just holds the entry of the boot aggregate.
\item \texttt{log}: Integrity measurements are done for all relevant resources and the integrity log is filled accordingly.
\item \texttt{fix}: In addition to writing the log file, the filedata hashes are also written as extended file attribute into the file system.
This is required for the last mode to work.
\item \texttt{enforce}: Only files that have a valid hash value are allowed to be read.
Accessing a resource without a hash or an invalid hash will be blocked by the kernel.
\end{itemize}
\subsubsection{IMA Policies}%
\label{ssub:ima_policies}
\subsubsection{IMA extensions}%
\label{ssub:ima_extensions}
\ToDo{file signature, ima-appraise, enforcing ima}
\ToDo{Überleitung zu IMA und IMA beschreiben. Danach DAA theoretisch beschreiben, kopie aus dem Seminarpaper}
\chapter{Concept}
\label{cha:concept}

BIN
thesis/MAIN.pdf

Binary file not shown.
Loading…
Cancel
Save