buildingSMART / buildingSMART/IFC5-development
IFCX viewer: rendering validation errors via innerHTML allows XSS from IFCX content
- Dominant language
- HTML
- Stars
- 220
- Forks
- 80
- Avg merge
- 4d 6h
- Merged PRs (30d)
- 2
Description
I noticed that validation error messages are rendered using `innerHTML`. Since error messages can contain values originating from IFCX content, this allows HTML injection when opening a crafted IFCX file. This effectively turns IFCX data into executable content in the viewer.
A minimal IFCX file with boolean-typed attribute
```html
```
triggers a validation error and executes when the message is rendered.
This means
- Arbitrary JavaScript execution in the viewer page
- gets triggered by opening an IFCX file (file-based vector)
- full control over he viewer DOM
It's not about backend compromise. But the code does run on a trusted domain and the payload can be embedded in any IFC file...
**Suggested fix**
Replace `innerHTML` with `textContent` for all error rendering:
```js
element.textContent = String(e.message);
```
Happy to open a PR if helpful.
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.