Commit fb57671
[Backport] CVE-2024-9959: Use after free in DevTools
Manual cherry-pick of patch originally reviewed on
https://chromium-review.googlesource.com/c/chromium/src/+/5886170:
Fix accessing disposed V8 session in page agent
Scripts running as part of Page.evaluateScriptOnNewDocument can pause
the page. During a pause we can detach the DevTools session, but the
page agent is still in the middle of running the
"DidCreateMainWorldContext" probe. This means any additional
Page.evaluateScriptOnNewDocument scripts would attempt to eval on
a detached V8 session.
This CL fixes this by overriding InspectorBaseAgent::Dispose in the
page agent and resetting `v8_session_` to a nullptr which we can
check for before evaling more scripts.
This check is only necessary for page agent methods that execute
more than one JS script as for all the others we wouldn't call
the probes on a disposed agent in the first place.
[email protected], [email protected]
Fixed: 368672129
Change-Id: I4c3361c8116a64343206da991e503aaa6bd917f6
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5886170
Reviewed-by: Danil Somsikov <[email protected]>
Reviewed-by: Andrey Kosyakov <[email protected]>
Commit-Queue: Simon Zünd <[email protected]>
Cr-Commit-Position: refs/heads/main@{#1359730}
Reviewed-on: https://codereview.qt-project.org/c/qt/qtwebengine-chromium/+/597921
Reviewed-by: Michal Klocek <[email protected]>1 parent e2405bd commit fb57671
File tree
2 files changed
+8
-2
lines changed- chromium/third_party/blink/renderer/core/inspector
2 files changed
+8
-2
lines changedLines changed: 7 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1036 | 1036 | | |
1037 | 1037 | | |
1038 | 1038 | | |
1039 | | - | |
| 1039 | + | |
1040 | 1040 | | |
1041 | 1041 | | |
1042 | 1042 | | |
| |||
1061 | 1061 | | |
1062 | 1062 | | |
1063 | 1063 | | |
1064 | | - | |
| 1064 | + | |
1065 | 1065 | | |
1066 | 1066 | | |
1067 | 1067 | | |
| |||
1972 | 1972 | | |
1973 | 1973 | | |
1974 | 1974 | | |
| 1975 | + | |
| 1976 | + | |
| 1977 | + | |
| 1978 | + | |
| 1979 | + | |
1975 | 1980 | | |
1976 | 1981 | | |
1977 | 1982 | | |
| |||
Lines changed: 1 addition & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
269 | 269 | | |
270 | 270 | | |
271 | 271 | | |
| 272 | + | |
272 | 273 | | |
273 | 274 | | |
274 | 275 | | |
| |||
0 commit comments