Exploit database

GH-3073153ca04c6fafea0bd6bcdd3d0072

rootdirective-sec/cve-2026-5718-lab

GitHubNot listedPoC
Download repository ZIP

Sources for CVE-2026-5718

2 sources

Preferred order: Exploit-DB, Metasploit, then GitHub repositories by stars. Open preferred source

Repository files1
rootdirective-sec/cve-2026-5718-labRevision 03cbf4aa663c

Files from this repository share one source choice. Supporting files may cover other vulnerabilities.

scripts/seed-wordpress.sh

Shell · 4,460 bytes
#!/usr/bin/env bash
set -euo pipefail

: "${SITE_URL:?SITE_URL is required}"
: "${DND_VERSION:?DND_VERSION is required}"
: "${LAB_PROFILE:?LAB_PROFILE is required}"
: "${ENABLE_LOCAL_RCE_PROOF:=no}"

FORM_BODY='[text* your-name placeholder "name"]
[email* your-email placeholder "email"]
[mfile upload-file filetypes:* blacklist-types:zip limit:1048576]
[submit "Send"]'

cd /var/www/html

echo "[seed:${LAB_PROFILE}] waiting for WordPress files..."
until [ -f wp-config.php ]; do
  sleep 2
done

echo "[seed:${LAB_PROFILE}] waiting for database..."
until wp db check --allow-root >/dev/null 2>&1; do
  sleep 3
done

if ! wp core is-installed --allow-root >/dev/null 2>&1; then
  echo "[seed:${LAB_PROFILE}] installing WordPress..."
  wp core install \
    --url="${SITE_URL}" \
    --title="CVE-2026-5718 ${LAB_PROFILE} Lab" \
    --admin_user=admin \
    --admin_password=adminpass \
    [email protected] \
    --skip-email \
    --allow-root
fi

echo "[seed:${LAB_PROFILE}] setting siteurl/home..."
wp option update siteurl "${SITE_URL}" --allow-root
wp option update home "${SITE_URL}" --allow-root

echo "[seed:${LAB_PROFILE}] installing Contact Form 7..."
wp plugin install contact-form-7 \
  --version=6.1.5 \
  --force \
  --activate \
  --allow-root

echo "[seed:${LAB_PROFILE}] installing Drag and Drop Multiple File Upload plugin ${DND_VERSION}..."
wp plugin install "https://downloads.wordpress.org/plugin/drag-and-drop-multiple-file-upload-contact-form-7.${DND_VERSION}.zip" \
  --force \
  --activate \
  --allow-root

echo "[seed:${LAB_PROFILE}] creating or updating CVE proof form..."
FORM_ID="$(wp post list \
  --post_type=wpcf7_contact_form \
  --name=cve-2026-5718-proof \
  --field=ID \
  --allow-root || true)"

if [ -z "${FORM_ID}" ]; then
  FORM_ID="$(wp post create \
    --post_type=wpcf7_contact_form \
    --post_status=publish \
    --post_title="CVE-2026-5718 Proof Form" \
    --post_name="cve-2026-5718-proof" \
    --post_content="${FORM_BODY}" \
    --porcelain \
    --allow-root)"
else
  wp post update "${FORM_ID}" \
    --post_title="CVE-2026-5718 Proof Form" \
    --post_content="${FORM_BODY}" \
    --allow-root >/dev/null
fi

# Contact Form 7 stores the active form template in the _form post meta.
# post_content alone is not enough for scan_form_tags().
wp post meta update "${FORM_ID}" _form "${FORM_BODY}" --allow-root >/dev/null

echo "[seed:${LAB_PROFILE}] form id: ${FORM_ID}"

PAGE_ID="$(wp post list \
  --post_type=page \
  --name=cve-2026-5718-lab \
  --field=ID \
  --allow-root || true)"

PAGE_BODY="[contact-form-7 id=\"${FORM_ID}\" title=\"CVE-2026-5718 Proof Form\"]"

if [ -z "${PAGE_ID}" ]; then
  wp post create \
    --post_type=page \
    --post_status=publish \
    --post_title="CVE-2026-5718 Lab" \
    --post_name="cve-2026-5718-lab" \
    --post_content="${PAGE_BODY}" \
    --allow-root >/dev/null
else
  wp post update "${PAGE_ID}" \
    --post_content="${PAGE_BODY}" \
    --allow-root >/dev/null
fi

echo "[seed:${LAB_PROFILE}] preparing upload directories..."
mkdir -p /var/www/html/wp-content/uploads/wp_dndcf7_uploads/wpcf7-files
chown -R www-data:www-data /var/www/html/wp-content/uploads

if [ "${ENABLE_LOCAL_RCE_PROOF}" = "yes" ]; then
  echo "[seed:${LAB_PROFILE}] enabling local RCE proof visibility in vulnerable upload directory..."

  cat > /var/www/html/wp-content/uploads/wp_dndcf7_uploads/.htaccess <<'HTACCESS'
Options -Indexes
# CVE-2026-5718 local lab only:
# PHP execution is intentionally allowed in this upload directory
# so the vulnerable service can demonstrate observable RCE behavior.
HTACCESS

  chown www-data:www-data /var/www/html/wp-content/uploads/wp_dndcf7_uploads/.htaccess
else
  echo "[seed:${LAB_PROFILE}] preserving upload-directory hardening..."

  cat > /var/www/html/wp-content/uploads/wp_dndcf7_uploads/.htaccess <<'HTACCESS'
Options -Indexes

<FilesMatch "\.(php|phar)$">
    Deny from all
</FilesMatch>
HTACCESS

  chown www-data:www-data /var/www/html/wp-content/uploads/wp_dndcf7_uploads/.htaccess
fi

echo "[seed:${LAB_PROFILE}] verifying Contact Form 7 upload options..."
wp eval "var_dump(dnd_cf7_get_option(${FORM_ID}, 'filetypes')); var_dump(dnd_cf7_get_option(${FORM_ID}, 'blacklist-types'));" --allow-root || true

echo "[seed:${LAB_PROFILE}] active upload-directory .htaccess:"
cat /var/www/html/wp-content/uploads/wp_dndcf7_uploads/.htaccess || true

echo "[seed:${LAB_PROFILE}] done: ${SITE_URL}/cve-2026-5718-lab/"