[12] [WebCore] Re-validate same-origin after CSP sandbox application in view transitions
Severity: High | Component: WebCore View Transitions | cc6b337
CSP sandbox 적용으로 새 document의 effective origin이 opaque 상태로 전환된 경우, view-transition pipeline이 캡처된 snapshot을 처리하지 않도록 Document::reveal() 시점에 second origin check를 추가했습니다. 패치 이전에는 outgoing document에서 캡처된 ImageBuffer와 element name이 sandbox-opaque document로 유출되었습니다. High로 평가된 이유입니다.
Document::reveal은 ViewTransitionParams를 설치하기 전에, source document의 origin과 새 document의 CSP 처리 이후 securityOrigin() 사이에서 same-origin 재검증을 수행합니다.
Source/WebCore/dom/Document.cpp
URL에서 도출된 origin 판단과 CSP 처리 이후 최종 origin 사이의 TOCTOU: CSP sandbox opaque-origin document에 cross-document view transition snapshot 설치.
Patch Details
Document::reveal에 CSP 처리 이후의 securityOrigin()을 사용하는 최종 same-origin check가 추가되었습니다. navigation 시작 시점의 admission gate(URL에서 도출된 origin)는 변경되지 않았습니다.
Background
Cross-document view transition은 outgoing document에서 element image와 geometry를 snapshot으로 캡처한 뒤, incoming document에서 재생합니다. 이 pipeline이 동작하려면 document 간 same-origin 조건이 충족되어야 합니다. HTML spec에 따르면, allow-same-origin 없이 Content-Security-Policy: sandbox가 지정되면 CSP 처리 이후 document의 effective origin이 opaque origin으로 교체됩니다.
Analysis
패치 이전 pipeline은 same-origin check를 한 번만 수행했습니다. 검사 시점은 DocumentLoader::navigationCanTriggerCrossDocumentViewTransition의 navigation 시작 단계로, response의 URL에서 도출된 origin을 기준으로 판단했습니다. CSP 처리는 이 이후에 실행됩니다. 결과적으로 Document::reveal() 내에서 resolveInboundCrossDocumentViewTransition이 실행되는 시점에는 이미 securityOrigin()이 opaque 상태였지만, pipeline은 재검증을 수행하지 않았습니다.