-
Notifications
You must be signed in to change notification settings - Fork 7.9k
Commit 120967f
Make some parts of _zend_mm_heap read-only at runtime.
As [presented at
OffensiveCon 2024](https://youtu.be/dqKFHjcK9hM?t=1622), having trivially
callable writeable function pointers at the top of the heap makes it
straightforward to turn a limited write into an arbitrary code execution.
Disabling ZEND_MM_HEAP by default isn't doable, as it's used by a couple of
profilers, so we're making some parts of `_zend_mm_heap` read-only at runtime
instead: this will prevent the custom heap functions pointers from being
hijacked, and we're also throwing the `shadow_key` there as it doesn't hurt to
make it read-only as well.1 parent 37488d6 commit 120967f
1 file changed
+19
-6
lines changedOriginal file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
296 | 296 |
| |
297 | 297 |
| |
298 | 298 |
| |
299 | + | ||
300 | + | ||
301 | + | ||
302 | + | ||
303 | + | ||
304 | + | ||
305 | + | ||
306 | + | ||
307 | + | ||
308 | + | ||
309 | + | ||
310 | + | ||
311 | + | ||
312 | + | ||
299 | 313 |
| |
300 | 314 |
| |
301 | 315 |
| |
| |||
306 | 320 |
| |
307 | 321 |
| |
308 | 322 |
| |
309 | - | ||
310 | 323 |
| |
311 | 324 |
| |
312 | 325 |
| |
| |||
330 | 343 |
| |
331 | 344 |
| |
332 | 345 |
| |
333 | - | ||
334 | - | ||
335 | - | ||
336 | - | ||
337 | - | ||
338 | 346 |
| |
339 | 347 |
| |
340 | 348 |
| |
| |||
2103 | 2111 |
| |
2104 | 2112 |
| |
2105 | 2113 |
| |
2114 | + | ||
2115 | + | ||
2116 | + | ||
2106 | 2117 |
| |
2107 | 2118 |
| |
2108 | 2119 |
| |
| |||
3141 | 3152 |
| |
3142 | 3153 |
| |
3143 | 3154 |
| |
3155 | + | ||
3144 | 3156 |
| |
3145 | 3157 |
| |
3146 | 3158 |
| |
| |||
3149 | 3161 |
| |
3150 | 3162 |
| |
3151 | 3163 |
| |
3164 | + | ||
3152 | 3165 |
| |
3153 | 3166 |
| |
3154 | 3167 |
| |
|
0 commit comments