Gravity Forms's set_uploaded_files function in forms_model.php walks every uploaded-file dictionary in $_POST['gform_uploaded_files'] and applies a sanitizer to each of four string fields. uploaded_filename passes through sanitize_file_name( wp_basename( ... ) ). temp_filename passes through sanitize_file_name( wp_basename( ... ) ). id passes through sanitize_key(). The fourth field, added to the dictionary's contract in version 2.9.18, is named url, and it passes through esc_url_raw().
CVE-2026-48866 is what happens when a function picks four sanitizers across four fields by the field's name, and the field that named itself a URL is the field whose value reaches unlink().
The url key was added in September 2025 to a dictionary the function had been basenaming since 2.4.3.
Lines 8595 through 8615 of forms_model.php at tag 2.10.0, the released version the CVE names, read in full:
foreach ( $input_files as $key => &$file ) {
if ( empty( $file ) ) {
unset( $input_files[ $key ] );
continue;
}
// All files regardless of upload or population method should have this.
if ( isset( $file['uploaded_filename'] ) ) {
$file['uploaded_filename'] = sanitize_file_name( wp_basename( $file['uploaded_filename'] ) );
}
// All multi-file uploads should have this. Single file uploads should have it once a submission or pagination request has been processed.
if ( isset( $file['temp_filename'] ) ) {
$file['temp_filename'] = sanitize_file_name( wp_basename( $file['temp_filename'] ) );
}
// Used when the field is dynamically populated on initial form display.
if ( isset( $file['url'] ) ) {
$file['url'] = esc_url_raw( $file['url'] );
}
// Sanitize or generate the UUID to be used by the file preview and error messages markup.
if ( isset( $file['id'] ) ) {
$file['id'] = sanitize_key( $file['id'] );
} else {
$file['id'] = GFFormsModel::get_uuid();
}
}
The function's @since block is the file's own admission of when each branch landed. The uploaded_filename and temp_filename clauses date to 2.4.3.5, December 2019. The url clause was added in 2.9.18, September 19, 2025. The function's docstring records the addition explicitly: "Added support for dynamically populated file URLs using the url key."
The inline comment on the url branch is the entire mental model the developer brought to the work: "Used when the field is dynamically populated on initial form display." esc_url_raw is the WordPress idiom for a URL string about to be stored for later display in HTML attributes. The function the developer reached for was the function for the destination they were thinking about, which was the form's rendered preview.
The runtime treats the same field as a filesystem locator. The two wp_basename calls six lines above are the codebase's standing acknowledgment that file-related fields in this exact dictionary can flow to unlink() and need their path components stripped. They are in the same function. Same iteration. Same foreach. The developer added the url clause adjacent to them and chose a different sanitizer because the field's key was url.
From gform_uploaded_files to unlink() is one string and one str_replace.
The url value the visitor submits is cached on the form context, attached to the entry record, and never re-canonicalized. The path the value walks to reach the delete site is the four function calls below, each one a method on a different class, none of them with a check that the URL it is handing forward still points at the uploads directory.
The injection site, with no authentication required for an action=gform_submit_form call to admin-ajax.php, registers via wp_ajax_nopriv_gform_submit_form. The submitted JSON body for one form field:
{
"input_3": [
{
"url": "https://target.com/wp-content/uploads/gravity_forms/../../../wp-config.php",
"uploaded_filename": "legitimate.txt",
"id": "poc-file-1"
}
]
}
uploaded_filename is legitimate.txt. The value will survive sanitize_file_name(wp_basename(...)) unchanged and will be what the WordPress admin sees in the entries list. id is alphanumeric. url carries the entire payload.
After set_uploaded_files returns, GF_Field_FileUpload::get_multifile_value reads the cached dictionary, walks the existing-files branch for any entry without a temp_filename (which is the dynamically-populated case), and serializes $existing_file_url into the JSON-encoded array that becomes the entry-meta field value. The URL is now in the database, intact.
Hours later, weeks later, on a routine entries-page cleanup, the admin selects the entry and clicks delete. GFFormsModel::delete_files runs, decoding the same JSON array and calling delete_physical_file($file, $lead_id) once per stored URL. delete_physical_file at lines 2490 through 2523:
private static function delete_physical_file( $file_url, $entry_id ) {
$ary = explode( '|:|', $file_url );
$url = rgar( $ary, 0 );
if ( empty( $url ) ) {
return;
}
$file_path = self::get_physical_file_path( $url, $entry_id );
$file_path = apply_filters( 'gform_file_path_pre_delete_file', $file_path, $url );
if ( file_exists( $file_path ) ) {
$result = unlink( $file_path );
// ...
}
}
No check between get_physical_file_path and unlink. The function hands the URL to a path-resolution helper, runs the result through a third-party filter, and unlinks whatever returns. get_physical_file_path itself, at line 2537:
public static function get_physical_file_path( $url, $entry_id = null ) {
$path_info = GF_Field_FileUpload::get_file_upload_path_info( $url, $entry_id );
if ( is_multisite() && get_site_option( 'ms_files_rewriting' ) ) {
$file_path = preg_replace( "|^(.*?)/files/gravity_forms/|", BLOGUPLOADDIR . 'gravity_forms/', $url );
} else {
$file_path = str_replace( trailingslashit( $path_info['url'] ), trailingslashit( $path_info['path'] ), $url );
}
return $file_path;
}
$path_info['url'] is the uploads URL root, https://target.com/wp-content/uploads/gravity_forms/. $path_info['path'] is the filesystem root, /var/www/html/wp-content/uploads/gravity_forms/. str_replace replaces the URL prefix with the filesystem prefix and returns:
/var/www/html/wp-content/uploads/gravity_forms/../../../wp-config.php
PHP's file_exists resolves the ../../../ against the actual filesystem layout. PHP's unlink does the same. The OS deletes /var/www/html/wp-config.php. The site stops serving requests. On the next page load, WordPress sees no database configuration and displays the installer wizard, offering to set up a fresh WordPress install on the existing domain.
The CVSS vector is AV:N/AC:L/PR:N/UI:R/S:C/C:H/I:H/A:H, 9.6. UI:R is the admin's delete click. Nothing else in the chain requires a credential.
The patch defends at the third address.
The 2.10.1 release ships commit cf2ff65, which closes the demonstrated chain by adding a guard inside delete_physical_file. The diff against the vulnerable forms_model.php:
$file_path = apply_filters( 'gform_file_path_pre_delete_file', $file_path, $url );
+// If the file is outside the uploads folder, something nefarious is up, so bail.
+if ( ! GFCommon::is_file_in_uploads( $url ) ) {
+ GFCommon::log_debug( __METHOD__ . sprintf( '(): Not deleting file from URL: %s', $file_path ) );
+ return;
+}
+
if ( file_exists( $file_path ) ) {
$result = unlink( $file_path );
The new helper, added to common.php in the same commit:
public static function get_absolute_path( $path ) {
$path = str_replace( array( '/', '\\' ), DIRECTORY_SEPARATOR, $path );
$path = str_replace( '://', '|%%protocol%%|', $path );
$parts = array_filter( explode( DIRECTORY_SEPARATOR, $path ), 'strlen' );
$absolutes = array();
foreach ( $parts as $part ) {
if ( '.' == $part ) { continue; }
if ( '..' == $part ) {
array_pop( $absolutes );
} else {
$absolutes[] = $part;
}
}
$path = implode( DIRECTORY_SEPARATOR, $absolutes );
return str_replace( '|%%protocol%%|', '://', $path );
}
public static function is_file_in_uploads( $file ) {
$file_path = self::get_absolute_path( $file );
$root_url = rgar( GF_Field_FileUpload::get_file_upload_path_info( '' ), 'url' );
if ( ! str_starts_with( $file_path, $root_url ) ) {
return false;
}
return true;
}
The patch's design choice is visible in where it landed. is_file_in_uploads is called at the delete sink, not at the storage source. The committer had three places they could have intervened.
The first option was to normalize the URL at storage in set_uploaded_files, adding a .. walk to the existing esc_url_raw call so the stored value can never carry a traversal. This would have required the smallest code change and would have aligned the url branch's defensive posture with the wp_basename calls immediately above it. The patch did not choose this.
The second option was to validate the URL at storage in set_uploaded_files, rejecting any value whose resolved path falls outside the uploads root before it reaches the database. This would have closed the bug at the point of entry and preserved the database invariant that every stored file URL points inside /wp-content/uploads/gravity_forms/. The patch did not choose this either.
The third option, the one the patch took, was to validate at the sink in delete_physical_file. This closes the demonstrated chain. The database can still hold a URL with ../ in it for an entry that exists but has not been deleted; the storage path is unchanged. The asymmetry inside set_uploaded_files between wp_basenamed filename fields and esc_url_rawd URL field is preserved verbatim in the patched release. The fix is a check in front of unlink. The shape that made the check necessary is still in the file.
The release notes for 2.10.1 enumerate the change in the changelog at changelog.txt, alongside a long list of unrelated polish: "Fixes a path traversal vulnerability that could allow form submissions to specify file paths outside the uploads directory." The line names the destination correctly. It does not name the storage-side sanitizer asymmetry that surfaced the bug.
Sanitized The Secrets, Not The Sink, in the file-upload dialect.
The pattern's catalog entry, Sanitized The Secrets, Not The Sink, names the shape: a function applies escape, quote, or sanitize logic to user-controlled fields the developer perceives as security-sensitive, and omits it on a field that actually flows into the dangerous interpreter. The mitigation logic in the same function is proof the developer understood the threat. The unsanitized field is proof they sorted by perceived field role rather than by destination.
The catalog already carries the shape five times. ASUSTOR's vpn.cgi escaping the username and password it writes into a pppd peer config and skipping the server-address field on the same line, all three reaching /bin/sh -c through pppd's pty handler. OPNsense's local_user_set applying escapeshellarg() to the free-form GECOS comment and interpolating the six adjacent shell arguments raw. Keras's deserialize_keras_object gating the __lambda__ branch with safe_mode and resolving the parallel module + class_name path through importlib.import_module unguarded. Easy Elements hardening the role field through a denylist of dangerous capabilities and looping over $_POST['custom_meta'] into the same WordPress capabilities map. BentoML's Dockerfile loop running bash_quote on env.value and rendering env.name on the same line raw.
Gravity Forms is the shape at a WordPress filter callback. Six lines above the url branch, the same function strips path components from uploaded_filename and temp_filename. The wp_basename calls are the codebase's standing acknowledgment that file-related fields can carry .. and that values arriving from the network must have it stripped before they reach the filesystem. The author of the url clause was reading the same function. The author chose esc_url_raw because the field's key was url.
The asymmetry is internally consistent if you read the field name as the destination's name. Filenames go through file-name sanitizers. URLs go through URL sanitizers. Identifiers go through key sanitizers. The function is sorted by what each field is. The system the function lives in sorts by where each field goes, and the destination for all three filesystem-bound fields is the same: a str_replace six thousand lines away builds a path the OS resolves, and unlink deletes whatever the path names.
The bug also fits a second catalog frame. The Shell Was Not The Sink names the cross-interpreter mistake the esc_url_raw choice embodies in isolation: esc_url_raw is the WordPress idiom for a value about to be stored or rendered as a URL, with a transformation set written for HTML-attribute and database contexts. The function's name encodes the threat model the developer was thinking about, which is href injection and storage-side XSS. The destination encodes the threat model they were not, which is filesystem traversal through PHP's unlink. Both frames are accurate. The within-function asymmetry frame is the sharper one here because the function itself contains the proof the developer understood the filesystem boundary, applied immediately above the field the patch had to close.
The patch closes CVE-2026-48866. The next file-upload add-on that registers a new field on this dictionary, with a key name reading to its author as anything other than "filename," and a destination ending in a filesystem operation, is the next instance.
Coverage stack