author | Christian Urban <christian dot urban at kcl dot ac dot uk> |
Sat, 14 Dec 2013 13:07:41 +1100 | |
changeset 20 | 928c015eb03e |
parent 17 | a87e2181d6b6 |
child 21 | 17ea9ad46257 |
permissions | -rw-r--r-- |
1 | 1 |
(*<*) |
2 |
theory Paper |
|
3 |
imports rc_theory final_theorems rc_theory os_rc |
|
4 |
begin |
|
5 |
||
16
a5f4dc4bbc5d
more related work
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
15
diff
changeset
|
6 |
(* Still to be done |
a5f4dc4bbc5d
more related work
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
15
diff
changeset
|
7 |
|
a5f4dc4bbc5d
more related work
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
15
diff
changeset
|
8 |
- ... which OSes exactly use RBAC? SELinux uses DTE which |
a5f4dc4bbc5d
more related work
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
15
diff
changeset
|
9 |
seems simpler than the RC-Model, but the authors never cite the |
a5f4dc4bbc5d
more related work
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
15
diff
changeset
|
10 |
DTE papers when mentioning SELinux. |
a5f4dc4bbc5d
more related work
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
15
diff
changeset
|
11 |
|
a5f4dc4bbc5d
more related work
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
15
diff
changeset
|
12 |
- Fred Spiessens' work on SCOLLAR |
a5f4dc4bbc5d
more related work
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
15
diff
changeset
|
13 |
|
a5f4dc4bbc5d
more related work
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
15
diff
changeset
|
14 |
- Related work: "Gran: Model Checking Grsecurity RBAC Policies" at CSF 2012 explores |
a5f4dc4bbc5d
more related work
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
15
diff
changeset
|
15 |
similar issues with policies (but does not provide formal proofs); in particular it |
a5f4dc4bbc5d
more related work
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
15
diff
changeset
|
16 |
defines a property similar to tainting, develops an abstraction for dynamic |
a5f4dc4bbc5d
more related work
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
15
diff
changeset
|
17 |
taintability, and report issues with role inheritance rules. |
a5f4dc4bbc5d
more related work
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
15
diff
changeset
|
18 |
|
a5f4dc4bbc5d
more related work
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
15
diff
changeset
|
19 |
[1] Mikhail I. Gofman, Ruiqi Luo, Ayla C. Solomon, Yingbin Zhang, Ping Yang, |
a5f4dc4bbc5d
more related work
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
15
diff
changeset
|
20 |
Scott D. Stoller: RBAC-PAT: A Policy Analysis Tool for Role Based Access |
a5f4dc4bbc5d
more related work
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
15
diff
changeset
|
21 |
Control. TACAS 2009:46--49. |
a5f4dc4bbc5d
more related work
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
15
diff
changeset
|
22 |
|
a5f4dc4bbc5d
more related work
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
15
diff
changeset
|
23 |
[2] Scott D. Stoller, Ping Yang, C. R. Ramakrishnan, Mikhail I. Gofman: |
a5f4dc4bbc5d
more related work
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
15
diff
changeset
|
24 |
Efficient policy analysis for administrative role based access control. ACM |
a5f4dc4bbc5d
more related work
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
15
diff
changeset
|
25 |
Conference on Computer and Communications Security 2007:445--455. |
a5f4dc4bbc5d
more related work
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
15
diff
changeset
|
26 |
|
a5f4dc4bbc5d
more related work
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
15
diff
changeset
|
27 |
[3] Arosha K. Bandara, Emil Lupu, Alessandra Russo: Using Event Calculus to |
a5f4dc4bbc5d
more related work
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
15
diff
changeset
|
28 |
Formalise Policy Specification and Analysis. POLICY 2003. |
a5f4dc4bbc5d
more related work
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
15
diff
changeset
|
29 |
|
a5f4dc4bbc5d
more related work
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
15
diff
changeset
|
30 |
Elisa Bertino, Barbara Catania, Elena Ferrari, and Paolo Perlasca. A logical framework for reasoning about access control models. ACM Trans. Inf. Syst. Secur, 6:71–127, 2003. |
a5f4dc4bbc5d
more related work
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
15
diff
changeset
|
31 |
|
a5f4dc4bbc5d
more related work
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
15
diff
changeset
|
32 |
J. Bryans. Reasoning about XACML policies using CSP. In Proceedings of the 2005 workshop on Secure web services, page 35. ACM, 2005. |
a5f4dc4bbc5d
more related work
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
15
diff
changeset
|
33 |
|
a5f4dc4bbc5d
more related work
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
15
diff
changeset
|
34 |
K. Fisler, S. Krishnamurthi, L.A. Meyerovich, and M.C. Tschantz. Verification and changeimpact analysis of access control policies. In Proceedings of the 27th international conference on Software engineering, pages 196–205. ACM New York, NY, USA, 2005. |
a5f4dc4bbc5d
more related work
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
15
diff
changeset
|
35 |
|
a5f4dc4bbc5d
more related work
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
15
diff
changeset
|
36 |
V. Kolovski, J. Hendler, and B. Parsia. Analyzing web access control policies. In Proceedings of the 16th international conference on World Wide Web, page 686. ACM, 2007. |
a5f4dc4bbc5d
more related work
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
15
diff
changeset
|
37 |
|
a5f4dc4bbc5d
more related work
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
15
diff
changeset
|
38 |
Joseph Y. Halpern and Vicky Weissman. Using first-order logic to reason about policies. ACM Trans. Inf. Syst. Secur., 11(4), 2008. |
a5f4dc4bbc5d
more related work
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
15
diff
changeset
|
39 |
|
a5f4dc4bbc5d
more related work
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
15
diff
changeset
|
40 |
Prathima Rao, Dan Lin, Elisa Bertino, Ninghui Li, Jorge Lobo: EXAM: An Environment for Access Control Policy Analysis and Management. POLICY 2008: 238-240 |
a5f4dc4bbc5d
more related work
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
15
diff
changeset
|
41 |
|
a5f4dc4bbc5d
more related work
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
15
diff
changeset
|
42 |
Alessandro Armando, Enrico Giunchiglia, and Serena Elisa Ponta. Formal specification and automatic analysis of business processes under authorization constraints: an action-based approach. In Proceedings of the 6th International Conference on Trust, Privacy and Security in Digital Business (TrustBus’09), 2009. |
a5f4dc4bbc5d
more related work
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
15
diff
changeset
|
43 |
|
a5f4dc4bbc5d
more related work
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
15
diff
changeset
|
44 |
G. Ahn, Hongxin Hu, Joohyung Lee, and Yunsong Meng. Reasoning about XACML policy descriptions in answer set programming (preliminary report). In Proceedings of International Workshop on Nonmonotonic Reasoning (NMR), 2010. |
a5f4dc4bbc5d
more related work
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
15
diff
changeset
|
45 |
|
a5f4dc4bbc5d
more related work
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
15
diff
changeset
|
46 |
G. Ahn, Hongxin Hu, Joohyung Lee, and Yunsong Meng. Representing and reasoning about web access control policies. In Proc. 34th Annual IEEE Computer Software and Applications Conference (COMPSAC 2010), pages 137–146, 2010. |
a5f4dc4bbc5d
more related work
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
15
diff
changeset
|
47 |
|
a5f4dc4bbc5d
more related work
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
15
diff
changeset
|
48 |
*) |
a5f4dc4bbc5d
more related work
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
15
diff
changeset
|
49 |
|
a5f4dc4bbc5d
more related work
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
15
diff
changeset
|
50 |
|
1 | 51 |
(* THEOREMS *) |
52 |
||
53 |
||
54 |
notation (Rule output) |
|
55 |
"==>" ("\<^raw:\mbox{}\inferrule{\mbox{>_\<^raw:}}>\<^raw:{\mbox{>_\<^raw:}}>") |
|
56 |
||
57 |
syntax (Rule output) |
|
58 |
"_bigimpl" :: "asms \<Rightarrow> prop \<Rightarrow> prop" |
|
59 |
("\<^raw:\mbox{}\inferrule{>_\<^raw:}>\<^raw:{\mbox{>_\<^raw:}}>") |
|
60 |
||
61 |
"_asms" :: "prop \<Rightarrow> asms \<Rightarrow> asms" |
|
62 |
("\<^raw:\mbox{>_\<^raw:}\\>/ _") |
|
63 |
||
64 |
"_asm" :: "prop \<Rightarrow> asms" ("\<^raw:\mbox{>_\<^raw:}>") |
|
65 |
||
66 |
notation (Axiom output) |
|
67 |
"Trueprop" ("\<^raw:\mbox{}\inferrule{\mbox{}}{\mbox{>_\<^raw:}}>") |
|
68 |
||
69 |
notation (IfThen output) |
|
70 |
"==>" ("\<^raw:{\normalsize{}>If\<^raw:\,}> _/ \<^raw:{\normalsize \,>then\<^raw:\,}>/ _.") |
|
71 |
syntax (IfThen output) |
|
72 |
"_bigimpl" :: "asms \<Rightarrow> prop \<Rightarrow> prop" |
|
73 |
("\<^raw:{\normalsize{}>If\<^raw:\,}> _ /\<^raw:{\normalsize \,>then\<^raw:\,}>/ _.") |
|
74 |
"_asms" :: "prop \<Rightarrow> asms \<Rightarrow> asms" ("\<^raw:\mbox{>_\<^raw:}> /\<^raw:{\normalsize \,>and\<^raw:\,}>/ _") |
|
75 |
"_asm" :: "prop \<Rightarrow> asms" ("\<^raw:\mbox{>_\<^raw:}>") |
|
76 |
||
77 |
notation (IfThenNoBox output) |
|
78 |
"==>" ("\<^raw:{\normalsize{}>If\<^raw:\,}> _/ \<^raw:{\normalsize \,>then\<^raw:\,}>/ _.") |
|
79 |
syntax (IfThenNoBox output) |
|
80 |
"_bigimpl" :: "asms \<Rightarrow> prop \<Rightarrow> prop" |
|
81 |
("\<^raw:{\normalsize{}>If\<^raw:\,}> _ /\<^raw:{\normalsize \,>then\<^raw:\,}>/ _.") |
|
82 |
"_asms" :: "prop \<Rightarrow> asms \<Rightarrow> asms" ("_ /\<^raw:{\normalsize \,>and\<^raw:\,}>/ _") |
|
83 |
"_asm" :: "prop \<Rightarrow> asms" ("_") |
|
84 |
||
85 |
(* insert *) |
|
86 |
notation (latex) |
|
87 |
"Set.empty" ("\<emptyset>") |
|
88 |
||
89 |
translations |
|
90 |
"{x} \<union> A" <= "CONST insert x A" |
|
91 |
"{x,y}" <= "{x} \<union> {y}" |
|
92 |
"{x,y} \<union> A" <= "{x} \<union> ({y} \<union> A)" |
|
93 |
"{x}" <= "{x} \<union> \<emptyset>" |
|
94 |
||
95 |
lemma impeq: |
|
96 |
"A = B \<Longrightarrow> (B \<Longrightarrow> A)" |
|
97 |
by auto |
|
98 |
||
99 |
||
100 |
||
101 |
||
102 |
consts DUMMY::'a |
|
103 |
||
104 |
abbreviation |
|
105 |
"is_parent f pf \<equiv> (parent f = Some pf)" |
|
106 |
||
107 |
context tainting_s_sound begin |
|
108 |
||
109 |
notation (latex output) |
|
110 |
source_dir ("anchor") and |
|
111 |
SProc ("P_\<^bsup>_\<^esup>") and |
|
112 |
SFile ("F_\<^bsup>_\<^esup>") and |
|
113 |
SIPC ("I'(_')\<^bsup>_\<^esup>") and |
|
114 |
READ ("Read") and |
|
115 |
WRITE ("Write") and |
|
116 |
EXECUTE ("Execute") and |
|
117 |
CHANGE_OWNER ("ChangeOwner") and |
|
118 |
CREATE ("Create") and |
|
119 |
SEND ("Send") and |
|
120 |
RECEIVE ("Receive") and |
|
121 |
DELETE ("Delete") and |
|
122 |
compatible ("permissions") and |
|
123 |
comproles ("compatible") and |
|
124 |
DUMMY ("\<^raw:\mbox{$\_$}>") and |
|
125 |
Cons ("_::_" [78,77] 79) and |
|
126 |
Proc ("") and |
|
127 |
File ("") and |
|
128 |
File_type ("") and |
|
129 |
Proc_type ("") and |
|
130 |
IPC ("") and |
|
131 |
init_processes ("init'_procs") and |
|
132 |
os_grant ("admissible") and |
|
133 |
rc_grant ("granted") and |
|
134 |
exists ("alive") and |
|
135 |
default_fd_create_type ("default'_type") and |
|
136 |
InheritParent_file_type ("InheritPatentType") and |
|
137 |
NormalFile_type ("NormalFileType") and |
|
138 |
deleted ("deleted _ _" [50, 100] 100) and |
|
13
dd1499f296ea
updated to new isabelle
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
11
diff
changeset
|
139 |
taintable_s ("taintable\<^sup>s") and |
dd1499f296ea
updated to new isabelle
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
11
diff
changeset
|
140 |
tainted_s ("tainted\<^sup>s") and |
dd1499f296ea
updated to new isabelle
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
11
diff
changeset
|
141 |
all_sobjs ("reachable\<^sup>s") and |
1 | 142 |
init_obj2sobj ("\<lbrakk>_\<rbrakk>") and |
143 |
erole_functor ("erole'_aux") --"I have a erole_functor and etype_aux to handle |
|
144 |
efficient, but their name not same, so ..., but don't work" |
|
145 |
||
146 |
||
147 |
abbreviation |
|
148 |
"is_process_type s p t \<equiv> (type_of_process s p = Some t)" |
|
149 |
||
150 |
abbreviation |
|
151 |
"is_current_role s p r \<equiv> (currentrole s p = Some r)" |
|
152 |
||
153 |
abbreviation |
|
154 |
"is_file_type s f t \<equiv> (etype_of_file s f = Some t)" |
|
155 |
||
156 |
lemma osgrant2: |
|
157 |
"\<lbrakk>p \<in> current_procs \<tau>; f \<notin> current_files \<tau>; parent f = Some pf; pf \<in> current_files \<tau>\<rbrakk> \<Longrightarrow> |
|
158 |
os_grant \<tau> (CreateFile p f)" |
|
159 |
by simp |
|
160 |
||
161 |
lemma osgrant6: |
|
162 |
"\<lbrakk>p \<in> current_procs \<tau>; u \<in> init_users\<rbrakk> \<Longrightarrow> os_grant \<tau> (ChangeOwner p u)" |
|
163 |
by simp |
|
164 |
||
8 | 165 |
lemma osgrant10: (* modified by chunhan *) |
166 |
"\<lbrakk>p \<in> current_procs \<tau>; p' \<notin> current_procs \<tau>\<rbrakk> \<Longrightarrow> os_grant \<tau> (Clone p p')" |
|
1 | 167 |
by simp |
168 |
||
169 |
||
170 |
lemma rcgrant1: |
|
171 |
"\<lbrakk>is_parent f pf; is_file_type s pf t; is_current_role s p r; |
|
172 |
default_fd_create_type r = InheritParent_file_type; |
|
173 |
(r, File_type t, WRITE) \<in> compatible\<rbrakk> |
|
174 |
\<Longrightarrow> rc_grant s (CreateFile p f)" |
|
175 |
by simp |
|
176 |
||
177 |
lemma rcgrant1': |
|
178 |
"\<lbrakk>is_parent f pf; is_file_type s pf t; is_current_role s p r; |
|
179 |
default_fd_create_type r = NormalFile_type t'; |
|
180 |
(r, File_type t, WRITE) \<in> compatible; |
|
181 |
(r, File_type t', CREATE) \<in> compatible\<rbrakk> |
|
182 |
\<Longrightarrow> rc_grant s (CreateFile p f)" |
|
183 |
by simp |
|
184 |
||
185 |
lemma rcgrant4: |
|
186 |
"\<lbrakk>is_current_role s p r; is_file_type s f t; (r, File_type t, EXECUTE) \<in> compatible\<rbrakk> |
|
187 |
\<Longrightarrow> rc_grant s (Execute p f)" |
|
188 |
by simp |
|
189 |
||
190 |
lemma rcgrant7: |
|
191 |
"\<lbrakk>is_current_role s p r; r' \<in> comproles r\<rbrakk> \<Longrightarrow> rc_grant s (ChangeRole p r')" |
|
192 |
by simp |
|
193 |
||
194 |
lemma rcgrant_CHO: |
|
195 |
"\<lbrakk>is_current_role s p r; |
|
196 |
type_of_process s p = Some t; |
|
197 |
(r, Proc_type t, CHANGE_OWNER) \<in> compatible\<rbrakk> \<Longrightarrow> rc_grant s (ChangeOwner p u)" |
|
198 |
by(simp) |
|
199 |
||
200 |
lemma pf_in_current_paper: |
|
201 |
"\<lbrakk>is_parent f pf; f \<in> current_files s; valid s\<rbrakk> \<Longrightarrow> pf \<in> current_files s" |
|
202 |
by (simp add:parent_file_in_current) |
|
203 |
||
204 |
lemma dels: |
|
205 |
shows "deleted (Proc p') ((Kill p p')#s)" |
|
206 |
and "deleted (File f) ((DeleteFile p f)#s)" |
|
207 |
and "deleted (IPC i) ((DeleteIPC p i)#s)" |
|
208 |
and "deleted obj s \<Longrightarrow> deleted obj (e#s)" |
|
209 |
apply simp_all |
|
210 |
apply(case_tac e) |
|
211 |
apply(simp_all) |
|
212 |
done |
|
213 |
||
214 |
lemma tainted_10: |
|
215 |
"\<lbrakk>(File f) \<in> tainted s; valid (e # s); f \<in> current_files (e # s)\<rbrakk> |
|
216 |
\<Longrightarrow> (File f) \<in> tainted (e # s)" |
|
217 |
apply(rule tainted.intros) |
|
218 |
apply(assumption) |
|
219 |
apply(assumption) |
|
220 |
apply(simp only: exists.simps) |
|
221 |
done |
|
222 |
||
223 |
definition |
|
224 |
Init ("init _") |
|
225 |
where |
|
226 |
"Init obj \<equiv> exists [] obj" |
|
227 |
||
228 |
lemma Init_rhs: |
|
229 |
shows "Init (File f) = (f \<in> init_files)" |
|
230 |
and "Init (Proc p) = (p \<in> init_processes)" |
|
231 |
and "Init (IPC i) = (i \<in> init_ipcs)" |
|
232 |
unfolding Init_def |
|
233 |
by(simp_all) |
|
234 |
||
235 |
notation (latex output) |
|
236 |
Init ("_ \<in> init") |
|
237 |
||
238 |
lemma af_init': |
|
239 |
"\<lbrakk>f \<in> init_files; is_file_type [] f t\<rbrakk> |
|
240 |
\<Longrightarrow> SFile (t, f) (Some f) \<in> all_sobjs" |
|
241 |
apply(rule af_init) |
|
242 |
apply(simp) |
|
243 |
by (simp add:etype_of_file_def) |
|
244 |
||
245 |
declare [[show_question_marks = false]] |
|
246 |
||
247 |
||
248 |
(*>*) |
|
249 |
||
250 |
section {* Introduction *} |
|
251 |
||
252 |
text {* |
|
253 |
Role-based access control models are used in many operating systems |
|
254 |
for enforcing security properties. The |
|
255 |
\emph{Role-Compatibility Model} (RC-Model), introduced by Ott |
|
256 |
\cite{ottrc,ottthesis}, is one such role-based access control |
|
257 |
model. It defines \emph{roles}, which are associated with processes, |
|
258 |
and defines \emph{types}, which are associated with system |
|
259 |
resources, such as files and directories. The RC-Model also includes |
|
260 |
types for interprocess communication, that is message queues, |
|
261 |
sockets and shared memory. A policy in the RC-Model gives every user |
|
262 |
a default role, and also specifies how roles can be |
|
263 |
changed. Moreover, it specifies which types of resources a role has |
|
264 |
permission to access, and also the \emph{mode} with which the role |
|
265 |
can access the resources, for example read, write, send, receive and |
|
266 |
so on. |
|
267 |
||
268 |
The RC-Model is built on top of a collection of system calls |
|
269 |
provided by the operating system, for instance system calls for |
|
270 |
reading and writing files, cloning and killing of processes, and |
|
271 |
sending and receiving messages. The purpose of the RC-Model is to |
|
272 |
restrict access to these system calls and thereby enforce security |
|
273 |
properties of the system. A problem with the RC-Model and role-based |
|
274 |
access control models in general is that a system administrator has |
|
275 |
to specify an appropriate access control policy. The difficulty with |
|
276 |
this is that \emph{``what you specify is what you get but not |
|
277 |
necessarily what you want''} \cite[Page 242]{Jha08}. To overcome |
|
278 |
this difficulty, a system administrator needs some kind of sanity |
|
279 |
check for whether an access control policy is really securing |
|
280 |
resources. Existing works, for example \cite{sanity01,sanity02}, |
|
281 |
provide sanity checks for policies by specifying properties and |
|
282 |
using model checking techniques to ensure a policy at hand satisfies |
|
283 |
these properties. However, these checks only address the problem on |
|
284 |
the level of policies---they can only check ``on the surface'' |
|
285 |
whether the policy reflects the intentions of the system |
|
286 |
administrator---these checks are not justified by the actual |
|
287 |
behaviour of the operating system. The main problem this paper addresses is to check |
|
288 |
when a policy matches the intentions of a system administrator |
|
289 |
\emph{and} given such a policy, the operating system actually |
|
290 |
enforces this policy. |
|
291 |
||
292 |
Our work is related to the preliminary work by Archer et al |
|
293 |
\cite{Archer03} about the security model of SELinux. |
|
294 |
They also give a dynamic model of system calls on which the access |
|
295 |
controls are implemented. Their dynamic model is defined in terms of |
|
296 |
IO automata and mechanised in the PVS theorem prover. For specifying |
|
297 |
and reasoning about automata they use the TAME tool in PVS. Their work checks |
|
298 |
well-formedness properties of access policies by type-checking |
|
299 |
generated definitions in PVS. They can also ensure some ``\emph{simple |
|
300 |
properties}'' (their terminology), for example whether a process |
|
301 |
with a particular PID is present in every reachable state from |
|
302 |
an initial state. They also consider ``\emph{deeper properties}'', for |
|
303 |
example whether only a process with root-permissions |
|
304 |
or one of its descendents ever gets permission to write to kernel |
|
305 |
log files. They write that they can state such deeper |
|
306 |
properties about access policies, but about checking such properties |
|
307 |
they write that ``\emph{the feasibility of doing |
|
308 |
so is currently an open question}'' \cite[Page 167]{Archer03}. |
|
309 |
We improve upon their results by using our sound and complete |
|
310 |
static policy check to make this feasible. |
|
311 |
||
17
a87e2181d6b6
final version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
16
diff
changeset
|
312 |
The work we report is also closely related to the work on \emph{grsecurity}, an |
16
a5f4dc4bbc5d
more related work
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
15
diff
changeset
|
313 |
access control system developed as a patch on top of Linux kernel \cite{gran12}. |
a5f4dc4bbc5d
more related work
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
15
diff
changeset
|
314 |
It installs a reference monitor to restrict access to system resources. |
a5f4dc4bbc5d
more related work
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
15
diff
changeset
|
315 |
They model a dynamic semantics of the operating system with four rules dealing with |
a5f4dc4bbc5d
more related work
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
15
diff
changeset
|
316 |
executing a file, setting a role and setting an UID as well as GID. |
17
a87e2181d6b6
final version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
16
diff
changeset
|
317 |
These rules are parametrerised by an arbitrary but fixed access policy. |
16
a5f4dc4bbc5d
more related work
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
15
diff
changeset
|
318 |
Although, there are only four rules, their state-space is in general |
17
a87e2181d6b6
final version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
16
diff
changeset
|
319 |
infinite, like in our work. They therfore give an abstracted semantics, |
16
a5f4dc4bbc5d
more related work
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
15
diff
changeset
|
320 |
which gives them a finite state-space. For example the abstracted |
a5f4dc4bbc5d
more related work
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
15
diff
changeset
|
321 |
semantics dispenses with users and roles by introducing |
a5f4dc4bbc5d
more related work
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
15
diff
changeset
|
322 |
abstract users and abstract roles. They obtain a soundness result |
a5f4dc4bbc5d
more related work
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
15
diff
changeset
|
323 |
for their abstract semantics and under some weak assumptions |
17
a87e2181d6b6
final version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
16
diff
changeset
|
324 |
also a completeness result. Comparing this to our work, we will have a much |
16
a5f4dc4bbc5d
more related work
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
15
diff
changeset
|
325 |
more fine-grained model of the underlying operating system. We will |
a5f4dc4bbc5d
more related work
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
15
diff
changeset
|
326 |
also obtain a soundness result, but more importantly obtain |
a5f4dc4bbc5d
more related work
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
15
diff
changeset
|
327 |
also a completeness result. But since we have a much more fine-grained |
17
a87e2181d6b6
final version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
16
diff
changeset
|
328 |
model, it will depend on some stronger assumptions. The abstract semantics |
16
a5f4dc4bbc5d
more related work
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
15
diff
changeset
|
329 |
in \cite{gran12} is used for model-checking policies according to |
a5f4dc4bbc5d
more related work
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
15
diff
changeset
|
330 |
whether, for example, information flow properties are ensured. |
17
a87e2181d6b6
final version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
16
diff
changeset
|
331 |
Since their formalism consists of only a few rules, they can get away with |
a87e2181d6b6
final version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
16
diff
changeset
|
332 |
``pencil-and-paper proofs'', whereas reasoning about our more detailed |
a87e2181d6b6
final version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
16
diff
changeset
|
333 |
model containing substantially more rules really necessitates the support of |
a87e2181d6b6
final version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
16
diff
changeset
|
334 |
a theorem prover and completely formalised models. |
16
a5f4dc4bbc5d
more related work
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
15
diff
changeset
|
335 |
|
1 | 336 |
Our formal models and correctness proofs are mechanised in the |
337 |
interactive theorem prover Isabelle/HOL. The mechanisation of the models is a |
|
338 |
prerequisite for any correctness proof about the RC-Model, since it |
|
339 |
includes a large number of interdependent concepts and very complex |
|
340 |
operations that determine roles and types. In our opinion it is |
|
341 |
futile to attempt to reason about them by just using ``pencil-and-paper''. |
|
342 |
Following good experience in earlier mechanisation work |
|
343 |
\cite{ZhangUrbanWu12}, we use Paulson's inductive method for |
|
344 |
reasoning about sequences of events \cite{Paulson98}. For example |
|
345 |
we model system calls as events and reason about an inductive |
|
346 |
definition of valid traces, that is lists of events. Central to |
|
347 |
this paper is a notion of a resource being \emph{tainted}, which for |
|
348 |
example means it contains a virus or a back door. We use our model |
|
349 |
of system calls in order to characterise how such a tainted object |
|
350 |
can ``spread'' through the system. For a system administrator the |
|
351 |
important question is whether such a tainted file, possibly |
|
352 |
introduced by a user, can affect core system files and render the |
|
353 |
whole system insecure, or whether it can be contained by the access |
|
354 |
policy. Our results show that a corresponding check can be performed |
|
355 |
statically by analysing the initial state of the system and the access policy. |
|
356 |
\smallskip |
|
357 |
||
358 |
\noindent |
|
359 |
{\bf Contributions:} |
|
360 |
We give a complete formalisation of the RC-Model in the interactive |
|
361 |
theorem prover Isabelle/HOL. We also give a dynamic model of the |
|
362 |
operating system by formalising all security related events that can |
|
363 |
happen while the system is running. As far as we are aware, we are |
|
364 |
the first ones who formally prove that if a policy in the RC-Model |
|
365 |
satisfies an access property, then there is no sequence of events |
|
366 |
(system calls) that can violate this access property. We also prove |
|
367 |
the opposite: if a policy does not meet an access property, then |
|
368 |
there is a sequence of events that will violate this property in our |
|
369 |
model of the operating system. With these two results in place we |
|
370 |
can show that a static policy check is sufficient in order to |
|
371 |
guarantee the access properties before running the system. Again as |
|
10
569222a42cf5
updated the paper for submission
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
8
diff
changeset
|
372 |
far as we know, no such check has been designed and proved correct |
569222a42cf5
updated the paper for submission
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
8
diff
changeset
|
373 |
before. |
1 | 374 |
|
375 |
||
376 |
%Specified dynamic behaviour of the system; |
|
377 |
%we specified a static AC model; designed a tainted relation for |
|
378 |
%the system; proved that they coincide. |
|
379 |
%In our paper .... |
|
380 |
||
381 |
*} |
|
382 |
||
383 |
section {* Preliminaries about the RC-Model *} |
|
384 |
||
385 |
||
386 |
text {* |
|
387 |
The Role-Compatibility Model (RC-Model) is a role-based access |
|
388 |
control model. It has been introduced by Ott \cite{ottrc} and is |
|
389 |
used in running systems for example to secure Apache servers. It |
|
390 |
provides a more fine-grained control over access permissions than |
|
391 |
simple Unix-style access control models. This more fine-grained |
|
392 |
control solves the problem of server processes running as root with |
|
393 |
too many access permissions in order to accomplish a task at |
|
394 |
hand. In the RC-Model, system administrators are able to restrict |
|
395 |
what the role of server is allowed to do and in doing so reduce the |
|
396 |
attack surface of a system. |
|
397 |
||
398 |
Policies in the RC-Model talk about \emph{users}, \emph{roles}, |
|
399 |
\emph{types} and \emph{objects}. Objects are processes, files or |
|
400 |
IPCs (interprocess communication objects---such as message queues, |
|
401 |
sockets and shared memory). Objects are the resources of a system an |
|
402 |
RC-policy can restrict access to. In what follows we use the letter |
|
403 |
@{term u} to stand for users, @{text r} for roles, @{term p} for |
|
404 |
processes, @{term f} for files and @{term i} for IPCs. We also |
|
405 |
use @{text obj} as a generic variable for objects. |
|
406 |
The RC-Model has the following eight kinds of access modes to objects: |
|
407 |
||
408 |
\begin{isabelle}\ \ \ \ \ %%% |
|
409 |
\begin{tabular}{@ {}l} |
|
410 |
@{term READ}, @{term WRITE}, @{term EXECUTE}, @{term "CHANGE_OWNER"}, |
|
411 |
@{term CREATE}, @{term SEND}, @{term RECEIVE} and @{term DELETE} |
|
412 |
\end{tabular} |
|
413 |
\end{isabelle} |
|
414 |
||
415 |
In the RC-Model, roles group users according to tasks they need to |
|
416 |
accomplish. Users have a default role specified by the policy, |
|
417 |
which is the role they start with whenever they log into the system. |
|
418 |
A process contains the information about its owner (a user), its |
|
419 |
role and its type, whereby a type in the RC-Model allows system |
|
420 |
administrators to group resources according to a common criteria. |
|
421 |
Such detailed information is needed in the RC-Model, for example, in |
|
422 |
order to allow a process to change its ownership. For this the |
|
423 |
RC-Model checks the role of the process and its type: if the access |
|
424 |
control policy states that the role has @{term CHANGE_OWNER} access mode for |
|
425 |
processes of that type, then the process is permitted to assume a |
|
426 |
new owner. |
|
427 |
||
428 |
Files in the RC-Model contain the information about their types. A |
|
429 |
policy then specifies whether a process with a given role can access |
|
430 |
a file under a certain access mode. Files, however, also |
|
431 |
include in the RC-Model information about roles. This information is |
|
432 |
used when a process is permitted to execute a file. By doing so it |
|
433 |
might change its role. This is often used in the context of |
|
434 |
web-servers when a cgi-script is uploaded and then executed by the |
|
435 |
server. The resulting process should have much more restricted |
|
436 |
access permissions. This kind of behaviour when executing a file can |
|
437 |
be specified in an RC-policy in several ways: first, the role of the |
|
438 |
process does not change when executing a file; second, the process |
|
439 |
takes on the role specified with the file; or third, use the role of |
|
440 |
the owner, who currently owns this process. The RC-Model also makes |
|
441 |
assumptions on how types can change. For example for files and IPCs |
|
442 |
the type can never change once they are created. But processes can |
|
443 |
change their types according to the roles they have. |
|
444 |
||
445 |
As can be seen, the information contained in a policy in the |
|
446 |
RC-Model can be rather complex: Roles and types, for example, are |
|
447 |
policy-dependent, meaning each policy needs to define a set of roles and a |
|
448 |
set of types. Apart from recording for each role the information |
|
449 |
which type of resource it can access and under which access-mode, it |
|
450 |
also needs to include a role compatibility set. This set specifies how one |
|
451 |
role can change into another role. Moreover it needs to include default |
|
452 |
information for cases when new processes or files are created. |
|
453 |
For example, when a process clones itself, the type of the new |
|
454 |
process is determined as follows: the policy might specify a default |
|
455 |
type whenever a process with a certain role is cloned, or the policy |
|
456 |
might specify that the cloned process inherits the type of the |
|
457 |
parent process. |
|
458 |
||
459 |
Ott implemented the RC-Model on top of Linux, but only specified it |
|
460 |
as a set of informal rules, partially given as logic formulas, |
|
461 |
partially given as rules in ``English''. Unfortunately, some |
|
462 |
presentations about the RC-Model give conflicting definitions for |
|
463 |
some concepts---for example when defining the semantics of the special role |
|
464 |
``inherit parent''. In \cite{ottrc} it means inherit the initial role |
|
465 |
of the parent directory, but in \cite{ottweb} it means inherit |
|
466 |
the role of the parent process. In our formalisation we mainly follow the |
|
467 |
version given in \cite{ottrc}. In the next section we give a mechanised |
|
468 |
model of the system calls on which the RC-Model is implemented. |
|
469 |
*} |
|
470 |
||
471 |
||
472 |
||
473 |
section {* Dynamic Model of System Calls *} |
|
474 |
||
475 |
text {* |
|
476 |
Central to the RC-Model are processes, since they initiate any action |
|
477 |
involving resources and access control. We use natural numbers to stand for process IDs, |
|
478 |
but do not model the fact that the number of processes in any practical |
|
479 |
system is limited. Similarly, IPCs and users are represented by natural |
|
480 |
numbers. The thirteen actions a process can perform are represented by |
|
481 |
the following datatype of \emph{events} |
|
482 |
||
483 |
\begin{isabelle}\ \ \ \ \ %%% |
|
484 |
\mbox{ |
|
485 |
\begin{tabular}{r@ {\hspace{1.5mm}}c@ {\hspace{1.5mm}}l@ {\hspace{3mm}}l@ |
|
486 |
{\hspace{1.5mm}}l@ {\hspace{3mm}}l@ {\hspace{1.5mm}}l@ |
|
487 |
{\hspace{3mm}}l@ {\hspace{1.5mm}}l} |
|
488 |
event |
|
489 |
& @{text "::="} & @{term "CreateFile p f"} & @{text "|"} & @{term "ReadFile p f"} & @{text "|"} & @{term "Send p i"} & @{text "|"} & @{term "Kill p p'"} \\ |
|
490 |
& @{text "|"} & @{term "WriteFile p f"} & @{text "|"} & @{term "Execute p f"} & @{text "|"} & @{term "Recv p i"}\\ |
|
491 |
& @{text "|"} & @{term "DeleteFile p f"} & @{text "|"} & @{term "Clone p p'"} & @{text "|"} & @{term "CreateIPC p i"} \\ |
|
492 |
& @{text "|"} & @{term "ChangeOwner p u"} & @{text "|"} & @{term "ChangeRole p r"} & @{text "|"} & @{term "DeleteIPC p i"}\\ |
|
493 |
\end{tabular}} |
|
494 |
\end{isabelle} |
|
495 |
||
496 |
\noindent |
|
497 |
with the idea that for example in @{term Clone} a process @{term p} is cloned |
|
498 |
and the new process has the ID @{term "p'"}; with @{term Kill} the |
|
499 |
intention is that the process @{term p} kills another process with |
|
500 |
ID @{term p'}. We will later give the definition what the role |
|
501 |
@{term r} can stand for in the constructor @{term ChangeRole} |
|
502 |
(namely \emph{normal roles} only). As is custom in Unix, there is no |
|
503 |
difference between a directory and a file. The files @{term f} in |
|
504 |
the definition above are simply lists of strings. For example, the |
|
505 |
file @{text "/usr/bin/make"} is represented by the list @{text |
|
506 |
"[make, bin, usr]"} and the @{text root}-directory is the @{text |
|
507 |
Nil}-list. Following the presentation in \cite{ottrc}, our model of |
|
8 | 508 |
IPCs is rather simple-minded: we only have events for creation and deletion of IPCs, |
1 | 509 |
as well as sending and receiving messages. |
510 |
||
511 |
Events essentially transform one state of the system into |
|
512 |
another. The system starts with an initial state determining which |
|
513 |
processes, files and IPCs are active at the start of the system. We assume the |
|
514 |
users of the system are fixed in the initial state; we also assume |
|
515 |
that the policy does not change while the system is running. We have |
|
516 |
three sets, namely |
|
517 |
@{term init_processes}, |
|
518 |
@{term init_files} and |
|
519 |
@{term init_ipcs} |
|
520 |
specifying the processes, files and IPCs present in the initial state. |
|
521 |
We will often use the abbreviation |
|
522 |
||
523 |
\begin{center} |
|
524 |
@{thm (lhs) Init_def} @{text "\<equiv>"} |
|
525 |
@{thm (rhs) Init_rhs(1)[where f=obj]} @{text "\<or>"} |
|
526 |
@{thm (rhs) Init_rhs(2)[where p=obj]} @{text "\<or>"} |
|
527 |
@{thm (rhs) Init_rhs(3)[where i=obj]} |
|
528 |
\end{center} |
|
529 |
||
530 |
\noindent |
|
531 |
There are some assumptions we make about the files present in the initial state: we always |
|
532 |
require that the @{text "root"}-directory @{term "[]"} is part of the initial state |
|
533 |
and for every file in the initial state (excluding @{term "[]"}) we require that its |
|
534 |
parent is also part of the |
|
535 |
initial state. |
|
16
a5f4dc4bbc5d
more related work
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
15
diff
changeset
|
536 |
A state is determined |
a5f4dc4bbc5d
more related work
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
15
diff
changeset
|
537 |
by a list of events, called the \emph{trace}. The empty trace, or empty list, stands |
a5f4dc4bbc5d
more related work
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
15
diff
changeset
|
538 |
for the initial state. Given a trace $s$, we prepend an event to $s$ to stand for the state in which the |
a5f4dc4bbc5d
more related work
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
15
diff
changeset
|
539 |
event just happened. |
a5f4dc4bbc5d
more related work
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
15
diff
changeset
|
540 |
We need to define |
1 | 541 |
functions that allow us to make some observations about traces. One |
542 |
such function is called @{term "current_procs"} and |
|
543 |
calculates the set of ``alive'' processes in a state: |
|
544 |
||
545 |
%initial state: |
|
546 |
%We make assumptions about the initial state, they're: |
|
547 |
%1. there exists a set of processes, files, IPCs and users already in the initial state, |
|
548 |
%users are not changed in system's running, we regards users adding and deleting a |
|
549 |
%administration task, not the issue for our policy checker; |
|
550 |
%2. every object in the initial state have got already roles/types/owner ... information assigned; |
|
551 |
%3. all the policy information are already preloaded in the initial state, including: |
|
552 |
%a compatible type table, @{term compatible}; |
|
553 |
%a mapping function from a role to its compatible role set, @{term comproles}; |
|
554 |
%every role's default values is pre-set, e.g. default process create type and |
|
555 |
%and default file/directory create type. |
|
556 |
||
557 |
\begin{isabelle}\ \ \ \ \ %%% |
|
558 |
\mbox{\begin{tabular}{l@ {\hspace{2mm}}c@ {\hspace{2mm}}l} |
|
559 |
@{thm (lhs) current_procs.simps(1)} & @{text "\<equiv>"} & @{thm (rhs) current_procs.simps(1)}\\ |
|
560 |
@{thm (lhs) current_procs.simps(2)} & @{text "\<equiv>"} & @{thm (rhs) current_procs.simps(2)}\\ |
|
561 |
@{thm (lhs) current_procs.simps(3)} & @{text "\<equiv>"} & @{thm (rhs) current_procs.simps(3)}\\ |
|
562 |
@{term "current_procs (DUMMY#s)"} & @{text "\<equiv>"} & @{term "current_procs s"} |
|
563 |
\end{tabular}} |
|
564 |
\end{isabelle} |
|
565 |
||
566 |
\noindent |
|
16
a5f4dc4bbc5d
more related work
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
15
diff
changeset
|
567 |
The first clause states that in the empty trace the processes are given by @{text "init_processes"}. The |
1 | 568 |
events for cloning a process, respectively killing a process, update this |
569 |
set of processes appropriately. Otherwise the set of live |
|
570 |
processes is unchanged. We have similar functions for alive files and |
|
571 |
IPCs, called @{term "current_files"} and @{term "current_ipcs"}. |
|
572 |
||
8 | 573 |
We can use these functions in order to formally model which events are |
1 | 574 |
\emph{admissible} by the operating system in each state. We show just three |
575 |
rules that give the gist of this definition. First the rule for changing |
|
576 |
an owner of a process: |
|
577 |
||
578 |
\begin{center} |
|
579 |
@{thm[mode=Rule] osgrant6} |
|
580 |
\end{center} |
|
581 |
||
582 |
\noindent |
|
583 |
We require that the process @{text p} is alive in the state @{text s} |
|
584 |
(first premise) and that the new owner is a user that existed in the initial state |
|
585 |
(second premise). |
|
586 |
Next the rule for creating a new file: |
|
587 |
||
588 |
\begin{center} |
|
589 |
@{thm[mode=Rule] osgrant2} |
|
590 |
\end{center} |
|
591 |
||
592 |
\noindent |
|
593 |
It states that |
|
594 |
a file @{text f} can be created by a process @{text p} being alive in the state @{text s}, |
|
595 |
the new file does not exist already in this state and there exists |
|
596 |
a parent file @{text "pf"} for the new file. The parent file is just |
|
597 |
the tail of the list representing @{text f}. % if it exists |
|
598 |
%(@{text "Some"}-case) or @{text None} if it does not. |
|
599 |
Finally, the rule for cloning a process: |
|
600 |
||
601 |
\begin{center} |
|
602 |
@{thm[mode=Rule] osgrant10} |
|
603 |
\end{center} |
|
604 |
||
605 |
\noindent |
|
606 |
Clearly the operating system should only allow to clone a process @{text p} if the |
|
607 |
process is currently alive. The cloned process will get the process |
|
14
d43f46423298
added reviews from CPP
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
13
diff
changeset
|
608 |
ID generated by the operating system, but this process ID should |
11 | 609 |
not already exist. The admissibility rules for the other events impose similar conditions. |
1 | 610 |
|
611 |
However, the admissibility check by the operating system is only one |
|
612 |
``side'' of the constraints the RC-Model imposes. We also need to |
|
613 |
model the constraints of the access policy. For this we introduce |
|
614 |
separate @{text granted}-rules involving the sets @{text |
|
615 |
permissions} and @{text "compatible r"}: the former contains triples |
|
616 |
describing access control rules; the latter specifies for each role @{text r} |
|
617 |
which roles are compatible with @{text r}. These sets are used in the |
|
618 |
RC-Model when a process having a role @{text r} takes on a new role |
|
619 |
@{text r'}. For example, a login-process might belong to root; |
|
620 |
once the user logs in, however, the role of the process should change to |
|
621 |
the user's default role. The corresponding @{text "granted"}-rule is |
|
622 |
as follows |
|
623 |
||
624 |
\begin{center} |
|
625 |
@{thm[mode=Rule] rcgrant7} |
|
626 |
\end{center} |
|
627 |
||
628 |
\noindent |
|
629 |
where we check whether the process @{text p} has currently role @{text r} and |
|
630 |
whether the RC-policy states that @{text r'} is in the role compatibility |
|
631 |
set of @{text r}. |
|
632 |
||
633 |
The complication in the RC-Model arises from the |
|
8 | 634 |
way the current role of a process in a state @{text s} is |
1 | 635 |
calculated---represented by the predicate @{term is_current_role} in our formalisation. |
636 |
For defining this predicate we need to trace the role of a process from |
|
637 |
the initial state to the current state. In the |
|
638 |
initial state all processes have the role given by the function |
|
639 |
@{term "init_current_role"}. If a @{term Clone} event happens then |
|
640 |
the new process will inherit the role from the parent |
|
641 |
process. Similarly, if a @{term ChangeRole} event happens, then |
|
642 |
as seen in the rule above we just change the role accordingly. More interesting |
|
643 |
is an @{term Execute} event in the RC-Model. For this event we have |
|
644 |
to check the role attached to the file to be executed. |
|
645 |
There are a number of cases: If the role of the file is a |
|
646 |
\emph{normal} role, then the process will just take on this role |
|
647 |
when executing the file (this is like the setuid mechanism in Unix). But |
|
648 |
there are also four \emph{special} roles in the RC-Model: |
|
649 |
@{term "InheritProcessRole"}, @{term "InheritUserRole"}, |
|
650 |
@{term "InheritParentRole"} and @{term |
|
651 |
InheritUpMixed}. For example, if a file to be executed has |
|
652 |
@{term "InheritProcessRole"} attached to it, then the process |
|
653 |
that executes this file keeps its role regardless of the information |
|
654 |
attached to the file. In this way programs can be can quarantined; |
|
655 |
@{term "InheritUserRole"} can be used for login shells |
|
656 |
to make sure they run with the user's default role. |
|
657 |
The purpose of the other special roles is to determine the |
|
658 |
role of a process according to the directory in which the |
|
659 |
files are stored. |
|
660 |
||
661 |
Having the notion of current role in place, we can define the |
|
662 |
granted rule for the @{term Execute}-event: Suppose a process @{term |
|
663 |
p} wants to execute a file @{text f}. The RC-Model first fetches the |
|
664 |
role @{text r} of this process (in the current state @{text s}) and |
|
665 |
the type @{text t} of the file. It then checks if the tuple @{term |
|
666 |
"(r, t, EXECUTE)"} is part of the policy, that is in our |
|
667 |
formalisation being an element in the set @{term compatible}. The |
|
668 |
corresponding rule is as follows |
|
669 |
||
670 |
\begin{center} |
|
671 |
@{thm[mode=Rule] rcgrant4} |
|
672 |
\end{center} |
|
673 |
||
674 |
\noindent |
|
675 |
The next @{text granted}-rule concerns the @{term CreateFile} event. |
|
676 |
If this event occurs, then we have two rules in our RC-Model |
|
677 |
depending on how the type of the created file is derived. If the type is inherited |
|
678 |
from the parent directory @{text pf}, then the @{term granted}-rule is as follows: |
|
679 |
||
680 |
\begin{center} |
|
681 |
@{thm[mode=Rule] rcgrant1} |
|
682 |
\end{center} |
|
683 |
||
684 |
\noindent |
|
685 |
We check whether @{term pf} is the parent file (directory) of @{text f} and check |
|
8 | 686 |
whether the type of @{term pf} is @{term t}. We also need to fetch |
1 | 687 |
the role @{text r} of the process that seeks to get permission for creating |
688 |
the file. If the default type of this role @{text r} states that the |
|
689 |
type of the newly created file will be inherited from the parent file |
|
690 |
type, then we only need to check that the policy states that @{text r} |
|
691 |
has permission to write into the directory @{text pf}. |
|
692 |
||
693 |
The situation is different if the default type of role @{text r} is |
|
694 |
some \emph{normal} type, like text-file or executable. In such cases we want |
|
695 |
that the process creates some predetermined type of files. Therefore in the |
|
696 |
rule we have to check whether the role is allowed to create a file of that |
|
697 |
type, and also check whether the role is allowed to write any new |
|
698 |
file into the parent file (directory). The corresponding rule is |
|
699 |
as follows. |
|
700 |
||
701 |
\begin{center} |
|
702 |
@{thm[mode=Rule] rcgrant1'} |
|
703 |
\end{center} |
|
704 |
||
705 |
\noindent |
|
706 |
Interestingly, the type-information in the RC-model is also used for |
|
707 |
processes, for example when they need to change their owner. For |
|
708 |
this we have the rule |
|
709 |
||
710 |
\begin{center} |
|
711 |
@{thm[mode=Rule] rcgrant_CHO} |
|
712 |
\end{center} |
|
713 |
||
714 |
\noindent |
|
715 |
whereby we have to obtain both the role and type of the process @{term p}, and then check |
|
716 |
whether the policy allows a @{term ChangeOwner}-event for that role and type. |
|
717 |
||
718 |
Overall we have 13 rules for the admissibility check by the operating system and |
|
719 |
14 rules for the granted check by the RC-Model. |
|
720 |
They are used to characterise when an event @{text e} is \emph{valid} to |
|
721 |
occur in a state @{text s}. This can be inductively defined as the set of valid |
|
722 |
states. |
|
723 |
||
724 |
\begin{center} |
|
725 |
\begin{tabular}{@ {}c@ {}} |
|
726 |
\mbox{@{thm [mode=Axiom] valid.intros(1)}}\hspace{5mm} |
|
727 |
\mbox{@{thm [mode=Rule] valid.intros(2)}} |
|
728 |
\end{tabular} |
|
729 |
\end{center} |
|
16
a5f4dc4bbc5d
more related work
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
15
diff
changeset
|
730 |
*} |
1 | 731 |
|
16
a5f4dc4bbc5d
more related work
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
15
diff
changeset
|
732 |
section {* The Tainted Relation *} |
a5f4dc4bbc5d
more related work
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
15
diff
changeset
|
733 |
|
a5f4dc4bbc5d
more related work
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
15
diff
changeset
|
734 |
text {* |
1 | 735 |
The novel notion we introduce in this paper is the @{text tainted} |
736 |
relation. It characterises how a system can become infected when |
|
737 |
a file in the system contains, for example, a virus. We assume |
|
738 |
that the initial state contains some tainted |
|
739 |
objects (we call them @{term "seeds"}). Therefore in the initial state @{term "[]"} |
|
740 |
an object is tainted, if it is an element in @{text "seeds"}. |
|
741 |
||
742 |
\begin{center} |
|
743 |
\mbox{@{thm [mode=Rule] tainted.intros(1)}} |
|
744 |
\end{center} |
|
745 |
||
746 |
\noindent |
|
747 |
Let us first assume such a tainted object is a file @{text f}. |
|
748 |
If a process reads or executes a tainted file, then this process becomes |
|
749 |
tainted (in the state where the corresponding event occurs). |
|
750 |
||
751 |
\begin{center} |
|
752 |
\mbox{@{thm [mode=Rule] tainted.intros(3)}}\hspace{3mm} |
|
753 |
\mbox{@{thm [mode=Rule] tainted.intros(6)}} |
|
754 |
\end{center} |
|
755 |
||
756 |
\noindent |
|
757 |
We have a similar rule for a tainted IPC, namely |
|
758 |
||
759 |
\begin{center} |
|
760 |
\mbox{@{thm [mode=Rule] tainted.intros(9)}} |
|
761 |
\end{center} |
|
762 |
||
763 |
\noindent |
|
764 |
which means if we receive anything from a tainted IPC, then |
|
765 |
the process becomes tainted. A process is also tainted |
|
766 |
when it is a produced by a @{text Clone}-event. |
|
767 |
||
768 |
\begin{center} |
|
769 |
\mbox{@{thm [mode=Rule] tainted.intros(2)}} |
|
770 |
\end{center} |
|
771 |
||
772 |
\noindent |
|
773 |
However, the tainting relationship must also work in the |
|
774 |
``other'' direction, meaning if a process is tainted, then |
|
775 |
every file that is written or created will be tainted. |
|
776 |
This is captured by the four rules: |
|
777 |
||
778 |
\begin{center} |
|
779 |
\begin{tabular}{c} |
|
780 |
\mbox{@{thm [mode=Rule] tainted.intros(4)}} \hspace{3mm} |
|
781 |
\mbox{@{thm [mode=Rule] tainted.intros(7)}} \medskip\\ |
|
782 |
\mbox{@{thm [mode=Rule] tainted.intros(5)}} \hspace{3mm} |
|
783 |
\mbox{@{thm [mode=Rule] tainted.intros(8)}} |
|
784 |
\end{tabular} |
|
785 |
\end{center} |
|
786 |
||
787 |
\noindent |
|
788 |
Finally, we have three rules that state whenever an object is tainted |
|
789 |
in a state @{text s}, then it will be still tainted in the |
|
790 |
next state @{term "e#s"}, provided the object is still \emph{alive} |
|
791 |
in that state. We have such a rule for each kind of objects, for |
|
792 |
example for files the rule is: |
|
793 |
||
794 |
\begin{center} |
|
795 |
\mbox{@{thm [mode=Rule] tainted_10}} |
|
796 |
\end{center} |
|
797 |
||
798 |
\noindent |
|
799 |
Similarly for alive processes and IPCs (then respectively with premises |
|
800 |
@{term "p \<in> current_procs (e#s)"} and @{term "i \<in> current_ipcs (e#s)"}). |
|
801 |
When an object present in the initial state can be tainted in |
|
802 |
\emph{some} state (system run), we say it is @{text "taintable"}: |
|
803 |
||
804 |
\begin{isabelle}\ \ \ \ \ %%% |
|
805 |
\mbox{\begin{tabular}{lcl} |
|
806 |
@{thm (lhs) taintable_def} & @{text "\<equiv>"} & @{term "init obj"} @{text "\<and>"} @{thm (rhs) taintable_def} |
|
807 |
\end{tabular}} |
|
808 |
\end{isabelle} |
|
809 |
||
810 |
Before we can describe our static check deciding when a file is taintable, we |
|
811 |
need to describe the notions @{term deleted} and @{term undeletable} |
|
812 |
for objects. The former characterises whether there is an event that deletes |
|
813 |
these objects (files, processes or IPCs). For this we have the following |
|
814 |
four rules: |
|
815 |
||
816 |
\begin{center} |
|
817 |
\begin{tabular}{@ {}c@ {\hspace{10mm}}c@ {}} |
|
818 |
\begin{tabular}{c} |
|
819 |
@{thm [mode=Axiom] dels(1)}\\[-2mm] |
|
820 |
@{thm [mode=Axiom] dels(2)}\\[-2mm] |
|
821 |
@{thm [mode=Axiom] dels(3)} |
|
822 |
\end{tabular} & |
|
823 |
@{thm [mode=Rule] dels(4)} |
|
824 |
\end{tabular} |
|
825 |
\end{center} |
|
826 |
||
827 |
||
828 |
\noindent |
|
829 |
Note that an object cannot be deleted in the initial state @{text |
|
830 |
"[]"}. An object is then said to be @{text "undeletable"} provided |
|
831 |
it did exist in the initial state and there does not exists a valid |
|
832 |
state in which the object is deleted: |
|
833 |
||
834 |
\begin{isabelle}\ \ \ \ \ %%% |
|
835 |
\mbox{\begin{tabular}{l@ {\hspace{2mm}}c@ {\hspace{2mm}}l@ {}} |
|
836 |
@{thm (lhs) undeletable_def} & @{text "\<equiv>"} & %%@{thm (rhs) undeletable_def} |
|
837 |
@{term "init obj \<and> \<not>(\<exists> s. (valid s \<and> deleted obj s))"} |
|
838 |
\end{tabular}} |
|
839 |
\end{isabelle} |
|
840 |
||
841 |
\noindent |
|
842 |
The point of this definition is that our static taintable check will only be |
|
843 |
complete for undeletable objects. But these are |
|
844 |
the ones system administrators are typically interested in (for |
|
16
a5f4dc4bbc5d
more related work
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
15
diff
changeset
|
845 |
example system files). |
a5f4dc4bbc5d
more related work
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
15
diff
changeset
|
846 |
|
a5f4dc4bbc5d
more related work
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
15
diff
changeset
|
847 |
It should be clear that we cannot |
1 | 848 |
hope for a meaningful check by just trying out all possible |
849 |
valid states in our dynamic model. The reason is that there are |
|
850 |
potentially infinitely many of them and therefore the search space would be |
|
8 | 851 |
infinite. For example starting from an |
1 | 852 |
initial state containing a process @{text p} and a file @{text pf}, |
13
dd1499f296ea
updated to new isabelle
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
11
diff
changeset
|
853 |
we can create files @{text "f\<^sub>1"}, @{text "f\<^sub>2"}, @{text "..."} |
1 | 854 |
via @{text "CreateFile"}-events. This can be pictured roughly as follows: |
855 |
||
856 |
\begin{center} |
|
857 |
\begin{tabular}[t]{c@ {\hspace{-8mm}}c@ {\hspace{-8mm}}c@ {\hspace{-8mm}}c@ {\hspace{-8mm}}cc} |
|
858 |
\begin{tabular}[t]{c} |
|
859 |
Initial state:\\ |
|
860 |
@{term "{p, pf}"} |
|
861 |
\end{tabular} & |
|
862 |
\begin{tabular}[t]{c} |
|
863 |
\\ |
|
864 |
@{text "\<Longrightarrow>"}\\[2mm] |
|
13
dd1499f296ea
updated to new isabelle
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
11
diff
changeset
|
865 |
{\small@{term "CreateFile p (f\<^sub>1#pf)"}} |
1 | 866 |
\end{tabular} |
867 |
& |
|
868 |
\begin{tabular}[t]{c} |
|
869 |
\\ |
|
13
dd1499f296ea
updated to new isabelle
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
11
diff
changeset
|
870 |
@{term "{p, pf, f\<^sub>1#pf}"} |
1 | 871 |
\end{tabular} |
872 |
& |
|
873 |
\begin{tabular}[t]{c} |
|
874 |
\\ |
|
875 |
@{text "\<Longrightarrow>"}\\[2mm] |
|
13
dd1499f296ea
updated to new isabelle
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
11
diff
changeset
|
876 |
{\small@{term "CreateFile p (f\<^sub>2#f\<^sub>1#pf)"}} |
1 | 877 |
\end{tabular} |
878 |
& |
|
879 |
\begin{tabular}[t]{c} |
|
880 |
\\ |
|
13
dd1499f296ea
updated to new isabelle
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
11
diff
changeset
|
881 |
@{term "{p, pf, f\<^sub>1#pf, f\<^sub>2#f\<^sub>1#pf}"} |
1 | 882 |
\end{tabular} & |
883 |
\begin{tabular}[t]{c} |
|
884 |
\\ |
|
885 |
@{text "..."}\\ |
|
886 |
\end{tabular} |
|
887 |
\end{tabular} |
|
888 |
\end{center} |
|
889 |
||
890 |
\noindent |
|
891 |
Instead, the idea of our static check is to use |
|
892 |
the policies of the RC-model for generating an answer, since they |
|
893 |
provide always a finite ``description of the system''. As we |
|
894 |
will see in the next section, this needs some care, however. |
|
895 |
*} |
|
896 |
||
897 |
section {* Our Static Check *} |
|
898 |
||
899 |
text {* |
|
900 |
Assume there is a tainted file in the system and suppose we face the |
|
901 |
problem of finding out whether this file can affect other files, |
|
902 |
IPCs or processes? One idea is to work on the level of policies only, and |
|
903 |
check which operations are permitted by the role and type of this |
|
904 |
file. Then one builds the ``transitive closure'' of this information |
|
905 |
and checks for example whether the role @{text root} has become |
|
906 |
affected, in which case the whole system is compromised. This is indeed the solution investigated |
|
907 |
in~\cite{guttman2005verifying} in the context of information flow |
|
908 |
and SELinux. |
|
909 |
||
910 |
Unfortunately, restricting the calculations to only use policies is |
|
911 |
too simplistic for obtaining a check that is sound and complete---it |
|
912 |
over-approximates the dynamic tainted relation defined in the previous |
|
913 |
section. To see the problem consider |
|
914 |
the case where the tainted file has, say, the type @{text bin}. If |
|
915 |
the RC-policy contains a role @{text r} that can both read and write |
|
916 |
@{text bin}-files, we would conclude that all @{text bin}-files can potentially |
|
917 |
be tainted. That |
|
918 |
is indeed the case, \emph{if} there is a process having this role @{text |
|
919 |
r} running in the system. But if there is \emph{not}, then the |
|
920 |
tainted file cannot ``spread''. A similar problem arises in case there |
|
921 |
are two processes having the same role @{text r}, and this role is |
|
922 |
restricted to read files only. Now if one of the processes is tainted, then |
|
923 |
the simple check involving only policies would incorrectly infer |
|
924 |
that all processes involving that role are tainted. But since the |
|
925 |
policy for @{text r} is restricted to be read-only, there is in fact |
|
926 |
no danger that both processes can become tainted. |
|
927 |
||
928 |
The main idea of our sound and complete check is to find a ``middle'' ground between |
|
929 |
the potentially infinite dynamic model and the too coarse |
|
930 |
information contained in the RC-policies. Our solution is to |
|
931 |
define a ``static'' version of the tainted relation, called @{term |
|
932 |
"tainted_s"}, that records relatively precisely the information |
|
933 |
about the initial state of the system (the one in which an object |
|
934 |
might be a @{term seed} and therefore tainted). However, |
|
935 |
we are less precise about the objects created in every subsequent |
|
936 |
state. The result is that we can avoid the potential infinity of |
|
937 |
the dynamic model. |
|
938 |
For the @{term tainted_s}-relation we will consider the following |
|
939 |
three kinds of \emph{items} recording the information we need about |
|
940 |
processes, files and IPCs, respectively: |
|
941 |
||
942 |
\begin{center} |
|
943 |
\begin{tabular}{l@ {\hspace{5mm}}l} |
|
944 |
& Recorded information:\smallskip\\ |
|
945 |
Processes: & @{term "SProc (r, dr, t, u) po"}\\ |
|
946 |
Files: & @{term "SFile (t, a) fo"}\\ |
|
947 |
IPCs: & @{term "SIPC (t) io"} |
|
948 |
\end{tabular} |
|
949 |
\end{center} |
|
950 |
||
951 |
\noindent |
|
952 |
For a process we record its role @{text r}, its default role @{text dr} (used to determine |
|
953 |
the role when executing a file or changing the owner of a process), its type @{text t} |
|
954 |
and its owner @{text u}. For a file we record |
|
955 |
just the type @{text t} and its @{term "source_dir"} @{text a} (we define this |
|
956 |
notion shortly). For IPCs we only record its type @{text t}. Note the superscripts |
|
957 |
@{text po}, @{text fo} and @{text io} in each item. They are optional arguments and depend on |
|
958 |
whether the corresponding object is present in the initial state or not. |
|
959 |
If it \emph{is}, then for processes and IPCs we will record @{term "Some(id)"}, |
|
960 |
where @{text id} is the natural number that uniquely identifies a process or IPC; |
|
961 |
for files we just record their path @{term "Some(f)"}. If the object is |
|
962 |
\emph{not} present in the initial state, that is newly created, then we just have |
|
963 |
@{term None} as superscript. |
|
964 |
Let us illustrate the different superscripts with the following example |
|
965 |
where the initial state contains a process @{term p} and a file (directory) |
|
966 |
@{term pf}. Then this |
|
967 |
process creates a file via a @{term "CreateFile"}-event and after that reads |
|
968 |
the created file via a @{term Read}-event: |
|
969 |
||
970 |
\begin{center} |
|
971 |
\begin{tabular}[t]{ccccc} |
|
972 |
\begin{tabular}[t]{c} |
|
973 |
Initial state:\\ |
|
974 |
@{term "{p, pf}"} |
|
975 |
\end{tabular} & |
|
976 |
\begin{tabular}[t]{c} |
|
977 |
\\ |
|
978 |
@{text "\<Longrightarrow>"}\\ |
|
979 |
{\small@{term "CreateFile p (f#pf)"}} |
|
980 |
\end{tabular} |
|
981 |
& |
|
982 |
\begin{tabular}[t]{c} |
|
983 |
\\ |
|
984 |
@{term "{p, pf, f#pf}"} |
|
985 |
\end{tabular} |
|
986 |
& |
|
987 |
\begin{tabular}[t]{c} |
|
988 |
\\ |
|
989 |
@{text "\<Longrightarrow>"}\\ |
|
990 |
{\small@{term "ReadFile p (f#pf)"}} |
|
991 |
\end{tabular} |
|
992 |
& |
|
993 |
\begin{tabular}[t]{c} |
|
994 |
\\ |
|
995 |
@{term "{p, pf, f#pf}"} |
|
996 |
\end{tabular} |
|
997 |
\end{tabular} |
|
998 |
\end{center} |
|
999 |
||
1000 |
\noindent |
|
1001 |
For the two objects in the initial state our static check records |
|
1002 |
the information @{term "SProc (r, dr, t, u) (Some(p))"} and @{term |
|
1003 |
"SFile (t', a) (Some(pf))"} (assuming @{text "r"}, @{text t} and so |
|
1004 |
on are the corresponding roles, types etc). In both cases we have |
|
1005 |
the superscript @{text "Some(...)"} since they are objects present |
|
1006 |
in the initial state. For the file @{term "f#pf"} created by the |
|
1007 |
@{term "CreateFile"}-event, we record @{term "SFile (t', a') |
|
1008 |
(None)"}, since it is a newly created file. The @{text |
|
1009 |
"ReadFile"}-event does not change the set of objects, therefore no |
|
1010 |
new information needs to be recorded. The problem we are avoiding |
|
1011 |
with this setup of recording the precise information for the initial |
|
1012 |
state is where two processes have the same role and type |
|
1013 |
information, but only one is tainted in the initial state, but the |
|
8 | 1014 |
other is not. The recorded unique process ID allows us to |
1 | 1015 |
distinguish between both processes. For all newly created objects, |
1016 |
on the other hand, we do not care. This is crucial, because |
|
1017 |
otherwise exploring all possible ``reachable'' objects can lead to |
|
1018 |
the potential infinity like in the dynamic model. |
|
1019 |
||
1020 |
An @{term source_dir} for a file is the ``nearest'' directory that |
|
1021 |
is present in the initial state and has not been deleted in a state |
|
1022 |
@{text s}. Its definition is the recursive function |
|
1023 |
||
1024 |
\begin{isabelle}\ \ \ \ \ %%% |
|
1025 |
\mbox{\begin{tabular}{lcl} |
|
1026 |
@{thm (lhs) source_dir.simps(1)} & @{text "\<equiv>"} \;\; & |
|
1027 |
@{text "if"} @{text "\<not> deleted [] s"} @{text "then"} @{term "Some []"} @{text "else"} @{term "None"}\\ |
|
1028 |
@{thm (lhs) source_dir.simps(2)} & @{text "\<equiv>"} & |
|
1029 |
@{text "if"} @{term "(f#pf) \<in> init_files \<and> \<not>(deleted (File (f#pf)) s)"}\\ |
|
1030 |
& & @{text "then"} @{term "Some (f#pf)"} @{text "else"} @{term "source_dir s pf"}\\ |
|
1031 |
\end{tabular}} |
|
1032 |
\end{isabelle} |
|
1033 |
||
1034 |
\noindent |
|
1035 |
generating an optional value. |
|
15
baa2970a9687
some small changes according to the reviews
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
14
diff
changeset
|
1036 |
The first clause states that the @{text |
1 | 1037 |
root}-directory is always its own anchor unless it has been |
1038 |
deleted. If a file is present in the initial state and not deleted |
|
1039 |
in @{text s}, then it is also its own anchor, otherwise the anchor |
|
1040 |
will be the anchor of the parent directory. For example if we have |
|
1041 |
a directory @{text pf} in the initial state, then its anchor is @{text "Some pf"} |
|
1042 |
(assuming it is not deleted). If we create a new file in this directory, |
|
1043 |
say @{term "f#pf"}, then its anchor will also be @{text "Some pf"}. |
|
1044 |
The purpose of @{term source_dir} is to determine the |
|
1045 |
role information when a file is executed, because the role of the |
|
1046 |
corresponding process, according to the RC-model, is determined by the role information of the |
|
1047 |
anchor of the file to be executed. |
|
1048 |
||
1049 |
There is one last problem we have to solve before we can give the |
|
1050 |
rules of our @{term "tainted_s"}-check. Suppose an RC-policy |
|
1051 |
includes the rule @{text "(r, foo, Write) \<in> permissions"}, that is |
|
1052 |
a process of role @{text "r"} is allowed to write files of type @{text "foo"}. |
|
1053 |
If there is a tainted process with this role, we would conclude that |
|
1054 |
also every file of that type can potentially become tainted. However, that |
|
1055 |
is not the case if the initial state does not contain any file |
|
1056 |
with type @{text foo} and the RC-policy does not allow the |
|
1057 |
creation of such files, that is does not contain an access rule |
|
1058 |
@{text "(r, foo, Create) \<in> permissions"}. In a sense the original |
|
1059 |
@{text "(r, foo, Write)"} is ``useless'' and should not contribute |
|
1060 |
to the relation characterising the objects that are tainted. |
|
1061 |
To exclude such ``useless'' access rules, we define |
|
1062 |
a relation @{term "all_sobjs"} restricting our search space |
|
1063 |
to only configurations that correspond to states in our dynamic model. |
|
1064 |
We first have a rule for reachable items of the form @{text "F(t, f)\<^bsup>Some f\<^esup>"} |
|
1065 |
where the file @{text f} with type @{text t} is present in |
|
1066 |
the initial state. |
|
1067 |
||
1068 |
\begin{center} |
|
1069 |
@{thm [mode=Rule] af_init'} |
|
1070 |
\end{center} |
|
1071 |
||
1072 |
\noindent |
|
1073 |
We have similar reachability rules for processes and IPCs that are part of the |
|
1074 |
initial state. Next is the reachability rule in case a file is created |
|
1075 |
||
1076 |
\begin{center} |
|
1077 |
@{thm [mode=Rule] af_cfd[where sd=a and sf="fo" and sp="po" and fr="dr"]} |
|
1078 |
\end{center} |
|
1079 |
||
1080 |
\noindent |
|
1081 |
where we require that we have a reachable parent directory, recorded |
|
1082 |
as @{text "F(t, a)\<^bsup>fo\<^esup>"}, and also a |
|
1083 |
process that can create the file, recorded as @{text "P(r, dr, pt, |
|
1084 |
u)\<^bsup>po\<^esup>"}. As can be seen, we also require that we have both @{text "(r, t, |
|
1085 |
Write)"} and \mbox{@{text "(r, t', Create)"}} in the @{text permissions} set |
|
1086 |
for this rule to apply. If we did \emph{not} impose this requirement |
|
1087 |
about the RC-policy, then there would be no way to create a file |
|
1088 |
with @{term "NormalFileType t'"} according to our ``dynamic'' model. |
|
1089 |
However in case we want to create a |
|
1090 |
file of type @{term InheritPatentType}, then we only need the access-rule |
|
1091 |
@{text "(r, t, Write)"}: |
|
1092 |
||
1093 |
\begin{center} |
|
1094 |
@{thm [mode=Rule] af_cfd'[where sd=a and sf="fo" and sp="po" and fr="dr"]} |
|
1095 |
\end{center} |
|
1096 |
||
1097 |
\noindent |
|
1098 |
We also have reachability rules for processes executing files, and |
|
1099 |
for changing their roles and owners, for example |
|
1100 |
||
1101 |
\begin{center} |
|
1102 |
@{thm [mode=Rule] ap_crole[where sp="po" and fr="dr"]} |
|
1103 |
\end{center} |
|
1104 |
||
1105 |
\noindent |
|
1106 |
which states that when we have a process with role @{text r}, and the role |
|
1107 |
@{text "r'"} is in the corresponding role-compatibility set, then also |
|
1108 |
a process with role @{text "r'"} is reachable. |
|
1109 |
||
1110 |
The crucial difference between between the ``dynamic'' notion of validity |
|
1111 |
and the ``static'' notion of @{term "all_sobjs"} |
|
1112 |
is that there can be infinitely many valid states, but assuming the initial |
|
1113 |
state contains only finitely many objects, then also @{term "all_sobjs"} will |
|
1114 |
be finite. To see the difference, consider the infinite ``chain'' of events |
|
13
dd1499f296ea
updated to new isabelle
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
11
diff
changeset
|
1115 |
just cloning a process @{text "p\<^sub>0"}: |
1 | 1116 |
|
1117 |
\begin{center} |
|
1118 |
\begin{tabular}[t]{c@ {\hspace{-2mm}}c@ {\hspace{-2mm}}c@ {\hspace{-2mm}}c@ {\hspace{-2mm}}cc} |
|
1119 |
\begin{tabular}[t]{c} |
|
1120 |
Initial state:\\ |
|
13
dd1499f296ea
updated to new isabelle
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
11
diff
changeset
|
1121 |
@{term "{p\<^sub>0}"} |
1 | 1122 |
\end{tabular} & |
1123 |
\begin{tabular}[t]{c} |
|
1124 |
\\ |
|
1125 |
@{text "\<Longrightarrow>"}\\[2mm] |
|
13
dd1499f296ea
updated to new isabelle
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
11
diff
changeset
|
1126 |
{\small@{term "Clone p\<^sub>0 p\<^sub>1"}} |
1 | 1127 |
\end{tabular} |
1128 |
& |
|
1129 |
\begin{tabular}[t]{c} |
|
1130 |
\\ |
|
13
dd1499f296ea
updated to new isabelle
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
11
diff
changeset
|
1131 |
@{term "{p\<^sub>0, p\<^sub>1}"} |
1 | 1132 |
\end{tabular} |
1133 |
& |
|
1134 |
\begin{tabular}[t]{c} |
|
1135 |
\\ |
|
1136 |
@{text "\<Longrightarrow>"}\\[2mm] |
|
13
dd1499f296ea
updated to new isabelle
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
11
diff
changeset
|
1137 |
{\small@{term "Clone p\<^sub>0 p\<^sub>2"}} |
1 | 1138 |
\end{tabular} |
1139 |
& |
|
1140 |
\begin{tabular}[t]{c} |
|
1141 |
\\ |
|
13
dd1499f296ea
updated to new isabelle
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
11
diff
changeset
|
1142 |
@{term "{p\<^sub>0, p\<^sub>1, p\<^sub>2}"} |
1 | 1143 |
\end{tabular} & |
1144 |
\begin{tabular}[t]{c} |
|
1145 |
\\ |
|
1146 |
@{text "..."}\\ |
|
1147 |
\end{tabular} |
|
1148 |
\end{tabular} |
|
1149 |
\end{center} |
|
1150 |
||
1151 |
\noindent |
|
1152 |
The corresponding reachable objects are |
|
1153 |
||
1154 |
\begin{center} |
|
1155 |
\begin{tabular}[t]{cccc} |
|
1156 |
\begin{tabular}[t]{c} |
|
13
dd1499f296ea
updated to new isabelle
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
11
diff
changeset
|
1157 |
@{text "{P(r, dr, t, u)\<^bsup>Some (p\<^sub>0)\<^esup>}"} |
1 | 1158 |
\end{tabular} & |
1159 |
\begin{tabular}[t]{c} |
|
1160 |
@{text "\<Longrightarrow>"} |
|
1161 |
\end{tabular} |
|
1162 |
& |
|
1163 |
\begin{tabular}[t]{c} |
|
13
dd1499f296ea
updated to new isabelle
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
11
diff
changeset
|
1164 |
@{text "{P(r, dr, t, u)\<^bsup>Some (p\<^sub>0)\<^esup>, P(r, dr, t, u)\<^bsup>None\<^esup>}"} |
1 | 1165 |
\end{tabular} |
1166 |
\end{tabular} |
|
1167 |
\end{center} |
|
1168 |
||
1169 |
\noindent |
|
1170 |
where no further progress can be made because the information |
|
13
dd1499f296ea
updated to new isabelle
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
11
diff
changeset
|
1171 |
recorded about @{text "p\<^sub>2"}, @{text "p\<^sub>3"} and so on is just the same |
dd1499f296ea
updated to new isabelle
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
11
diff
changeset
|
1172 |
as for @{text "p\<^sub>1"}, namely @{text "P(r, dr, t, u)\<^bsup>None\<^esup>"}. Indeed we |
1 | 1173 |
can prove the lemma: |
1174 |
||
1175 |
\begin{lemma}\label{finite} |
|
1176 |
If @{text "finite init"}, then @{term "finite all_sobjs"}. |
|
1177 |
\end{lemma} |
|
1178 |
||
1179 |
\noindent |
|
1180 |
This fact of @{term all_sobjs} being finite enables us to design a |
|
1181 |
decidable tainted-check. For this we introduce inductive rules defining the |
|
1182 |
set @{term "tainted_s"}. Like in the ``dynamic'' version of tainted, |
|
1183 |
if an object is element of @{text seeds}, then it is @{term "tainted_s"}. |
|
1184 |
||
1185 |
\begin{center} |
|
1186 |
@{thm [mode=Rule] ts_init} |
|
1187 |
\end{center} |
|
1188 |
||
1189 |
\noindent |
|
1190 |
The function @{text "\<lbrakk>_\<rbrakk>"} extracts the static information from an object. |
|
1191 |
For example for a process it extracts the role, default role, type and |
|
8 | 1192 |
user; for a file the type and the anchor. If a process is tainted and creates |
1 | 1193 |
a file with a normal type @{text "t'"} then also the created file |
1194 |
is tainted. The corresponding rule is |
|
1195 |
||
1196 |
\begin{center} |
|
1197 |
@{thm [mode=Rule] ts_cfd[where sd=a and sf="fo" and sp="po" and fr="dr"]} |
|
1198 |
\end{center} |
|
1199 |
||
1200 |
\noindent |
|
1201 |
If a tainted process creates a file that inherits the type of the directory, |
|
1202 |
then the file will also be tainted: |
|
1203 |
||
1204 |
\begin{center} |
|
1205 |
@{thm [mode=Rule] ts_cfd'[where sd=a and sf="fo" and sp="po" and fr="dr"]} |
|
1206 |
\end{center} |
|
1207 |
||
1208 |
\noindent |
|
1209 |
If a tainted process changes its role, then also with this changed role |
|
1210 |
it will be tainted: |
|
1211 |
||
1212 |
\begin{center} |
|
1213 |
@{thm [mode=Rule] ts_crole[where pt=t and sp="po" and fr="dr"]} |
|
1214 |
\end{center} |
|
1215 |
||
1216 |
\noindent |
|
1217 |
Similarly when a process changes its owner. If a file is tainted, and |
|
1218 |
a process has read-permission to that type of files, then the |
|
1219 |
process becomes tainted. The corresponding rule is |
|
1220 |
||
1221 |
\begin{center} |
|
1222 |
@{thm [mode=Rule] ts_read[where sd=a and sf="fo" and sp="po" and fr="dr"]} |
|
1223 |
\end{center} |
|
1224 |
||
1225 |
\noindent |
|
1226 |
If a process is tainted and it has write-permission for files of type @{text t}, |
|
1227 |
then these files will be tainted: |
|
1228 |
||
1229 |
\begin{center} |
|
1230 |
@{thm [mode=Rule] ts_write[where sd=a and sf="fo" and sp="po" and fr="dr"]} |
|
1231 |
\end{center} |
|
1232 |
||
1233 |
\noindent |
|
1234 |
We omit the remaining rules for executing a file, cloning a process and |
|
1235 |
rules involving IPCs, which are similar. A simple consequence of our definitions |
|
1236 |
is that every tainted object is also reachable: |
|
1237 |
||
1238 |
\begin{lemma} |
|
13
dd1499f296ea
updated to new isabelle
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
11
diff
changeset
|
1239 |
@{text "tainted\<^sup>s \<subseteq> reachable\<^sup>s"} |
1 | 1240 |
\end{lemma} |
1241 |
||
1242 |
\noindent |
|
1243 |
which in turn means that the set of @{term "tainted_s"} items is finite by Lemma~\ref{finite}. |
|
1244 |
||
1245 |
Returning to our original question about whether tainted objects can spread |
|
1246 |
in the system. To answer this question, we take these tainted objects as |
|
1247 |
seeds and calculate the set of items that are @{term "tainted_s"}. We proved this |
|
1248 |
set is finite and can be enumerated using the rules for @{term tainted_s}. |
|
1249 |
However, this set is about items, not about whether objects are tainted or not. |
|
1250 |
Assuming an item in @{term tainted_s} arises from an object present in the initial |
|
1251 |
state, we have recorded enough information to translate items back into objects |
|
1252 |
via the function @{text "|_|"}: |
|
1253 |
||
1254 |
\begin{center} |
|
1255 |
\begin{tabular}{lcl} |
|
1256 |
@{text "|P(r, dr, t, u)\<^bsup>po\<^esup>|"} & @{text "\<equiv>"} & @{text po}\\ |
|
1257 |
@{text "|F(t, a)\<^bsup>fo\<^esup>|"} & @{text "\<equiv>"} & @{text fo}\\ |
|
1258 |
@{text "|I(t\<^bsup>\<^esup>)\<^bsup>io\<^esup>|"} & @{text "\<equiv>"} & @{text io} |
|
1259 |
\end{tabular} |
|
1260 |
\end{center} |
|
1261 |
||
1262 |
\noindent |
|
1263 |
Using this function, we can define when an object is @{term taintable_s} in terms of |
|
1264 |
an item being @{term tainted_s}, namely |
|
1265 |
||
1266 |
\begin{isabelle}\ \ \ \ \ %%% |
|
1267 |
\mbox{\begin{tabular}{lcl} |
|
13
dd1499f296ea
updated to new isabelle
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
11
diff
changeset
|
1268 |
@{thm (lhs) taintable_s_def} & @{text "\<equiv>"} & @{text "\<exists>item. item \<in> tainted\<^sup>s \<and> |item| = Some obj"} |
1 | 1269 |
\end{tabular}} |
1270 |
\end{isabelle} |
|
1271 |
||
1272 |
\noindent |
|
1273 |
Note that @{term taintable_s} is only about objects that are present in |
|
1274 |
the initial state, because for all other items @{text "|_|"} returns @{text None}. |
|
1275 |
||
1276 |
||
1277 |
With these definitions in place, we can state our theorem about the soundness of our |
|
1278 |
static @{term taintable_s}-check for objects. |
|
1279 |
||
1280 |
\begin{theorem}[Soundness] |
|
1281 |
@{thm [mode=IfThen] static_sound} |
|
1282 |
\end{theorem} |
|
1283 |
||
1284 |
\noindent |
|
1285 |
The proof of this theorem generates for every object that is ``flagged'' as |
|
1286 |
@{term taintable_s} by our check, a sequence of events which shows how the |
|
1287 |
object can become tainted in the dynamic model. We can also state a completeness |
|
1288 |
theorem for our @{term taintable_s}-check. |
|
1289 |
||
1290 |
\begin{theorem}[Completeness] |
|
1291 |
@{thm [mode=IfThen] static_complete} |
|
1292 |
\end{theorem} |
|
1293 |
||
1294 |
\noindent |
|
1295 |
This completeness theorem however needs to be restricted to |
|
1296 |
undeletebale objects. The reason is that a tainted process can be |
|
1297 |
killed by another process, and after that can be ``recreated'' by a |
|
1298 |
cloning event from an untainted process---remember we have no control |
|
1299 |
over which process ID a process will be assigned with. Clearly, in |
|
1300 |
this case the cloned process should be considered untainted, and |
|
1301 |
indeed our dynamic tainted relation is defined in this way. The |
|
1302 |
problem is that a static test cannot know about a process being |
|
1303 |
killed and then recreated. Therefore the static test will not be |
|
1304 |
able to ``detect'' the difference. Therefore we solve this problem |
|
1305 |
by considering only objects that are present in the initial state |
|
1306 |
and cannot be deleted. By the latter we mean that the RC-policy |
|
1307 |
stipulates an object cannot be deleted (for example it has been created |
|
1308 |
by @{term root} in single-user mode, but in the everyday running |
|
1309 |
of the system the RC-policy forbids to delete an object belonging to |
|
1310 |
@{term root}). Like @{term "taintable_s"}, we also have a static check |
|
1311 |
for when a file is undeletable according to an RC-policy. |
|
1312 |
||
1313 |
This restriction to undeletable objects might be seen as a great |
|
1314 |
weakness of our result, but in practice this seems to cover the |
|
1315 |
interesting scenarios encountered by system administrators. They |
|
1316 |
want to know whether a virus-infected file introduced by a user can |
|
1317 |
affect the core system files. Our test allows the system |
|
1318 |
administrator to find this out provided the RC-policy makes the core |
|
8 | 1319 |
system files undeletable. We assume that this proviso is already part |
1 | 1320 |
of best practice rule for running a system. |
1321 |
||
1322 |
We envisage our test to be useful in two kind of situations: First, if |
|
1323 |
there was a break-in into a system, then, clearly, the system |
|
1324 |
administrator can find out whether the existing access policy was |
|
1325 |
strong enough to contain the break-in, or whether core system files |
|
1326 |
could have been affected. In the first case, the system |
|
1327 |
administrator can just plug the hole and forget about the break-in; |
|
1328 |
in the other case the system administrator is wise to completely |
|
1329 |
reinstall the system. |
|
1330 |
Second, the system administrator can proactively check whether an |
|
1331 |
RC-policy is strong enough to withstand serious break-ins. To do so |
|
1332 |
one has to identify the set of ``core'' system files that the policy |
|
1333 |
should protect and mark every possible entry point for an attacker |
|
1334 |
as tainted (they are the seeds of the @{term "tainted_s"} relation). |
|
1335 |
Then the test will reveal |
|
1336 |
whether the policy is strong enough or needs to be redesigned. For |
|
1337 |
this redesign, the sequence of events our check generates should be |
|
1338 |
informative. |
|
1339 |
*} |
|
1340 |
||
1341 |
||
1342 |
||
1343 |
||
1344 |
section {*Conclusion and Related Works*} |
|
1345 |
||
1346 |
||
1347 |
text {* |
|
1348 |
We have presented the first completely formalised dynamic model of |
|
1349 |
the Role-Compa\-tibility Model. This is a framework, introduced by Ott |
|
1350 |
\cite{ottrc}, in which role-based access control policies |
|
1351 |
can be formulated and is used in practice, for example, for securing Apache |
|
1352 |
servers. Previously, the RC-Model was presented as a |
|
1353 |
collection of rules partly given in ``English'', partly given as formulas. |
|
1354 |
During the formalisation we uncovered an inconsistency in the |
|
1355 |
semantics of the special role @{term "InheritParentRole"} in |
|
1356 |
the existing works about the RC-Model \cite{ottrc,ottweb}. By proving |
|
1357 |
the soundness and completeness of our static @{term |
|
1358 |
"taintable_s"}-check, we have formally related the dynamic behaviour |
|
1359 |
of the operating system implementing access control and the static |
|
1360 |
behaviour of the access policies of the RC-Model. The |
|
1361 |
crucial idea in our static check is to record precisely the |
|
1362 |
information available about the initial state (in which some resources might be |
|
1363 |
tainted), but be less precise |
|
1364 |
about the subsequent states. The former fact essentially gives us |
|
1365 |
the soundness of our check, while the latter results in a finite |
|
1366 |
search space. |
|
1367 |
||
1368 |
The two most closely related works are by Archer et al and by Guttman et al |
|
1369 |
\cite{Archer03,guttman2005verifying}. The first describes a |
|
1370 |
formalisation of the dynamic behaviour of SELinux carried out in the |
|
1371 |
theorem prover PVS. However, they cannot use their formalisation in |
|
1372 |
order to prove any ``deep'' properties about access control rules |
|
1373 |
\cite[Page 167]{Archer03}. The second analyses access control |
|
1374 |
policies in the context of information flow. Since this work |
|
1375 |
is completely on the level of policies, it does |
|
1376 |
not lead to a sound and complete check for files being taintable (a dynamic notion |
|
1377 |
defined in terms of operations performed by the operating system). |
|
1378 |
While our results concern the RC-Model, we expect that they |
|
1379 |
equally apply to the access control model of SELinux. In fact, |
|
1380 |
we expect that the formalisation is simpler for SELinux, since |
|
1381 |
its rules governing roles are much simpler than in the RC-Model. |
|
1382 |
The definition of our admissibility rules can be copied verbatim for SELinux; |
|
1383 |
we would need to modify our granted rules and slightly adapt our |
|
16
a5f4dc4bbc5d
more related work
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
15
diff
changeset
|
1384 |
static check. We leave this as future work. Another direction |
a5f4dc4bbc5d
more related work
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
15
diff
changeset
|
1385 |
of future work could be to reason formally about confidentiality in |
a5f4dc4bbc5d
more related work
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
15
diff
changeset
|
1386 |
access control models. This would, of course, need the explicit assumption |
a5f4dc4bbc5d
more related work
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
15
diff
changeset
|
1387 |
about the absence of any covert channels in systems. |
1 | 1388 |
|
1389 |
||
1390 |
Our formalisation is carried out in the Isabelle/HOL theorem prover. |
|
1391 |
It uses Paulson's inductive method for |
|
1392 |
reasoning about sequences of events \cite{Paulson98}. |
|
1393 |
We have approximately 1000 lines of code for definitions and 6000 lines of |
|
1394 |
code for proofs. Our formalisation is available from the |
|
17
a87e2181d6b6
final version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
16
diff
changeset
|
1395 |
Mercurial repository at \url{http://www.dcs.kcl.ac.uk/staff/urbanc/cgi-bin/repos.cgi/rc/}.\\[-12mm]\mbox{} |
1 | 1396 |
|
17
a87e2181d6b6
final version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
16
diff
changeset
|
1397 |
%%\\[-12mm] |
a87e2181d6b6
final version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
16
diff
changeset
|
1398 |
% |
a87e2181d6b6
final version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
16
diff
changeset
|
1399 |
% |
1 | 1400 |
%In a word, what the manager need is that given the |
1401 |
%initial state of the system, a policy checker that make sure the under the policy |
|
1402 |
%he made, this important file cannot: 1. be deleted; 2. be tainted. |
|
1403 |
%Formally speaking, this policy-checker @{text "PC"} (a function that given the |
|
1404 |
%initial state of system, a policy and an object, it tells whether this object |
|
1405 |
%will be fully protected or not) should satisfy this criteria: |
|
17
a87e2181d6b6
final version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
16
diff
changeset
|
1406 |
% |
1 | 1407 |
% @{text "(PC init policy obj) \<and> (exists init obj) \<longrightarrow> \<not> taintable obj"} |
1408 |
%If the @{text obj} exists in the initial-state, and @{text "PC"} justify the safety |
|
1409 |
%of this object under @{text "policy"}, this object should not be @{text taintable}. |
|
1410 |
%We call this criteria the \emph{completeness} of @{text "PC"}. |
|
1411 |
%And there is the \emph{soundness} criteria of @{text "PC"} too, otherwise a "NO-to-ALL" |
|
1412 |
%answer always satisfy the \emph{completeness}. \emph{soundness} formally is: |
|
1413 |
% @{text "PC init policy obj \<longrightarrow> taintable obj"} |
|
17
a87e2181d6b6
final version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
16
diff
changeset
|
1414 |
% |
1 | 1415 |
%This policy-checker should satisfy other properties: |
1416 |
% 1. fully statical, that means this policy-checker should not rely on the system |
|
1417 |
%running information, like new created files/process, and most importantly the |
|
1418 |
%trace of system running. |
|
1419 |
% 2. decidable, that means this policy-checker should always terminate. |
|
17
a87e2181d6b6
final version
Christian Urban <christian dot urban at kcl dot ac dot uk>
parents:
16
diff
changeset
|
1420 |
% |
3 | 1421 |
*} |
1 | 1422 |
(*<*) |
1423 |
end |
|
1424 |
||
1425 |
end |
|
1426 |
(*>*) |
|
1427 |
(* |
|
1428 |
||
1429 |
Central to RC-Model is the roles and types. We start with do formalisation on |
|
1430 |
types first. |
|
1431 |
||
1432 |
\begin{isabelle}\ \ \ \ \ %%% |
|
1433 |
\mbox{ |
|
1434 |
\begin{tabular}{r@ {\hspace{1mm}}l@ {\hspace{2mm}}l} |
|
1435 |
@{text t_client} & @{text "="} & @{text "Christian"} \\ |
|
1436 |
& @{text "|"} & @{text "Chunhan"} \\ |
|
1437 |
& @{text "|"} & @{text " ... "} \\ |
|
1438 |
\end{tabular}} |
|
1439 |
||
1440 |
\mbox{ |
|
1441 |
\begin{tabular}{r@ {\hspace{1mm}}l@ {\hspace{2mm}}l@ {\hspace{2mm}}l} |
|
1442 |
@{text t_normal_file_type} & @{text "="} & @{text "WebServerLog_file"} & \\ |
|
1443 |
& @{text "|"} & @{text "WebData_file"} & @{text t_client} \\ |
|
1444 |
& @{text "|"} & @{text "CGI_file"} & @{text t_client} \\ |
|
1445 |
& @{text "|"} & @{text "Private_file"} & @{text t_client} |
|
1446 |
\end{tabular}} |
|
1447 |
||
1448 |
\mbox{ |
|
1449 |
\begin{tabular} {r@ {\hspace{1mm}}l@ {\hspace{5mm}}l} |
|
1450 |
@{text t_rc_file_type} |
|
1451 |
& @{text "="} & @{term "InheritParent_file_type"} \\ |
|
1452 |
& @{text "|"} & @{term "NormalFile_type t_normal_file_type"} |
|
1453 |
\end{tabular}} |
|
1454 |
\end{isabelle} |
|
1455 |
||
1456 |
@{term "type_of_file"} function calculates the current type for the files: |
|
1457 |
\begin{isabelle}\ \ \ \ \ %%% |
|
1458 |
\mbox{\begin{tabular}{lcl} |
|
1459 |
@{thm (lhs) type_of_file.simps(1)} & @{text "\<equiv>"} & @{thm (rhs) type_of_file.simps(1)}\\ |
|
1460 |
@{thm (lhs) type_of_file.simps(2)} & @{text "\<equiv>"} & @{thm (rhs) type_of_file.simps(2)}\\ |
|
1461 |
@{term "type_of_file (DUMMY#s)"} & @{text "\<equiv>"} & @{term "type_of_file s"} |
|
1462 |
\end{tabular}} |
|
1463 |
\end{isabelle} |
|
1464 |
||
1465 |
Note that this @{term "type_of_file"} is not the function @{term "etype_of_file"} |
|
1466 |
that we call in the grant check of RC-Model, @{term "rc_grant"}. The reason is |
|
1467 |
that file's type can be set to a special type of @{term "InheritParent_file_type"}, |
|
1468 |
means that the ``efficient'' type of this file is the efficient type of its directory. |
|
1469 |
\mbox{\begin{tabular}{lcl} |
|
1470 |
@{thm (lhs) etype_aux.simps(1)} & @{text "\<equiv>"} & @{thm (rhs) etype_aux.simps(1)}\\ |
|
1471 |
@{thm (lhs) etype_aux.simps(2)} & @{text "\<equiv>"} & @{thm (rhs) etype_aux.simps(2)}\smallskip\\ |
|
1472 |
@{thm (lhs) etype_of_file_def} & @{text "\<equiv>"} & @{thm (rhs) etype_of_file_def} |
|
1473 |
\end{tabular}} |
|
1474 |
Here @{term etype_aux} is an auxiliary function which do recursion |
|
1475 |
on the pathname of files. By the way, in our proofs, we do proved |
|
1476 |
that functions like @{term "etype_of_file"} will always return |
|
1477 |
``normal'' values. |
|
1478 |
||
1479 |
||
1480 |
We have similar observation functions calculating the current type for processes |
|
1481 |
and IPCs too, only diffence here is that there is no ``effcient'' type here for |
|
1482 |
processes and IPCs, all types that calculated by @{term "type_of_process"} and |
|
1483 |
@{term "type_of_ipc"} are alrealdy efficient types. |
|
1484 |
||
8 | 1485 |
*) |
1486 |
(* |
|
1 | 1487 |
|
1488 |
text {* |
|
1489 |
\begin{isabelle}\ \ \ \ \ %%% |
|
1490 |
\mbox{ |
|
1491 |
\begin{tabular}{r@ {\hspace{1mm}}l@ {\hspace{2mm}}l@ {\hspace{2mm}}l} |
|
1492 |
@{text t_normal_role} & @{text "="} & @{text "WebServer"} & \\ |
|
1493 |
& @{text "|"} & @{text "WS_client"} & @{text t_client} \\ |
|
1494 |
& @{text "|"} & @{text "UpLoader"} & @{text t_client} \\ |
|
1495 |
& @{text "|"} & @{text "CGI "} & @{text t_client} |
|
1496 |
\end{tabular}} |
|
1497 |
||
1498 |
\mbox{ |
|
1499 |
\begin{tabular} {r@ {\hspace{1mm}}l@ {\hspace{2mm}}l@ {\hspace{5mm}}l} |
|
1500 |
@{text t_role} |
|
1501 |
& @{text "="} & @{term "InheritParentRole"} & ``for file's initial/forced role, |
|
1502 |
meaning using parent directory's |
|
1503 |
role instead'' \\ |
|
1504 |
& @{text "|"} & @{term "UseForcedRole"} & ``for file's initial role'' \\ |
|
1505 |
& @{text "|"} & @{term "InheritProcessRole"} & ``using process' current role''\\ |
|
1506 |
& @{text "|"} & @{term "InheritUserRole"} & ``using owner's default role''\\ |
|
1507 |
& @{text "|"} & ... & \\ |
|
1508 |
& @{text "|"} & @{term "NormalRole t_normal_role"} & ``user-defined |
|
1509 |
policy roles" |
|
1510 |
\end{tabular}} |
|
1511 |
\end{isabelle} |
|
1512 |
||
1513 |
@{text "t_normal roles"} are normally user-defined roles in the |
|
1514 |
policy, where @{text "WebServer"} is the role who plays for the |
|
1515 |
server, while @{text "WS_client"} is the role server plays for |
|
1516 |
certain client, so is for @{text "UpLoader"} role. @{text "CGI"} is |
|
1517 |
the role that client's programme scripts play. |
|
1518 |
||
1519 |
@{term "currentrole"} function calculates the current role of process, here we |
|
1520 |
only show 3 cases of its definition, it responses to @{term "ChangeOwner"}, |
|
1521 |
@{term "ChangeRole"} events too. |
|
1522 |
||
1523 |
\begin{isabelle}\ \ \ \ \ %%% |
|
1524 |
\mbox{\begin{tabular}{lcl} |
|
1525 |
@{thm (lhs) currentrole.simps(1)} & @{text "\<equiv>"} & @{thm (rhs) currentrole.simps(1)}\\ |
|
1526 |
@{thm (lhs) currentrole.simps(2)} & @{text "\<equiv>"} & @{thm (rhs) currentrole.simps(2)}\\ |
|
1527 |
@{thm (lhs) currentrole.simps(3)} & @{text "\<equiv>"} & @{thm (rhs) currentrole.simps(3)} |
|
1528 |
\end{tabular}} |
|
1529 |
\end{isabelle} |
|
1530 |
||
1531 |
If the event trace is @{term "[]"}, means the |
|
1532 |
system state currently is the initial state, then @{term "init_currentrole"} will |
|
1533 |
do. @{term "Execute p f"} event is one complex case, when this event happens, process |
|
1534 |
@{term p}'s role will be changed according to the efficient initial role of the |
|
1535 |
executable file @{term f}, here ``efficient'' is like the file's type too. |
|
1536 |
||
1537 |
\begin{isabelle}\ \ \ \ \ %%% |
|
1538 |
\mbox{\begin{tabular}{lcl} |
|
1539 |
@{thm (lhs) initialrole.simps(1)} & @{text "\<equiv>"} & @{thm (rhs) initialrole.simps(1)}\\ |
|
1540 |
@{thm (lhs) initialrole.simps(2)} & @{text "\<equiv>"} & @{thm (rhs) initialrole.simps(2)}\\ |
|
1541 |
@{thm (lhs) initialrole.simps(3)} & @{text "\<equiv>"} & @{thm (rhs) initialrole.simps(3)}\medskip\\ |
|
1542 |
||
1543 |
@{thm (lhs) erole_functor.simps(1)} & @{text "\<equiv>"} & @{thm (rhs) erole_functor.simps(1)}\\ |
|
1544 |
@{thm (lhs) erole_functor.simps(2)} & @{text "\<equiv>"} & @{thm (rhs) erole_functor.simps(2)} |
|
1545 |
\end{tabular}} |
|
1546 |
\end{isabelle} |
|
1547 |
||
1548 |
If this efficient initial role is normal role, then RC-Model assigns |
|
1549 |
this role to the process after execution finished. Otherwise if this |
|
1550 |
efficient initial role is using special value @{term |
|
1551 |
"UseForcedRole"}, then the new role for the process is then |
|
1552 |
determinated by the efficient forced role of the executable file |
|
1553 |
@{term "forcedrole"}. When new process is created, this process' |
|
1554 |
role is assigned to its creator's role. |
|
8 | 1555 |
|
1556 |
*} |
|
11 | 1557 |
|
1558 |
||
1559 |
HERE: chunhan |
|
1560 |
Therefore we define @{term new_proc} as |
|
1561 |
||
1562 |
(* *) |
|
1563 |
\begin{isabelle}\ \ \ \ \ %%% |
|
1564 |
\mbox{\begin{tabular}{l@ {\hspace{2mm}}c@ {\hspace{2mm}}l} |
|
1565 |
@{term "new_proc s"} & @{text "\<equiv>"} & @{term "Max (current_procs s) + 1"} |
|
1566 |
\end{tabular}} |
|
1567 |
\end{isabelle} |
|
1568 |
||
1569 |
\noindent |
|
1570 |
namely the highest ID currently in existence increased by one. |
|
1571 |
||
1 | 1572 |
*) |