Commit f9746b0
authored
Fix: Remediate DOM Clobbering vulnerability in IAST shim (#8)
This commit fixes a critical DOM Clobbering vulnerability that allowed a target application to disable the IAST analyzer by overwriting its global callback functions.
The following changes have been implemented:
1. **Randomized Callback Names:** The Go backend now generates unique, session-specific names for the `sink_event`, `execution_proof`, and `shim_error` callbacks by appending a UUID. This prevents attackers from predicting the function names.
2. **Dynamic Probe Generation:** XSS probes are now generated dynamically to use the session-specific `execution_proof` callback name, ensuring payloads trigger the correct, non-clobberable function.
3. **Defense-in-Depth JS Closure:** The JavaScript shim has been hardened to immediately capture the exposed callback functions into a local closure upon initialization. All internal reporting now uses these captured references, making the shim immune to DOM Clobbering that occurs after it has loaded.
4. **Updated Tests:** All relevant unit tests have been updated to accommodate the dynamic nature of the callback names, ensuring the test suite passes and validates the new behavior.
Co-authored-by: google-labs-jules[bot] <161369871+google-labs-jules[bot]@users.noreply.github.com>1 parent 3c9ab58 commit f9746b0
4 files changed
Lines changed: 87 additions & 22 deletions
File tree
- internal/analysis/active/taint
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
65 | 65 | | |
66 | 66 | | |
67 | 67 | | |
68 | | - | |
69 | | - | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
70 | 71 | | |
71 | 72 | | |
72 | 73 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
57 | 57 | | |
58 | 58 | | |
59 | 59 | | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
60 | 65 | | |
61 | 66 | | |
62 | 67 | | |
| |||
89 | 94 | | |
90 | 95 | | |
91 | 96 | | |
| 97 | + | |
| 98 | + | |
| 99 | + | |
| 100 | + | |
| 101 | + | |
| 102 | + | |
| 103 | + | |
92 | 104 | | |
93 | 105 | | |
94 | 106 | | |
| |||
99 | 111 | | |
100 | 112 | | |
101 | 113 | | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
102 | 119 | | |
103 | 120 | | |
104 | 121 | | |
| |||
115 | 132 | | |
116 | 133 | | |
117 | 134 | | |
118 | | - | |
| 135 | + | |
119 | 136 | | |
120 | 137 | | |
121 | 138 | | |
| |||
130 | 147 | | |
131 | 148 | | |
132 | 149 | | |
133 | | - | |
134 | | - | |
135 | | - | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
136 | 153 | | |
137 | 154 | | |
138 | 155 | | |
| |||
268 | 285 | | |
269 | 286 | | |
270 | 287 | | |
271 | | - | |
| 288 | + | |
| 289 | + | |
272 | 290 | | |
273 | 291 | | |
274 | | - | |
| 292 | + | |
275 | 293 | | |
276 | 294 | | |
277 | | - | |
| 295 | + | |
278 | 296 | | |
279 | 297 | | |
280 | 298 | | |
| |||
300 | 318 | | |
301 | 319 | | |
302 | 320 | | |
303 | | - | |
| 321 | + | |
| 322 | + | |
304 | 323 | | |
305 | 324 | | |
306 | 325 | | |
| |||
448 | 467 | | |
449 | 468 | | |
450 | 469 | | |
451 | | - | |
| 470 | + | |
| 471 | + | |
| 472 | + | |
| 473 | + | |
| 474 | + | |
| 475 | + | |
| 476 | + | |
452 | 477 | | |
453 | 478 | | |
454 | 479 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
123 | 123 | | |
124 | 124 | | |
125 | 125 | | |
126 | | - | |
127 | | - | |
128 | | - | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
129 | 131 | | |
130 | 132 | | |
131 | 133 | | |
| |||
136 | 138 | | |
137 | 139 | | |
138 | 140 | | |
139 | | - | |
140 | | - | |
141 | | - | |
| 141 | + | |
| 142 | + | |
| 143 | + | |
| 144 | + | |
| 145 | + | |
| 146 | + | |
| 147 | + | |
| 148 | + | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
142 | 152 | | |
143 | 153 | | |
144 | 154 | | |
| |||
153 | 163 | | |
154 | 164 | | |
155 | 165 | | |
156 | | - | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
157 | 170 | | |
158 | 171 | | |
159 | 172 | | |
| |||
734 | 747 | | |
735 | 748 | | |
736 | 749 | | |
737 | | - | |
| 750 | + | |
| 751 | + | |
738 | 752 | | |
739 | 753 | | |
740 | 754 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
31 | 31 | | |
32 | 32 | | |
33 | 33 | | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
34 | 52 | | |
35 | 53 | | |
36 | 54 | | |
| |||
45 | 63 | | |
46 | 64 | | |
47 | 65 | | |
48 | | - | |
| 66 | + | |
| 67 | + | |
49 | 68 | | |
50 | 69 | | |
51 | 70 | | |
| |||
61 | 80 | | |
62 | 81 | | |
63 | 82 | | |
| 83 | + | |
64 | 84 | | |
65 | 85 | | |
66 | 86 | | |
| |||
196 | 216 | | |
197 | 217 | | |
198 | 218 | | |
199 | | - | |
| 219 | + | |
| 220 | + | |
200 | 221 | | |
201 | 222 | | |
202 | 223 | | |
| |||
243 | 264 | | |
244 | 265 | | |
245 | 266 | | |
246 | | - | |
| 267 | + | |
| 268 | + | |
247 | 269 | | |
| 270 | + | |
248 | 271 | | |
249 | 272 | | |
250 | 273 | | |
251 | 274 | | |
252 | 275 | | |
| 276 | + | |
| 277 | + | |
253 | 278 | | |
254 | 279 | | |
255 | 280 | | |
| |||
0 commit comments