text
stringlengths
0
1.99k
return temp;
}
To identify the length of each structure field, it is sufficient to read
its definition in the pmlist.h file.
struct portMap
{
int m_PortMappingEnabled;
long int m_PortMappingLeaseDuration;
char m_RemoteHost[16];
char m_ExternalPort[6];
char m_InternalPort[6];
char m_PortMappingProtocol[4];
char m_InternalClient[16];
char m_PortMappingDescription[50];
int expirationEventId;
long int expirationTime;
struct portMap* next;
struct portMap* prev;
} *pmlist_Head, *pmlist_Tail, *pmlist_Current;
The definition of the above structure highlights that, regardless of the
circumstances, the attacker is limited in the number of characters he can
inject into the various fields of the SOAP request, thereby restricting the
commands he can use to exploit the command injection.
---------------------------------------------------------------------------
--[ 4. Compilation and debugging
To study the service's behavior during execution, it is highly recommended
to compile it from source and debug it to streamline the development phase
of the exploit. The compilation phase was likely the most troublesome. As
the service's source code was quite outdated, it took numerous tests and
failures before a solution was found. The solution was to compile and run
the service in a virtual machine (x86_64) using QEMU, with Fedora 21
selected as the guest operating system.
It is not necessary to allocate much storage space, as this machine will
only run the sshd service (for administration) and the targeted service.
A disk can be created with the following command.
$ qemu-img create -f qcow2 fedora21.qcow2 20G
Once the disk is created, the next step is to launch QEMU, specifying the
path to the ISO (the download link is provided in the references
section[3]), and perform a standard Fedora 21 installation.
$ qemu-system-x86_64 \
-m 4G \
-smp 4 \
-cdrom Fedora-Live-Workstation-x86_64-21-5.iso \
-drive file=fedora21.qcow2,format=qcow2 \
-boot d \
-net nic\
-net user \
-vga std \
-display default
Once the operating system is installed on the guest machine, the VM can be
powered off and then restarted using the command below.
$ qemu-system-x86_64 \
-m 4G
-smp 4 \
-drive file=fedora21.qcow2,format=qcow2 \
-net nic \
-net user,hostfwd=tcp::2222-:22 \
-vga std \
-display default
The libupnp[4] library must be compiled before linux-igd because it depends
on it to implement the UPnP Internet Gateway Device (IGD) protocol. Since
linux-igd links against libupnp during compilation, failing to compile
libupnp first will result in build errors due to missing headers and
libraries. Therefore, compiling libupnp first ensures that the required
dependencies are available for successfully building linux-igd. According
to the linux-igd installation file INSTALL, we must first compile version
1.3.1[5] of the libupnp library.
$ tar -xf libupnp-1.3.1.tar.gz
$ cd libupnp-1.3.1/
$ ./configure
$ make -j4
$ sudo make install
The targeted service can then be compiled.
$ tar -xf linuxigd-1.0.tar.gz
$ cd linuxigd-1.0/
$ make -j4
$ sudo make install
Following the installation of linux-igd, the following files have been
added to the system.
/etc/