High

YesWiki: Authenticated (Admin) Server-Side Template Injection to Remote Code Execution via Bazar Semantic Templates

  • Disclosed: 09.07.2026
  • Updated: 11.10.2026 10:22

Summary

YesWiki Bazar contains a stored Server-Side Template Injection (SSTI) vulnerability in the semantic template feature that can be escalated to confirmed Remote Code Execution (RCE). An authenticated administrator can place arbitrary Twig expressions into the Semantic template (Twig) field (bn_sem_template), and that content is later executed server-side when public semantic endpoints are requested.

This was first confirmed through a harmless proof payload where {{ 7 * 7 }} was rendered as 49 through the public JSON-LD endpoint. The finding was then further validated locally by storing a Twig payload that invoked a system-level callable, resulting in command execution and an interactive shell on the test machine.

Because the payload is stored in the form configuration and later triggered through a public endpoint, this issue is both persistent and remotely triggerable after an administrator plants the malicious template.

Details

The vulnerable behavior is in the Bazar semantic rendering flow.

The administrator-editable fields:

  • bn_sem_template
  • bn_sem_reverse_template

allow Twig template content to be stored inside a form definition. That content is later rendered by the backend semantic transformer through TemplateEngine::renderFromStringNoEscape(), which passes the user-controlled string into Twig for execution.

Relevant sink:

php
$json = $this->templateEngine->renderFromStringNoEscape($form['bn_sem_template'], $data);

The rendering helper evaluates the supplied string as a live Twig template:

php
public function renderFromStringNoEscape(string $templateString, array $data = []): string
{
    $wrapped = '{% autoescape false %}' . $templateString . '{% endautoescape %}';
    return $this->twig->createTemplate($wrapped)->render($data);
}

This is unsafe because administrator-controlled semantic template text is executed as server-side Twig code rather than treated as inert data. In the validated environment, Twig expressions were first confirmed to execute through a harmless arithmetic payload and were then escalated to operating-system-level command execution by invoking a callable through Twig.

The public trigger path used during validation was:

GET /api/forms/2/entries/json-ld

The attack chain is:

  1. An administrator stores malicious Twig code in the semantic template field.
  2. YesWiki saves that payload in the form configuration.
  3. A later request to the public semantic endpoint causes the backend to render and execute the stored Twig.
  4. Because the Twig environment is not adequately constrained, the stored payload can escalate from template execution to system command execution.

PoC

The following steps reproduce the issue on the locally validated YesWiki instance.

Stage 1: Confirm Server-Side Template Execution

  1. Log in to YesWiki as an administrator.
  2. Open Bazar form management.
  3. Edit form ID 2 (Agenda in the validated instance).
  4. Locate the field labeled Semantic template (Twig).
  5. Replace its content with the following harmless payload:
js
{"proof":"{{ 7 * 7 }}"}
  1. Save the form.
  2. Trigger the public semantic endpoint:
bash
curl -s 'https://target.example/?api/forms/2/entries/json-ld'
  1. Observe that the server returns evaluated Twig output instead of the literal string {{ 7 * 7 }}.

Confirmed response:

js
{"@context":null,"@id":"https:\/\/target.example\/?api\/fiche\/2","@type":["ldp:Container","ldp:BasicContainer"],"dcterms:title":"Agenda","ldp:contains":[{"proof":"49","id":"https:\/\/target.example\/?TesT2"},{"proof":"49","id":"https:\/\/target.example\/?Bordeaux"}]}

Key execution proof:

js
"proof":"49"

Stage 2: Confirm Remote Code Execution

After confirming SSTI with the harmless payload above, a second locally controlled payload was stored in the same semantic template field to test whether Twig execution could be escalated to command execution. When the public semantic endpoint was requested, the payload executed on the server and established an interactive shell back to the test listener.

Observed local evidence included:

  • an inbound connection to the attacker's listener
  • an interactive shell prompt on the YesWiki host
  • successful command execution from the shell inside the YesWiki project directory

Observed shell output:

Connection received on 172.31.60.19 60308
khizar@Victus:/mnt/c/Users/khiza/Documents/Codex/2026-05-24/i-am-trying-to-make-a/yeswiki-src$ ls
INSTALL.md
LICENSE
Makefile
README.md
SECURITY.md
actions
cache
codex-admin-login.php
composer.json
composer.lock
custom
docker
docs
files
formatters
handlers
includes
index.php
interwiki.conf
javascripts
lang
package.json
private
robots.txt
setup
styles
templates
tests
themes
tools
vendor
wakka.config.php
wakka.php
yeswicli

This confirms that the issue is not limited to template evaluation or data disclosure. In the validated local environment, the stored Twig payload reached full operating-system-level command execution.

Impact

An authenticated administrator can inject arbitrary Twig expressions into Bazar semantic templates, and those expressions are executed server-side when public semantic endpoints are requested.

In the validated environment, this leads to confirmed Remote Code Execution. An attacker with administrator access can:

  • execute arbitrary Twig expressions on the server
  • store a persistent payload in form configuration
  • have that payload triggered later by unauthenticated requests to public semantic endpoints
  • execute operating-system commands on the host
  • gain interactive shell access to the underlying server
  • pivot from application-level administration to full server compromise

This breaks the expected trust boundary between application administration and host-level execution. In practical terms, YesWiki administrator privileges become sufficient to obtain command execution on the server in affected deployments.

Affected software

Click a technology to see all vulnerabilities affecting it.

PlatformPackageVulnerable versionsFixed in
Composer package yeswiki/yeswiki < 4.6.6 4.6.6

References

CVSS score -
CVSS vector
CVSS:4.0/AV:N/AC:L/AT:N/PR:L/UI:N/VC:N/VI:H/VA:N/SC:N/SI:N/SA:N
Weakness (CWE)
CWE-1336
Platform
Composer
Package
yeswiki/yeswiki
Disclosed
09.07.2026
Updated
11.10.2026 10:22

Sources and licenses

OSV / GitHub Advisory Database - GHSA-65p8-9433-jpcp - CC BY 4.0

Vulnerability history: yeswiki/yeswiki

All published vulnerabilities of this package (Composer package), newest first. Shows whether this is a one-off slip or a package that needs watching.

All (31) in the archive
Total entries
31
First → latest
03.2022 07.2026
Without a fix
2
Exploited in attacks
0

Severity breakdown

  • Critical 5
  • High 16
  • Medium 8
  • Low 2

Disclosures per year

  1. 2022: 1
  2. 2023: 0
  3. 2024: 1
  4. 2025: 12
  5. 2026: 17
Severity:
  1. High · 8.8 CVE-2026-52775 < 4.6.6 4.6.6
  2. YesWiki: Authenticated (Admin) Server-Side Template Injection to Remote Code Execution via Bazar Semantic Templates this entry
    High CVE-2026-52762 < 4.6.6 4.6.6
  3. Critical · 9.8 CVE-2026-46670 < 4.6.4 4.6.4
  4. Critical · 10.0 CVE-2025-46348 < 4.5.4 4.5.4
  5. High · 7.1 CVE-2025-24019 < 4.5.0 4.5.0
  6. High · 7.6 CVE-2025-24018 < 4.5.0 4.5.0
  7. High · 7.6 CVE-2025-24017 < 4.5.0 4.5.0
  8. High · 9.9 CVE-2024-51478 < 4.4.5 4.4.5
  9. High · 7.5 CVE-2021-43091 < 4.1.0 4.1.0

Know which vulnerabilities affect your application

With the DockRay integration and software inventory enabled, DockRay checks reported component versions against known vulnerabilities and notifies you about confirmed matches. Coverage depends on the supported technology and available advisory data.

Connect your application
DockRay newsletter

Application security in your inbox

Important vulnerabilities, actionable guidance and practical advice for your applications. Choose your technologies and follow what matters to your project.

  • A daily digest of new vulnerabilities, critical ones included.
  • Notifications about important updates.
  • Practical advice on application security and monitoring.

Leave empty to receive updates for every technology.

Free to subscribe. Unsubscribe with one click in any email.