Skip to content

v21.0.0-beta7 🌈

Pre-release
Pre-release

Choose a tag to compare

@colinmollenhour colinmollenhour released this 03 Dec 23:36
· 0 commits to main since this release

Security

This release fixes 16 security issues: 10 are published with CVE identifiers (requested) and 6 as GitHub Security Advisories only. This pre-release of the 21.x line merges the v20.19.4 security release. The same fixes ship in v20.18.6.

Scores are CVSS 3.1. The most serious issues let a guest save inline translations that run script when an administrator opens a product, let an unauthenticated attacker run script in a logged-in administrator's session through a crafted link, and let an API role that may read orders take over the API sessions of other integrations. Two more let restricted admin or API roles run code on the server, under the conditions their advisories describe. If you have turned inline translation on, give restricted admin or API roles to people you would not trust with full access, or sell bundle products, upgrade first.

Advisories with a CVE

Advisory Issue Severity CVE Fixed in
GHSA-mgm5-f8r8-wf8m Inline translation lets a guest save translations that run script in the admin High 8.0 requested 20.18.6, 20.19.4, 21.0.0-beta7
GHSA-3p6w-8ppw-569c Unencoded path parameters in URLs allow cross-site scripting against administrators and shoppers High 8.0 requested 20.18.6, 20.19.4, 21.0.0-beta7
GHSA-f33f-mg8g-75p9 SQL injection through sales list API filter keys lets an order-reading API role hijack API sessions (regression of GHSA-fvrf-9428-527m) High 7.2 requested 20.18.6, 20.19.4, 21.0.0-beta7
GHSA-qjwx-wccq-qmj5 Legacy product media API update() writes caller-supplied content to an unchecked path (code execution) Medium 6.6 requested 20.18.6, 20.19.4, 21.0.0-beta7
GHSA-27rq-c2g4-8rmr Mail sender settings pass extra arguments to sendmail, letting restricted admin roles run code Medium 6.6 requested 20.19.4, 21.0.0-beta7 (20.18.x not affected)
GHSA-rv24-pj9h-rrc7 Product attribute editor and option API rewrite or delete attributes of other entity types Medium 6.5 requested 20.18.6, 20.19.4, 21.0.0-beta7
GHSA-cwg2-j6c8-759r Guests can skip a required bundle option or add several choices of a single-choice bundle option (bypass of GHSA-ch6h-4phh-xwc5) Medium 5.3 requested 20.18.6, 20.19.4, 21.0.0-beta7
GHSA-r6pv-74j5-r6h8 XPath injection in the email template editor lets a Transactional Emails role read the encryption key Medium 4.9 requested 20.18.6, 20.19.4, 21.0.0-beta7
GHSA-86q2-h4f7-v62q Block and config path allow-lists let restricted roles read the encryption key and encrypted settings Medium 4.9 requested 20.18.6, 20.19.4, 21.0.0-beta7
GHSA-c8ch-jjfh-v6qf Continue Shopping URL taken from a crafted link allows cross-site scripting on the cart page Medium 4.7 requested 20.18.6, 20.19.4, 21.0.0-beta7

Advisories without a CVE

These are published so you can track them. Each one either needs a back-office account, depends on settings that are not the default, or has low impact.

Advisory Issue Severity Fixed in
GHSA-x3w2-74h6-3g58 Restricted roles plant stored XSS for administrators in product, order, cart and promotion pages (GHSA-wxr3 and GHSA-2r86 follow-up) Medium 6.1 20.18.6, 20.19.4, 21.0.0-beta7
GHSA-2xf5-qg5f-c7wm Restricted configuration roles plant stored XSS for administrators through configuration values (GHSA-qpch follow-up) Medium 6.1 20.18.6, 20.19.4, 21.0.0-beta7
GHSA-4mwc-875w-j8q2 Restricted roles still change download links, gift messages and tax rules, and list customers (GHSA-4wh6 and GHSA-mvf8 follow-up) Low 3.8 20.18.6, 20.19.4, 21.0.0-beta7
GHSA-gmxh-ph58-89rv Multishipping applies a whole-cart fixed discount again to the shipping of each extra address Low 3.1 20.18.6, 20.19.4, 21.0.0-beta7
GHSA-c6j2-fqrr-hvqp Product image APIs copy any server image named by the uploaded content into the public media directory Low 2.7 20.18.6, 20.19.4, 21.0.0-beta7
GHSA-65j7-x7q7-2x9x Admin credit memo and invoice actions skip state checks, letting a sales role inflate stock Low 2.7 20.18.6, 20.19.4, 21.0.0-beta7

GHSA-27rq-c2g4-8rmr does not affect 20.15.0 to 20.18.5, because those releases ignored the Set Return-Path setting; 20.18.6 carries the fix as a precaution. 20.1.0 to 20.14.x are affected through the newsletter queue and are no longer supported.

Behaviour changes and upgrade notes

Review these before you upgrade. Most need no action unless you run SOAP/XML-RPC integrations, custom scripts that post inline translations, extensions that save attributes, bundles, downloadable links or price rules through their own code, or a theme that overrides the templates listed at the end. Each advisory has the full list.

Inline translation

  • The storefront translation endpoint always saves in the storefront area and ignores a posted area. Enabled for Admin no longer lets storefront requests save translations; only Enabled for Frontend does. The admin endpoint always uses the admin area. Mage_Core_Helper_Translate::apply() ignores its $area argument and uses the area of the current store.
  • The storefront endpoint requires a POST request with a valid form key. The bundled js/mage/translate_inline.js sends it; custom scripts that post translations must add the form_key parameter. Both endpoints answer with valid JSON ({"success":true}, or {"error":true,"message":...}).
  • Translated strings that core templates print inside JavaScript are escaped for JavaScript (quoteEscape($text, true) in event-handler attributes), so a translation that contains quotes shows them as text instead of breaking the page.

URLs and links

  • Mage_Core_Model_Url percent-encodes &, ", ', <, >, ?, \, `, whitespace and control characters in route parameter names and values. /, %, +, #, { and } are left as they are, and values that are already encoded are not encoded again. The router decodes values back, so links keep working, but the URLs differ on the wire.
  • The shared wishlist's "Add All to Cart" links to the wishlist by its sharing code only; other parameters of the shared wishlist page are no longer carried over.
  • The cart stores and shows a Continue Shopping URL only if it is an http(s) URL on the store's unsecure or secure base URL (same scheme, host and port, inside its path) without a user name or password. Quotes, <, >, \, backticks, whitespace and control characters in it are percent-encoded. Any other URL, or one that contains an HTML character reference, is replaced by the store's home page.

SOAP/XML-RPC and REST APIs

  • List filters. A filter key that is not a plain field name (letters, digits and underscores, optionally preceded by a table alias and a dot) is refused with Invalid filter field "…".: fault 101 for sales_order.list, sales_order_invoice.list, sales_order_shipment.list, sales_order_creditmemo.list and customer.list, and a new fault 109 for catalog_product.list. Core filter keys and their documented aliases are plain names. Extensions that use Mage_Api_Helper_Data::parseFilters() get the same check.
  • Varien_Db_Adapter_Pdo_Mysql::prepareSqlCondition() substitutes the field name and the value in a single pass. A filter value that contains the text {{fieldName}} is compared literally, as before 20.0.17.
  • Product attribute API. info, addOption, removeOption, update and remove accept only product attributes. Any other attribute returns "Requested attribute not found." (update and remove now return not_exists, fault 101), and removeOption with an option of another attribute returns unable_to_remove_option (fault 109). An attribute code that both a product and a category attribute use, such as name, always resolves to the product attribute. Integrations that managed options of customer or category attributes through this API must use another route.
  • Product media API. catalog_product_attribute_media.update with new content faults with not_created ("Detected malicious path or filename input.") when the gallery file lies outside the product media directory or has no image extension. Content that is not an image is refused, and images are re-encoded, as create() already did. create() and POST /api/rest/products/:id/images store the uploaded content itself and never a server file it names; the new Varien_Io_File::writeContent() does this, and Varien_Io_File::write() is unchanged.
  • Custom option API. catalog_product_custom_option.add and .update dispatch catalog_product_prepare_save with an empty request object (Mage_Catalog_Model_Product_Option_Api_Request), so third-party observers of that event see no request data during these calls.
  • Downloadable and bundle ids. A product save refuses a link, sample, bundle option or bundle selection id that belongs to another product, whichever caller saves it, with errors such as The downloadable link with ID "%s" belongs to another product. The resource models also refuse to move an existing row to another product. Code that moved links or bundle options between products by id now gets an error.

Email

  • The Return-Path is passed to the mail program as -f only when it is a valid email address and contains no whitespace, control characters, double quotes or backslashes. Otherwise the message is sent without it, so bounces go to the server's default address, and a warning with the refused address is written to the system log even when logging is off. This also covers values saved before the upgrade and messages already in the email queue. Addresses with a quoted local part or non-ASCII characters are affected.
  • Core passes the -f transport to each message it sends instead of installing it as the process-wide default transport. Code that relied on Zend_Mail::getDefaultTransport() returning it after a core email no longer gets it.
  • The sender email fields under Store Email Addresses and the Return-Path Email field refuse addresses that are not valid HTML5 email addresses or that fail the check above, with Invalid email address "…". Saving a newsletter queue whose sender changed checks the sender in the same way and requires a sender name. A paused queue's newsletter content can no longer be changed by saving it, and saving or resuming a paused queue no longer clears its subject, sender, text and store views.
  • Transactional email editor. Load Template refuses a template code that is not a declared default email template ("The requested default email template does not exist."), and saving a template ignores such an original template code. Used as Default For is shown only for declared default templates.
  • Previews. The newsletter template, newsletter queue and transactional email previews are sent with a Content-Security-Policy: sandbox header, and the newsletter preview frame has a sandbox attribute. Script in a preview no longer runs; links still open in a new window.

Content directives and permissions

  • Blocks allow-list (System › Permissions › Blocks). A block name must have exactly two parts, group/name ("Block Name is incorrect."). The allow-list checks the class a name resolves to: names that resolve to a denied class or a subclass of one, to a class on the layout deny list (the installer's final block, the admin RSS feed blocks and Mage_Core_Block_Template_Zend) or to an admin block are refused ("Block Name is disallowed."). Existing rows of these kinds are dropped from the allow-list, each with a warning in the system log, and stop rendering in {{block}} directives; a store that allowed rss/order_new or an adminhtml/... block in content loses it. Extensions extend the deny list under validators/custom_layout/disallowed_block.
  • {{block}} calls only toHtml, a method whose name starts with get, is or has, or a method declared for template variables, through its output parameter. Other methods are logged and the block's HTML is rendered instead.
  • {{config}} directive. A path that holds an encrypted value (backend model adminhtml/system_config_backend_encrypted or a subclass), a parent path of one, or a value that is not a plain configuration path renders as an empty string, even if it is on the variables allow-list, and the attempt is logged. The same check applies to store.getConfig() in template expressions. Adding such a path under System › Permissions › Variables is refused, and existing rows of this kind are ignored.
  • Mage_Install_Block_End::getEncryptionKey() returns only a key set on the block by the installer.

Catalog and product editor

  • Attributes. Saving an existing attribute can no longer change its entity type or whether it is user-defined, whichever way it is saved; extension code that changes is_user_defined must use Mage_Eav_Model_Entity_Setup::updateAttribute(). A save that names an option id of another attribute is refused as a whole. The admin attribute editor saves only the product attribute named by the attribute_id request parameter, or a new attribute, and ignores posted entity type, user-defined flag, backend type and table, model classes, and attribute set and group fields. Extensions that post source_model or frontend_model through the attribute form no longer have them saved and must set them in code or a setup script.
  • Custom option types. A custom option whose type is not a configured option type is refused on save with "The custom option type is not valid." Types that extensions register in their configuration are accepted. A product that still holds an unknown type cannot be saved with that option until it is changed or removed.
  • Product images. A new image row in a product save must name a file that is present in the temporary media directory (or in database storage), with letters, digits, _, - and . in each path segment and an image extension. Otherwise the save is refused with "The image file name is not valid." or "The uploaded image file was not found. Please upload the image again." A script that saves the same product object again after adding an image, without reloading it, now gets the second error.
  • Downloadable links and samples. A product save copies only the fields of the Downloadable Information tab onto each link and sample row; extensions that store extra columns add them to the downloadable_product_save_link or downloadable_product_save_sample fieldset. A link or sample of URL type must have an http or https URL, or the save is refused with "Please enter a valid http or https URL for each link and sample of URL type." This also applies to the downloadable link API.
  • Date custom options. When a date option is shown, Date Fields Order must be an order of day, month and year, or the default order is used; each part of Year Range must be a whole number of up to four digits, or the current year is used.
  • Configuration save (20.19.4 and 21.0.0-beta7). Saving Date Fields Order (System › Configuration › Catalog › Catalog › Date & Time Custom Options) is refused unless it holds day, month and year once each, and Year Range unless each year is empty or four digits and the start is not after the end. A message names the field.

Cart, checkout and promotions

  • Bundle products. Adding a bundle to the cart refuses option ids that do not belong to the bundle, more than one selection under a radio button or drop-down option, repeated or non-numeric selection ids, and selections that do not exist or are not available in the store view ("Please specify product option(s)."). A request that leaves out a required option is refused with "Required options are not selected." Cart items saved before the upgrade that lack a required selection or hold several selections of a single-choice option are flagged with these messages and can't be checked out until they are removed or reconfigured. Wishlists treat such options as not selected instead of refusing them.
  • Multiple-address checkout. A Fixed amount discount for whole cart rule with Apply to Shipping Amount discounts shipping only on the first address that uses the rule, from what is left of the rule amount; the total discount of one checkout is at most the rule amount.
  • Price rule conditions. Saving a shopping cart or catalog price rule builds conditions and actions only from rule[conditions] and rule[actions]; top-level conditions, actions, conditions_serialized and actions_serialized values are ignored. A condition on an attribute its condition type does not offer is refused with "The condition attribute "…" is not available. Remove the condition and save the rule again." A rule that already holds a condition on an attribute that is no longer offered still saves, as long as the stored value is a plain attribute code.
  • Shipping carrier titles and method names are escaped in totals, so markup in them shows as text.

Orders, invoices and credit memos

  • Only an open credit memo can be cancelled ("Credit memo cannot be canceled."), and invoices are cancelled, voided or captured only when their state allows it ("Invoice cannot be canceled.", "Invoice cannot be voided.", "Invoice cannot be captured."). The checks are in Mage_Sales_Model_Order_Creditmemo::cancel() and Mage_Sales_Model_Order_Invoice::cancel(), void() and capture(), so they also apply to the API and custom code, which now get an exception instead of reversing totals again.
  • With Automatically Return Credit Memo Item to Stock set to Yes, items are returned to stock when a credit memo is created, not again on later saves of it. Extensions that saved credit memos to trigger a return to stock no longer get it.
  • Order statuses. A new status code must be 2 to 32 characters, start with a lower-case letter and contain only lower-case letters, digits and underscores; saving an existing status for a code that does not exist is refused with "Order status does not exist." Existing codes are not changed.
  • Order creation. The order creation, reorder and edit pages save gift messages only for the cart being edited; in Mage_Adminhtml_Model_Giftmessage_Save, saveAllInQuote() accepts only cart types and saveAllInOrder() only order types. The customer selection grid renders only for users with Orders › Actions › Create.
  • Tax classes. The checks that refuse deleting a class used by tax rules, products or customer groups move into the tax class model, so data scripts and extensions that delete an in-use class now get an exception instead of the rule rows being removed.

Admin output

  • Payment instructions. Bank Transfer and Cash On Delivery instructions are escaped wherever they are printed, including the copy stored on existing orders. Line breaks are kept; instructions that deliberately contain HTML now show the tags as text.
  • Error messages in the admin Configure popup and in product, mass attribute update and shipping label errors go through the storefront message filter: simple formatting is kept, other tags show as text.
  • The customer editor's address JavaScript template, the dashboard chart type (an unknown stored value is shown as a bar chart), the media storage synchronization status, the shipment tracking popup and the rule condition editor's value labels are encoded for their context.

Templates

  • Template overrides. If your theme overrides any of these templates, apply the same changes. Storefront: catalog/product/compare/sidebar.phtml, checkout/cart.phtml, checkout/cart/sidebar/default.phtml, checkout/onepage/billing.phtml, checkout/onepage/progress/shipping_method.phtml, oauth/customer/token/list.phtml, payment/form/banktransfer.phtml and cashondelivery.phtml, payment/info/banktransfer.phtml, sales/billing/agreement/view.phtml, tax/checkout/shipping.phtml, wishlist/shared.phtml and wishlist/sidebar.phtml (base, and rwd where it has its own copy), and rwd's checkout/onepage/review/info.phtml and sales/recurring/profile/view.phtml. Overrides that you have not updated keep their old escaping for translated strings and stored values until you update them. Admin: bundle/product/edit/bundle/option/selection.phtml, catalog/product/edit.phtml, customer/tab/addresses.phtml, dashboard/graph.phtml, giftmessage/form.phtml, newsletter/preview/iframeswitcher.phtml, page/header.phtml (base and openmage), payment/form/banktransfer.phtml, cashondelivery.phtml and payment/info/banktransfer.phtml, sales/order/create/form.phtml, sales/order/create/totals/shipping.phtml, sales/order/shipment/tracking/info.phtml, sales/order/view/history.phtml, system/config/system/storage/media/synchronize.phtml and system/email/template/edit.phtml. The scripts js/mage/translate_inline.js, js/mage/adminhtml/product.js and js/mage/adminhtml/rules.js also change.

If inline translation has been turned on without Developer Client Restrictions › Allowed IPs, check the core_translate table for rows you did not create and delete them. If a restricted SOAP/XML-RPC role has held the order, invoice, shipment or credit memo resources, delete the rows of api_session and rotate API keys. If restricted admin roles have held System › Transactional Emails, System › Permissions › Blocks or Variables, the Store Email Addresses or System configuration sections, Newsletter › Newsletter Queue, or an API role the product media permissions, review who held them: these issues let such roles read the encryption key or run code on the server. Check the web root for files you did not create, and follow the Workarounds of GHSA-r6pv-74j5-r6h8 and GHSA-86q2-h4f7-v62q to rotate the encryption key and stored credentials if needed. Each advisory lists the tables to check for planted script.

Thanks

We thank every researcher who reported these issues through HackerOne and GitHub's private vulnerability reporting. Each advisory names its reporters.

Changes

  • Merges v20.19.4: the security fixes above and the changes merged to main since v20.19.3 (see the v20.19.4 notes).

Full Changelog: v21.0.0-beta6...v21.0.0-beta7