Suramya's Blog : Welcome to my crazy life…

May 27, 2019

Microsoft and Brilliant launch Online Quantum Computing Class that actually looks useful

Filed under: Computer Software,Interesting Sites,My Thoughts,Techie Stuff — Suramya @ 12:14 PM

Quantum computing (QC) is the next big thing and everyone is eager to jump on the bandwagon. So my email & news feeds are usually flooded with articles on how QC will solve all my problems. I don’t deny that there are some very interesting usecases out there that would benefit from Quantum Computers but after a while it gets tiring. That being said I just found out that Microsoft & Brilliant have launched a new interactive course on Quantum Computing that allows you to build quantum algorithms from the ground up with a quantum computer simulated in your browser and I feel its pretty cool and a great initiative. The tutorial enables you to learn Q# which is Microsoft’s answer to the question of which language to use for Quantum computing code. Check it out if you are interested in learning how to code in Q#.

The course starts with basic concepts and gradually introduces you to Microsoft’s Q# language, teaching you how to write ‘simple’ quantum algorithms before moving on to truly complicated scenarios. You can handle everything on the web (including quantum circuit puzzles) and the course’s web page promises that by the end of the course, “you’ll know your way around the world of quantum information, have experimented with the ins and outs of quantum circuits, and have written your first 100 lines of quantum code — while remaining blissfully ignorant about detailed quantum physics.”
Brilliant has more than 8 million students and professionals worldwide learning subjects from algebra to special relativity through guided problem-solving. In partnership with Microsoft’s quantum team, Brilliant has launched an interactive course called “Quantum Computing,” for learning quantum computing and programming in Q#, Microsoft’s new quantum-tuned programming language. The course features Q# programming exercises with Python as the host language (one of our new features!). Brilliant and Microsoft are excited to empower the next generation of quantum computer scientists and engineers and start growing a quantum workforce today.

Starting from scratch

Because quantum computing bridges the fields of information theory, physics, mathematics, and computer science, it can be difficult to know where to begin. Brilliant’s course, integrated with some of Microsoft’s leading quantum development tools, provides self-learners with the tools they need to master quantum computing.
The new quantum computing course starts from scratch and brings students along in a way that suits their schedule and skills. Students can build and simulate simple quantum algorithms on the go or implement advanced quantum algorithms in Q

Once you have gone through the tutorial you should also check out IBM Q that allows you to code on a Quantum computer for free.

– Suramya

May 26, 2019

Why on earth are Indian news channels announcing the launch of ‘Spy Satellites’?

Filed under: My Thoughts — Suramya @ 10:26 PM

When other countries launch spy satellites the mission is top secret and hardly anyone knows about it. So I had a bit of a shock on Thursday when I was walking past a TV in the cafeteria at work and noticed a news ticker stating “ISRO launched spy satellite successfully” on screen. I had a good laugh about it with the folks I was with and then promptly forgot about it. However yesterday I was looking at the election news and ended up at the following Economic times article: “ISRO launches ‘cloud-proof’ earth observation spy satellite RISAT-2B to keep an eye on Pakistan” which reminded me about the launch so I just had to post about it.

If we are advertising our spy satellite launches then we are giving foreign assets enough information to figure out the orbit and timings where the satellite would be over head (unless it was in a geo-stationary orbit) giving them the ability to hide activity from them. For example when the Pokhran test was done it 1997 it was a surprise for the US in spite of the massive satellite coverage US has because we had a mapping of when each of the satellites pass over India allowing india to build up preparations over months so as not to indicate any sudden heightening of activity and performing critical jobs during satellite “blind” periods when they are beyond the reach of Pokhran.

Now by announcing the launch we are making it easier for other countries like Pakistan to duplicate this feat. Since they know the launch details it makes it easier to track the orbit of the payload and narrow down the search for the satellite if they didn’t locate it when it was released in orbit.

Press freedom is well and good but I don’t think it makes sense to announce such news to the world.

– Suramya

May 24, 2019

Science is bringing personal cooling closer to reality with a wearable cooling Patch

Filed under: Interesting Sites,My Thoughts — Suramya @ 6:03 PM

In an announcement that is going to cause a lot of couples to sigh in relief, researchers from University of California, San Diego have come up with a wearable patch that cools the skin temperature down by ~10 Deg C. It is still in research phase but the basic prototype works and I am definitely in queue to buy this when it comes out. I love cool temperatures and my wife is the polar opposite and prefers hot and humid weather (30 Deg + ) so usually one of us is suffering. Its gotten to the point that I know that if I am feeling comfortable then she is cold. We usually end up carrying an extra jacket for her when we travel to moderately cold places and lots of cold water for me if we are going somewhere where she would be comfortable. This would allow us to keep the house warm enough for her without making me miserable due to the heat. According to the press release:

Thermoelectric systems use semiconductors to pump heat from one side of a device to the other, creating a cool zone and a hot zone. Such systems can provide compact, easily adjustable cooling, but getting them to efficiently dissipate heat has proved challenging.

Renkun Chen, Sheng Xu and their colleagues at the University of California, San Diego, addressed this problem by embedding multiple pillars of a semiconducting material between two stretchy polymer sheets. One sheet served as the hot zone, the other as the cool zone. This design conferred flexibility and insulated the hot and cold sides from each other, allowing the hot layer to dissipate its heat into the air.

This system would also have an application in offices. Usually the temperatures in office are kept cool because of research in early 60’s that calculated the optimal temperature taking into account the comfort of a forty-year-old, hundred-and-fifty-four-pound man wearing a business suit, (Learn more about the Sexist history of Office temperature here if you are interested) and this means that women in offices usually freeze and don’t perform at the peak of their performance. Once this patch is released, the office could be kept at a warmer temperature making it more comfortable for the women (and folks not wearing jackets/suits to office) and anyone who dislikes the warmer temperature (like me) would wear this patch and be comfortable as well. Decreasing the cooling required would reduce the load on AC’s and power infra as well.

So in conclusion I hope that this gets a commercial release quickly. 🙂

Source: Air conditioner ‘in a patch’ provides portable cooling – Nature.com

– Suramya

January 22, 2019

Is notifying HR dept where Offenders work a good way to reduce Drunk Driving?

Filed under: My Thoughts — Suramya @ 11:21 PM

While waiting for my flight to Bangalore I was refreshing my Twitter feed to stave off boredom and one of the tweets caught my attention. The tweet was as below:

So employers are the new mummy-papa? The state should treat adults like adults. Punish them as per law, throw them into jail, but please spare everyone this nanny nonsense.

and the image attached to the tweet is as below:

I checked out the image attached and was reading the replies and one of the commenters had posted something to the effect of “The cops shouldn’t be doing this as this could destroy the persons career if HR knows about their habit of drinking and driving.” This comment sparked an immediate reaction which is what led to this post. From a quick check on the internet the letter appears to be real and there is a very polarized debate ongoing about it. I will be replying back on the Twitter thread as well with a link to this post but wanted a blog post as it gives me more space to give context.

Basically, drinking and driving is a big problem in India. Even in cities like Bangalore where there are frequent checks for DUI, I personally know people who drink & drive. They use strategies like waiting for an extra hour after closing time/event end to avoid cops. Some of them take the back roads to avoid known blockades location for testing. If I can, I do try to get people to take cabs back but its an uphill battle. In one case this guy could barely stand but wanted to ride his bike home and when I told him to take a cab his reply was “It’s ok I will be fine once I am on the bike” as if it would magically make him sober. In 2017 73,741 drunk driving cases were registered in Bangalore. I couldn’t find the numbers for 2018 but am still searching, I will update the post if I find it. The article didn’t have the breakdown on how many repeat offenders were there in the list but I wouldn’t be surprised if a significant count was from repeat offenders. A lot of the folks don’t care about the fine or think that paying a bit of money is a good option to get away with something that risks lives.

It would be one thing if they were only risking their own lives but they also end up killing innocent people in accidents. Take this incident from New Years 2019 in Mumbai where a drunk driver killed a class 9 student who was waiting for his friend alongside a road and had the bad luck of being at the wrong place at the wrong time. We have to face facts, fines are not working as well as we want them to. People still think that they can get away with this behavior with minimal consequences.

The fix is to increase the stakes. The cops first tried to do that by increasing the fines and jail duration but that hasn’t had such a major impact. So the question becomes how do we raise the stakes further? One way would be to do what Hyderabad cops are doing and start notifying the HR department of the companies where the offenders work, in cases of repeat offenders or when people are significantly over the allowed limit. If you know that your job might be impacted when you drink and drive then a lot of people will think twice about doing it. To clarify I am not saying that this should be done everytime. I think that they shouldn’t do this when the person is over the limit by a small amount e.g. if they had 3 glasses instead of 2 but if they had 10 glasses (for example) then yes their offices should be told and the HR will take a call if they want to have such a reckless employee working for them and what action if any should be taken against them.

As for the impact on the job/wreak the career of a person driving under the influence I have just this to say “Good”. Why should we be concerned about the impact to the career of someone who drives under the influence and refuses to take accountability for their actions? Shouldn’t we be more concerned about the impact to the families who lose loved ones to these senseless drivers? What about the impact to people who are crippled in drunk driving related accidents?

What do you think?

– Suramya

August 12, 2018

Critique of a sextortion scam email that I received

Filed under: My Thoughts,Techie Stuff — Suramya @ 11:27 PM

Earlier this month I got an email that claimed to have photos/videos of me viewing adult sites and threatened that they would mail the photos to all my contacts if I don’t send them $7000. To make the email look authentic and scare me, they also included an old password of mind that they got from one of the many leaks over the past few years. I think this one was from a BBS that I used for a bit around 2000-2005.

The reason I am publishing this email and my critique is to show how full of crap such emails are. Basically if you ever get such emails you should never give them money because then they know that they can frighten you to pay and they will keep putting the pressure on to squeeze more and more money out of you.

On the other hand if you know that someone has managed to get their hands on some incriminating photos (they gave proof or you had sent it to them) and are blackmailing you then you should never give in to the blackmail. Instead reach out to the authorities and file a formal complaint. If you are a kid then talk to your parent and have them raise a complaint. Never ever give more photos/videos to the sick person blackmailing you because that just gives them more ammo to blackmail you.

Here are some links to sites that can help guide you:

UK National Crime Agency
Interpol Sextortion
FBI Sextortion

So lets get started, I am going to take apart the email I got to show you how useless and full of it the email is..

I know ***** is your password. Lets get directly to purpose. You do not know me and you are probably thinking why you are getting this email? None has compensated me to check you.

Umm ok… That’s an old password that I haven’t used in over a decade and even then it was used for throwaway logins that I didn’t really care about. It did catch my eye, good job adding it to the subject to catch my attention. Yes, no one compensated you initially but you sure want to get compensated now.

Well, I installed a malware on the adult video clips (adult porn) web site and guess what, you visited this web site to experience fun (you know what I mean). When you were watching video clips, your web browser started out operating as a RDP that has a keylogger which provided me accessibility to your display screen and also web camera. after that, my software collected your complete contacts from your Messenger, FB, as well as email. After that I created a double-screen video. 1st part shows the video you were viewing (you have a fine taste hahah), and second part displays the view of your webcam, and its you.

Wow! You must teach me how you did this. How did you manage to get a browser to act as an RDP, especially on a Linux machine that doesn’t even support the protocol natively? Please sensei, teach me 🙂

Actually the even more amazing trick is how you managed to activate a webcam on my computer as I don’t have any camera’s connected to it. 🙂 Did you hack the display to turn it into a camera? Or did you send nanobots via the wire to reprogram/repurpose one of the parts on my desktop to convert it into a camera?

You got two different choices. Let us understand each of these options in aspects:

1st choice is to disregard this email. In this case, I am going to send your actual video clip to almost all of your contacts and just consider about the humiliation you feel. And consequently in case you are in an important relationship, how it will affect?

Now comes the threat… how are you going to send a video that I just proved can’t exist?

Latter solution is to give me $7000. We are going to think of it as a donation. As a result, I will without delay delete your video footage. You will go forward daily life like this never happened and you would never hear back again from me.

You will make the payment via Bitcoin (if you don’t know this, search “how to buy bitcoin” in Google search engine).

BTC Address to send to: 1FwvWtFdGBRvoiCa8BQdzqpu5QoiCSRFMa
[CASE SENSITIVE, copy & paste it]

Holy S**T! You really expect people to pay you $7000 for an email that offers no proof of this supposed video that you managed to magically capture? Lets check if anyone was stupid enough to fall for this nonsense. We can use bitref.com to check the balance of any bit coin address and here’s what the current balance is for this address: $0.0. Yup you have received a big fat 0 for your trouble. In fact I would suggest you sell your software/tech to the NSA/MI5 or other spy agencies around the world and you will get a much better payday.


The money this idiot made from this scam so far.

If you may be thinking of going to the cop, good, this email message cannot be traced back to me. I have covered my moves. I am just not trying to charge you so much, I just like to be paid for. I have a unique pixel in this email, and right now I know that you have read through this mail. You now have one day to pay. If I do not receive the BitCoins, I will certainly send your video recording to all of your contacts including friends and family, colleagues, and so forth. However, if I do get paid, I will erase the video right away. It’s a non-negotiable offer and thus please do not waste my personal time & yours by responding to this mail. If you really want evidence, reply with Yeah! then I will send out your video recording to your 6 contacts.

I am really quaking in my boots. Its been over 3 weeks since you sent out the email, and I don’t know how many of my contacts have received this magical email. Though if I had to guess I would place the number at 0. Since the entire email is a scam to steal money from unsuspecting fools. I think if the person sending out the email hadn’t been so greedy and asked for $7000 but rather asked for something in the range of a few hundred they might have made some money.

Well this is all for now. Will write more later.

– Suramya

August 8, 2018

Work-life balance, Is it something to strive for?

Filed under: My Life,My Thoughts — Suramya @ 11:42 PM

A couple of days ago I read this article by a lady who was the founder of a start-up and she had a whole different take on the work life balance question. She felt that it’s not something that you should focus on and that if your work is a major part of your life then having artificial boundaries about allowed topics of discussion / things is not correct.

The article made me think about the pro’s and cons of having a work life balance.I have in the past worked in companies where we have worked 14-18 hours a day and I have worked in companies where I was out of the office at 6pm everyday.

I think that having a work life balance is good, actually I think it’s essential. You can sustain the insane hours over a short period of time but in the long term it’s not sustainable. I am not saying that once you leave the office don’t have any conversations related to work, that is not realistic. But make an effort to disconnect frequently.It will help recharge your mental energies and let you come back refreshed and eager to work.

I am one of the last people to tell folks not to work too much because I have a tendency of spending too much time working if what I am working is something interesting. But I have seen from personal experience when I take a break from work and do something unrelated it helps me focus and get things done.

In the course of the normal day I read, watch some shows to decompress and once a month I try to go for a trek/trip and over the past two years I have seen what a difference it makes in my sanity and ability to deliver projects. When I go for these trips I don’t check office emails. I have spent some time talking about work with folks but for the most part I disconnect from work. The idea is to stop worrying about work and focus on other things for a while. If conversation or idea related to work does come up then don’t stress about it either, spend a few mins on the topic and then go back to whatever you were doing. Trust me it will help. 

I have seen that some of the best ideas I have had have come to me when I was doing something other than work/actively thinking about the problem. 

At my previous job I used to go for evening snacks with the team and one of the semi-enforced rules was that for the duration of the snacking conversations related to work were discouraged. We would talk about other stuff like hobbies, movies, travel etc. It helped us know each other better and become a more tightly integrated team. If a work related topic came up we would all discuss it for a bit and then someone or other would say something to the effect of ‘no work related talks’ and we would stop. But if the issue was interesting enough we have spent significant time discussing it as well.

So having a hard and fast rule is not a good idea. You should be flexible and take it as it happens.

What do you think? Is work life balance something to stride for?

February 7, 2018

Hacking the Brainwaves Cyber Security CTF Hackathon 2018

Earlier this year I took part in the Brainwaves Cyber Security Hackathon 2018 with Disha Agarwala and it was a great experience. We both learnt a lot from the hackathon and in this post I will talk about how we approached the problems and some of our learning’s from the session.

Questions we had to answer/solve in the Hackathon:

  • Find the Webserver’s version and the Operating system on the box
  • Find what processes are running on the server?
  • What fuzzy port is the SSH server running on?
  • Discover the site architecture and layout.
  • Describe the major vulnerability in the home page of the given website based on OWASP TOP 1. Portal Url: https://socgen-ctf.0x10.info
  • Gain access to member area and admin area through blind sql, or session management.
  • Dump all user account from member area. [SQLi]
  • [Broken Validation] Demonstrate how you can modify the limit in order management.
  • [Open Redirect] Redirect site/page to hackerearth.com
  • List any other common bug came across while on the site
    • After logging into the member area, perform the following functions:
    • Find the master hash & crack it
    • Dump all user’s
    • Find the email ID and password of saved users

Information Gathering:

In order to find the services running on the server, the first thing we had to do was find the IP/hostname of the actual server hosting the site which was a bit tricky because the URL provided is protected by CloudFlare. So, any scans of socgen-ctf.0x10.info took us to the CloudFlare proxy server instead of the actual server which was a problem.

We figured this out by trying to access the IP address that socgen-ctf.0x10.info translated to in the browser.

suramya@gallifrey:~$ host socgen-ctf.0x10.info 
socgen-ctf.0x10.info has address 104.28.15.64 

Since the site homepage didn’t do anything except display text that refreshed every 15 seconds we needed to find other pages in the site to give us an a attack surface. We checked to see if the site had a robots.txt (It tells web crawlers not to index certain directories). These directories are usually ones that have sensitive data and in this case the file existed with the following contents:

# robots.txt
Sitemap: http://socgen-ctf.0x10.info/sitemap.xml
User-agent: *
Disallow: images
Disallow: /common/
Disallow: /cgi-bin/

The images directory didn’t have any interesting files in it but the /common/ directory on the other hand had a file named embed.php in it which basically ran a PHP Info dump. This dump has a lot of information that can be used to attack the site but the main item we found here was the IP address of the actual server where the services were running (38.109.218.93).

Using this information we were able to initiate a nmap scan to get the services running on the site. The nmap command that gave us all the information we needed was:

nmap -sV -O -sS -T4 -p 1-65535 -v 38.109.218.93

This gave us the following result set after a really really long run time:

PORT     STATE    SERVICE       VERSION
23/tcp   filtered telnet
25/tcp   open     smtp?
80/tcp   open     http          This is not* a web server, look for ssh banner
81/tcp   open     http          nginx 1.4.6 (Ubuntu)
82/tcp   open     http          nginx 1.4.6 (Ubuntu)
137/tcp  filtered netbios-ns
138/tcp  filtered netbios-dgm
139/tcp  filtered netbios-ssn
445/tcp  filtered microsoft-ds
497/tcp  filtered retrospect
1024/tcp open     kdm?
1720/tcp open     h323q931?
2220/tcp open     ssh           OpenSSH 6.6.1p1 Ubuntu 2ubuntu2.8 (Ubuntu Linux; protocol 2.0)
2376/tcp open     ssl/docker?
3380/tcp open     sns-channels?
3389/tcp open     ms-wbt-server xrdp
5060/tcp filtered sip
5554/tcp filtered sgi-esphttp
8000/tcp open     http          nginx 1.4.6 (Ubuntu)
8080/tcp open     http          Jetty 9.4.z-SNAPSHOT
8086/tcp open     http          nginx 1.10.3 (Ubuntu)
9090/tcp open     http          Transmission BitTorrent management httpd (unauthorized)
9996/tcp filtered palace-5
19733/tcp filtered unknown
25222/tcp filtered unknown
30316/tcp filtered unknown
33389/tcp open     ms-wbt-server xrdp
33465/tcp filtered unknown
34532/tcp filtered unknown
35761/tcp filtered unknown
35812/tcp filtered unknown
35951/tcp filtered unknown
37679/tcp filtered unknown
38289/tcp filtered unknown
38405/tcp filtered unknown
38995/tcp filtered unknown
40314/tcp filtered unknown
44194/tcp filtered unknown
47808/tcp filtered bacnet

For some reason the results from the nmap scan varied so we had to run the scan multiple times to get all the services on the host. This was possibility because the server was setup to make automated scanning more difficult.

Once we identified the port where the SSH server was running on (2220) we were able to connect to the port and that gave us the exact OS Details of the server. We did already know that the server was running Ubuntu along with the kernel version from the PHP Info dump but this gave us the exact version.

Discovering Site architecture:

Since we had to discover the URL to the members & admin area before we could attack it, we used dirb which is a Web Content Scanner to get the list ofall the public directories/files on the site. This gave us the URL’s to several interesting files and directories. One of the files identified by dirb was https://socgen-ctf.0x10.info/sitemap.xml. When we visited the link it gave us a list of other URL’s on the site of interest (we had to replace the hostname to socgen-ctf.0x10.info) including the members area (http://socgen-ctf.0x10.info/members.php?p=login) and siteadmin (http://socgen-ctf.0x10.info/siteadmin).

After a long and fruitless effort to use SQL Injection on the siteadmin area we started to explore the other files/URL’s identified by dirb. This gave us a whole bunch of files/data that seem to be left over from other hackathons so we ignored them.

SQL Injection

The main site https://socgen-ctf.0x10.info/index.php?p=. appeared to be vulnerable to SQL at the first glance because when we visit https://socgen-ctf.0x10.info/index.php?p=.’ (note the trailing single quote) it reloads the page. This meant that we could write queries to it however since it didn’t display a true or false on the page a SQL injection wasn’t easily possible. (We could have tried a blind injection but that would require a lot of effort for a non-guaranteed result.

As we explored the remaining URL’s in sitemap.xml one of the links (https://socgen-ctf.0x10.info/embedframe.php) was interesting as it appeared to give a dump of data being read from the site DB. Opening the site while watching the Developer Toolbar for network traffic identified a URL that appeared to be vulnerable to SQL injection (https://socgen-ctf.0x10.info/ajax.php?cid=&p=view_channel&id=28) and once we tested the url we found that the variable id was indeed vulnerable to injection.

We used blind sql to gain access by executing true and false statements and see that it returns different results for true(displays ‘1’ on the webpage) and false (displays 0) . We checked whether a UNION query runs on the site which it did and using other queries we identified the DB backend to be a mysql database (5.xx.xxx version). Then we found out the table name (members) which was an easy guess since the website had an add customer field. After identifying the number of columns in the table we got stuck because any statements to list the available tables or extract data were failing with an error about inconsistent column numbers.

Finally, we ran sqlmap which is an open source tool for automating SQL injection. It took us a few tries to get the software running because initially any attempt to scan the site was rejected with a 403 error message. Turns out that the connections were being rejected because the site didn’t like the useragent the software was sending by default and adding a flag to randomize the useragent resolved the permission denied issue.

Once the scan ran successfully we tried to get access to the MySQL usertable but that failed because the user we were authenticating as to the MySQL server didn’t have access to the table required.

sqlmap -u 'https://socgen-ctf.0x10.info/ajax.php?cid=&p=view_channel&id=28' --random-agent -p id --passwords

So, then we tried getting an interactive shell and an OOB shell both of which failed. We finally ran the command to do a full dump of everything that the system allowed us to export using SQL injection via SQLMap. This included the DB schema, table schema’s and a dump of every table on the database server which the mysql user had access to. The command we used is the following:

sqlmap -u 'https://socgen-ctf.0x10.info/ajax.php?cid=&p=view_channel&id=28' --random-agent -p id  --all --threads 3

This gave us a full dump of all the tables and the software was helpful enough to identify password hashes when they existed in the table and offered to attempt decryption as well. In this case the password was encrypted with a basic unsalted MD5 hash which was cracked quite easily. Giving us the password for the first two accounts in the database (admin & demo).

Looking at the rest of the entries in the users table we noticed that they all had funny values in the email address field, instead of a regular email address we had entries that looked like the following:

,,,"0000-00-00 00:00:[email protected]509a6f75849b",1
,1,RU,

As we had no clue what this was about the first thing we attempted was to access the
https://socgen-ctf.0x10.info/cdn-cgi/l/email-protection URL. This URL gave us a message that told us that the email addresses in the DB were obfuscated by CloudFlare to protect them from Bots. A quick Google search gave us a 21 line python script which we tweaked to convert all the hash to email address and passwords. (The code is listed below for reference)

#! /usr/bin/env python 
# -*- coding: utf-8 -*- 
# vim:fenc=utf-8 
# 
# Copyright © 2016 xl7dev  
# Distributed under terms of the MIT license. 

""" 

""" 
import sys 
import re 
fp = sys.argv[1] 
def deCFEmail(): 
   r = int(fp[:2],16) 
   email = ''.join([chr(int(fp[i:i+2], 16) ^ r) for i in range(2, len(fp), 2)]) 
   print email 
if __name__ == "__main__":                                                                                                                                                                       
   deCFEmail() 

This gave us the email addresses and passwords for all the users on the site. Since the accounts appeared to be created by SQL injection a bunch of them didn’t have any passwords but the remaining were valid accounts for the most part and we verified a couple by logging in manually with the credentials.

OWASP TOP 10 Vulnerability

To find the vulnerabilities in the home page we tried various manual techniques at first but drew a blank so we decided to use the owasp-zap. This tool allows you to automatically scan for vulnerabilities in a given URL along with a whole other stuff.

At first the scan failed because of the same issue as earlier with the user-agent. This time we took a different approach to resolve the issue by configuring owasp-zap as a proxy server and configuring Firefox traffic to use this proxy server for all traffic. This gave us the site in the software and we were then able to trigger both an active scan and spider scan of the site.

This gave us detailed reports that highlighted various issues in the site which we submitted.

Redirecting HomePage

The redirection of the home page was quite simple. We tried inserting a customer name with javascript tags in it and were able to do so successfully. So we inserted the following into the DB and the system automatically redirected the page when the Customer list section was accessed.

Other Interesting Finds

The nmap scan told us that in addition to port 80 a web server was listening on ports 81, 82, 8000, 8080 and 8086.

Ports 82, 8000 and 8086 were running standard installs of nginx and we didn’t find much of interest at these ports even after we ran dirb on all of them. Port 8080 appeared to be running a proxy or a Jenkins instance.

Port 81 was the most interesting because it was running a nginx server that responded to any queries with a 403 error. When we tried accessing the site via the browser we got an error about corrupted content.

We were unable to identify what the purpose of this site was but it was interesting.

SSH Banner / PHP Shell

The webserver instance running on port 80 had the version set to the following text “This is not* a web server, look for ssh banner Server at private-tunel.wehostservers.ru Port 80” so we went back and investigated the SSH Banner from the ssh server on port 2220. The banner was encrypted and to decrypt the SSH banner, we continuously converted the cipherText from its hex value to ASCII value . It gave us the following results on each conversion

3333333733333333333333373333333333333336333333383333333233333330333333363333333233333336333333313333333633363335333333363336333533333336333333353
3333337333333323333333233333330333333363333333633333336333633363333333733333332333333373333333733333336333333313333333733333332333333363333333433333332333333303333
3337333333333333333633363333333333363333333133333337333333333333333633333338333333323333333033333336333333333333333633363336333333373333333533333336333633333333333
63333333433333332333333303333333633363333333333363333333533333336333333313333333633333334333733393336363633373335373436663230363132307368336c6c2e706870

3337333333373333333633383332333033363332333633313336363533363635333633353337333233323330333633363336363633373332333733373336333133373332333633343332333033373333333
636333336333133373333333633383332333033363333333636363337333533363633333633343332333033363633333633353336333133363334373936663735746f206120sh3ll.php
 37333733363832303632363136653665363537323230363636663732373736313732363432303733366336313733363832303633366637353663363432303663363536313634796f75to a #

ssh banner forward slash could lead you to a #sh3ll.php

Once we got the full decrypted text we knew that there was a potential webshell on the server but it wasn’t apparent where the shell was located. After hit and try failed we turned back to our old faithful dirb to see if it could find the shell.

dirb allows us to specify a custom word list which is used to iterate through the paths and we can also append an extension to each of the words to search for, so we created a file called test with the following content:

suramya@gallifrey:~$ cat test 
shell
sh3ll
sh311

and then ran the following command:

suramya@gallifrey:~$ dirb https://socgen-ctf.0x10.info/ test  -X '.php'

This gave us the location of the shell.


Accessing the link gave us a page with a message “you found a shell, try pinging google via sh3ll.php?exec=ping 8.8.8.8”

Accessing the URL with the additional parameter gave us a page with the following output:

February 5, 2018

Is it a good idea to stop reading news?

Filed under: My Thoughts — Suramya @ 5:40 PM

Earlier today I was browsing the web and ended up on this HackerNews Thread where one of the users had posted the following comment:

I have recently stopped reading any kind of news. As a result I find that my mind is lot less cluttered. I have realized that once you give it up, you don’t really miss it a lot.

This made me think and I was wondering what the benefits are if we stop reading the news and what the downsides are of the same.

A little while ago a lot of the news items from around the world were pretty depressing and I found that if I read my news feed first thing in the morning as I normally did I ended up feeling a bit out of sorts for a while. Not depressed per se but with more of a bleah attitude for a while in the morning. After I figured this out I stopped reading general news first thing in the morning as I figured the issue was caused due to the fact that I was reading the news while half asleep when a lot of my brain was still struggling to wake up making it harder for my usual snark from kicking in. Instead of reading all news first thing in the morning I switched to reading only the tech news feeds early in the morning and then catch up with the world news later in the day (usually in the evening on the way back home). I found that this worked best for me for a while, but after a bit I changed my reading habits again and now I read the news (both tech and general) on the way to work and am fine with it. Plus another good development is that I get out of the house sooner if I am not cocooned in bed catching up with the news. 🙂

So, is it a good idea to stop reading any news? I don’t think so even after my experience. Knowing what is going on in the world is important and shutting yourself off from the world is not an answer. There are a lot of issues in the world and the first step in fixing them is to know about the issues. I mean if you don’t even know a problem exists then how are you going to even think about a solution for it? There is a quote from Isacc Asimov that seems relevant here:

“Your assumptions are your windows on the world. Scrub them off every once in a while, or the light won’t come in.”
― Isaac Asimov

So the question becomes, how do I scrub my windows to the world? The answer is quite simple, read about what is happening in the world. There might be new discoveries, events etc happening that will challenge your thinking and maybe result in a complete change in your thought process. Don’t get put down by the constant negative news in the media. The fact is that it’s not all bad out there and there are good things happening all over the world but that doesn’t sell so the media focuses on the negative aspects to sell paper (or user views etc). Bill Gates wrote about this recently as well. In a recent study folks took 15 different measures of progress (like quality of life, knowledge, and safety) and found that the world is actually getting better inspite of the mess we keep seeing in the news all the time.

All that being said it is quite possible that you end up getting down/depressed after reading & watching so much negative news in the press. This is a normal reaction. John Scalzi who is one of my favorite authors had the following advise on how to deal with this scenario (It was published about a year ago but is still valid):

3. Disconnect (temporarily). Especially now, it might be useful for a “hard reset”: taking a week (or two! Or more!) away from most news and social media in order to give your brain the equivalent of a few deep, cleansing breaths and the ability to switch focus away from the outside world and back into your internal creative life.

It’s often hard to do this — social media in particular is specifically designed to make you feel like if you’re not constantly attached to it then you’re missing something important. But here’s the thing: Even if it were true (which it usually is not), there are millions of other people out there to deal with it while you take a week off from the world to get your head right. Let them.

What are your thoughts about this topic? Do you feel that stopping to read news is a good idea? Let me know via comments below (or via email).

This is all for now. Will post more later.

– Suramya

January 29, 2018

How can we secure a Client App so that the server side can detect tampering?

Filed under: Computer Security,My Thoughts — Suramya @ 5:09 PM

If you have been following ADHAAR in the News/Social Media recently then you must have seen the posts by some prominent cyber security folks about basic security issues with Adhaar. I couldn’t resist chiming in with my two cents and pretty soon the conversation switched from the glaring security issues with Adhaar to how we could secure applications when the client could not be trusted. Sushil Kambampati had some interesting questions on this topic and we tried having a discussion on Twitter itself for a short while but since twitter is not the best medium for long winded conversations we switched to email pretty soon and the following is a summary/expansion of my conversation with him.

Special thanks to Sushil for asking the two questions listed below thereby motivating me to write this post. Please note that all the items below are my personal thoughts and I don’t claim to know everything so some of the things below might not be the best option or might require additional safeguards beside the ones I talk about.

What are the risks if the client has been modified by an attacker?

The possibilities are endless if an app has been modified and can still successfully communicate to the server backend. The attackers can tamper with it to install a backdoor on an app, re-sign it and publish the malicious version to third-party app marketplaces. They can also change the app to query the server in ways that the designer didn’t expect. e.g. query the DB for all possibly values of the Adhaar no (as an example) to identify valid values. They can also attempt to perform SQL injection attacks/other attacks on the server by sending it data that it doesn’t expect.

How can the server-code detect whether the client app has been modified?

This is a very interesting problem and there is no foolproof method to ensure that the local client hasn’t been modified. However that said we can always make it harder for the attacker to modify the app. Some ways we can detect tampering are listed below along with potential ways to bypass the checks. (I am going to talk about app side checks in addition to server side since both need to be performed to secure the app). I specifically talk about Android applications here but the same is valid for any server/client system where the client can’t necessarily be trusted (and if your client is installed on a machine you don’t control then it def can’t be trusted).

  • We add code obfuscation/shrink the code using Proguard.This makes it more difficult (though certainly not impossible) to reverse engineer the code by making it harder to read a stack trace because the method names are obfuscated. Other things we can do to harden the app is to include checks to detect if the app is running in a virtual environment (emulator) and abort runs. This check should not be an easy thing to disable e.g. by setting a flag, instead the build process should add the check when building the release version or something similar while making it as hard as possible to disable. Finally we should ensure that all debug code is stripped out from the build when creating the release version. This will make it harder for the attacker.

    The communication between Server & Client should be over a secure/encrypted channel (use HTTPS not HTTP), all local data should be encrypted with a unique password that is generated at runtime (1st run) using a random seed.

  • We have the app send a checksum that the server verifies everytime an API call is made.
  • This is a very basic check that is fairly simple to bypass as any competent attacker will also modify the app to send the correct checksum value even though the actual checksum value is different.

  • Have the Server request for a byte string from a random location in the APP e.g. send me 100 bytes starting from byte # 2000 from the beginning of the file. This check would fail if any changes are made to the file in the section that the check queried.
  • The issue is that there is a high probability that the check location requested by the server is not for the location that the attacker has modified. Also, if the attacker is sufficently motivated they can append a copy of the original App to the tampered app and then modify the check function to return the values from the original app when the server attempts to verify the integrity.

  • Verifying your app’s signing certificate at runtime.
  • All applications in the Appstore are signed with a developers private key and the app signature will be broken if the APK is modified. By default android will not allow you to install an app where the signature doesn’t match. However you can potentially bypass it by changing the code / value you are checking against. Also, the app can still be installed manually if the phone is rooted.

  • Verifying the installer
  • Each app contains the identifier of the app which installed it. Therefore, with a very simple check you could have your app verify the installer ID. This can be an in app check and also triggered by a server API call. However with access to the code (by reverse engineering the app) this check could potentially be commented out.

  • Monitor your server side logs
  • This is very important, because any attempts to hack the server/bypass restrictions will leave a trace in your logs. If you have configured good log monitoring rules then this can act as an indicator of someone trying to hack your application. Then you have the option of putting countermeasures into action like blacklisting etc.

Hope this all makes sense. Please let me know if you have any further questions by posting a comment below or emailing me.

Regards,

Suramya

December 5, 2017

Dominos Pizza online has stronger password requirements than Citibank India Online

Filed under: Computer Related,My Thoughts,Techie Stuff — Suramya @ 11:59 PM

Today I decided to change my IPIN (Internet Pin) on Citibank as I haven’t changed it in a while and its a good idea to change it on a regular basis. So I logged in to my account and clicked on the password reset link and I got the following text:

The first item there is fairly standard but what really surprised me were items # 3,4 & 6. What do you mean I can’t have any special characters in my password? Why can’t I have a password longer than 16 Characters when the NIST password guidelines recommend that you allow a password of up to 64 char’s in length.

In contrast The Dominos Pizza’s Online portal has stronger security and requires you to have Upper case, Lower Case, Numeric Char and a Special Character in the password. Making it a lot more secure and harder to crack than the Citibank password.

This is not all. The best part is yet to come. I use a password manager and my generated password was 22 characters long this time, so I pasted it into the form and the system accepted the password change. Now since I am a paranoid person I decided to check if the password changed successfully by logging in with the new password. Imagine my surprise when an error message popped up on screen when I tried to log in telling me that my password can’t be longer than 16 chars. I was confused since the password change form took my 22 char password without trouble, so I tried logging in with the old password and that obviously didn’t work. Finally I tried removing the extra 6 characters from my password and was able to log in.

Basically the stupid system truncated my password to 16 and then saved it instead of warning me that my password was too long when I was changing the password which would have been the logical thing to do.

Citibank needs to update its system to follow the NIST rules and start allowing people to choose more secure passwords.

Well this is all for now, will write more later.

– Suramya

Older Posts »

Powered by WordPress