Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PDF preview with XSS causing command execution #11949

Closed
3 tasks done
guchangan1 opened this issue Jul 11, 2024 · 1 comment
Closed
3 tasks done

PDF preview with XSS causing command execution #11949

guchangan1 opened this issue Jul 11, 2024 · 1 comment

Comments

@guchangan1
Copy link

guchangan1 commented Jul 11, 2024

Is there an existing issue for this?

  • I have searched the existing issues

Can the issue be reproduced with the default theme (daylight/midnight)?

  • I was able to reproduce the issue with the default theme

Could the issue be due to extensions?

  • I've ruled out the possibility that the extension is causing the problem.

Describe the problem

A type check was missing when handling fonts in PDF.js, which would allow arbitrary JavaScript execution in the PDF.js context.
If pdf.js is used to load a malicious PDF, and PDF.js is configured with isEvalSupported set to true (which is the default value), unrestricted attacker-controlled JavaScript will be executed in the context of the hosting domain.

PoC

  1. Download latest Siyuan-3.1.0 app
  2. Create new document, and directly insert a malicious PDF document that has been created。
    poc-rce.pdf
  3. Open Later,The calculator poped up.
    image

Occurence

app/stage/protyle/js/pdf/pdf.js

Impact

Client side code execution.

Expected result

Upgrade pdf.js

Screenshot or screen recording presentation

SIYUAN-pdf-xss.mp4

Version environment

- Version: 3.1.0(latest)
- Operating System: arm macos sonoma 14.5
- Browser (if used):

Log file

2024/07/11 10:24:23 runtime.go:74: kernel is booting:
* ver [3.1.0]
* arch [arm64]
* os [darwin]
* pid [21316]
* runtime mode [prod]
* working directory [/Applications/SiYuan.app/Contents/Resources]
* read only [false]
* container [std]
* database [ver=20220501]

More information

No response

@88250
Copy link
Member

88250 commented Jul 11, 2024

Duplicate of #11650

@88250 88250 marked this as a duplicate of #11650 Jul 11, 2024
@88250 88250 closed this as completed Jul 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants