HTML injection in pgAdmin 4's cloud deployment module. The verify_credentials, deploy, regions, and update-server endpoints under /rds/, /azure/, /google/, and the top-level /cloud/ blueprint propagated AWS / Azure / Google SDK exception text — and the related file-resolution and database-commit exception text — into the JSON response body (the info and errormsg fields) without HTML-encoding. The Cloud Wizard frontend rendered these strings through html-react-parser, so an attacker-influenced exception message embedded structural HTML directly into the wizard's DOM.
The reported entry point is /rds/verify_credentials/. An authenticated pgAdmin user submits a crafted access_key whose value contains an <iframe/src=...> payload; AWS STS rejects the credential with an IncompleteSignature exception whose text quotes the access_key verbatim; the pgAdmin backend forwards that text into the JSON info field; the Cloud Wizard's FormFooterMessage parses it as HTML. The browser fetches the iframe's src from an attacker-controlled host, and JavaScript executing inside the cross-origin iframe writes to parent.location, redirecting the victim's pgAdmin tab. Because the injection renders inside pgAdmin's own interface, X-Frame-Options and Content-Security-Policy frame-ancestors do not mitigate it. Baseline impact is self-targeted (the same user who supplied the payload sees the injection); escalation against other authenticated users requires an additional cross-site request-forgery primitive capable of submitting the malformed credential request with a valid X-pgA-CSRFToken in the victim's browser context.
The same unsanitised-error-into-JSON pattern was present across multiple sibling endpoints — Azure's check_cluster_name_availability, every Google endpoint that surfaces SDK errors (verification_ack, projects, regions, instance_types, database_versions, the verify_credentials path-resolution branches), the central /deploy endpoint that bubbles str(e) from deploy_on_rds / deploy_on_azure / deploy_on_google, and update_cloud_server which surfaces the str(e) from a failing db.session.commit — all of which are now covered.
Fix HTML-escapes every external/SDK exception string at the endpoint sink via a new shared sanitize_external_text helper (HTML escape with control-character strip), promoted out of the psycopg3 driver into web/pgadmin/utils/text_sanitize.py. The Cloud Wizard frontend additionally renders its FormFooterMessage in plain-text mode for backend-derived strings, so the value is never parsed as HTML even if a future sink forgets the escape.
This issue affects pgAdmin 4: from 6.6 before 9.16.
CVSS Vector: CVSS:3.1/AV:N/AC:L/PR:L/UI:R/S:U/C:N/I:L/A:N
CVSS Score: 3.5
Self-XSS only. The same authenticated pgAdmin user that submits the crafted cloud credential is the one whose browser renders the echoed error -- there is no third-party attacker driving a distinct victim, so the confused-deputy elements (S:C / C:H confidentiality uplift) do not apply. The frontend DOMPurify layer added by #10068 already neutralises the in-browser exploit; this fix is defence in depth that ensures non-browser JSON consumers (audit logs, scripted API clients) never see the raw markup either. Scored as I:L for that residual escape only; S:U because no authority is crossed.
Cross-user escalation would require an independent CSRF primitive capable of submitting the malformed credential request with a valid X-pgA-CSRFToken in the victim's browser context. That is not part of this defect.
| Attack Vector |
Network |
Scope |
Unchanged |
| Attack Complexity |
Low |
Confidentiality Impact |
None |
| Privileges Required |
Low |
Integrity Impact |
Low |
| User Interaction |
Required |
Availability Impact |
None |
Self-XSS only. The same authenticated pgAdmin user that submits the crafted cloud credential is the one whose browser renders the echoed error -- there is no third-party attacker driving a distinct victim, so the confused-deputy elements (S:C / C:H confidentiality uplift) do not apply. The frontend DOMPurify layer added by #10068 already neutralises the in-browser exploit; this fix is defence in depth that ensures non-browser JSON consumers (audit logs, scripted API clients) never see the raw markup either. Scored as I:L for that residual escape only; S:U because no authority is crossed.
Cross-user escalation would require an independent CSRF primitive capable of submitting the malformed credential request with a valid X-pgA-CSRFToken in the victim's browser context. That is not part of this defect.
CVSS 3.1