Final Learning Journal
Final Learning Journal
November 2019
Table of Contents
1. Introduction ...................................................................................................... 3
2. An overview of Malware ................................................................................... 5
2.1. Malware situation of the world ................................................................... 5
2.2. What has changed between the MS reports?............................................ 7
2.3. Design of a sophisticated piece of malware .............................................. 8
3. A closer look into Viruses............................................................................... 10
3.1. Fixing a PE file ........................................................................................ 10
4. Getting to know WLAN................................................................................... 14
4.1. WPA2/3 Information ................................................................................ 14
4.2. Harmfulness of Crack attacks.................................................................. 15
4.3. Current situation of the 4-way handshake ............................................... 15
4.4. What is new in WPA3? ............................................................................ 15
4.5. Recovering lost credentials ..................................................................... 16
4.6. Analysis of Defcon22 conference ............................................................ 17
5. Exploits and countermeasures ....................................................................... 19
5.1. What is a Man-in-the-browser attack? ..................................................... 19
5.2. Know Advanced persistent threat and targeted attacks .......................... 20
5.3. What is XSS? .......................................................................................... 20
5.4. IOT and common vulnerabilities .............................................................. 21
6. Software and system security ........................................................................ 22
6.1. Security tools and mechanisms ............................................................... 22
6.2. What is Ransomware? ............................................................................ 23
6.3. How malware makes itself invisible to antimalware software? ................ 23
6.4. System functionality, attack propagation and detection in dependent
systems ............................................................................................................. 24
7. Conclusion ..................................................................................................... 26
8. References .................................................................................................... 28
9. Appendices .................................................................................................... 29
9.1. Minutes of the meeting #4 ....................................................................... 29
1. Introduction
The present document is the final assignment for the course System and Application
Security, it is a compilation of multiple weekly reports that have been done over the
past two months using the knowledge acquired in the lectures, independent
research and discussion in group meetings. The contents of the reports vary from
one to another according to the topic of the lectures and the activities assigned by
the professors every week. The learning journal covers multiple topics in cyber-
security and networks.
The first topic addressed is malware in general and its impact on the world, then
viruses are explained, and a practical exercise is presented to help understand the
topic. The third subject reviewed is WLAN, here basic information is presented and
a practical example of the vulnerabilities of a network is also written about. Next,
exploits and countermeasures are described to present different examples of
situations where these topics have been present. In last place, software security
was described and researched.
The team for the weekly meetings was the number 12, conformed by Melissa
Welander, Fredrik Brushane, Heta Pärssinen, Luke Skeen and Juan Giraldo. Five
group meetings took place during the academic period, the first one was on
September 12 at 8:00 in the Natura building, the second one was on September 19
at 10:00 in the Natura building, the third one was on September 26 at 10:00 in the
Natura building, the fourth one was on October 10 at 10:00 in the Quantum building,
I was the chairperson in this meeting, and the last one took place on October 17
also in the Quantum building at 18:00.
In the current society information is everything, the ones who possess a great
amount information tend to use it to make much profit. That is why a massive
amount of services and devices capable of managing information efficiently have
been developed over the last few years and nowadays they are a vital part of the
everyday life of every person in the world. These information services contain any
kind of valuable data, from medical records and baking credentials to nuclear launch
codes. Due to the value of the information inside the systems, every day people try
to break into devices and use different techniques to steal the private information.
Therefore, a great amount of research and breakthroughs in the area of information
security have been made, some of the methodologies, techniques and tools are
presented in this journal. The subjects addressed in the course and therefore
presented in this work are of great relevance for a software engineer student who
is developing a knowledge base in cyber-security.
My expectations for the course were high, I was very interested in learning about
different mechanisms to defend against the multiple threats users encounter every
day on the web and in understanding in more depth how cyber-criminals manage to
penetrate and affect different technological devices. Before taking the course, I had
some knowledge about security and attacks due to a research project I did back at
my home university. The research was about implementing a methodology to detect
web defacement attacks. During the project I learned about attack vectors, web
architectures, countermeasures to web attacks and some exploits like SQL
injections and XSS attacks.
One can say I already had the base knowledge about some of the topics covered
by the course, but still, all the information presented by the lecturers was of great
importance to develop a deeper understanding of each topic and to create a
connection between each one.
2. An overview of Malware
In this report mostly information security topics are addressed, more specifically
Malware and its presence in our society. Information about the evolution and
present situation of Malware in the world is covered along with descriptions and
examples of some of the most relevant pieces of malware nowadays. To give an
accurate insight about the evolution of malware, a comparison between two official
Microsoft security reports is presented in the report. A detailed description of a
made-up virus is given in order to replicate the process of designing a complex piece
of malware.
All the information showcased in the map is gathered by Kaspersky using their
multiple anti malware services, like On-Access Scan - OAS, On-Demand Scan -
ODS, Web Anti-virus - WAV, Mail Anti-virus - MAV, IDS - Intrusion Detection Scan,
VUL - Vulnerability Scan, KAS - Kaspersky Anti-Spam and BAD - Botnet Activity
Detection. Taking this into consideration, one can say that the malware information
is accurate but as this is only Kaspersky’s data, the map lacks from representativity
as not everyone in the world uses Kaspersky as their main anti malware software.
Information about the most dangerous current pieces of malware was also collected
in order to have a better perspective of the potential threats people can run into
while using an electronic device. A table was made to present some of the most
dangerous researched malicious software (Table 1), at the top of this table is a
Ransomware called Wannacry, it was developed to encrypt the data of computers
running previous versions than Windows Vista, the objective of the cybercriminals
who created it was to request money to release the hijacked information. This piece
of malware affected more than one hundred thousand computers all over the world,
among the affected people there were hospitals, airports, phone and gas
companies, this is why this malicious software is at the top of the table, because it
actually compromised vital information needed to keep people alive.
The malware was thought to be a keylogger virus which targets Windows 32- or 64-
bit operating systems and infects the executable file of a video game to steal the
account credentials of the player (Figure 1). The virus will be integrated to the game
launcher’s code by overwriting the parts of the file containing zeros, spaces or
padding making it very difficult to be detected by an antimalware software. This
malware will be put in the host’s machine when the user installs a third-party
software that provides in-game information but also serves as a container for the
virus. Now, whenever the launcher is executed the keylogger will be activated and
ready to capture the player’s account information by recording the keystrokes of the
user (Figure 2). The virus needs to survive in the system at least until the executable
file of the game is clicked for the first time after the infection.
The virus hides from scanners by encrypting its code and mutating on each
infection, so the instructions perform the way they are intended to perform but with
a different implementation. Whenever the user launches the game, the virus will
decrypt itself using the encryption key previously generated and will be ready to
capture data when the player logs in to his account. One way to defend from the
virus is using a two-step verification log-in that is usually provided by the game
companies. Also marking the client launcher in the malware software configurations
to do constant check-ups of that specific program. Finally changing the password
constantly is the most effective countermeasure for this malware.
Figure 1. Malware structure
It was of great help to see examples of every hiding technique because having a
practical implementation makes the understanding of the methods way easier. In
addition the section about the detection methods for viruses was the most useful of
all, due to the annual growth and evolution of technology new hiding methods are
developed, each time more complex and ingenious than the last time, this is why
knowing multiple techniques of detection comes in handy to defend against these
threats that attempt to harm our integrity.
The first step to address this problem was to try to execute the file, it was executed
in a computer running windows 10, but every time the file was clicked a warning
was shown saying that the application cannot be run in Win32 mode (Image 1). In
order to try the file in other operative system, a program called WineBottler, that
allows the execution of Windows applications in MacOS, was installed on a
MacBook Pro, it was a surprise realizing that without changing any configuration of
the file, it was executed correctly in the Mac environment (Image 2). Knowing that
the file can be executed properly without making any corrections to the code means
that the main structure of the PE file was not altered and that the problem must be
in the configuration of the file that Winne can fix by itself. It was decided to explore
more closely the contents of the executable in order to understand what is
happening inside.
Using a PE viewer it was possible to identify the sections of the mystery file, it was
divided in the DOS_HEADER, the DOS_STUB, the NT_HEADERS containing the
PE file signature, the PE file header and the PE optional header, it also has the
SECTION_HEADER, which defines an array of 7 positions for the .text , the .rdata,
the .data, the foobar1, the foobar2, the foobar3, and the .rsrc fields (Image 3). At
the end it has the IMPORT_DESCRIPTOR and the DIRECTORY_TABLE, this
confirm us that the structure of the file is intact so the virus must have changed the
content of any of the sections. Something to notice is that the file is digitally signed,
these signatures are used by the software publishers to identify the executable file
as theirs, a valid signature ensures the authenticity and the integrity of a PE file.
Looking deeper into the signature it was found that the signer was “SysTApplSecur
rulz OK!” and also that the signature is not valid, meaning that there is a high chance
the digital signature was modified by the virus and the current one is not the original.
Taking into consideration that the only thing needed to change the signature of a
file is editing the hex code, one can say that executing a PE file based only in the
digital signature is not a good decision.
Making use of the hex editor built in the PE viewer it was possible to explore the
contents of each one of the sections in the file, some useful information was found
inside. The first thing to notice is that the file contains a MZ header which confirms
the executable file is MS-DOS-compatible. The PE header is also present in the hex
code as well the section header definitions, meaning that the content of these
sections is correct. The previous sections were followed by a long padding of zeros,
for some unknown reason the hex editor highlighted this section with a red colour
like if it was not supposed to be there. A section declaring what looked like an error
logs, followed by a charset table and a calendar format, these parts of the code
appear to be legit and not tampered by the malware. Two sections of the code were
especially striking, the first one was a series of strings saying “Hello from Sys-
AppSec test application”, there were two of these separated by three zeros, but at
the end of the second string there also was three zeros followed by the letter “H”,
this raised the suspicion that other string was missing. The other striking part of the
code was almost at the end of the file, it consisted of multiple copies of the phrase
“SystApplSecur rulz OK!”, considering that this is the same digital signature of the
executable file and that is very possible the signature was changed by the virus, the
text seemed like it was planted by the malware.
Using the information previously collected, some strategies were developed to fix
the PE file. The first approach was deleting the padding found after the PE header
in the hex file, this not only did not fix the issue but left the file completely useless,
at a point that windows won't even recognise it as a .exe file. With this, the theory
that the virus might have left some paddings that can be removed to fix the file fell
apart. Next, the text containing the “Hello from Sys-AppSec test application” phrase
was addressed, this piece of code looked like it had an unfinished pattern so it was
decided to complete it by overwriting some of the current bytes with the ones that
completed the pattern. Unfortunately, this procedure didn't fix the application but
unlike the previous method, this one didn't leave the file useless.
Other approach used was to delete the text containing the words “SystApplSecur
rulz OK!”, based on the premise that the digital signature was altered by the
malware, this method didn't fix the application. Knowing some viruses can insert
themselves in paddings, it occurred that the text previously mentioned might not
needed to be deleted but replaced with zeros, unfortunately this didn't work either.
At this point it was decided to investigate more about how Wine Bottler executes PE
files, but due to lack of documentation of that software it was impossible to get any
valuable information that could have been used to fix the application. In the end the
file wasn't fixed, but that task is left for future work based on this research.
4. Getting to know WLAN
I already knew the basics about wireless LAN, but it was helpful to receive an
introduction to this technology because I didn't recall very well some topics like
security mechanisms and WLAN communications. Also, it was very interesting to
see actual statistics about the WLAN security situation in some countries, for
example in Romania one can see how they drastically improve the security of their
wireless networks in only 4 years. Personally I found useful the review and
description of the different infrastructure attacks because you always hear in the
tech field people talking about different wireless attacks, you know what they mean
but you don't know how they work, so it was nice to get to understand them more
deeply.
The most interesting topic reviewed the past week was the different WLAN
protocols, WEP, WPA, WPA2, WPA3 and WPS. First, the explanation of the WEP
was especially useful, because you get to understand how was developed the first
approach to wireless security, also you can understand what went wrong and learn
from that so in the future these mistakes don't come back. It was shocking that
knowing that WEP has been deprecated from more than 16 years, some people are
still using it to “protect” their wireless networks. But it is good that in Finland WEP is
still covered by the law, so it gets a little bit of protection from that aspect.
Now regarding the WPA protocols, it was interesting to learn about the evolution
and current state of this wireless security tool. Especially how the original WPA was
cracked and how the second version of it was constructed as a fix for all the known
vulnerabilities, also it was nice to understand the improvements that the third
iteration of WPA is going to provide. Finally, I was able to learn about a new network
feature, last week was the first time I heard about WPS. Even though this is
considered a very insecure network security protocol, I find it a very clever idea to
address the problem of connection to an AP, but sadly it was poorly executed.
The larger file was the first one to be analysed by the software, it only took less than
a second to get the WEP key using this file (Image 4). The second file did not
produce key, the program couldn't crack it, but it didn't matter because both files are
from the same network so the first key should work for the two of them. Using
Wireshark and the key it was possible to unencrypt the contents of the
“encrypted_connection” file by adding a WEP decryption key in the IEEE 802.11
wireless LAN preferences. Now all left to do was to find the router credentials inside
the network traffic, fortunately the information provided in the problem description
stated that the credentials were stored in the browser which means that is very
possible that they were used in an HTTP request to a web server. Now an HTTP
filter was applied in Wireshark to search for the credentials inside de packet. Right
down into the authorisation section of the Hypertext Transfer Protocol information,
the username and the password were found (Image 5).
Image 4. Wep key in Aircrack-ng
The attacks present in the toolkit are especially dangerous because they are
relatively easy to implement, any person with enough knowledge in networks and
Linux can download the software and execute the correct commands to start getting
valuable information, even though the demo in the video didn't work, but apparently
it was due to the specific network situation at Defcon. A new rogue AP attack toolkit
was released as a part of a Defcon 26 talk. This software is called w1f1 and it
specialises in Wi-Fi hacking, it uses most of the features in the Manna from Heaven
toolkit. The documentation for this new program claims that it is a replacement for
the deprecated mana-toolkit, which means that the software presented back in the
Defcon 22 is no longer relevant.
5. Exploits and countermeasures
This week’s topic was especially useful and interesting because nowadays a lot of
different exploits are being used to commit illegal activities and is on the developers
and engineers to come up with mechanisms to fight this threat. I already had some
knowledge about exploits and different attack vectors that cyber-criminals use, but
still it was good to get the concepts refreshed and to look at some real-life examples
of attacks. It was also good to learn about not only the exploits but the
countermeasures as well, so one can be prepared for any attack or malicious
activities.
Personally, I am very familiar with the injection attacks, SQL and XSS, due to some
research I made back at my home university. The research was oriented to prevent
web defacement by dynamically analysing the HTML and JavaScript code of a web
page. As a matter of fact, the main causes of defacement are SQL injections and
XSS, which can compromise the credentials or authentication of the web page
allowing an intruder to modify its content.
Some countermeasures have been developed to stop these kinds of attacks, for
example, field obfuscation, real time encryption of sensitive fields, and fake strokes
to defeat browser based keyloggers. All these strategies are focused to hide the
sensitive information from the attackers.
Some Finnish banks have implemented some security mechanisms, like two-step
verification to double check if you are the one making the transaction and if the
information is correct, also the manual insertion of randomly generated credentials
in obfuscated fields is being used at banks like Osuuspankki.
One of the most harmful vulnerabilities where IoT devices were involved was the
Mirai attack. Millions of devices were infected by a malware that turned them into
zombies for a massive botnet that was used to create multiple DDoS attacks that
affected a great number of important companies like GitHub, Twitter, Netflix and
Airbnb.
6. Software and system security
The topics addressed in these two weeks were very important to me, because as a
software engineer the safety and the wellbeing of the users of my products is one
of my primary concerns. The techniques and the different research papers
presented were of much help to understand the actual situation of the software
security and to get a look at the newest and greatest breakthroughs in the security
field. One topic that was especially interesting was the agile and security research
because nowadays almost every software company is implementing some kind of
agile methodology to develop software, like Scrum or Kanban, so a lot of programs
and services are launched to the market using these techniques and if there is some
security flaw a great number of users will be affected. With the findings in the
presented papers software engineers can implement better practices and improve
the current ones to guarantee a product of high quality.
One of the most harmful ransomwares has been Wannacry, it affected more than
141000 computers all over the world and compromised the security of multiple
governmental organizations like hospitals and natural gas companies. The attack
was based on a known vulnerability of the Windows OS, all the affected computers
didn't have the latest versions of Windows which left them defenceless against the
cyber-criminals.
Some of the most common attacks to web applications are SQL injections and XSS
attacks, these use the user interface to inject JavaScript code or SQL queries to
alter either the functionality of the server or to retrieve valuable information like credit
card credentials from the database. In case of one of these attacks the functionality
of the system would remain the same regarding what the user can see, but internally
the server could have been modified by a script and now it is not working as it was
programmed. For example, a simple script can modify a web application that
redirects the user to a payment page where he/she must input their credentials, to
lead the user to fake page that will capture their credentials.
Regarding the attack propagation, it is limited to the specific attacked web
application, but the damage to the server would be considerable if the code injection
manages to pass all the filters and detection mechanisms that should be
implemented in the application.
The spreading of the attack starts from the user interface and starts to move up from
component to component until it reaches the backend and causes the damage. The
detection of the attack should be relatively easy because nowadays most web
applications have input sanitization systems that prevents and alerts of any possible
injection attack. Also, if the malicious request manages to pass through the input
validation system, the web server should have a detection system that analyses the
request and determine if it is benign or not.
7. Conclusion
During the course I was able to learn new topics like WLAN and software security
and improve my knowledge about the ones I already knew, like malware and
exploits. One subject that I was able to understand better was encryption, I got the
chance to see how it works and by which operations it is possible, mainly by
cryptography. Due to the practical component of the course I was able to learn about
many different tools related to cyber security, like Hex editors, Wireshark, Aircrack-
ng, among others. All the information provided by the professors was very clear and
they always presented the connection between every discussed topic so we could
understand how each one fits into the system and application security.
Personally, I found interesting the lecture about malware, because as I said before
I had a basic knowledge about this topic but not the full picture of how malware
actually works and what types exist. With the explanation of the professors and the
material presented for the lecture I learned that viruses are not the only kind of
malware and that there are multiple ways malware can hide even from the most
sophisticated antimalware software. Another interesting point was that when
starting a new topic, the professor always talked about the background of the topic
and not only the topic itself, how it started and why it was developed. In my opinion
this helps to create a perspective on why and how the technology keeps evolving.
Something that I didn’t like about the course was that we didn’t have a practical
excise for every assignment, personally I enjoy applying the theory into a certain
problem to help sink the ideas better into my mind. For example, it was very
interesting to use the knowledge about malware to try to fix the broken PE file, even
though my group couldn’t fix it.
My knowledge about cyber security has improved drastically, when I started the
course I only had basic understanding of most of the topics covered in the lectures,
now, thanks to the groupworks and the materials provided by the professors I have
been able to develop a deeper knowledge base. The understanding I used to have
of security was incomplete and composed of different parts without any connection
between each other, I only knew basic concepts of isolated topics I have picked up
during other courses. Also all my knowledge was theoretical and I never tried or saw
this concepts in action, but now I have not only created a bigger picture of the topic
in general and gotten a much clearer understanding of the addressed subjects but
I have seen them in practice and I have been able to interact and apply them to
solve different problems.
8. References
[1] J. Ruohonen and V. Leppanen, “A Case-Control Study on the Server-Side
Bandages Against XSS” Data feed retrieved in October:
https://moodle.utu.fi/pluginfile.php/996636/mod_resource/content/1/SQAMIA_2018
_Ruohonen.pdf
[2] S. Rauti and S. Laurén, “Honeypot, Sandbox, and Monitoring” Data feed
retrieved in October:
https://moodle.utu.fi/pluginfile.php/825952/mod_resource/content/0/UTU_WP4_3c
ybertrust_final_report_20170616.pdf
[4] P. Ferrie and P. Szor, “Zmist Opportunities”, Virus Bulletin, pag. 6-7, March 2001.
9. Appendices
9.1. Minutes of the meeting #4
Group Work assignment 4
Place: Quantum Building UTU
Date and time: 10/10/2019
Chairperson: Juan Giraldo
Present: Juan Giraldo, Luke Skeen, Melissa Welander, Heta Pärssinen, Fredrik
Brushane.
Not Present:
Summary of meeting participation after this meeting:
Juan Giraldo has missed 0 meetings
Luke Skeen has missed 0 meetings
Melissa Welander has missed 0 meetings
Heta Pärssinen has missed 0 meetings
Fredrik Brushane has missed 1 meeting
Some famous APT attacks were shared in the meeting, Juan talked
about NetTraveler, Titan Rain and GhostNet. Luke and Heta talked about shadow-
hammer.
The man in the browser threat was also addressed, first the general definition was
discussed among the team. Next it was concluded that the Zeus trojan is connected
to the MItB attack because the Trojan is how the attack can take place, basically
the Trojan implants the malware in the browser. Some discussed countermeasures
were field obfuscation and real time encryption of sensitive fields. Various cases of
attacks and vulnerabilities were found by the group members, the most relevant
were the pacemaker’s vulnerability, the drug infusion pumps security breach, the
hijacking of hospital networks and the hacking of heart rate monitors.
The group concluded that in those cases the lack of network security and of
a system that allows a secure connection between the device and the real user,
are the reasons why there were vulnerabilities. The information was retrieved from:
https://www.alpinesecurity.com/blog/most-dangerous-hacked-medical-devices
Group work:
Activity 1:
The proposed definitions for each attack were:
Targeted Attacks:
A targeted attack refers to a type of threat in which threat actors actively pursue and
compromise a target entity’s infrastructure while maintaining anonymity. These
attackers have a certain level of expertise and have enough resources to conduct
their schemes over a long-term period. They can adapt, adjust, or
improve their attacks to counter their victim’s defences. Ginwui and
the PPDropper Trojans are some examples of targeted attacks.
Activity 2:
Cross-Site Scripting is a cyber-attack that consists of injecting malicious code in the
form of JavaScript scripts that will be run by the server when the cybercriminal inputs
the code in some input field. Some countermeasures are, input sanitation, input
validation, blacklisting of the allow characters, encoding, content security policies
and XSS prevention libraries.
Activity 3:
Some of the challenges of securing IoT devices is that normal wireless security
mechanisms cannot be used for this technology due to the low data rates they use
and the computing capacity is very limited, so the most common security algorithms
cannot be run in the devices. One example of a security breach that happened on
these devices is the Mirai attack, where a lot of IoT devices were infected and
converted into bots that could perform massive DDoS attacks to big companies like
Netflix or Amazon.