ソースを参照

Add unchecked assembly, add gitignore, cleanup

master
Ivaylo Ivanov 1年前
コミット
09fc053cf6
7個のファイルの変更91行の追加748行の削除
  1. 4
    0
      .gitignore
  2. 0
    25
      SemSEpaper/exercises.aux
  3. 0
    48
      SemSEpaper/exercises.blg
  4. 0
    650
      SemSEpaper/exercises.log
  5. バイナリ
      SemSEpaper/exercises.pdf
  6. バイナリ
      SemSEpaper/exercises.synctex.gz
  7. 87
    25
      SemSEpaper/exercises.tex

+ 4
- 0
.gitignore ファイルの表示

@@ -0,0 +1,4 @@
1
+*.log
2
+*.aux
3
+*.blg
4
+*.gz

+ 0
- 25
SemSEpaper/exercises.aux ファイルの表示

@@ -1,25 +0,0 @@
1
-\relax 
2
-\bibstyle{plain}
3
-\providecommand \oddpage@label [2]{}
4
-\@writefile{toc}{\contentsline {section}{\numberline {1}Weakness and consequences}{1}{}\protected@file@percent }
5
-\@writefile{toc}{\contentsline {subsection}{\numberline {1.1}Solidity storage layout}{1}{}\protected@file@percent }
6
-\@writefile{toc}{\contentsline {subsection}{\numberline {1.2}The Weakness}{1}{}\protected@file@percent }
7
-\citation{securify}
8
-\citation{teether}
9
-\@writefile{loa}{\contentsline {algocf}{\numberline {1}{\ignorespaces A completely unchecked array write}}{2}{}\protected@file@percent }
10
-\@writefile{loa}{\contentsline {algocf}{\numberline {2}{\ignorespaces An incorrectly managed array length}}{2}{}\protected@file@percent }
11
-\@writefile{toc}{\contentsline {section}{\numberline {2}Vulnerable contracts in literature}{2}{}\protected@file@percent }
12
-\citation{securify}
13
-\citation{teether}
14
-\citation{fuzzdrivegen}
15
-\citation{smartian}
16
-\citation{doughoyte}
17
-\bibdata{exercise.bib}
18
-\bibcite{smartian}{1}
19
-\bibcite{doughoyte}{2}
20
-\bibcite{teether}{3}
21
-\bibcite{fuzzdrivegen}{4}
22
-\@writefile{toc}{\contentsline {section}{\numberline {3}Code properties and automatic detection}{3}{}\protected@file@percent }
23
-\@writefile{toc}{\contentsline {section}{\numberline {4}Exploit sketch}{3}{}\protected@file@percent }
24
-\bibcite{securify}{5}
25
-\gdef \@abspage@last{4}

+ 0
- 48
SemSEpaper/exercises.blg ファイルの表示

@@ -1,48 +0,0 @@
1
-This is BibTeX, Version 0.99d
2
-Capacity: max_strings=200000, hash_size=200000, hash_prime=170003
3
-The top-level auxiliary file: exercises.aux
4
-Reallocating 'name_of_file' (item size: 1) to 6 items.
5
-The style file: plain.bst
6
-Reallocating 'name_of_file' (item size: 1) to 13 items.
7
-Database file #1: exercise.bib
8
-You've used 5 entries,
9
-            2118 wiz_defined-function locations,
10
-            528 strings with 5241 characters,
11
-and the built_in function-call counts, 2246 in all, are:
12
-= -- 224
13
-> -- 114
14
-< -- 3
15
-+ -- 45
16
-- -- 40
17
-* -- 142
18
-:= -- 346
19
-add.period$ -- 18
20
-call.type$ -- 5
21
-change.case$ -- 35
22
-chr.to.int$ -- 0
23
-cite$ -- 5
24
-duplicate$ -- 98
25
-empty$ -- 166
26
-format.name$ -- 40
27
-if$ -- 502
28
-int.to.chr$ -- 0
29
-int.to.str$ -- 5
30
-missing$ -- 4
31
-newline$ -- 28
32
-num.names$ -- 10
33
-pop$ -- 49
34
-preamble$ -- 1
35
-purify$ -- 30
36
-quote$ -- 0
37
-skip$ -- 81
38
-stack$ -- 0
39
-substring$ -- 107
40
-swap$ -- 41
41
-text.length$ -- 3
42
-text.prefix$ -- 0
43
-top$ -- 0
44
-type$ -- 20
45
-warning$ -- 0
46
-while$ -- 16
47
-width$ -- 6
48
-write$ -- 62

+ 0
- 650
SemSEpaper/exercises.log ファイルの表示

@@ -1,650 +0,0 @@
1
-This is pdfTeX, Version 3.141592653-2.6-1.40.25 (MiKTeX 23.5) (preloaded format=pdflatex 2023.6.4)  27 OCT 2023 11:03
2
-entering extended mode
3
- restricted \write18 enabled.
4
- %&-line parsing enabled.
5
-**./exercises.tex
6
-(exercises.tex
7
-LaTeX2e <2022-11-01> patch level 1
8
-L3 programming layer <2023-05-15>
9
-(d:\Users\Forest\AppData\Local\Programs\MiKTeX\tex/latex/base\article.cls
10
-Document Class: article 2022/07/02 v1.4n Standard LaTeX document class
11
-(d:\Users\Forest\AppData\Local\Programs\MiKTeX\tex/latex/base\size10.clo
12
-File: size10.clo 2022/07/02 v1.4n Standard LaTeX file (size option)
13
-)
14
-\c@part=\count185
15
-\c@section=\count186
16
-\c@subsection=\count187
17
-\c@subsubsection=\count188
18
-\c@paragraph=\count189
19
-\c@subparagraph=\count190
20
-\c@figure=\count191
21
-\c@table=\count192
22
-\abovecaptionskip=\skip48
23
-\belowcaptionskip=\skip49
24
-\bibindent=\dimen140
25
-)
26
-(d:\Users\Forest\AppData\Local\Programs\MiKTeX\tex/latex/base\latexsym.sty
27
-Package: latexsym 1998/08/17 v2.2e Standard LaTeX package (lasy symbols)
28
-\symlasy=\mathgroup4
29
-LaTeX Font Info:    Overwriting symbol font `lasy' in version `bold'
30
-(Font)                  U/lasy/m/n --> U/lasy/b/n on input line 52.
31
-)
32
-(d:\Users\Forest\AppData\Local\Programs\MiKTeX\tex/latex/amsfonts\amssymb.sty
33
-Package: amssymb 2013/01/14 v3.01 AMS font symbols
34
-
35
-(d:\Users\Forest\AppData\Local\Programs\MiKTeX\tex/latex/amsfonts\amsfonts.sty
36
-Package: amsfonts 2013/01/14 v3.01 Basic AMSFonts support
37
-\@emptytoks=\toks16
38
-\symAMSa=\mathgroup5
39
-\symAMSb=\mathgroup6
40
-LaTeX Font Info:    Redeclaring math symbol \hbar on input line 98.
41
-LaTeX Font Info:    Overwriting math alphabet `\mathfrak' in version `bold'
42
-(Font)                  U/euf/m/n --> U/euf/b/n on input line 106.
43
-)) (d:\Users\Forest\AppData\Local\Programs\MiKTeX\tex/latex/graphics\epsfig.sty
44
-Package: epsfig 2017/06/25 v1.7b (e)psfig emulation (SPQR)
45
-
46
-(d:\Users\Forest\AppData\Local\Programs\MiKTeX\tex/latex/graphics\graphicx.sty
47
-Package: graphicx 2021/09/16 v1.2d Enhanced LaTeX Graphics (DPC,SPQR)
48
-
49
-(d:\Users\Forest\AppData\Local\Programs\MiKTeX\tex/latex/graphics\keyval.sty
50
-Package: keyval 2022/05/29 v1.15 key=value parser (DPC)
51
-\KV@toks@=\toks17
52
-)
53
-(d:\Users\Forest\AppData\Local\Programs\MiKTeX\tex/latex/graphics\graphics.sty
54
-Package: graphics 2022/03/10 v1.4e Standard LaTeX Graphics (DPC,SPQR)
55
-
56
-(d:\Users\Forest\AppData\Local\Programs\MiKTeX\tex/latex/graphics\trig.sty
57
-Package: trig 2021/08/11 v1.11 sin cos tan (DPC)
58
-)
59
-(d:\Users\Forest\AppData\Local\Programs\MiKTeX\tex/latex/graphics-cfg\graphics.
60
-cfg
61
-File: graphics.cfg 2016/06/04 v1.11 sample graphics configuration
62
-)
63
-Package graphics Info: Driver file: pdftex.def on input line 107.
64
-
65
-(d:\Users\Forest\AppData\Local\Programs\MiKTeX\tex/latex/graphics-def\pdftex.de
66
-f
67
-File: pdftex.def 2022/09/22 v1.2b Graphics/color driver for pdftex
68
-))
69
-\Gin@req@height=\dimen141
70
-\Gin@req@width=\dimen142
71
-)
72
-\epsfxsize=\dimen143
73
-\epsfysize=\dimen144
74
-)
75
-(d:\Users\Forest\AppData\Local\Programs\MiKTeX\tex/latex/preprint\fullpage.sty
76
-Package: fullpage 1999/02/23 1.1 (PWD)
77
-\FP@margin=\skip50
78
-) (d:\Users\Forest\AppData\Local\Programs\MiKTeX\tex/latex/tools\enumerate.sty
79
-Package: enumerate 2015/07/23 v3.00 enumerate extensions (DPC)
80
-\@enLab=\toks18
81
-)
82
-(d:\Users\Forest\AppData\Local\Programs\MiKTeX\tex/latex/tools\xspace.sty
83
-Package: xspace 2014/10/28 v1.13 Space after command names (DPC,MH)
84
-)
85
-(d:\Users\Forest\AppData\Local\Programs\MiKTeX\tex/latex/todonotes\todonotes.st
86
-y
87
-Package: todonotes 2023/01/31 v1.1.6 Todonotes source and documentation.
88
-Package: todonotes 2023/01/31
89
- (d:\Users\Forest\AppData\Local\Programs\MiKTeX\tex/latex/base\ifthen.sty
90
-Package: ifthen 2022/04/13 v1.1d Standard LaTeX ifthen package (DPC)
91
-)
92
-(d:\Users\Forest\AppData\Local\Programs\MiKTeX\tex/latex/xkeyval\xkeyval.sty
93
-Package: xkeyval 2022/06/16 v2.9 package option processing (HA)
94
-
95
-(d:\Users\Forest\AppData\Local\Programs\MiKTeX\tex/generic/xkeyval\xkeyval.tex
96
-(d:\Users\Forest\AppData\Local\Programs\MiKTeX\tex/generic/xkeyval\xkvutils.tex
97
-\XKV@toks=\toks19
98
-\XKV@tempa@toks=\toks20
99
-)
100
-\XKV@depth=\count193
101
-File: xkeyval.tex 2014/12/03 v2.7a key=value parser (HA)
102
-)) (d:\Users\Forest\AppData\Local\Programs\MiKTeX\tex/latex/xcolor\xcolor.sty
103
-Package: xcolor 2022/06/12 v2.14 LaTeX color extensions (UK)
104
-
105
-(d:\Users\Forest\AppData\Local\Programs\MiKTeX\tex/latex/graphics-cfg\color.cfg
106
-File: color.cfg 2016/01/02 v1.6 sample color configuration
107
-)
108
-Package xcolor Info: Driver file: pdftex.def on input line 227.
109
-
110
-(d:\Users\Forest\AppData\Local\Programs\MiKTeX\tex/latex/graphics\mathcolor.ltx
111
-)
112
-Package xcolor Info: Model `cmy' substituted by `cmy0' on input line 1353.
113
-Package xcolor Info: Model `hsb' substituted by `rgb' on input line 1357.
114
-Package xcolor Info: Model `RGB' extended on input line 1369.
115
-Package xcolor Info: Model `HTML' substituted by `rgb' on input line 1371.
116
-Package xcolor Info: Model `Hsb' substituted by `hsb' on input line 1372.
117
-Package xcolor Info: Model `tHsb' substituted by `hsb' on input line 1373.
118
-Package xcolor Info: Model `HSB' substituted by `hsb' on input line 1374.
119
-Package xcolor Info: Model `Gray' substituted by `gray' on input line 1375.
120
-Package xcolor Info: Model `wave' substituted by `hsb' on input line 1376.
121
-)
122
-(d:\Users\Forest\AppData\Local\Programs\MiKTeX\tex/latex/pgf/frontendlayer\tikz
123
-.sty
124
-(d:\Users\Forest\AppData\Local\Programs\MiKTeX\tex/latex/pgf/basiclayer\pgf.sty
125
-
126
-(d:\Users\Forest\AppData\Local\Programs\MiKTeX\tex/latex/pgf/utilities\pgfrcs.s
127
-ty
128
-(d:\Users\Forest\AppData\Local\Programs\MiKTeX\tex/generic/pgf/utilities\pgfuti
129
-l-common.tex
130
-\pgfutil@everybye=\toks21
131
-\pgfutil@tempdima=\dimen145
132
-\pgfutil@tempdimb=\dimen146
133
-)
134
-(d:\Users\Forest\AppData\Local\Programs\MiKTeX\tex/generic/pgf/utilities\pgfuti
135
-l-latex.def
136
-\pgfutil@abb=\box51
137
-)
138
-(d:\Users\Forest\AppData\Local\Programs\MiKTeX\tex/generic/pgf/utilities\pgfrcs
139
-.code.tex
140
-(d:\Users\Forest\AppData\Local\Programs\MiKTeX\tex/generic/pgf\pgf.revision.tex
141
-)
142
-Package: pgfrcs 2023-01-15 v3.1.10 (3.1.10)
143
-))
144
-Package: pgf 2023-01-15 v3.1.10 (3.1.10)
145
-
146
-(d:\Users\Forest\AppData\Local\Programs\MiKTeX\tex/latex/pgf/basiclayer\pgfcore
147
-.sty
148
-(d:\Users\Forest\AppData\Local\Programs\MiKTeX\tex/latex/pgf/systemlayer\pgfsys
149
-.sty
150
-(d:\Users\Forest\AppData\Local\Programs\MiKTeX\tex/generic/pgf/systemlayer\pgfs
151
-ys.code.tex
152
-Package: pgfsys 2023-01-15 v3.1.10 (3.1.10)
153
-
154
-(d:\Users\Forest\AppData\Local\Programs\MiKTeX\tex/generic/pgf/utilities\pgfkey
155
-s.code.tex
156
-\pgfkeys@pathtoks=\toks22
157
-\pgfkeys@temptoks=\toks23
158
-
159
-(d:\Users\Forest\AppData\Local\Programs\MiKTeX\tex/generic/pgf/utilities\pgfkey
160
-slibraryfiltered.code.tex
161
-\pgfkeys@tmptoks=\toks24
162
-))
163
-\pgf@x=\dimen147
164
-\pgf@y=\dimen148
165
-\pgf@xa=\dimen149
166
-\pgf@ya=\dimen150
167
-\pgf@xb=\dimen151
168
-\pgf@yb=\dimen152
169
-\pgf@xc=\dimen153
170
-\pgf@yc=\dimen154
171
-\pgf@xd=\dimen155
172
-\pgf@yd=\dimen156
173
-\w@pgf@writea=\write3
174
-\r@pgf@reada=\read2
175
-\c@pgf@counta=\count194
176
-\c@pgf@countb=\count195
177
-\c@pgf@countc=\count196
178
-\c@pgf@countd=\count197
179
-\t@pgf@toka=\toks25
180
-\t@pgf@tokb=\toks26
181
-\t@pgf@tokc=\toks27
182
-\pgf@sys@id@count=\count198
183
-
184
-(d:\Users\Forest\AppData\Local\Programs\MiKTeX\tex/generic/pgf/systemlayer\pgf.
185
-cfg
186
-File: pgf.cfg 2023-01-15 v3.1.10 (3.1.10)
187
-)
188
-Driver file for pgf: pgfsys-pdftex.def
189
-
190
-(d:\Users\Forest\AppData\Local\Programs\MiKTeX\tex/generic/pgf/systemlayer\pgfs
191
-ys-pdftex.def
192
-File: pgfsys-pdftex.def 2023-01-15 v3.1.10 (3.1.10)
193
-
194
-(d:\Users\Forest\AppData\Local\Programs\MiKTeX\tex/generic/pgf/systemlayer\pgfs
195
-ys-common-pdf.def
196
-File: pgfsys-common-pdf.def 2023-01-15 v3.1.10 (3.1.10)
197
-)))
198
-(d:\Users\Forest\AppData\Local\Programs\MiKTeX\tex/generic/pgf/systemlayer\pgfs
199
-yssoftpath.code.tex
200
-File: pgfsyssoftpath.code.tex 2023-01-15 v3.1.10 (3.1.10)
201
-\pgfsyssoftpath@smallbuffer@items=\count199
202
-\pgfsyssoftpath@bigbuffer@items=\count266
203
-)
204
-(d:\Users\Forest\AppData\Local\Programs\MiKTeX\tex/generic/pgf/systemlayer\pgfs
205
-ysprotocol.code.tex
206
-File: pgfsysprotocol.code.tex 2023-01-15 v3.1.10 (3.1.10)
207
-))
208
-(d:\Users\Forest\AppData\Local\Programs\MiKTeX\tex/generic/pgf/basiclayer\pgfco
209
-re.code.tex
210
-Package: pgfcore 2023-01-15 v3.1.10 (3.1.10)
211
-
212
-(d:\Users\Forest\AppData\Local\Programs\MiKTeX\tex/generic/pgf/math\pgfmath.cod
213
-e.tex
214
-(d:\Users\Forest\AppData\Local\Programs\MiKTeX\tex/generic/pgf/math\pgfmathutil
215
-.code.tex)
216
-(d:\Users\Forest\AppData\Local\Programs\MiKTeX\tex/generic/pgf/math\pgfmathpars
217
-er.code.tex
218
-\pgfmath@dimen=\dimen157
219
-\pgfmath@count=\count267
220
-\pgfmath@box=\box52
221
-\pgfmath@toks=\toks28
222
-\pgfmath@stack@operand=\toks29
223
-\pgfmath@stack@operation=\toks30
224
-)
225
-(d:\Users\Forest\AppData\Local\Programs\MiKTeX\tex/generic/pgf/math\pgfmathfunc
226
-tions.code.tex)
227
-(d:\Users\Forest\AppData\Local\Programs\MiKTeX\tex/generic/pgf/math\pgfmathfunc
228
-tions.basic.code.tex)
229
-(d:\Users\Forest\AppData\Local\Programs\MiKTeX\tex/generic/pgf/math\pgfmathfunc
230
-tions.trigonometric.code.tex)
231
-(d:\Users\Forest\AppData\Local\Programs\MiKTeX\tex/generic/pgf/math\pgfmathfunc
232
-tions.random.code.tex)
233
-(d:\Users\Forest\AppData\Local\Programs\MiKTeX\tex/generic/pgf/math\pgfmathfunc
234
-tions.comparison.code.tex)
235
-(d:\Users\Forest\AppData\Local\Programs\MiKTeX\tex/generic/pgf/math\pgfmathfunc
236
-tions.base.code.tex)
237
-(d:\Users\Forest\AppData\Local\Programs\MiKTeX\tex/generic/pgf/math\pgfmathfunc
238
-tions.round.code.tex)
239
-(d:\Users\Forest\AppData\Local\Programs\MiKTeX\tex/generic/pgf/math\pgfmathfunc
240
-tions.misc.code.tex)
241
-(d:\Users\Forest\AppData\Local\Programs\MiKTeX\tex/generic/pgf/math\pgfmathfunc
242
-tions.integerarithmetics.code.tex)
243
-(d:\Users\Forest\AppData\Local\Programs\MiKTeX\tex/generic/pgf/math\pgfmathcalc
244
-.code.tex)
245
-(d:\Users\Forest\AppData\Local\Programs\MiKTeX\tex/generic/pgf/math\pgfmathfloa
246
-t.code.tex
247
-\c@pgfmathroundto@lastzeros=\count268
248
-))
249
-(d:\Users\Forest\AppData\Local\Programs\MiKTeX\tex/generic/pgf/math\pgfint.code
250
-.tex)
251
-(d:\Users\Forest\AppData\Local\Programs\MiKTeX\tex/generic/pgf/basiclayer\pgfco
252
-repoints.code.tex
253
-File: pgfcorepoints.code.tex 2023-01-15 v3.1.10 (3.1.10)
254
-\pgf@picminx=\dimen158
255
-\pgf@picmaxx=\dimen159
256
-\pgf@picminy=\dimen160
257
-\pgf@picmaxy=\dimen161
258
-\pgf@pathminx=\dimen162
259
-\pgf@pathmaxx=\dimen163
260
-\pgf@pathminy=\dimen164
261
-\pgf@pathmaxy=\dimen165
262
-\pgf@xx=\dimen166
263
-\pgf@xy=\dimen167
264
-\pgf@yx=\dimen168
265
-\pgf@yy=\dimen169
266
-\pgf@zx=\dimen170
267
-\pgf@zy=\dimen171
268
-)
269
-(d:\Users\Forest\AppData\Local\Programs\MiKTeX\tex/generic/pgf/basiclayer\pgfco
270
-repathconstruct.code.tex
271
-File: pgfcorepathconstruct.code.tex 2023-01-15 v3.1.10 (3.1.10)
272
-\pgf@path@lastx=\dimen172
273
-\pgf@path@lasty=\dimen173
274
-)
275
-(d:\Users\Forest\AppData\Local\Programs\MiKTeX\tex/generic/pgf/basiclayer\pgfco
276
-repathusage.code.tex
277
-File: pgfcorepathusage.code.tex 2023-01-15 v3.1.10 (3.1.10)
278
-\pgf@shorten@end@additional=\dimen174
279
-\pgf@shorten@start@additional=\dimen175
280
-)
281
-(d:\Users\Forest\AppData\Local\Programs\MiKTeX\tex/generic/pgf/basiclayer\pgfco
282
-rescopes.code.tex
283
-File: pgfcorescopes.code.tex 2023-01-15 v3.1.10 (3.1.10)
284
-\pgfpic=\box53
285
-\pgf@hbox=\box54
286
-\pgf@layerbox@main=\box55
287
-\pgf@picture@serial@count=\count269
288
-)
289
-(d:\Users\Forest\AppData\Local\Programs\MiKTeX\tex/generic/pgf/basiclayer\pgfco
290
-regraphicstate.code.tex
291
-File: pgfcoregraphicstate.code.tex 2023-01-15 v3.1.10 (3.1.10)
292
-\pgflinewidth=\dimen176
293
-)
294
-(d:\Users\Forest\AppData\Local\Programs\MiKTeX\tex/generic/pgf/basiclayer\pgfco
295
-retransformations.code.tex
296
-File: pgfcoretransformations.code.tex 2023-01-15 v3.1.10 (3.1.10)
297
-\pgf@pt@x=\dimen177
298
-\pgf@pt@y=\dimen178
299
-\pgf@pt@temp=\dimen179
300
-)
301
-(d:\Users\Forest\AppData\Local\Programs\MiKTeX\tex/generic/pgf/basiclayer\pgfco
302
-requick.code.tex
303
-File: pgfcorequick.code.tex 2023-01-15 v3.1.10 (3.1.10)
304
-)
305
-(d:\Users\Forest\AppData\Local\Programs\MiKTeX\tex/generic/pgf/basiclayer\pgfco
306
-reobjects.code.tex
307
-File: pgfcoreobjects.code.tex 2023-01-15 v3.1.10 (3.1.10)
308
-)
309
-(d:\Users\Forest\AppData\Local\Programs\MiKTeX\tex/generic/pgf/basiclayer\pgfco
310
-repathprocessing.code.tex
311
-File: pgfcorepathprocessing.code.tex 2023-01-15 v3.1.10 (3.1.10)
312
-)
313
-(d:\Users\Forest\AppData\Local\Programs\MiKTeX\tex/generic/pgf/basiclayer\pgfco
314
-rearrows.code.tex
315
-File: pgfcorearrows.code.tex 2023-01-15 v3.1.10 (3.1.10)
316
-\pgfarrowsep=\dimen180
317
-)
318
-(d:\Users\Forest\AppData\Local\Programs\MiKTeX\tex/generic/pgf/basiclayer\pgfco
319
-reshade.code.tex
320
-File: pgfcoreshade.code.tex 2023-01-15 v3.1.10 (3.1.10)
321
-\pgf@max=\dimen181
322
-\pgf@sys@shading@range@num=\count270
323
-\pgf@shadingcount=\count271
324
-)
325
-(d:\Users\Forest\AppData\Local\Programs\MiKTeX\tex/generic/pgf/basiclayer\pgfco
326
-reimage.code.tex
327
-File: pgfcoreimage.code.tex 2023-01-15 v3.1.10 (3.1.10)
328
-)
329
-(d:\Users\Forest\AppData\Local\Programs\MiKTeX\tex/generic/pgf/basiclayer\pgfco
330
-reexternal.code.tex
331
-File: pgfcoreexternal.code.tex 2023-01-15 v3.1.10 (3.1.10)
332
-\pgfexternal@startupbox=\box56
333
-)
334
-(d:\Users\Forest\AppData\Local\Programs\MiKTeX\tex/generic/pgf/basiclayer\pgfco
335
-relayers.code.tex
336
-File: pgfcorelayers.code.tex 2023-01-15 v3.1.10 (3.1.10)
337
-)
338
-(d:\Users\Forest\AppData\Local\Programs\MiKTeX\tex/generic/pgf/basiclayer\pgfco
339
-retransparency.code.tex
340
-File: pgfcoretransparency.code.tex 2023-01-15 v3.1.10 (3.1.10)
341
-)
342
-(d:\Users\Forest\AppData\Local\Programs\MiKTeX\tex/generic/pgf/basiclayer\pgfco
343
-repatterns.code.tex
344
-File: pgfcorepatterns.code.tex 2023-01-15 v3.1.10 (3.1.10)
345
-)
346
-(d:\Users\Forest\AppData\Local\Programs\MiKTeX\tex/generic/pgf/basiclayer\pgfco
347
-rerdf.code.tex
348
-File: pgfcorerdf.code.tex 2023-01-15 v3.1.10 (3.1.10)
349
-)))
350
-(d:\Users\Forest\AppData\Local\Programs\MiKTeX\tex/generic/pgf/modules\pgfmodul
351
-eshapes.code.tex
352
-File: pgfmoduleshapes.code.tex 2023-01-15 v3.1.10 (3.1.10)
353
-\pgfnodeparttextbox=\box57
354
-)
355
-(d:\Users\Forest\AppData\Local\Programs\MiKTeX\tex/generic/pgf/modules\pgfmodul
356
-eplot.code.tex
357
-File: pgfmoduleplot.code.tex 2023-01-15 v3.1.10 (3.1.10)
358
-)
359
-(d:\Users\Forest\AppData\Local\Programs\MiKTeX\tex/latex/pgf/compatibility\pgfc
360
-omp-version-0-65.sty
361
-Package: pgfcomp-version-0-65 2023-01-15 v3.1.10 (3.1.10)
362
-\pgf@nodesepstart=\dimen182
363
-\pgf@nodesepend=\dimen183
364
-)
365
-(d:\Users\Forest\AppData\Local\Programs\MiKTeX\tex/latex/pgf/compatibility\pgfc
366
-omp-version-1-18.sty
367
-Package: pgfcomp-version-1-18 2023-01-15 v3.1.10 (3.1.10)
368
-))
369
-(d:\Users\Forest\AppData\Local\Programs\MiKTeX\tex/latex/pgf/utilities\pgffor.s
370
-ty
371
-(d:\Users\Forest\AppData\Local\Programs\MiKTeX\tex/latex/pgf/utilities\pgfkeys.
372
-sty
373
-(d:\Users\Forest\AppData\Local\Programs\MiKTeX\tex/generic/pgf/utilities\pgfkey
374
-s.code.tex))
375
-(d:\Users\Forest\AppData\Local\Programs\MiKTeX\tex/latex/pgf/math\pgfmath.sty
376
-(d:\Users\Forest\AppData\Local\Programs\MiKTeX\tex/generic/pgf/math\pgfmath.cod
377
-e.tex))
378
-(d:\Users\Forest\AppData\Local\Programs\MiKTeX\tex/generic/pgf/utilities\pgffor
379
-.code.tex
380
-Package: pgffor 2023-01-15 v3.1.10 (3.1.10)
381
-\pgffor@iter=\dimen184
382
-\pgffor@skip=\dimen185
383
-\pgffor@stack=\toks31
384
-\pgffor@toks=\toks32
385
-))
386
-(d:\Users\Forest\AppData\Local\Programs\MiKTeX\tex/generic/pgf/frontendlayer/ti
387
-kz\tikz.code.tex
388
-Package: tikz 2023-01-15 v3.1.10 (3.1.10)
389
-
390
-(d:\Users\Forest\AppData\Local\Programs\MiKTeX\tex/generic/pgf/libraries\pgflib
391
-raryplothandlers.code.tex
392
-File: pgflibraryplothandlers.code.tex 2023-01-15 v3.1.10 (3.1.10)
393
-\pgf@plot@mark@count=\count272
394
-\pgfplotmarksize=\dimen186
395
-)
396
-\tikz@lastx=\dimen187
397
-\tikz@lasty=\dimen188
398
-\tikz@lastxsaved=\dimen189
399
-\tikz@lastysaved=\dimen190
400
-\tikz@lastmovetox=\dimen191
401
-\tikz@lastmovetoy=\dimen192
402
-\tikzleveldistance=\dimen193
403
-\tikzsiblingdistance=\dimen194
404
-\tikz@figbox=\box58
405
-\tikz@figbox@bg=\box59
406
-\tikz@tempbox=\box60
407
-\tikz@tempbox@bg=\box61
408
-\tikztreelevel=\count273
409
-\tikznumberofchildren=\count274
410
-\tikznumberofcurrentchild=\count275
411
-\tikz@fig@count=\count276
412
-
413
-(d:\Users\Forest\AppData\Local\Programs\MiKTeX\tex/generic/pgf/modules\pgfmodul
414
-ematrix.code.tex
415
-File: pgfmodulematrix.code.tex 2023-01-15 v3.1.10 (3.1.10)
416
-\pgfmatrixcurrentrow=\count277
417
-\pgfmatrixcurrentcolumn=\count278
418
-\pgf@matrix@numberofcolumns=\count279
419
-)
420
-\tikz@expandcount=\count280
421
-
422
-(d:\Users\Forest\AppData\Local\Programs\MiKTeX\tex/generic/pgf/frontendlayer/ti
423
-kz/libraries\tikzlibrarytopaths.code.tex
424
-File: tikzlibrarytopaths.code.tex 2023-01-15 v3.1.10 (3.1.10)
425
-)))
426
-(d:\Users\Forest\AppData\Local\Programs\MiKTeX\tex/generic/pgf/frontendlayer/ti
427
-kz/libraries\tikzlibrarypositioning.code.tex
428
-File: tikzlibrarypositioning.code.tex 2023-01-15 v3.1.10 (3.1.10)
429
-)
430
-(d:\Users\Forest\AppData\Local\Programs\MiKTeX\tex/latex/tools\calc.sty
431
-Package: calc 2017/05/25 v4.3 Infix arithmetic (KKT,FJ)
432
-\calc@Acount=\count281
433
-\calc@Bcount=\count282
434
-\calc@Adimen=\dimen195
435
-\calc@Bdimen=\dimen196
436
-\calc@Askip=\skip51
437
-\calc@Bskip=\skip52
438
-LaTeX Info: Redefining \setlength on input line 80.
439
-LaTeX Info: Redefining \addtolength on input line 81.
440
-\calc@Ccount=\count283
441
-\calc@Cskip=\skip53
442
-)
443
-\c@@todonotes@numberoftodonotes=\count284
444
-)
445
-(d:\Users\Forest\AppData\Local\Programs\MiKTeX\tex/latex/listings\listings.sty
446
-\lst@mode=\count285
447
-\lst@gtempboxa=\box62
448
-\lst@token=\toks33
449
-\lst@length=\count286
450
-\lst@currlwidth=\dimen197
451
-\lst@column=\count287
452
-\lst@pos=\count288
453
-\lst@lostspace=\dimen198
454
-\lst@width=\dimen199
455
-\lst@newlines=\count289
456
-\lst@lineno=\count290
457
-\lst@maxwidth=\dimen256
458
-
459
-(d:\Users\Forest\AppData\Local\Programs\MiKTeX\tex/latex/listings\lstmisc.sty
460
-File: lstmisc.sty 2023/02/27 1.9 (Carsten Heinz)
461
-\c@lstnumber=\count291
462
-\lst@skipnumbers=\count292
463
-\lst@framebox=\box63
464
-)
465
-(d:\Users\Forest\AppData\Local\Programs\MiKTeX\tex/latex/listings\listings.cfg
466
-File: listings.cfg 2023/02/27 1.9 listings configuration
467
-))
468
-Package: listings 2023/02/27 1.9 (Carsten Heinz)
469
-
470
-(d:\Users\Forest\AppData\Local\Programs\MiKTeX\tex/latex/algorithm2e\algorithm2
471
-e.sty
472
-Package: algorithm2e 2017/07/18 v5.2 algorithms environments
473
-\c@AlgoLine=\count293
474
-\algocf@hangindent=\skip54
475
-
476
-(d:\Users\Forest\AppData\Local\Programs\MiKTeX\tex/latex/ifoddpage\ifoddpage.st
477
-y
478
-Package: ifoddpage 2022/10/18 v1.2 Conditionals for odd/even page detection
479
-\c@checkoddpage=\count294
480
-) (d:\Users\Forest\AppData\Local\Programs\MiKTeX\tex/latex/relsize\relsize.sty
481
-Package: relsize 2013/03/29 ver 4.1
482
-)
483
-\skiptotal=\skip55
484
-\skiplinenumber=\skip56
485
-\skiprule=\skip57
486
-\skiphlne=\skip58
487
-\skiptext=\skip59
488
-\skiplength=\skip60
489
-\algomargin=\skip61
490
-\skipalgocfslide=\skip62
491
-\algowidth=\dimen257
492
-\inoutsize=\dimen258
493
-\inoutindent=\dimen259
494
-\interspacetitleruled=\dimen260
495
-\interspacealgoruled=\dimen261
496
-\interspacetitleboxruled=\dimen262
497
-\algocf@ruledwidth=\skip63
498
-\algocf@inoutbox=\box64
499
-\algocf@inputbox=\box65
500
-\AlCapSkip=\skip64
501
-\AlCapHSkip=\skip65
502
-\algoskipindent=\skip66
503
-\algocf@nlbox=\box66
504
-\algocf@hangingbox=\box67
505
-\algocf@untilbox=\box68
506
-\algocf@skipuntil=\skip67
507
-\algocf@capbox=\box69
508
-\algocf@lcaptionbox=\skip68
509
-\algoheightruledefault=\skip69
510
-\algoheightrule=\skip70
511
-\algotitleheightruledefault=\skip71
512
-\algotitleheightrule=\skip72
513
-\c@algocfline=\count295
514
-\c@algocfproc=\count296
515
-\c@algocf=\count297
516
-\algocf@algoframe=\box70
517
-\algocf@algobox=\box71
518
-) (d:\Users\Forest\AppData\Local\Programs\MiKTeX\tex/latex/float\float.sty
519
-Package: float 2001/11/08 v1.3d Float enhancements (AL)
520
-\c@float@type=\count298
521
-\float@exts=\toks34
522
-\float@box=\box72
523
-\@float@everytoks=\toks35
524
-\@floatcapt=\box73
525
-)
526
-\c@theorem=\count299
527
-
528
-(d:\Users\Forest\AppData\Local\Programs\MiKTeX\tex/latex/l3backend\l3backend-pd
529
-ftex.def
530
-File: l3backend-pdftex.def 2023-04-19 L3 backend support: PDF output (pdfTeX)
531
-\l__color_backend_stack_int=\count300
532
-\l__pdf_internal_box=\box74
533
-) (exercises.aux)
534
-\openout1 = `exercises.aux'.
535
-
536
-LaTeX Font Info:    Checking defaults for OML/cmm/m/it on input line 70.
537
-LaTeX Font Info:    ... okay on input line 70.
538
-LaTeX Font Info:    Checking defaults for OMS/cmsy/m/n on input line 70.
539
-LaTeX Font Info:    ... okay on input line 70.
540
-LaTeX Font Info:    Checking defaults for OT1/cmr/m/n on input line 70.
541
-LaTeX Font Info:    ... okay on input line 70.
542
-LaTeX Font Info:    Checking defaults for T1/cmr/m/n on input line 70.
543
-LaTeX Font Info:    ... okay on input line 70.
544
-LaTeX Font Info:    Checking defaults for TS1/cmr/m/n on input line 70.
545
-LaTeX Font Info:    ... okay on input line 70.
546
-LaTeX Font Info:    Checking defaults for OMX/cmex/m/n on input line 70.
547
-LaTeX Font Info:    ... okay on input line 70.
548
-LaTeX Font Info:    Checking defaults for U/cmr/m/n on input line 70.
549
-LaTeX Font Info:    ... okay on input line 70.
550
-
551
-(d:\Users\Forest\AppData\Local\Programs\MiKTeX\tex/context/base/mkii\supp-pdf.m
552
-kii
553
-[Loading MPS to PDF converter (version 2006.09.02).]
554
-\scratchcounter=\count301
555
-\scratchdimen=\dimen263
556
-\scratchbox=\box75
557
-\nofMPsegments=\count302
558
-\nofMParguments=\count303
559
-\everyMPshowfont=\toks36
560
-\MPscratchCnt=\count304
561
-\MPscratchDim=\dimen264
562
-\MPnumerator=\count305
563
-\makeMPintoPDFobject=\count306
564
-\everyMPtoPDFconversion=\toks37
565
-)
566
-(d:\Users\Forest\AppData\Local\Programs\MiKTeX\tex/latex/epstopdf-pkg\epstopdf-
567
-base.sty
568
-Package: epstopdf-base 2020-01-24 v2.11 Base part for package epstopdf
569
-Package epstopdf-base Info: Redefining graphics rule for `.eps' on input line 4
570
-85.
571
-
572
-(d:\Users\Forest\AppData\Local\Programs\MiKTeX\tex/latex/00miktex\epstopdf-sys.
573
-cfg
574
-File: epstopdf-sys.cfg 2021/03/18 v2.0 Configuration of epstopdf for MiKTeX
575
-))
576
-\c@lstlisting=\count307
577
-LaTeX Font Info:    Trying to load font information for U+lasy on input line 73
578
-.
579
- (d:\Users\Forest\AppData\Local\Programs\MiKTeX\tex/latex/base\ulasy.fd
580
-File: ulasy.fd 1998/08/17 v2.2e LaTeX symbol font definitions
581
-)
582
-LaTeX Font Info:    Trying to load font information for U+msa on input line 73.
583
-
584
-
585
-(d:\Users\Forest\AppData\Local\Programs\MiKTeX\tex/latex/amsfonts\umsa.fd
586
-File: umsa.fd 2013/01/14 v3.01 AMS symbols A
587
-)
588
-LaTeX Font Info:    Trying to load font information for U+msb on input line 73.
589
-
590
-
591
-(d:\Users\Forest\AppData\Local\Programs\MiKTeX\tex/latex/amsfonts\umsb.fd
592
-File: umsb.fd 2013/01/14 v3.01 AMS symbols B
593
-)
594
-(d:\Users\Forest\AppData\Local\Programs\MiKTeX\tex/latex/listings\lstlang1.sty
595
-File: lstlang1.sty 2023/02/27 1.9 listings language file
596
-)
597
-Overfull \hbox (15.0pt too wide) detected at line 117
598
-[][] 
599
- []
600
-
601
-[1
602
-
603
-{C:/Users/Forest/AppData/Local/MiKTeX/fonts/map/pdftex/pdftex.map}]
604
-Overfull \hbox (15.0pt too wide) detected at line 156
605
-[][] 
606
- []
607
-
608
-[2] (exercises.bbl
609
-! Undefined control sequence.
610
-l.15   \url
611
-           {https://github.com/Arachnid/uscc/tree/master/submissions-2017/do...
612
-The control sequence at the end of the top line
613
-of your error message was never \def'ed. If you have
614
-misspelled it (e.g., `\hobx'), type `I' and the correct
615
-spelling (e.g., `I\hbox'). Otherwise just continue,
616
-and I'll forget about whatever was undefined.
617
-
618
-
619
-Overfull \hbox (1.15688pt too wide) in paragraph at lines 12--17
620
-[]\OT1/cmr/m/n/10 doughoyte.  Merdeto-ken: It's some hot shit.  https://github.
621
-com/Arachnid/uscc/tree/master/submissions-
622
- []
623
-
624
-[3]) [4] (exercises.aux) ) 
625
-Here is how much of TeX's memory you used:
626
- 16580 strings out of 476410
627
- 323857 string characters out of 5788642
628
- 2009845 words of memory out of 5000000
629
- 36658 multiletter control sequences out of 15000+600000
630
- 521468 words of font info for 72 fonts, out of 8000000 for 9000
631
- 1141 hyphenation exceptions out of 8191
632
- 99i,9n,94p,510b,1991s stack positions out of 10000i,1000n,20000p,200000b,200000s
633
-<d:/Users/Forest/AppData/Local/Programs/MiKTeX/fonts/
634
-type1/public/amsfonts/cm/cmbx10.pfb><d:/Users/Forest/AppData/Local/Programs/MiK
635
-TeX/fonts/type1/public/amsfonts/cm/cmbx12.pfb><d:/Users/Forest/AppData/Local/Pr
636
-ograms/MiKTeX/fonts/type1/public/amsfonts/cm/cmmi10.pfb><d:/Users/Forest/AppDat
637
-a/Local/Programs/MiKTeX/fonts/type1/public/amsfonts/cm/cmr10.pfb><d:/Users/Fore
638
-st/AppData/Local/Programs/MiKTeX/fonts/type1/public/amsfonts/cm/cmr12.pfb><d:/U
639
-sers/Forest/AppData/Local/Programs/MiKTeX/fonts/type1/public/amsfonts/cm/cmr17.
640
-pfb><d:/Users/Forest/AppData/Local/Programs/MiKTeX/fonts/type1/public/amsfonts/
641
-cm/cmr5.pfb><d:/Users/Forest/AppData/Local/Programs/MiKTeX/fonts/type1/public/a
642
-msfonts/cm/cmr7.pfb><d:/Users/Forest/AppData/Local/Programs/MiKTeX/fonts/type1/
643
-public/amsfonts/cm/cmti10.pfb><d:/Users/Forest/AppData/Local/Programs/MiKTeX/fo
644
-nts/type1/public/amsfonts/cm/cmtt8.pfb>
645
-Output written on exercises.pdf (4 pages, 150280 bytes).
646
-PDF statistics:
647
- 68 PDF objects out of 1000 (max. 8388607)
648
- 0 named destinations out of 1000 (max. 500000)
649
- 13 words of extra memory for PDF output out of 10000 (max. 10000000)
650
-

バイナリ
SemSEpaper/exercises.pdf ファイルの表示


バイナリ
SemSEpaper/exercises.synctex.gz ファイルの表示


+ 87
- 25
SemSEpaper/exercises.tex ファイルの表示

@@ -1,14 +1,15 @@
1 1
 \documentclass [10pt]{article}
2 2
 
3
-  
3
+
4 4
 \usepackage{latexsym}
5 5
 \usepackage{amssymb}
6
-\usepackage{epsfig} 
6
+\usepackage{epsfig}
7 7
 \usepackage{fullpage}
8 8
 \usepackage{enumerate}
9 9
 \usepackage{xspace}
10 10
 \usepackage{todonotes}
11 11
 \usepackage{listings}
12
+\usepackage{url}
12 13
 \usepackage[ruled,linesnumbered]{algorithm2e} % Enables the writing of pseudo code.
13 14
 \usepackage{float}% http://ctan.org/pkg/float
14 15
 
@@ -24,7 +25,7 @@
24 25
 
25 26
 \date{WT 2023/24}
26 27
 
27
-\author{\textbf{*** YOUR NAME AND STUDENT ID ***}}
28
+\author{\textbf{Ivanov, Ivaylo (11777707) \& Millauer, Peter (01350868)}}
28 29
 
29 30
 \newtheorem{theorem}{Theorem}
30 31
 \newtheorem{lemma}[theorem]{Lemma}
@@ -46,23 +47,23 @@
46 47
 \definecolor{codepurple}{rgb}{0.58,0,0.82}
47 48
 \definecolor{backcolour}{rgb}{0.95,0.95,0.92}
48 49
 
49
-\lstdefinestyle{mystyle}{ 
50
-	backgroundcolor=\color{backcolour},   
50
+\lstdefinestyle{mystyle}{
51
+	backgroundcolor=\color{backcolour},
51 52
 	commentstyle=\color{codegreen},
52 53
 	keywordstyle=\color{magenta},
53 54
 	numberstyle=\tiny\color{codegray},
54 55
 	stringstyle=\color{codepurple},
55 56
 	basicstyle=\ttfamily\footnotesize,
56
-	breakatwhitespace=false,         
57
-	breaklines=true,                 
58
-	captionpos=b,                    
59
-	keepspaces=true,                 
60
-	numbers=left,                    
61
-	numbersep=5pt,                  
62
-	showspaces=false,                
57
+	breakatwhitespace=false,
58
+	breaklines=true,
59
+	captionpos=b,
60
+	keepspaces=true,
61
+	numbers=left,
62
+	numbersep=5pt,
63
+	showspaces=false,
63 64
 	showstringspaces=false,
64
-	showtabs=false,                  
65
-	tabsize=2	
65
+	showtabs=false,
66
+	tabsize=2
66 67
 }
67 68
 
68 69
 
@@ -92,33 +93,34 @@ Any unchecked array write is potentially dangerous, as the storage-location of a
92 93
 
93 94
 \medspace
94 95
 
95
-A trivial example of such a vulnerable write operation is shown in Algorithm 1.
96
+A trivial example of such a vulnerable write operation is shown in Algorithm~\ref{alg:vuln-write}.
96 97
 
97 98
 \lstset{style=mystyle}
98 99
 \begin{algorithm}[H]
99 100
 	\begin{lstlisting}[language=Octave]
100 101
 	pragma solidity 0.4.25;
101
-	
102
+
102 103
 	contract MyContract {
103 104
 		address private owner;
104 105
 		uint[] private arr;
105
-		
106
+
106 107
 		constructor() public {
107 108
 			arr = new uint[](0);
108 109
 			owner = msg.sender;
109 110
 		}
110
-		
111
+
111 112
 		function write(unit index, uint value) {
112 113
 			arr[index] = value;
113 114
 		}
114 115
 	}
115 116
 	\end{lstlisting}
116 117
 	\caption{A completely unchecked array write}
118
+  \label{alg:vuln-write}
117 119
 \end{algorithm}
118 120
 
119 121
 \medspace
120 122
 
121
-In the following example (Algorithm 2) the $pop$ function incorrectly checks for an array $length >= 0$, thereby allowing the $length$ value to underflow when called with an empty array. Once this weakness is triggered, $update$ in Algorithm 2 behaves just like $write$ did in Algorithm 1. 
123
+In the following example (Algorithm~\ref{alg:pop-incorrect}) the $pop$ function incorrectly checks for an array $length >= 0$, thereby allowing the $length$ value to underflow when called with an empty array. Once this weakness is triggered, $update$ in Algorithm~\ref{alg:pop-incorrect} behaves just like $write$ did in Algorithm~\ref{alg:pop-incorrect}.
122 124
 
123 125
 \medspace
124 126
 
@@ -126,26 +128,26 @@ In the following example (Algorithm 2) the $pop$ function incorrectly checks for
126 128
 \begin{algorithm}[H]
127 129
 	\begin{lstlisting}[language=Octave]
128 130
 	pragma solidity 0.4.25;
129
-	
131
+
130 132
 	contract MyContract {
131 133
 		address private owner;
132 134
 		uint[] private arr;
133
-		
135
+
134 136
 		constructor() public {
135 137
 			arr = new uint[](0);
136 138
 			owner = msg.sender;
137 139
 		}
138
-		
140
+
139 141
 		function push(value) {
140 142
 			arr[arr.length] = value;
141 143
 			arr.length++;
142 144
 		}
143
-		
145
+
144 146
 		function pop() {
145 147
 			require(arr.length >= 0);
146 148
 			arr.length--;
147 149
 		}
148
-		
150
+
149 151
 		function update(unit index, uint value) {
150 152
 			require(index < arr.length);
151 153
 			arr[index] = value;
@@ -153,8 +155,68 @@ In the following example (Algorithm 2) the $pop$ function incorrectly checks for
153 155
 	}
154 156
 	\end{lstlisting}
155 157
 	\caption{An incorrectly managed array length}
158
+  \label{alg:pop-incorrect}
156 159
 \end{algorithm}
157 160
 
161
+Another weakness that allows arbitrary storage access is unchecked assembly code. Assembly is a powerful tool that allows the developers to get as close to the EVM as they can,
162
+but it may also be very dangerous when not tested correctly. As per the documentation\footnote{\url{https://docs.soliditylang.org/en/latest/assembly.html}}: \textit{"this [inline assembly]
163
+bypasses important safety features and checks of Solidity. You should only use it for tasks that need it, and only if you are confident with using it."}
164
+When given access to such lowlevel structures, a programmer can built-in not only weaknesses similar to the ones described previously, but also others, such as overwriting map locations,
165
+contract variables etc.
166
+
167
+An example for such a weakness is given in Algorithm~\ref{alg:unchecked-assembly}.
168
+
169
+\medspace
170
+
171
+\lstset{style=mystyle}
172
+\begin{algorithm}[H]
173
+	\begin{lstlisting}[language=Octave]
174
+	pragma solidity 0.4.25;
175
+
176
+	contract MyContract {
177
+		address private owner;
178
+    mapping(address => bool) public managers;
179
+
180
+		constructor() public {
181
+			owner = msg.sender;
182
+      setNextUserRole(msg.sender);
183
+		}
184
+
185
+    function setNextManager(address next) internal {
186
+      uint256 slot;
187
+      assembly {
188
+        slot := managers.slot
189
+        sstore(slot, next)
190
+      }
191
+
192
+      bytes32 location = keccak256(abi.encode(160, uint256(slot)));
193
+      assembly {
194
+        sstore(location, true)
195
+      }
196
+		}
197
+
198
+    function registerUser(address user) {
199
+      require(msg.sender == owner);
200
+      setNextManager(user);
201
+    }
202
+
203
+    function cashout() {
204
+      require(managers[msg.sender]);
205
+      address payable manager = msg.sender;
206
+      manager.transfer(address(this).balance);
207
+    }
208
+	}
209
+	\end{lstlisting}
210
+	\caption{An unchecked assembly write to mapping}
211
+  \label{alg:unchecked-assembly}
212
+\end{algorithm}
213
+
214
+The contract has a manager mapping, which should be used as a stack.
215
+The developer has added the \texttt{setNextManager} function, which should set the top of the stack to the latest user as a manager.
216
+The issue is that the function is implemented in such a way, that the stack would not grow, but the first element would always be overwritten - this arises from the fact that the memory slot
217
+of the managers mapping does not point to the memory address on the top of the stack, but instead to the base of it.
218
+The function is then using this slot address directly, without calculating any offset, overwriting the base of the stack.
219
+
158 220
 
159 221
 \section{Vulnerable contracts in literature}
160 222
 
@@ -166,7 +228,7 @@ Automatic detection tools can be broadly categorized into ones employing static
166 228
 
167 229
 \medspace
168 230
 
169
-Initially, the given EVM byte-code is disassembled into a control-flow-graph (CFG). In the second step, the tools identify potentially risky instructions. In the case of arbitrary writes, the instruction of note is $sstore(k,v)$ where both $k$ and $v$ are input-controlled. The tools differ in the way they identify whether or not the values are input-controlled. 
231
+Initially, the given EVM byte-code is disassembled into a control-flow-graph (CFG). In the second step, the tools identify potentially risky instructions. In the case of arbitrary writes, the instruction of note is $sstore(k,v)$ where both $k$ and $v$ are input-controlled. The tools differ in the way they identify whether or not the values are input-controlled.
170 232
 
171 233
 \medspace
172 234
 

読み込み中…
キャンセル
保存