Sylius has potential Cross Site Scripting vulnerability via the "Province" field in the Checkout and Address Book
Published 10 May 2024 · Updated 9 Mar 2026
Is your project on an affected sylius/sylius?
Look after several Laravel or PHP apps? Indie watches up to 15 repos, private ones too, for $5 a month. See Indie
Affected packages
- Affected
- <1.9.12
- Fixed in
- 1.9.12
composer require sylius/sylius:^1.9.12- Affected
- >=1.10.0-alpha.1 <1.10.16
- Fixed in
- 1.10.16
composer require sylius/sylius:^1.10.16- Affected
- >=1.11.0-alpha.1 <1.11.17
- Fixed in
- 1.11.17
composer require sylius/sylius:^1.11.17- Affected
- >=1.12.0-alpha.1 <1.12.16
- Fixed in
- 1.12.16
composer require sylius/sylius:^1.12.16- Affected
- >=1.13.0-alpha.1 <1.13.1
- Fixed in
- 1.13.1
composer require sylius/sylius:^1.13.1Details
Impact
There is a possibility to save XSS code in province field in the Checkout and Address Book and then execute it on these pages. The problem occurs when you open the address step page in the checkout or edit the address in the address book. This only affects the base UI Shop provided by Sylius.
Patches
The issue is fixed in versions: 1.9.12, 1.10.16, 1.11.17, 1.12.16, 1.13.1 and above.
Workarounds
1. Create new file assets/shop/sylius-province-field.js:
// assets/shop/sylius-province-field.js
function sanitizeInput(input) {
const div = document.createElement('div');
div.textContent = input;
return div.innerHTML; // Converts text content to plain HTML, stripping any scripts
}
const getProvinceInputValue = function getProvinceInputValue(valueSelector) {
return valueSelector == undefined ? '' : `value="${sanitizeInput(valueSelector)}"`;
};
$.fn.extend({
provinceField() {
const countrySelect = $('select[name$="[countryCode]"]');
countrySelect.on('change', (event) => {
const select = $(event.currentTarget);
const provinceContainer = select.parents('.field').next('div.province-container');
const provinceSelectFieldName = select.attr('name').replace('country', 'province');
const provinceInputFieldName = select.attr('name').replace('countryCode', 'provinceName');
const provinceSelectFieldId = select.attr('id').replace('country', 'province');
const provinceInputFieldId = select.attr('id').replace('countryCode', 'provinceName');
const form = select.parents('form');
if (select.val() === '' || select.val() == undefined) {
provinceContainer.fadeOut('slow', () => {
provinceContainer.html('');
});
return;
}
provinceContainer.attr('data-loading', true);
form.addClass('loading');
$.get(provinceContainer.attr('data-url'), { countryCode: select.val() }, (response) => {
if (!response.content) {
provinceContainer.fadeOut('slow', () => {
provinceContainer.html('');
provinceContainer.removeAttr('data-loading');
form.removeClass('loading');
});
} else if (response.content.indexOf('select') !== -1) {
provinceContainer.fadeOut('slow', () => {
const provinceSelectValue = getProvinceInputValue((
$(provinceContainer).find('select > option[selected$="selected"]').val()
));
provinceContainer.html((
response.content
.replace('name="sylius_address_province"', `name="${provinceSelectFieldName}"${provinceSelectValue}`)
.replace('id="sylius_address_province"', `id="${provinceSelectFieldId}"`)
.replace('option value="" selected="selected"', 'option value=""')
.replace(`option ${provinceSelectValue}`, `option ${provinceSelectValue}" selected="selected"`)
));
provinceContainer.addClass('required');
provinceContainer.removeAttr('data-loading');
provinceContainer.fadeIn('fast', () => {
form.removeClass('loading');
});
});
} else {
provinceContainer.fadeOut('slow', () => {
const provinceInputValue = getProvinceInputValue($(provinceContainer).find('input').val());
provinceContainer.html((
response.content
.replace('name="sylius_address_province"', `name="${provinceInputFieldName}"${provinceInputValue}`)
.replace('id="sylius_address_province"', `id="${provinceInputFieldId}"`)
));
provinceContainer.removeAttr('data-loading');
provinceContainer.fadeIn('fast', () => {
form.removeClass('loading');
});
});
}
});
});
if (countrySelect.val() !== '') {
countrySelect.trigger('change');
}
if ($.trim($('div.province-container').text()) === '') {
$('select.country-select').trigger('change');
}
const shippingAddressCheckbox = $('input[type="checkbox"][name$="[differentShippingAddress]"]');
const shippingAddressContainer = $('#sylius-shipping-address-container');
const toggleShippingAddress = function toggleShippingAddress() {
shippingAddressContainer.toggle(shippingAddressCheckbox.prop('checked'));
};
toggleShippingAddress();
shippingAddressCheckbox.on('change', toggleShippingAddress);
},
});2. Add new import in assets/shop/entry.js:
// assets/shop/entry.js // ... import './sylius-province-field';
3. If you're using Gulp, update your gulpfile.babel.js:
import chug from 'gulp-chug';
+ import concat from 'gulp-concat';
import gulp from 'gulp';
import yargs from 'yargs';
const { argv } = ...
+ const rootPath = argv.rootPath || 'public/assets';
+
const config = [...];
'--rootPath',
argv.rootPath || '../../../../../../../public/assets',
'--nodeModulesPath',
argv.nodeModulesPath || '../../../../../../../node_modules',
];
...
export const buildShop = ...
+ export const patchShopJs = function patchShopJs() {
+ return gulp.src([
+ `${rootPath}/shop/js/app.js`,
+ 'assets/shop/sylius-province-field.js',
+ ])
+ .pipe(concat('app.js'))
+ .pipe(gulp.dest(`${rootPath}/shop/js`));
+ };
+ patchShopJs.description = 'Append shop security patches to built app.js.';
...
- export const build = gulp.parallel(buildAdmin, buildShop);
+ export const build = gulp.series(
+ gulp.parallel(buildAdmin, buildShop),
+ patchShopJs,
+ );
...
- gulp.task('shop', buildShop);
+ gulp.task('shop', gulp.series(buildShop, patchShopJs));
...4. Rebuild your assets:
yarn build
Acknowledgements
This security issue has been reported by @r2tunes, thank you!
References
- The original advisory: https://github.com/advisories/GHSA-mw82-6m2g-qh6c
For more information
If you have any questions or comments about this advisory:
- Open an issue in Sylius issues
- Email us at security@sylius.com
Is GHSA-7prj-9ccr-hr3q in any of your client repos?
Checking one package by hand is fine. Checking it across forty client projects is not. NPMscan reads the lockfiles in every GitHub repo you pick, finds each project with an affected sylius/sylius, and gives you the command that fixes it.
More advisories for sylius/sylius
- MediumCVE-2026-53639Sylius: IDOR on Shop Payment Request API endpoints · 9 Jul 2026
- MediumCVE-2026-53638Sylius: Channel-based payment method restriction bypass on shop account orders API endpoint · 9 Jul 2026
- MediumCVE-2026-53637Sylius: Cart FormComponent allows modification or deletion of an already-completed order · 9 Jul 2026
- MediumCVE-2026-31825Sylius has a DQL Injection via API Order Filters · 11 Mar 2026
- HighCVE-2026-31824Sylius has a Promotion Usage Limit Bypass via Race Condition · 11 Mar 2026
- MediumCVE-2026-31823Sylius Vulnerable to Authenticated Stored XSS · 11 Mar 2026
References
Advisory data from OSV.dev (opens OSV.dev in a new tab), refreshed daily.