Friday, January 18, 2019

Writeup on Intigriti CTF - A Failed Attempt

On 9th of January, 2019, Intigriti announced following CTF challenge
( https://twitter.com/intigriti/status/1082979668972748803 ). As I recently started trying out CTFs,
I thought to give it a try, although my CSSLP exam was almost close.

So where to start? As there was no other hints at that time, and there is an emoji pointing to the
attached image, I thought the clues or flag itself was inside the image, so I downloaded it to my
Kali VM.

Then it was time to analyze the downloaded image file.
 
Using “strings” command on the image file showed some interesting texts like “lmao” and
“nottheflag.pdf”. So I thought maybe there was a pdf file embedded inside the image file (As I
remembered reading similar steganography techniques in twitter or somewhere before)

On the first attempt, I just renamed the file to .zip extension and used “unzip” command which
gave me the pdf file.
But then I found a better way to do that using “binwalk” command later thanks to further google
searches. This “binwalk” command shows what are the embedded files inside a file.


If you use “-e” option of “binwalk”, it even extracts those files to the current directory. But I was
still new to this tool, so I only found about it later. I just used “unzip” command on the jpg, and
voilà, now there was a file named “nottheflag.pdf” in my current directory.


Opening the PDF file showed a base64 encoded string and a URL to a tweet.


Decoding the base64 string:



 

Accessing the decoded URL (https://go.intigriti.com/07b0fL24lkmva) pointed to a zip file.

Ok, it is an encrypted file. Where is the password? Let's see what hints are posted by intigriti.

There is an emoji pointing up. I checked the original tweet again, and examined the cover image
of the current image, even found another twitter account named “WhereIsTheFlag”.
https://twitter.com/WhereIsTheFlag


Still I did not have a clue where was the password.

Again new hints were posted by intigriti pointing up.
Where is it?
Feeling same as @SYNTAXERRORBA

The ceiling? 😓

The sky? 😕

Ok, after sometime, I remembered I had to study for CSSLP exam. So gave up.
…….
But again later, Another hint.

I already looked cover image of intigriti twitter account. (But I forgot to check the cover image of
other twitter account “WhereIsTheFlag”, that was where they hid the password according to
another writeup). So no password for me.

Another hint is about a matrix. The MATRIX?

😕, maybe they are talking about a color table in JPG file?
Spent more time wasting about reading about JPG and using commands like xxd to analyze jpg
file. Then I remembered again I had to study for CSSLP and went back to studying.
The last hint.

I am not skilled enough on CTFs yet, but I can try.
Using unzip commands to see available data on the zip file:




unzip -l command shows encrypted zip file contain 441 jpg image files with two different sizes
(314 and 317/318 bytes)
as the last hint says we do not need to decrypt the zip file, I thought image filenames and file
sizes should be sufficient to get the flag.

As one of the hint is about a matrix, it is possible the information from files should be arranged in
a matrix and because 441 is 21x21, this assumption seemed correct. Best known data
representation (at least for me) using a matrix is QR code. According to wikipedia article about
QR code, the version 1 of QR code is 21x21 which gives further credence to possible retrieval
of QR code using found data. If this assumption is correct, two image sizes may be used to
represent for black and white colors.
Therefore the next step was to convert the file sizes to 0/1 or black/white and then to arrange
those in 21x21 matrix ordered by file name.
First I generated a black png and a white png with size 10x10 pixels for generating the main
image, using imagemagick convert command.

Then I generated an imagemagick convert command which arranges above created black and
white images in rows and columns, while black representing image files greater than 314 bytes,
and white representing image files equals to 314 bytes in size.



Then I copied the generated imagemagick command from qr2.txt and executed it in command
line (somehow using `cat qr2.txt` did not work, so had to copy paste using xclip command).

Now it is time to see the generated image. ⏳

So I got a silhouette of a nice building. 😯 I don’t think that is the flag.

Then after sometime, as the last attempt, I thought maybe if I compared the encrypted file
content (retrieved through zipdetails command), I could find which files were similar (black or
white). But It did not work as I did not find any encrypted file with same data as any other file.
Then I gave up for the last time as I still had another high priority, CSSLP exam. So no flag for
me this time, but at least I passed (provisionally) CSSLP exam 😊.

You can find a writeup on a successful attempt to capture this flag by @DJBusyR
here https://busyr.com/writeups/intigriti_-_find_the_flag_earn_swag.pdf

Friday, November 9, 2018

My Experience on Preparing for PTE Academic Exam


After postponing for a long time, today (2018-11-09) I finally sat for the PTE Academic English exam. As I did not spend enough time to prepare and practice for the exam, I do not expect that I will get a good score 😅. I will have to wait 5 more business days to see the exam results. Until then, I decided to record some of the things which can be helpful to other future test takers.

Planning

As I was postponing the preparation for this exam many times (as there were lot of other interesting tech stuff to learn than 'boring' English 😃), I decided to just schedule the exam without any preparation 😟. I scheduled the exam about 3 weeks ago, so I only had around 2 weekends + 3 more weekdays to prepare for the exam.
PTE official website itself has lots of valuable resources for you to prepare for the exam (See https://pearsonpte.com/preparation/ ). This website even provides free practice questions which you can download to your computer (See “Offline practice test” in https://pearsonpte.com/preparation/resources/  page). I downloaded the PTE test takers hand book and other such documents available from the official website. This website also has good introductions (including short videos) about each question type. Then I created a separate folder for each question type to store the resources related to that question type. This helped me to easily focus on each question type individually. Then I created a plan to prepare for the exam within the short time period available before the exam.
For PTE, there are two main areas you must focus.
  •  English enabling skills (Grammar, Vocabulary, Pronunciation, etc)
  • How to answer each question type

Preparation

Improving English Enabling Skills 

In addition to prepare for answering the questions, you must improve your core English enabling skills such as grammar, vocabulary (PTE exam focuses on academic related vocabulary), and pronunciation.
For grammar, I followed an online video course from Udemy website (by Anthony Kelleher). For vocabulary, I followed a pdf which contained "the top 400 words from PTE vocabulary". But I think my academic related vocabulary was already good due to the day-to-day work I do for my job and due to lot of reading I do, so you may have to spend more time to study more words targeted in PTE vocabulary.
For the pronunciation, I learned two techniques. First one is, to google whenever I find a word which I didn't know how to pronounce, and then click the "speaker"🔉 button in the Google 🔎 result page to listen how to pronounce it. The second technique was to use the Voice Recorder software available in Windows OS to record my own voice saying the specific word and then to listen to the recorded voice to compare it with actual expected pronunciation to identify whether I have to improve the pronunciation. You will be surprised to learn that although you thought you pronounce the word correctly in your mind, you pronounced it wrongly in reality (even some simple words). This second technique is very useful as it gives you immediate feedback to correct your pronunciation.

Preparing for Question Types

What I did first, was to re-order the question types by the complexity and difficulty, from most complex/difficult to least complex/easy. Then I could prioritize spending time on preparing and practicing the question types in the top of the list, and then go down the list. I identified that I actually did not have to prepare for some question types in the list, as those are very basic questions. I practiced answering those questions only during the mock tests.
"Write an essay" question type was on the top of my prioritized list, and the second one was "Describe an image" question type. Those were followed by "Re-tell a lecture", "Summarize Spoken Text", and "Summarize Written Text". From all of these prioritized question types, I struggled with "describe an image" question type the most.

Methods/Structures

To answer a question from each of these complex question types in PTE exam, it is not enough to have proper English enabling skills such as grammar, vocabulary, and pronunciation. It is essential to have a method, or a structure prepared beforehand for properly and quickly answer these questions within the given short time period. Fortunately, there are videos in YouTube that explain about these methods/structures by an excellent English PTE guru named Jay, from http://www.e2language.com website. I will list down links to these videos at the end of this post.

Practice

For practicing, I found some sample questions from different sources such as from Jay’s videos, from PTE website, and other online resources. As I did not have enough time left, I did not practice enough questions to make me feel fully confident. For example, I wrote only 3-5 essays before the PTE exam.
I also bought 2 scored mock tests from Pearson website (https://www.ptepractice.com/). Doing these scored mock tests was very useful to get ready for the actual exam.
Things to note: Although I had more than enough time when I did the mock exams, it seemed I was not careful with time during the real test. Therefore, I was not able to answer 1-2 questions in the first section. Also, it was little bit distracting due to the noise of the other test takers during the first section. From my overall experience during the preparation and facing the PTE exam, the most difficult question type for me was "Describe an image" question type. All other question types were manageable. It was very interesting experience (as this is my first non-tech exam after more than 10 years), but I am not exactly sure what will be the score. Let's hope for the best 🙏. [UPDATE: I received my PTE score report on next day. Score was better than I expected 😊]

Links

·        Question Type: “Write an essay”
o   PTE Writing Write Essay SUPER STRUCTURE  Sentence by Sentence with Jay! - https://www.youtube.com/watch?v=z_-u0fHQetQ
o   How to write a good essay Paraphrasing the question - https://www.youtube.com/watch?v=o9aVjBHEEbU  
·        Question Type: “Describe an image”
o   PTE Speaking: Describe Image | SUPER METHOD! - https://www.youtube.com/watch?v=rveo3RFK3kk
o   PTE ACADEMIC DESCRIBE IMAGE with RESPONSES - ULTIMATE COLLECTION !! - https://www.youtube.com/watch?v=T9_PYMRyQCY
·        Question Type: “Re-tell a lecture”
o   PTE Speaking  Retell Lecture METHOD with Jay! - https://www.youtube.com/watch?v=U9iYnbHd5ys
·        Question Type: “Summarize Spoken Text”
o   PTE Listening: Summarize Spoken Text | METHOD with Jay!  - https://www.youtube.com/watch?v=cc86wI4v4rc
·        Question Type: “Summarize Written Text”
o   PTE Writing: Summarize Written Text | Learn the Proven Method! - https://www.youtube.com/watch?v=AdyRgrOEzx8

Tuesday, October 30, 2018

Kaizen Singapore CTF - My first CTF experience


Today (27 of Oct, 2018), I attended a CTF organized by Div0, Booz Allen Hamilton, and ICE71, based on Kaizen CTF platform of Booz Allen Hamilton. According to Booz Allen Hamilton, they had done similar events throughout the world using this platform. I got to know about this event through Div0's meetup page (https://www.meetup.com/div-zero/events/255394149/). Although I had heard about CTFs and was interested in participating CTFs for a quite some time, this was the first CTF I felt comfortable enough to attend. Main reasons were, it was a single player CTF and organizers had specially mentioned that this was a beginner friendly CTF which can be an ice breaker of CTFs. As I did not know any other colleagues who were interested and had security skills to form a CTF team, I was not able to attend CTFs which expect teams.

As I learned, there are two types of CTFs. One type is attacker-defender type CTFs, and the other type is jeopardy style CTFs. The CTF organized by Kaizen was a jeopardy style CTF.
The event started by hosting a lunch and networking session at around 1pm, and then after a quick introduction about rules and the platform, the CTF was started at around 3pm.
The time duration for the CTF was from 3pm to around 7pm. At 3pm, the Kaizen platform allowed us to access the CTF challenges. The CTF challenges were categorized under 'coding', 'reverse engineering', 'crypto', 'web', 'networking', and 'forensics'.

As we were instructed not to share the details of the CTF challenges, I will try to give information about the experience without leaking information about the challenges.
I started the first challenge in 'coding' category, although I understood what was the expected algorithm, due to lack of experience in developing expected kind of scripts, I did not continue to work on creating a script for this. I stopped it there and then started challenges in 'Web' category. From around 6-7 challenges in 'Web category, I completed 3. I also almost completed 2 more 'Web' challenges, but I was not able to continue those two at the last step. Then I moved to complete a challenge from each 'Forensics', 'Networking' categories, and 2 challenges from 'Crypto' category.

So I completed 7 challenges and almost completed around 3 more challenges. Although my score was not that high, I think it is a good score for a first time CTF. As I was afraid I would be stuck in rabbit holes, I moved away to other challenges when I felt I was stuck at one challenge for few minutes. I am not yet sure whether that is a good approach for CTFs, or whether I should try to complete high value single tasks taking more time. My strategy was trying to complete basic challenges of each category if I feel like I have the basic knowledge, then move to work on other advanced challenges in categories familiar to me, and to move to next one if I am stuck more than few minutes.

There were very valuable prizes prepared for the top 5 players in the leader board, including 2000 SGD worth training voucher for a security training such as OSCP/OSCE for the first place winner. The organizers had organized this event excellently and only complain I have is that room was too cold at the end. It would be great if there was hot coffee or tea there. Overall it was worthy learning experience and I would like to thank Div0, Booz Allen Hamilton, and ICE71 for their effort on organizing this event.

Thursday, April 20, 2017

Phishing with Unicode Domains

“Phishing with Unicode Domains” is an interesting phishing attack resurfaced by a security researcher named Xudong Zheng last week.
In this phishing attack, it is impossible to identify whether a site is fraudulent one by just checking the SSL certificate + the URL in the URL bar.

Punycode makes it possible to register domains with foreign characters. It works by converting individual domain label to an alternative format using only ASCII characters. For example, the domain "xn--s7y.co" is equivalent to "短.co".
From a security perspective, Unicode domains can be problematic because many Unicode characters are difficult to distinguish from common ASCII characters. It is possible to register domains such as "xn--pple-43d.com", which is equivalent to "аpple.com". It may not be obvious at first glance, but "аpple.com" uses the Cyrillic "а" (U+0430) rather than the ASCII "a" (U+0041). This is known as a homograph attack.

Original article: https://www.xudongz.com/blog/2017/idn-phishing/
POC: https://www.xn--80ak6aa92e.com/
https://en.wikipedia.org/wiki/IDN_homograph_attack