Project

General

Profile

Actions

Bug #99631

open

HTML5: Overly Permissive Message Posting Policy

Added by Robert Böttner over 1 year ago. Updated over 1 year ago.

Status:
Needs Feedback
Priority:
Should have
Assignee:
Category:
Security
Target version:
-
Start date:
2023-01-19
Due date:
% Done:

0%

Estimated time:
TYPO3 Version:
11
PHP Version:
8.1
Tags:
Complexity:
Is Regression:
Sprint Focus:

Description

When doing a penetration test with Fortify at one of my clients we discovered a warning of level medium regarding the usage of postMessage in BE context.

Here´s the summary:

A broadcast of information to windows on the client-side using postMessage was observed. The postMessage function is one of the features of HTML5 that allows a window to send messages to another open window. The typical syntax of postMessage is window.postMessage(message, targetOrigin, [transfer]).
The message parameter contains the information to be shared and targetOrigin indicates the origin of the destination window. It is recommended to explicitly specify the targetOrigin intended for a particular message. While the function permits the use of a wildcard character, e.g. “*”, for the targetOrigin, allowing the message to be shared to any window, we strongly recommend avoiding this practice. If a malicious user injects a new window into the javascript’s execution context, then the new window will now be able to receive any information that is shared using the vulnerable postMessage construct. It is also important to validate any message that is received from another window to confirm that the sender was authorized to do so. This will avoid receiving unintended input from a malicious window.
Explanation
If the postMessage() is used to transmit sensitive information between windows, then an unauthorized window would be able to retrieve this information as well.
Execution
Inspect all messages that are transferred between windows to check the targetOrigin of the function calls. In this particular case, the given stack trace represents the execution of javascript that led to the discovery of the vulnerability.
Recommendation
All data that is shared between windows must have explicit origins to avoid eavesdropping. It is recommended to avoid using “*” for the targetOrigin in order to prevent a broadcast of the information.

I could find usages in these places but don´t know exactly which one triggered the warning
  • typo3/sysext/backend/Resources/Public/JavaScript/BroadcastService.js
  • typo3/sysext/backend/Resources/Public/JavaScript/Utility/MessageUtility.js
  • typo3/sysext/core/Resources/Public/JavaScript/Contrib/broadcastchannel-polyfill.js
  • typo3/sysext/dashboard/Resources/Public/JavaScript/Contrib/muuri.js
  • typo3/sysext/t3editor/Resources/Public/JavaScript/Contrib/codemirror/addon/tern/tern.js
Actions

Also available in: Atom PDF