PenTest Magazine Mobile Pentesting
PenTest Magazine Mobile Pentesting
PenTest Magazine Mobile Pentesting
Improve your
Firewall Auditing
As a penetration tester you have to be an expert in multiple
technologies. Typically you are auditing systems installed and
maintained by experienced people, often protective of their own
methods and technologies. On any particular assessment testers may
have to perform an analysis of Windows systems, UNIX systems, web
applications, databases, wireless networking and a variety of network
protocols and firewall devices. Any security issues identified within
those technologies will then have to be explained in a way that both
management and system maintainers can understand.
he network scanning phase of a
penetration assessment will quickly
identify a number of security
weaknesses and services running on the
scanned systems. This enables a tester to
quickly focus on potentially vulnerable
systems and services using a variety of tools
that are designed to probe and examine
them in more detail e.g. web service query
tools. However this is only part of the picture
and a more thorough analysis of most
systems will involve having administrative
access in order to examine in detail how
they have been configured. In the case of
firewalls, switches, routers and other
infrastructure devices this could mean
manually reviewing the configuration files
saved from a wide variety of devices.
Although various tools exist that can
examine some elements of a configuration,
the assessment would typically end up
being a largely manual process. Nipper
Studio is a tool that enables penetration
testers, and non-security professionals, to
quickly perform a detailed analysis of
network infrastructure devices. Nipper
Studio does this by examining the actual
configuration of the device, enabling a much
more comprehensive and precise audit than
a scanner could ever achieve.
www.titania.com
Mobile Pentesting
Table of Contents
INTRODUCION
08
In todays world smart phones, IPADs and tablets are being used for GPS navigations, Social
networking applications, cross platform mobile messaging, e-mail, Banking payments and
many other applications. Mobile security has not kept pace with traditional computer security.
This article presents concept of mobile security, mobile attacks.
13
In this article, we will review the mobile landscape, various security threats, architecture/design
and few examples of tools that a relevant to platforms to handle these threats. This is a basic
article, but effective.
MOBILE PENTESTING
18
PenTesting Mobile
by Longinus Timochenco
Scan or PenTest? Pentest It is an option to study different forms of intrusion that may occur.
But vulnerability and Scan, which performs a system analysis to identify possible failures?
They do not have the same function? Examples of tools PenTest for Mobiles and difference
between PenTest and Scan you will find in this article.
Smartphone PenTest Framework is a tool for penetration testing the android smartphone.
Install Smartphone PenTest Framework in Kali Linux step-by step.Also read about Install
Android SDK Tool.
Android InSecurity
22
30
Mobile Pentesting
41
This is a tutorial in which you read how to scan a mobile phone using rooted Android Phone.
What is rooting? How install BackTrack on your phone? The answer to this question can also be
found in this article.
CRYPTOGRAPHY
Misuses of Cryptography
by Yuval Nativ
Established in many field cryptography it has been developed for ages and it is being passed
in a constant stage of evolution. In this article read about concepts related to cryptography,
cryptography tools and real uses of cryptography.
Cryptographic best practices dictate that even where confidentiality rather than integrity is the
overriding concern the cipher-text itself should be given integrity protection. Implementing
Message Level Security, Transport Level Security, Message Level Security and integrity
protection of the cipher-test you will learn more about it from this article.
SQL Injections, Cross-Site Scripting (XSS), inadvertently Disclosed sensitive information, and
other vulnerabilities. Testing of web application security with the help of VEGA.
50
60
66
73
The Web Appliaction security is a part of Information Security that deals mostly with security
of websites, web applications and web services or whatever used to browse over the web.Web
application security and compliance should be a top priority for enterprise and users.
advertisement
Mobile Pentesting
Dear Readers,
e are proudly presenting you the newest issue Mobile Pentesting! In this issue we will lay a focus
over mobile security, mobile penetration testing and mobile attacks. Moreover, this issue will
supply you with the topics concerning some pentesting tools and software.
An Overview on Mobile Security written by Senthilraj Gnanasekar will open the issue. The article presents
the summary of Top Mobile Security Threats and focuses primarily on mobile security. Next article Mobile
Security Testing was written by two authors Sandeep Chanda and Sridhar Bhamidipalli. We find here an
introduction to specific mobile platforms, inter alia, Android , iOS .
Next articles Android InSecurity and Smartphone Pentest Framework show us how to deal with specific
operating systems. Enrico Del Zotto covers the Android and shows how to configure it, while Bhargav
Tandel focuses on showing step-by-step installation in Linux Kali.
To learn more about the attacks platforms, we recommend you to read an article written by Vikas Jain.
In addition, we placed an article by Yuval Nativ Misuses of Cryptography. This article you can also find on
our blog. It interprets the info about tools and real uses of cryptography.
What is the difference between PenTest Scan and automated security? The answer to this question is
available in the article written by Longinus Timochenko PenTesting Mobile.
Additionally, we have for you a bonus in the form of articles of VEGA in Kali Linux and web applications.
Enjoy reading the magazine!
Magdalena Jaroszewska and PenTest Magazine Team
[ GEEKED AT BIRTH ]
DISCLAIMER!
Mobile Pentesting
Introduction
For the last 2 years, the number of mobile devices sold worldwide exceeds a billion and around 1 million
applications are available through marketplaces of the mobile platform providers.
Most of the business applications were designed and built for Web. But we also can advance a theory of that
mobile applications gained its handheld usability by the extent of the Client/Server systems, which came
up quickly modified for mobile usage. When mobile applications are not designed from the ground-up and
thoroughly integrated with the mobile landscape, several lapses in security will start showing up frequently.
The testers should fill these gaps in the areas of:
Authentication & Authorization: Ensure the user has the right privileges
Integrity: Trust the data and application behavior
Confidentiality: Take care of the application data must be privately managed
The means of achieving this is by denying several security hacking points like:
Encryption or lack of having one
Input validation both inside and outside application
Prevent snooping by data filtering
Storing authentication tokens in application
Storing critical data on the device
When we are planning the security infrastructure, the business priority has nothing to do with it as data that
might be obtained by a hacker from any of these applications can also have devastating effect.
Mobile security has two major areas:
Mobile Platform/O
Mobile network.
We will explore each of the areas in detail.
Mobile Pentesting
Mobile Networks
Mobile data networks have their own security protocols and vulnerabilities. Although there are several types
of networks across the world, the following are a few of the most common and usable types:
GSM
GSM networks are the most common ones for carrying mobile communication and transferring data. GSM is
considered to be the most secured network technology, but presumably we can find some gaps and cracks in
the certain security structure fence.
Communication Channel: The encryption does not occur through the complete communication channel,
but only from mobile to the base station.
TMSI: The temporary mobile subscriber ID can be discovered by hackers and falsely approven in many
occasions that can give the data position of the user being off/on.
Authentication: The authentication is only unidirectional. Hence, the user cannot be assured that the
communication he/she receives is really the desired and trusted one.
All in all, GSM is an old established network and has evolved piece-by-piece in the approximately all
security aspects over the years.
Mobile Pentesting
Wi-Fi
One of the most convenient networking protocol in the world, which is used by probably all corporates
across their physical locations. While hackers found Wi-Fi networks easy to break, equal security measures
can be taken to prevent such attacks on the following matters:
Attaching a wireless router to an unsecure switch port can disclose the whole network to undesirable entities
Malicious association appears once soft Access Points are created for general network connection
instead of company access points
Several other issues like DOS, Network injection, MAC Spoofing etc. can affect the network, however,
equal measure of securing are available and recommended for the companies.
Next generation
There are some other newer technologies like LTE and NFC, initially being fixed on their security vulnerabilities.
A mobile application should not just rely on the platform or network features as they all have vulnerabilities
as well. So in fact all the applications have to be tested thoroughly as well as their security plan should be set
up beforehand.
10
Mobile Pentesting
While the security test plan commonly depends on the specific needs of the organization, some critical areas
are also must be examined in every security test plan.
User Access Plan test cases around user access scenarios. Thus, the test process is to be implemented on
the following sections:
Different access levels Expected user access is withheld at different stages of application life cycle.
Jail-breaking/rooting How the application behaves when the device is Jail broke. How does the access
level hold up or fail.
Privilege checks Access to resources (like files, features) is expected to be verified.
Data Input As discussed earlier, inputs must be verified at every stage for integrity as well as expected
source.
User Input should be verified against tampering.
Data could be sniffed over the network, hence, we need to encrypt.
Application execution Plan to test against Network interfaces, communication with other resources,
session management (expirations, integrity)
User session remains until the user logs off or planned timeout occurs.
Provide consistent server side operations for CRUD operations.
11
Mobile Pentesting
Integration points with other systems (outside the mobile device)
Metrics
Load testing for the application
Specifically identify the breaking points
Test for denial of service attacks
Conclusion
Mobile application security is a vast area and It depends a lot on the type of application. Beyond the
functional testing, a separate approach should be done simultaneously to security testing.
12
Mobile Pentesting
Android InSecurity
by Enrico Bruno Del Zotto
The full article is divided in three parts. The first one is the simplest one. We start with an
android architecture introduction and after we will learn how to exploit the application
framework. At the second part of the article we will finish the application framework with
attack on content provider, sql-injection on android dbs, and some mitm network attacks.
In the third part (more advanced) we will start with a bit of arm asm and we will see how to
write a real android exploit.
Android has a layer of abstraction (Application Framework) and lacks the native windowing system, glibc
and most of the standard utilities of Linux, which gives it a very unique anatomy.
Mobile Pentesting
-Prevents user A from reading user Bs files, -Ensures that user A does not exhaust user Bs memory,
-Ensures that user A does not exhaust user Bs CPU resources, -Ensures that user A does not exhaust
user Bs devices (e.g. telephony, GPS, bluetooth). The Android OS is architected as a specific platform,
where every new application launches in its own unique instance of Dalvik. This is a really nice security
feature, because it prevents applications from undesired access or provide you with the awareness of
other applications, which are also executing on a device. This technique creates a secure execution
environment and prevents data leakage between applications. The Dalvik VM interacts with a number
of core libraries, which enables functionality for the application running within. But how is the access
to various functionalities controlled? This brings us to the next major security element of the Android
OS the permissions model. Permissions are requested by an application during the installation process
and it is giving access to various features and functionalities on a device. Currently there are 124 unique
permissions, which are categorized into 11 top level groups. The permission model is a viable security
feature because it
14
Mobile Pentesting
Lets start
To start in Android p.t. appropriately, you have to install the SDK,NDK,and some other important tools
like drozer (well use it in our exemples).Drozer was developed at mwrinfosecurity@uk (https://www.
mwrinfosecurity.com/products/drozer/) and helps to reduce the time taken for Android security assessments
by automating the tedious and by using flexible, pre-written modules to perform common tasks, and also
execute dynamic code on a device, because we do not intend to compile and install small test scripts. [2]
15
Mobile Pentesting
16
Mobile Pentesting
17
Mobile Pentesting
Get the info of a packages:
dz> run app.package.info -a com.vodafone.vodafone360updates
The list of the activities of some packages. We will now only consider vulnerabilities exposed through
Androids built-in mechanism for Inter-Process Communication (IPC). These vulnerabilities typically result
in the leakage of sensitive data to other apps installed on the same device. [4]
dz> run app.package.attacksurface
Attack Surface:
8 activities exported
3 broadcast receivers exported
2 content providers exported
0 services exported
com.vodafone.vodafone360updates
And for example run an activity exported (You can view the information of your samsung account and
change the password without sigin).
dz> run app.activity.start --action android.intent.action.MAIN --category
android.intent.category.LAUNCHER --component com.osp.app.signin
com.osp.app.signin.AccountinfoView
18
Mobile Pentesting
And now were enumerating the services of an app:
dz> run app.service.info -a com.vodafone.smhs
Package: com.vodafone.smhs
com.vodafone.smhs.services.HtcFeedService
Permission: null
(in this case we are logging only the error messages), start a fuzzing tap clicker and send event attached to
our package:
>adb shell monkey -p flipboard.app -v 1000
In this manner well see our application randomly tapped and well log all events searching for some useful
strings in the logcat. A facebook vulnerability (http://blog.parse.com/2012/04/10/discovering-a-majorsecurity-hole-in-facebooks-android-sdk/) was detected in the described manner. The Parse android sdk log
the facebook accesstoken. Logcat is public tool, that is why we could search for access token and send it to a
place (e-mail or something else) in order to use it for a mitm attack.
A good way to proliferate information about application and their components is to eavesdrop on interapplication communication. One way you could do this is to request the information about the most recent
intents from the activity manager. [5]
You can download (https://www.isecpartners.com/tools/mobile-security/intent-sniffer.aspx) and see the
informations about recent intents:
19
Mobile Pentesting
Attacking services
A Service is an application component that can perform long-running operations in the background and
does not provide a user interface. Another application component can start a service and it will continue to
run in the background even if the user switches to another application. Additionally, a component can bind
to a service to interact with it and even perform interprocess communication IPC). For example, a service
might handle network transactions, play music, perform file I/O, or interact with a content provider, all from
the background. [6]
Trying to send crafted data to a service, as an intent without data or some other things you could have
strange results.
20
Mobile Pentesting
Expecially if you can decompile the code and you could understand what a service is expected to have.
For example in OWASP GoatDroid project. We have this service:
<service android:name=.services.LocationService >
<intent-filter>
<action android:name=org.owasp.goatdroid.fourgoats.services.LocationService />
</intent-filter>
</service>
If you have the source code [7] you could see the above action processing that if you have started the service,
and some preferences are settled. Then you can give the location of the user every tot second, and if this
position is written in a vulnerable content provider or in a file, you could read it without having no permission.
This is an example of a service started with a null metadata/extra data fields.
dz> run app.service.start -component com.android.systemui com.android.systemui.PhoneSettingService
21
Mobile Pentesting
The key issue in the code is that this application will be granted the android.permission.SEND_SMS permission
while leaving its .SendSMSNowReceiver vulnerable receiver, without the protection of appropriate permissions
and exposed to other applications.
This is not all there is to these kinds of vulnerabilities; there is another part. Just because the receiver leaves
other applications to interact with it doesnt necessarily mean that its exploitable; to verify whether its
exploitable, you can actually try sending to the broadcast in the intent some data, or better if you can read the
source code (disassembled or not ) In this case (https://github.com/jackMannino/OWASP-GoatDroid-Project/
blob/master/OWASP%20GoatDroid-%20FourGoats/src/org/owasp/goatdroid/fourgoats/broadcastreceivers/
SendSMSNowReceiver.java). The following is the code that determines how the receiver handles the org.
owasp.goatdroid.fourgoats.SOCIAL_SMS actions:
public void onReceive(Context arg0, Intent arg1) {
context = arg0;
SmsManager sms = SmsManager.getDefault();
Bundle bundle = arg1.getExtras();
sms.sendTextMessage(bundle.getString(phoneNumber), null,
bundle.getString(message), null, null);
Utils.makeToast(context, Constants.TEXT_MESSAGE_SENT, Toast.LENGTH_LONG);
}
The key issue in the code is that the receiver takes values straight from the bundle object without first
checking the calling application or the values being supplied and plugs it into a sendTextMessage call.
This basically means any application will be able to send arbitrary, uncontrolled SMSs.
The sintax in order to send something to a b.r.:
dz> run app.broadcast.send -action [ACTION] -category [CATEGORY] -component [PACKAGE
COMPONENT] data-uri [DATA_URI] extra [TYPE KEY VALUE] flags [FLAGS*] mimetype
[MIMETYPE]
In our console with this command we could send som sms without having the permissions:
dz> run app.broadcast.send -action org.owasp.goatdroid.fourgoats.SOCIAL_SMS -component
org.owasp.goatdroid.fourgoats
org.owasp.goatdroid.fourgoats.broadcastreceivers.SendSMSNowReceiver -extra string
phoneNumber 1234567890 -extra string message 31337
22
Mobile Pentesting
Conclusions
In this first part of the android insicurity article we have seen some insecurity aspects of android platform,
how to enumerate vulnerabile things in tha application framework, in the second part we will investigate
into the second part of application framework, and we will explain some attack in the network layer for the
android platform.
References
[1] http://www.webroot.com/shared/pdf/Android-Malware-Exposed.pdf
[2] https://www.mwrinfosecurity.com/products/drozer/
[3] https://labs.mwrinfosecurity.com/system/assets/502/original/mwri_drozer-users-guide_2013-07-25.pdf
[4] https://www.mwrinfosecurity.com/system/assets/559/original/mwri_drozer-users-guide_2013-09-11.pdf
[5] http://my.safaribooksonline.com/book/networking/security/9781782167167/4dot-exploiting-applications/ch04s04_html
[6] http://developer.android.com/guide/components/services.html
[7] https://github.com/jackMannino/OWASPGoatDroidProject/blob/master/OWASP%20GoatDroid%20FourGoats/src/org/
owasp/goatdroid/fourgoats/services/LocationService.java
My passion is security all aspects derived from this. Apart geek life,my kung-fu is
volleyball and my friends. I worked as penetration tester and admin and after a period of
my life in other topics (consultant) currently im mobile developer in the north east of
Italy but im looking for a company in order to work fulltime in security.
advertisement
EMBEDDED LINUX
www.css-design.com
Communication Systems Solutions
Lincoln, NE 68516
402.261.8688
Mobile Pentesting
Misuses of Cryptography
by Yuval tisf Nativ
Cryptography is a well-established field. It has been developed for ages and it is being
passed in a constant stage of evolution. From the ancient days of transformation algorithms
with basic security concepts to the ECC and RSA, cryptography has proven as a main (if not
the only) mean for privacy and security. Certainly, we all use its techniques nowadays.
Although we have verycloseto unbreakable algorithms, we also may hear, that companies (even big ones)
are being hacked all the time and the data is stolen. We can hear, that SSL decryption and signature are
compromised along with standard protocols that utilize AES, which got broken too. Then, how can this occur?
On the following article we will try to cover the basic and common mistakes of the implementation of
different cryptography methods being implemented on different services and products. We will also learn
how the basic misunderstanding of the information security concepts and cryptography has impacted all of
us and and its influence will probably just increase with the time. Hopefully, the readers of this article are
already informed to the issues at hand or have gained a better understanding of others mistakes, which made
them succeed in implementing cryptography onto different systems.
Cryptography Concepts
We have a couple of key cryptography concepts, which are available in our arsenal today.
Lets separate them off into two main categories and then into the detailed technical information:
24
Mobile Pentesting
Trust
Trust is a more difficult thing to achieve. When talking about trust, we usually avoid the digital world since
it is very hard to come with a strong trust over the internet. How do I know, that the certificate i see uploaded
really belongs to the domain it claims to? How do I know, that domain belongs to the company is indicates.
Most of you have experienced a domain purchase, thus you know that there are many other domain names
very similar to your own. A famous phishing attack is known for purchasing the domain name paypaI.com
(which is paypa and a captial i).
It is important to note that these two categories are not really separated. We will talk about most of the
algorithms, which provide solutions for secrecy, integrity and trust or any other two of these categories, but
the sorting out intended to give the reader a better understanding of these two different problems.
Hashing
Hashing algorithms are one way functions, which produce a known size output and requires no key. Hashes are
used to store sensitive information (including passwords) and as checksums for information. It is important to
remember that they do not provide any trust and hashing open algorithms, that anyone can generate a hash for a
known plain text.
The two prime examples (and, probably, most commonly known) are the MD5 cipher and the SHA2 family.
MD5 has been widely used but is now considered to be insecure due to known collusion attacks, that have
generated a 128bit output. SHA2 is a family, which encompass two most commonly used algorithms: the
SHA256 and the SHA512. The names indicate the output size. As for the day, this article is written (2014),
there is no mathematical attack available against the SHA2 family algorithms.
Since algorithms are built on block cipher, (discussed later in the article) each little modification to the plain
text will result in a major change to the output. This makes them great for integrity checking. The following
line Im just sitting here reading a magazine... gives the following output by using SHA256:
6e7ac84298c8fac86f3ca5c02b6d9f7a7472856ac92fa0d2a8ae97fcfb38c98a
If you input this line Im just sitting here reading a magazine... you will get the following output:
b1abf53eef4b67cedb52c717ed40b601f0a93820e805e2776aa3fcccfae0dc47
Notice how a small modification has resulted in a huge, easily noticeable difference.
Symmetric Encryption
A cipher will be categorized as symmetric encryption only when the key is being used to encrypt the plain
text. Then the same key required to decrypt the cipher text back to plain text. In this category we classify
them as stream ciphers and the block ciphers. The stream ciphers operate on one bit at the time when one of
the ground rules claims not to encrypt information with the same key twice. A prime example for a strong
stream cipher algorithm is RC4.
A block cipher is still a symmetric cipher but it runs on blocks of plain text and it runs in iterations.
These algorithms are more expensive (resources wise) but are dimmed stronger.
25
Mobile Pentesting
Two prime examples for strong block ciphers are the AES family and the Twofish algorithm.
A-Symmetric Encryption
A Symmetric encryption is a process which enables a key pair (public and private) while one is being used
to the encryption process and the other is used for the decryption process. At this article we will not go into
asymmetric encryption, but I would want to mention two key concepts. The first is that all big asymmetric
algorithms relay on a factorial of two prime numbers. These prime numbers are the fundamental blocks of all
numbers. Since there is no real way to compute prime numbers or check for prime numbers, they are harder
to come by. The last sentence is generally, but not entirely true. We do have algorithms like RabinMiller [1]
for a better method of checking if the number is a prime or a composite and we do have the Prime Number
Theorem [2] to allocate amount of primes within a group, but not to particularly determine which numbers
are the primes. We have the Eulers function ( f(n) = n2 + n + 41 ) alike other prime number. It is generating
functions of a certain type of primes or not always primes. Eventually, they are shown up as not to be valid
to anything relating to cryptography. The end concept you should know about Asymmetric encryption before
we go on is this:
26
Mobile Pentesting
BBM uses an asymmetric key, employed on the all devices. It later uses an PINtoPIN encryption, but
the PIN is never encrypted. This is important to understand since those are not encrypted messages, but
scrambled ones.
WEP
WEP stands for Wired Equivalent Privacy. It is an amendment to the protocol introduced by the IEEE 802.11
WiFi protocol. WEP refers to more than just the encryption, but to the authentication process, the encryption,
the integrity and more. WEP applies the RC4 stream cipher for confidentiality. RC4 is esteemed to be good
stream cipher.
Even though RC4 is still being used in many protocols, where WEP is considered to be very insecure due to
the design of the protocol, not the encryption standard it implements. Since RC4 is a stream cipher repeating
the same key more than once, it is a big nono. If the same key is used more than once, it may allow an
attacker to conclude on the entire key and, eventually, rest of the messages accordingly. In order to avoid
this, the designers of WEP added an IV to the key.
The IV (initialization vector) is added to the key and therefore changing the actual key is going into the
RC4 cipher each time to ensure the same key is unrepeated. The IV is added to the packet and sent in
the clear to prevent other clients from repeating by using the same IV again. So far, its a good concept
of the implementation, however, it is a completely different thing. The IV is 24 bit long. Within 5,000
packets there is a 50% chance of the same IV being used twice. Since it is sent in the clear, an attacker
can easily spot two packets encrypted with the same IV.
A standard network will generate more than 5,000 packets per 10 second. Assume that you watch a 12
seconds long youtube video on HD, at the meanwhile you will generate approximately 43,000 packets.
If you would like to check that, load your favorite packet sniffer and prove it to yourself. This means
that an attacker does not even have to be active in order to crack the key and can just sniff traffic
(the bus is actually the air!); then, attempt to crack the key locally without generating any traffic or
interacting with the network or any of its clients.
To compare, the WPA1 standard which still utilizes RC4 for encryption, uses TKIP to exchange keys and the
WPA2 uses AES for the encryption process and can use TKIP and/or CCMP.
WEP takes a good symmetric cipher which is used in many other encryption standards such as WPA1,
SSL and others. It incorporates into a protocol, which misses the biggest issue with the cipher itself. It is
important to notice, that the authentication manner suits the RC4 algorithm as well as used in a challengeresponse manner. Note, that the main vulnerable point in WPA1&2 is the handshake itself.
PRISM NSA
The PRISM program was released in 2013 over Edward Snowdens case [1]. It has rattled the industry
and the world. Plenty of articles have been written about it and this is not going to be another one of them.
Instead, we are going to focus on the aftermath of this epic event.
The PRISM program has proven to us that a third party cannot be trusted whether we are referring to a
service provider or a product manufacturer (programs, certifications and more). It has been showed that
closed systems (software or encryption) is not something we can relay on. We need to understand how the
particular schemes work and let a sufficiently big group of experts to comment on that system, so that we
can vouch for its security. Big service providers have been proven to supply information to the PRISM
program (willingly and unwillingly [2]) and some have even tried to fight the program. LavaBit is a prime
example. When Lavabit were asked to hand over the SSL keys to their services, they tried to fight the act,
eventually handing the keys over. The event caused the shutdown of the company since it cannot guarantee
users safety and privacy [3].
This has woken up the information security community and they have started modifying the way we look
at security. Services like Threema, which we will talk about later, rose and started finding solutions how to
provide security but through transparency rather than obscurity.
27
Mobile Pentesting
The lesson we learn from this is that there are entities with interest and resources directed to trouble methods
of information breach. If we are keen to keep our information secure, we need to rely on comprehensive
mechanism. IPv6, for instance, requires the IPSec technology for encryption. IPSec [4] has been around
for a while with only one issue. The protocol is so mindbogglingly complex that not a single cryptographer
has been able to understand it and even state for its security level. Simple algorithms like the RSA,
AES, Twofish, PGP have all been proven to be secure with the test of time. They are relatively easy for
understanding and implementation, therefore, analysis and attacks can be implemented to patch up the
needed parts for us to make it secure.
CryptoLocker
CryptoLocker is a relatively new ransomeware. The unique thing about this ransomeware is the way it
implements cryptographic (hindsight perfectly).
CryptoLocker spreads itself by using regular phishing emails and requires to be run as executable after
downloading. It infects only Windows machines. After being executed, CryptoLocker will copy itself to
a random name on your Documents and Settings folder. It will start a search for all *.doc, ppt, pptx, xls,
bmp, jpeg etc and will list them. On the next stage, it will turn to a bunch of DNSs which one of them is the
real C&C server. The C&C server creates a new UID for the infected machine and creates a new public and
private key pair. The public key is sent to the victims copy of CryptoLocker, which the encrypts all of the
files it listed in RSA 2048 bit. Later on, it zero fills all the original files and deletes them from the drive.
The user is then displayed with a message requesting 300 USD for the key which should be transferred via
BitCoin. If the user does not transfer the BitCoins required within 72 hours, the private key will be deleted
and the information is lost.
28
Mobile Pentesting
The cracking of it is to look for the hash in google. We can use a salting method of adding the ahggf4%4d
string in the beginning and the string 12gf& at the end, making the password size larger and removing the
collisions when someone matches the hash (well see that in a minute).
pass = 123
SHA1(ahggf4%4d & pass & 12gf&) =323dd0a9312cd53581003d884fb307ca7c811087
This also protects us from collision attacks since someone got to our tables and assume that they find the
323dd0a9312cd53581003d884fb307ca7c811087 sum is generated by the plain text value of 123456 as well, when
they try to login, the salting will still occur meaning that:
29
Mobile Pentesting
pass=123456 //remember that SHA1(123456) == SHA1(ahggf4%4d & pass & 12gf&)
SHA1(ahggf4%4d & pass & 12gf&) // SHA1(ahggf4%4d12345612gf&
The reason we just went into that is the implementation of the cryptographic mechanism in the
Microsofts Membership Providers. If you go to the Microsofts documentation page you will find the
following table explanation:
Table 1. Membership Providers Reference Table
Column Name
ApplicationId
UserId
Password
PasswordFormat
PasswordSalt
Column Type
uniqueidentifier
uniqueidentifier
nvarchar(128)
int
nvarchar(128)
MobilePIN
Email
LoweredEmail
PasswordQuestion
PasswordAnswer
IsApproved
IsLockedOut
CreateDate
nvarchar(16)
nvarchar(256)
nvarchar(256)
nvarchar(256)
nvarchar(128)
bit
bit
datetime
Description
Application ID
User ID
Password (plaintext, hashed, or encrypted; base-64-encoded if hashed or encrypted)
Password format (0=Plaintext, 1=Hashed, 2=Encrypted)
Randomly generated 128-bit value used to salt password hashes; stored in base-64encoded form
Users mobile PIN (currently not used)
Users e-mail address
Users e-mail address (lowercase)
Password question
Answer to password question
1=Approved, 0=Not approved
1=Locked out, 0=Not locked out
Date and time this account was created
Trimmed it a bit to see only the fields we are interested in. If you look at the Password field it has 3
options plaintext which we do not want, hashed or encrypted. Now, encrypted options always have its issues
since it can be decrypted with the right key, but well let that go for now and consider the hashed option.
This service uses SHA1 as the hash function, which is already a bit problematic, but the most problematic
thing is the salting implementation, which is very important but in almost a useless way. The salt and the
password are saved on the same table. They are both BASE64 encoded (NOT encrypted! Just another
representation of the actual data). Thereby, when the attacker gets a read permission on the table, lets say via
SQL injection, the data is all he needs to decrypt the passwords.
Troy Hunt wrote a nice piece about this and if you write in ASP.NET or have an understanding of the
language then you will enjoy exploring it.
Threema is a recent application available for mobile devices. It is an instant messaging solution using PGP.
The cryptographic implementation of Threema is a very good example of how to use cryptography. When you
create a user on Threema, your device also generates a publicprivate key pair. Whenever you add a contact you
must have their private key. You can set levels of trust for the contact. You can get 1 rating for someone that you
do not know and has just texted you. You can get a 2 rating if the person you are communicating with is already
in your address book and has been matched via a phone number or an email address. A 3 star is something you
set manually or when you scan a QR code from a phone of your friend with the secret key.
For the sufficient system the infrastructure cannot be only peer to peer since this will require both parties
to be online for communication. In Threema you must go through Threemas servers, then you can leave
a message for a user while he is offline. In order to implement a privacy protection mechanism over your
contact list, Threemas client does not upload it to the server and does not search in plain text but rather
hashes the details of the user you are looking for and then searching for the hash on the server, so the server
does not recognize the user communicating with, but it is able to match a specific user with a specific key.
The implementation of the public key infrastructure with Threema allows you to encrypt the information and
to vouch for the authenticity of the author. The only key missing here for me is the exchange of a temporal
sessions key.
30
Mobile Pentesting
bitcoin
BitCoin is a new distributed monetary system based on a peertopeer topology.
The better term I like for this is cryptocurrency. The bitcoin system is divided into three main components:
The Wallet
The wallet is basically a public and private key pair, which is used to perform an outgoing transaction. You
need to have the private key of that particular wallet. The public key is shared with the entire network, which
will allow receiving bitcoins from other wallets.
The Block Chain
The block chain is the history of all the transactions, registered an verified in the bitcoin network.
The block chain is what makes BitCoin so strong. Since the currency flows as digital bits and bytes, there is
an important factor to make sure that no user can double spend the currency in that particular wallet.
Mining
Mining for bitcoin is the process which is used to reward users with bitcoins. The process is actually intended
to add computing power to the system by allowing users to gain currency. Mining allows user to recompute the
block chain and verify that all bitcoin done transactions are confirmed with a matching balance.
Though people will comment that bitcoin is still not a successful currency, for the time of March 2013
bitcoins network has had more computing power than the top 500 supercomputers in the world [2].
The original paper by Satoshi Nakamoto which suggested the BitCoin system can be found here [3].
SQRL
Secure QRcode
Login is another technology emerged from PRISM. Steve Gibson wrote a shocking white paper about an
alternative method for web authentication and privacy issues. This protocol utilizes asymmetric concepts and
algorithms to allow seamless and strong authentication.
Mobile Pentesting
matching the public key stored on the server. This will allow the site to know that the user who replied to the
challenge also has the private key matching the public key stored on the server.
Wrapping It All Up
The end point of this article is that you should continue using encryption. Before implementing or judging
system, one has to possess a strong understanding of the methods. You do not need to be a mathematician.
You do not need to understand the bits and the bytes at this point. All you need is to gain practical knowledge
of encryption standards and algorithms. The do and the do nots at cryptography while reviewing a new
system are the obliging requirements for you in this case. Along with general concepts, you can see the point
of failures in many protocols, which is the basis of hacking.
Yuval tisf Nativ is the Offensive Division manager at SeeSecurity Technologies. His work
encompasses consulting, security research and at night time teaching developers on how
to become hackers.
32