Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ Scalar options are `wp_json_encode()`d rather than interpolated by hand; functio

**Upgrading the library means re-applying that rename and the security patches below**, then regenerating `jquery.fancybox.min.js`.

The file also carries security changes that upstream does not have (CVE-2026-96571, 3.4.3). Anything read from a link is untrusted, because comment authors control `href` and post authors control `data-*`. `pickElementOptions()` allow-lists per-link options, `isSafeUrl()` refuses unsafe schemes, `sanitizeHtml()` applies the `elementHtmlRules` allow-list to captions and HTML or Ajax slides, `getInlineContent()` never parses HTML, `isForeignFrame()` stops a URL hash auto-opening another site's page, video template values are escaped, and thumbnails are built through the DOM. Do not add a template, `parentEl` or `media`-style option to `elementOptionTypes`.
The file also carries security changes that upstream does not have (CVE-2026-96571, 3.4.3). Anything read from a link is untrusted, because comment authors control `href` and post authors control `data-*`. Options passed in JavaScript are the site's own and stay trusted: since 3.4.4 an element-opened slide carries two flags, `untrusted` for everything read from the element (captions, thumbs, download link) and `untrustedContent`, set only when its `src` came from `data-src` or `href`. HTML, Ajax and inline content follow `untrustedContent`, so `.fancyboxforwp({ src: ... })` on a site's own element can open a form again (issue #116). `pickElementOptions()` allow-lists per-link options, `isSafeUrl()` refuses unsafe schemes, `sanitizeHtml()` applies the `elementHtmlRules` allow-list to captions and HTML or Ajax slides, `getInlineContent()` never parses HTML, `isForeignFrame()` stops a URL hash auto-opening another site's page, video template values are escaped, and thumbnails are built through the DOM. Do not add a template, `parentEl` or `media`-style option to `elementOptionTypes`.

### Assets

Expand Down
20 changes: 14 additions & 6 deletions assets/js/jquery.fancybox.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,9 @@
// Links can be written by people who are not trusted to run scripts: comment
// authors control `href`, and post authors also control `data-*` attributes.
// Anything read from an element is treated as untrusted. Options passed to the
// JavaScript API come from the site's own code and are left alone.
// JavaScript API come from the site's own code and are left alone - including a
// `src` given to `.fancyboxforwp({ src: ... })` on an element, whose HTML, Ajax
// or inline content is then as trusted as `$.fancyboxforwp.open({ src: ... })`.

// The only options an element may set, and the value types each one accepts.
// Everything else is dropped, notably templates (`baseTpl`, `errorTpl`, `btnTpl`,
Expand Down Expand Up @@ -783,12 +785,18 @@
obj.untrusted = true;
obj.src = self.opts.src || opts.src || $item.attr("href");

// Captions and every other value read from the element stay untrusted, but
// the content is only as untrusted as its source: a `src` from the options
// passed in JavaScript is the site's own, one from `data-src` or `href` is
// not. Without this, a site's own login form opened this way lost its fields.
obj.untrustedContent = !self.opts.src;

// Assume that simple syntax is used, for example:
// `$.fancyboxforwp.open( $("#test"), {} );`
if (!obj.type && !obj.src) {
obj.type = "inline";
obj.src = item;
} else if ($.type(obj.src) === "string" && opts.type !== "html" && opts.type !== "inline" && obj.src.charAt(0) !== "#" && !isSafeUrl(obj.src)) {
} else if (obj.untrustedContent && $.type(obj.src) === "string" && opts.type !== "html" && opts.type !== "inline" && obj.src.charAt(0) !== "#" && !isSafeUrl(obj.src)) {
// `javascript:` and friends. An unknown type renders the error slide.
obj.type = "blocked";
obj.src = "";
Expand Down Expand Up @@ -1820,7 +1828,7 @@
break;

case "html":
self.setContent(slide, slide.untrusted ? sanitizeHtml(slide.src) : slide.src || slide.content);
self.setContent(slide, slide.untrustedContent ? sanitizeHtml(slide.src) : slide.src || slide.content);

break;

Expand Down Expand Up @@ -1859,14 +1867,14 @@
self.showLoading(slide);

ajaxLoad = $.ajax(
$.extend({}, slide.opts.ajax.settings, slide.untrusted ? {
$.extend({}, slide.opts.ajax.settings, slide.untrustedContent ? {
// Otherwise jQuery runs the response if it is served as JavaScript
dataType: "html"
} : {}, {
url: slide.src,
success: function (data, textStatus) {
if (textStatus === "success") {
self.setContent(slide, slide.untrusted ? sanitizeHtml(data) : data);
self.setContent(slide, slide.untrustedContent ? sanitizeHtml(data) : data);
}
},
error: function (jqXHR, textStatus) {
Expand Down Expand Up @@ -1896,7 +1904,7 @@
// markup it is handed, so a target taken from an element may only be a selector.

getInlineContent: function (slide) {
if (!slide.untrusted || $.type(slide.src) !== "string") {
if (!slide.untrustedContent || $.type(slide.src) !== "string") {
return $(slide.src);
}

Expand Down
2 changes: 1 addition & 1 deletion assets/js/jquery.fancybox.min.js

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions fancybox.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Plugin Name: FancyBox for WordPress
* Plugin URI: https://wordpress.org/plugins/fancybox-for-wordpress/
* Description: Integrates <a href="http://fancyapps.com/fancybox/3/">FancyBox 3</a> into WordPress.
* Version: 3.4.3
* Version: 3.4.4
* Author: Colorlib
* Author URI: https://colorlib.com/wp/
* Requires at least: 5.6
Expand Down Expand Up @@ -36,7 +36,7 @@
* Plugin Init
*/
// Constants
define( 'FBFW_VERSION', '3.4.3' );
define( 'FBFW_VERSION', '3.4.4' );
define( 'FBFW_PATH', plugin_dir_path( __FILE__ ) );
define( 'FBFW_URL', plugin_dir_url( __FILE__ ) );
define( 'FBFW_PLUGIN_BASE', plugin_basename( __FILE__ ) );
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "fancybox-for-wordpress",
"version": "3.4.3",
"version": "3.4.4",
"description": "Integrates FancyBox 3 into WordPress.",
"homepage": "https://wordpress.org/plugins/fancybox-for-wordpress/",
"author": "Colorlib",
Expand Down
7 changes: 6 additions & 1 deletion readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Tags: fancybox, lightbox, images, photos, pictures
Requires at least: 5.6
Tested up to: 7.2
Requires PHP: 7.4
Stable tag: 3.4.3
Stable tag: 3.4.4
License: GPLv3 or later
License URI: http://www.gnu.org/licenses/gpl-3.0.html

Expand Down Expand Up @@ -54,6 +54,8 @@ This plugin is developed and maintained by [Colorlib](https://colorlib.com/), wh
If it is useful to you, a [review](https://wordpress.org/support/plugin/fancybox-for-wordpress/reviews/?filter=5) genuinely helps.

== Changelog ==
= 3.4.4 =
Fixed: Content your own site opens in the lightbox from JavaScript, such as a login form loaded with `.fancyboxforwp({ type: 'ajax', src: ... })`, kept only its text since 3.4.3: form fields and styles were removed. The 3.4.3 security rules now apply where they were meant to, to what a link supplies itself through its `href` or `data-` attributes, and captions on links are still filtered. Thanks to David Anderson for the report.
= 3.4.3 =
Security: Fixed a stored cross-site scripting issue (CVE-2026-96571) where a crafted link in a comment could run script when opened in the lightbox. Video source, format and poster values are now escaped. Thanks to Yuto Hyakumoto and Wordfence for the responsible report.
Security: Fixed a crafted link that could freeze the browser of everyone who loaded the page.
Expand Down Expand Up @@ -381,6 +383,9 @@ Fixed errors causes by WordPress SVN.

== Upgrade Notice ==

= 3.4.4 =
Fixes forms and styles disappearing from content your own site opens in the lightbox from JavaScript, a regression in 3.4.3. The 3.4.3 security protections for links are unchanged.

= 3.4.3 =
Security release. Fixes a stored cross-site scripting issue and a page-freezing bug that could both be triggered through a link in a comment. Update as soon as possible.

Expand Down
Loading