Sunday, May 01, 2016
The Dreamz Experience
Sunday, March 20, 2016
Building Secure Connected Devices - II
Local Network Access


The thing to remember in new device setup is to always authenticate the other endpoint


Physical Access

Firmware Upgrades

Tuesday, February 16, 2016
Building Secure Connected Devices - I
(Originally published here, please excuse misalignments, if any)

Why is IoT security a concern?
- Connecting more physical things potentially increases the surface area of the attack vector. While previously the attack could be limited to your email account, or social network account, the attack could now come to your house.
- Newer interactions with these connected devices opens up completely new attack vectors.
- Strong constraints on cost and power of connected devices required a newer breed of hardware to address a lot of the IoT use cases. While embedded devices have been around for a long time, connecting them to the Internet opens them up to a range of attacks that weren’t possible on these devices before. It took a while for the hardware to catch up with the latest security standards for already identified attack vectors.
- As with the rapid increase in cloud/web-service developers, it takes time for newer set of enthusiasts, hobbyists and developers to get acquainted with the attack vectors and their solutions.
Device Interactions

|
|
|
- Physical Access: The first is the physical interactions that the device owner has with her devices. For this interaction you have to be present in the house for operating the device.
- Local Network Access: The second is the access over the local Wi-Fi network. For this interaction you can be anywhere in the vicinity of the house in the Wi-Fi Access Points range.
- Remote Access: Finally, most Wi-Fi devices talk to some cloud services. It may be to facilitate remote access to the owner of the device, or to query other services (weather, electrical pricing etc.).
Remote Access
- man-in-the-middle: snoop your thermostat data from your device to the cloud (Nest), or modify settings from the cloud to the device
- replay attacks: if the data is encrypted, replay the same encrypted packet of data that unlocks the door lock of the house
- DNS spoofing: divert the traffic of your connected toy to a malicious server
- device spoofing: create a malicious/fake camera, and make the cloud believe that the camera belongs to you, the owner, and that the video feed is genuine


Friday, December 25, 2015
FreeBasics and Net Neutrality
Welcome to the Real-Internet dot Org!
Our Beliefs
- We believe Internet access to every individual on this planet will enable the poor/unconnected easy access to communication, education, healthcare and jobs
- We also believe in Net Neutrality
How does it work?
- We don’t approve your apps or site. Its your stuff, you do what you have to do
- We won’t enforce that you adhere to our guidelines (since our guidelines may change from time to time)
- We don’t act as a proxy for all user accesses performed using the Internet platform
- We won’t lobby to permit differential pricing by telecom providers in your country
Participate
Site Developers
Mobile Operators
- Allow certain bandwidth free of cost to all your subscribers. For starters, exactly the same bandwidth that you might allow internet.org users.
- Allow your subscribers to access any content that is legally allowed.
- Provide small-enough incremental bandwidth steps that subscribers can pay for, if they spill over. Over 50% of people who use free internet pay for data and access the broader internet within 30 days (Source: internet.org).
- Scrap zero-rating or differential pricing.
Frequently Asked Questions
- Your program isn’t doing shit, how does this benefit Internet adoption for the poor?
- Ok let’s say we (a) start acting as a proxy, and (b) start enforcing guidelines for participating app/sites. You think these 2 changes benefit the purpose? What gives?
Sunday, February 15, 2015
Bitcoins Simplified - II The Blockchain
In the previous part we looked at how ownership and transfer of ownership is implemented in Bitcoin. We left off with the question, how do you ensure that Mark only spends Bitcoin X only once? What is to stop him from sending the same Bitcoin X to multiple people?
When you own an account at a bank, the bank ensures that you can only spend money that you own. The bank in this case acts as the central entity that enforces the correct set of rules on your bank account.
The Blockchain
In Bitcoin, the entire process is decentralized. The bitcoin network is a peer-to-peer network of multiple nodes running the Bitcoin client. All these nodes, in conjunction, maintain and validate a distributed ledger, called the blockchain, to enforce the rules. This is a central part of the innovation behind bitcoins.
- The blockchain is a chain of blocks.
- Each block contains a list of transactions.
- As new bitcoin transactions are generated, they are captured together into a new block and the new block is added to the blockchain.
As can be seen above, each block contains a link to the previous block's hash, thus linking the blocks in the chain. The blockchain, thus, records all the Bitcoin transactions, right from the birth of Bitcoin. This way all the nodes in the bitcoin network know when Mark has spent the bitcoins that he owns, thus invalidating any subsequent double-spend transactions by Mark.
Proof of Work
Now the question is, since any node in the network can add blocks to the chain, how do you prove that someone malicious did not add an incorrect block to the chain? Or worse, fork the blockchain and create their own set of blocks thus misguiding everyone.
This is ensured by enforcing the following simple rules:
- adding any block to the blockchain takes a significant amount of processing (CPU) power (proof-of-work). While at the same time, validating any block in the blockchain is extremely trivial.
- if the blockchain is forked, all the nodes in the Bitcoin network pick the longer branch of the blockchain, ignoring the smaller branch.
Assuming that majority of the processing power in the Bitcoin network is controlled by 'good' nodes, this makes it extremely hard for malicious nodes to fork the blockchain. This is because the total processing power of the good nodes, will keep extending the blockchain further, while malicious nodes fail in their race to fork the blockchain since the forked branch will always be shorter. [1]
The process of adding new blocks to the blockchain is called bitcoin mining.
Bitcoin Mining
So all bitcoin miners are always in a race to find the appropriate proof-of-work with other miners in the network. This involves significant computer power. What is the incentive for these miners to expend this computing power?
The miner who added a new valid block to the blockchain gets a reward of new bitcoins. This not only acts as an incentive for miners, but also ensures a steady and predictable supply of new bitcoins in the system. [2]
Isn't all of this fascinating?
Additional Notes:
1. The proof-of-work algorithm makes the bitcoin miners choose a value for a set of fields in the new blocks header, such that the hash of the generated block satisfies a difficulty target. This criteria is that the hash of the block should be less than a defined target value. This makes the bitcoin miners try all the possible values in the proof-of-work fields and check the hash of the block to match with the current difficulty target, thus expending processing power. The verification process is trivial because all it does is computes the hash of the newly added block with the difficulty target.
The difficulty target of the bitcoin network keeps incrementing to keep up with the advances in hardware of the miners. The difficulty target is so adjusted that it takes an average of 10 minutes to mine a new block.
2. The current reward is of 25 bitcoins. The reward halves after every 210,000 blocks that are mined.
Acknowledgements: Thanks to Danny Hamilton for his corrections.
Saturday, February 14, 2015
Be the customer
Easier said than done... :)
Bitcoins Simplified - I
Here is my take at simplifying the technology behind the working of bitcoin:
Bitcoin is
- electronic currency: it does not rely on electronic tokens rather than physical tokens to represent money
- decentralized (peer-to-peer): there is no central authority (like a central bank etc.) responsible for creating the currency, or responsible for managing transactions of this currency
Let's begin by assuming that there is such a currency in an electronic form, then look at the various problems that such a currency would pose.
Ownership
Since the currency is electronic, how do I prove ownership? Anybody could make a copy of my currency and claim that it is theirs.
If your mind is thinking about PKI, you are in the right direction. Digital signatures have been used for a long time now, to ensure the authenticity of the source of a message. The same principle is used for signing transactions. Since I am the only one who has the private key, I am the only one who can sign the transaction. That proves ownership.
In the example above, Mark owns bitcoin X. When he performs a transaction, his transaction will be treated as valid, since he can generated a valid signature. Larry cannot spend Bitcoin X, since he cannot generate a valid signature for bitcoin X.
You may be wondering how exactly would you know what public key should be used to validate the signature. Hold on to that thought, we will come to it in a minute.
Transfer of Ownership
Ok, now how do I transfer that ownership to someone else? What signifies ownership in this case?
I know the answer is forming in your head :).
Since we are using digital signatures, my signed transaction should include the 'public key' of the recipient. Thus the public key of the current owner will be encoded in the bitcoin transaction.
In the example above, Mark transfers Bitcoin X to Larry. He does so by including Larry's public key in the transaction.
So what does this mean for Larry, when he is spending Bitcoin X? He should sign the transaction with a private key that corresponds to the Public key that was encoded in the previous transaction. Only that will allow him to unlock/transfer the Bitcoin to the next recipient. This is shown below.
So far so good, but the biggest question is, how do you ensure that Mark only spends Bitcoin X only once? What is to stop him from sending the same Bitcoin X to multiple people? This is where the distributed ledger concept of Bitcoin kicks in. It is a central part of the bitcoin innovation. More on that in a follow-on blog post.
Sunday, February 01, 2015
The Release Rush
I love watching the excellent participants, working on their culinary recipes, race with each other towards the deadline.
I wondered why they all feel so rushed up towards the finishing line often finishing only seconds, before the deadline.
It happens no matter how long the time slot is, or how simple the cuisine is. And it happens to every participant, even the most expert cooks, with a spectacular plan and meticulous execution. Why so? Bad planning?
And then I wonder, how I would feel if a participant finishes 10 minutes before their deadline. They finished alright, but could they have delivered more? Did they take it too easy? Not just for the sake of competition, but for realizing their own potential.
The goal is not just to deliver, in the given time. That is not success.
The goal is to deliver your best, in the given time. That has the potential to be a success.
Sunday, January 25, 2015
Bitcoin: What's the big deal?
{ This is Part 2 of the Bitcoin TechTalk series. The previous TechTalk about Bitcoin is available here: Bitcoin: A Bubble? }
A: So new currency you say, why do you need a new currency?
B: It is a decentralised network, there is no central authority. So a central authority cannot ask you for a high percentage of commission. A network of miners maintain the network and they are rewarded by new bitcoins for their work.
A: Well, that is for now. Once the transaction volume increases,who is to stop them for charging high commission?
B: Well since anyone is free to participate in the miner network, hopefully economic/competitive equilibrium is reached.
A: Hmm... but if anyone can participate in the miner network, how do you avoid malicious activity?
B: That is the crux of the bitcoin algorithm. It maintains a distributed ledger of all transactions since Bitcoin's birth. Adding transactions to this ledger requires high computing power. And every miner in the miner network is in a race to add transactions to this ledge. On the other hand, validating transactions from the ledger requires very few computational resources. So it is easy for the miner network to identify and discard malicious transactions.
A: While the distributed ledger in itself is useful in a lot of situations beyond currencies, the very low transaction charges implies that you could perform very small transactions without incurring much cost. A slew of new and interesting ideas could be implemented with this. (Ref: Why Bitcoin matters)
B: But the cost of bitcoins is too high, I don't think micropayments is an option at all.
A: Actually, the bitcoin protocol has a nifty feature where you could divide a bitcoin down to as small a fraction as you wish. Currently the smallest unit of bitcoin, also called a satoshi, is 1/100,000,000 BTC
Thursday, January 22, 2015
The urge to do
Programming and debugging are activities where we should think a lot and do little. Commonly what happens is the reverse. We are driven by the urge to do something.
It's particularly true for debugging. We see a problem, the first instinct is to print something, build and rerun. And then print some more. In the end when we discover the problem we go: Ah, that was obvious. I could have gotten there faster instead of these x iterations. And on complex systems these iterations take a long long time.
It often helps to resist the urge to do and think what could be going off here. It saves a ton of time.
So also for programming.
A lot of programming time is spent in the edit build debug cycle. We make numerous iterations through this cycle to get to our goal. How could we optimize this? What if we are allowed only 1 iteration through this?
To ensure that I put enough thought in the process, recently I created this game for myself. After breaking the problem into subproblems I take it as a challenge that every submodule that is built will run completely in the first iteration itself. I get to decide the size of the submodule, but my code should do exactly what I intended in the first shot. Over time I have found that this leads to a lot of efficiency by forcing me to think of all the dependencies and side effects upfront.
Of course not all problems can be addressed with this method. Especially if it's a new technology or domain you learn much faster through each iteration. But for a lot of cases this approach does magic. You should try it out...
Saturday, January 17, 2015
Bitcoin: A Bubble?
[ Please contribute in the comments section, that is the place for most revelations / insights ]
- A: Why does its value fluctuate?
- B: Same reason why the value of any other commodity or equity shares fluctuate.
- A: What is it backed by? Equity shares have the products created by the corporation or its assets as its backing?
- B: I don't think its backed by anything per-se. Even in case of corporations, the perceived value as reflected in the market capitalization wouldn't always match the assets or the created products.
- A: All currencies are usually backed by gold, aren't they. There is no such backing for bitcoins. Could the energy spent in mining the bitcoins the backing for bitcoins?
- B: True that. That makes it seem like a bubble. I don't have anything to show for it when things are going south. The energy spent is actually energy spent, I still don't have anything to show for it.
- A: Actually, what happens if the price of gold itself goes down, what do we have to show for that? An ornament?
- B: Let's go back to the time in human civilization where only food and wood (shelter) was required for survival. At that point, what would be the value of gold, nothing. I can't eat it, I can't use it for shelter. It's as good as stone. It's price rose only when multiple people were interested in it.
- A: And it was scarce enough. Demand-Supply. As long as you have demand, the value will be maintained. So yeah, apart from food and shelter everything else is pretty much perceived value driven by demand-supply.
- B: The supply is throttled at about 25 bitcoins per 10 minutes for miners, so that addresses the supply side
- A: I wonder what is the number of bitcoin owners. If all of them together dump bitcoin, only then the demand will go down.
- B: Hmm, that will affect the value of bitcoin, but we could still continue to use it as a medium of currency exchange.
Some links that I search after this discussion:
- Only once currency is still backed by gold: http://www.businessinsider.com/are-there-any-currencies-backed-by-gold-2012-3?IR=T
- Number of unique bitcoin addresses: https://blockchain.info/charts/n-unique-addresses
- Bitcoin Venture Capital Investments: http://www.coindesk.com/bitcoin-venture-capital/
Fresh Minds == Fresh Ideas
Once we are working on something for an extended duration of time, the base assumptions get latched on to our mind. We continue to be actively focused and working towards our targeted milestones, ignoring these along the way. It takes a fresh mind to question these assumptions. Only then do we realise 'Ouch, that is no longer true...'. We have to continue to flush/revisit these base assumption.
That's why we stumble upon debugging clues when we discuss the problem with someone.
That's why we have a deeper understanding of a subject when we teach it to someone.
So if you care about innovation, if you care about questioning the status-quo, ensure you encourage fresh minds to contribute ideas openly. Make it an integral part of your organization's culture. Ensure every idea is evaluated on the merit of the idea than that of the proposer.
Thursday, January 15, 2015
This is *your* project
In our minds, ever so slightly, we stop being in the driver's seat. But the reality is, its just us, it is our project. Others will help us, they guide us, but its us who decides where the car is going.
And it happens at work too... You are knee deep in it, you have to drive it. Everyone else has only a limited perspective, however experienced they are. Take the right calls, raise the right issues.
Older Blog's Archive
Monday, February 13, 2012
Why work (hard) on a BE Project?
(Note: Although I mention BE Project below, this applies to any project that you are working on during your student days. )
Answer some questions for me:
1. What programming language are you strongest in?
C, C++, Java?
2. How complex a program have you written in this language? Any programming beyond the assignments?
Programming is what you are going to be doing for a long time in your career. How have you really prepared yourself for this? Scoring well in theory exams is in no way an indicator of how well you can program.
Lets take cricket to emphasize the point further:
a. People who score excellent in cricket theory exams cannot become cricketers. They will tremble and sweat standing on a pitch when facing a fast bowler. A situation not unlike many I have seen in IT companies.
b. Excellent cricketers have spent a long time practicing on the pitch. You are automatically comfortable, you know you are on your home pitch. You may be nervous, but clueless you are not.
Of course, I don't mean theory is not important. It is crucial. But so is programming, and unfortunately our examination systems, do not quite test you well on that. Thankfully, within the first 10 minutes, a good interviewer can identify a kaun-kitne-paani-main-hain... (This gets quite close to the point I am trying to make).
3. Do you think after 4 years of your BE, you are a mature technical professional who is hireable?
Towards the end of my third year, I always thought we have hardly done anything significant during Engineering. I mean anyone reading a few books can get here. What makes me different?
Here are some of the important benefits of a great Project:
1. Choose your co-workers, choose your work
This is something which is closer to the hearts of the students and so lets look at that first.
Rarely in life do you get a chance to choose your co-workers. This is a golden opportunity to work alongside your friends on something constructive. Many of my students often remember and miss their days of the project when they were designing for their project, brainstorming an idea or hunting for a bug for days at end.
The culmination of all these gives you a high, a sense of achievement, like nothing else. Its that feeling of accomplishment that stays with you.
Not only your co-workers, but this is also your opportunity to choose your domain of work, or pick an idea that you are passionate about. Many people that I know end up working in more or less the same domain that they did their BE project in, , even after years of passing out of BE.
2. Preparing for the future
Here are a few things that you'll be doing once you join any organisation
a. get familiar with the tools
- revision control system
- bug tracking system
- development environment
- netiquette
b. get familiar with the code
- understand the existing architecture, code base
- debug and fix bugs
- design, implement and test a component
And this is going to be your profession. Surprisingly, as a student you have never had to do any of the above during your engineering. The academic assignments are too small to count towards this.
Your project acts as the sufficiently complex entity where you can get to experience all of the above first-hand. You yourself have to consider the breaking of problem into sub-problems, scheduling, risk mitigation and other strategies. These no longer stay concepts from Pressman, but you get to put them in practice. As you experience these concepts, you start developing ways and procedures of dealing with problems yourselves. This is the important learning curve. This is what contributes to the "experience".
There are many things that you can learn and absorb during the various phases of your project. We'll cover that probably in another article.
3. Foot in the door
The resumes of most BE passouts are just about the same. As I mentioned above, good marks aren't necessarily an indicator of mature developers. So how are you different from the thousands of engineers passing out with you?
Your BE project acts as your foot-in-the-door. That is what separates you from the rest. Working on your BE project also counts towards your experience in that particular domain. You now have something more concrete to talk about in the interview, and having spent time on that you are an expert in that field.
Acknowledgements: Thanks to Amey Inamdar and Amod Jaltade for their suggestions.







