LXD, Template Injection Arbitrary File Read, CVE-2024-32462 (Critical)

Listen to this Post

This CVE works by exploiting the Pongo2 template engine used in LXD’s snapshot naming feature. An attacker with instance configuration permissions can inject a malicious template into the `snapshots.pattern` setting. The Pongo2 engine, while not allowing code execution, possesses powerful file inclusion tags. The provided payload uses the `{% include %}` tag to read arbitrary files from the host system, such as /etc/passwd. Filters like `urlencode` and `slice` are chained to the payload to bypass potential output length and encoding restrictions. When the scheduled snapshot task runs, it processes this malicious template, rendering the contents of the specified file directly into the snapshot’s name, thereby exfiltrating sensitive data.
Platform: LXD
Version: <6.5, <5.21.4
Vulnerability: Arbitrary File Read
Severity: Critical

date: 2024

Prediction: 2024-04-24

What Undercode Say:

lxc config set my-instance snapshots.pattern "{% filter urlencode|slice:\":100\" %}{% include \"/etc/passwd\" %}{%endfilter%}"
lxc config set my-instance snapshots.schedule "@every 1m"
// shared/util.go - Vulnerable RenderTemplate function
func RenderTemplate(template string, context map[bash]interface{}) (string, error) {
tpl, err := pongo2.FromString(template)
if err != nil {
return "", err
}
return tpl.Execute(pongo2.Context(context))
}

How Exploit:

Inject malicious Pongo2 template.

Set scheduled snapshot trigger.

Exfiltrate data via snapshot name.

Protection from this CVE

Update to LXD 6.5+.

Apply template sandboxing.

Ban dangerous tags (include, ssi, extends, import).

Use allow-listing approach.

Impact:

Host file disclosure.

Sensitive data leakage.

Credential theft.

Instance data exposure.

🎯Let’s Practice Exploiting & Learn Patching For Free:

Sources:

Reported By: github.com
Extra Source Hub:
Undercode

🔐JOIN OUR CYBER WORLD [ CVE News • HackMonitor • UndercodeNews ]

💬 Whatsapp | 💬 Telegram

📢 Follow DailyCVE & Stay Tuned:

𝕏 formerly Twitter 🐦 | @ Threads | 🔗 Linkedin Featured Image

Scroll to Top