Turning On The Red Light?

I was recently playing with a web program called 123D Circuits where you can make your own circuits and simulate them without having to buy any pieces! This is awesome because I’ve never really known where to buy bread boards and was never so motivated as to Google for them.

This program sort of lets you do whatever you want as long as you use the components they provide. So let’s just do something that all circuit beginners start out doing: lighting up an LED!

I suppose we’re going to need a power source and then an LED:

Basic circuit.

Here’s our basic circuit.

So we’re using a total of 3V as our battery source to power our LED. Why? Just because. Now let’s press the “Simulate” button and call it a day!

Broken LED.

Nope.

So for some reason our LED exploded which is both annoying but also cool. Good job 123D! Now why would it explode? Most likely it’s being powered too much. In fact, the reason is because there is too much current going through the LED. An LED generally has a max current rating of 20 mA but in this case (assuming it’s a 1 Ohm LED), it’s getting about I = V / R = 3 / 1 = 3 Amps of current. So that’s a little bit too much…

So how can we reduce the current? By adding resistance to the circuit! We can do that by adding a resistor so let’s do that, fire this baby up, and then we can call it a day.

Not working.

What?

Okay this is silly. What could be the problem here? Actually if you speak Resistor, you would notice that this resistor has a resistance of 1 Ohm (you can tell this by reading the color sequence on the resistor; Google is your friend in this case). So ideally if we increase the resistance (to 220 Ohms because that gives us about 13 mA of current), then we are finally done:

Almost done.

Resistance is 220 Ohms.

Cross your fingers!

Working circuit.

And so there was light!

Advertisements

Discovering Web Vulnerabilities and More!

This week I’ve been learning about web vulnerabilities, specifically, cross site scripting (XSS) which is simply a way for bad guys to stick their own JavaScript (or other) codes into the webpages that your browser loads. And when your browser loads these pages with bad code in them, bad things happen like losing important personal information.

Tonight we’ll be playing around with Vega, a web vulnerability scanner developed by an open security company named Subgraph.

Pretty.

Oh wow what a nice logo.

Wait a minute… That logo — plagiarism?!

Not plagiarism.

Oh, false alarm.

So getting Vega to work wasn’t quite so easy. There was a lot of guessing involved and it ended up taking much longer than I anticipated but in retrospect if I had just read the website’s documentation more extensively I would have had it going in no time at all.

This slideshow requires JavaScript.

Horrah! After getting the missing library that Subgraph.com so kindly told us to get, Vega is functioning as it should (or at least appears to be).

Vega up and running.

Veg(et)a after the Kid Buu Saga.

I think that reference (see the caption above) deserves a moment. So let’s take a moment before we move on.

Okay now that Vega is finally up and running we can finally use it to tear holes in the websites we love! Our target:

Site for testing.

Note: this is purely for educational purposes. There is no malicious intent so nothing was done further than performing a basic web vulnerability scan.

So apparently all we have to do is aim Vega at the desired site and press the button!

This slideshow requires JavaScript.

All we did was press “Start New Scan” and then pasted the URL of the desired site to be scanned. The way Vega works is this, it scans a page for potential input fields. In those fields Vega attempts to inject various codes so as to see if the field is vulnerable to any sort of attack. If so, it will be reported in the Scan Alert Summary. So the waiting game begins. But wait — already one bite!

Vega beginning its scan.

Meet your demise, website.

Oh wait this is actually taking a while… Let’s find something else to do: anime with commentary à la David (start from the beginning of the slideshow for maximal pleasure).

This slideshow requires JavaScript.

Handy tip from David:

“Time flies when you watch anime.”

Also,

“Watch Pokémon. It’s quality of comedy has grown immensely. But I can only vouch for the subbed version.”

“Dubbed anime sucks.”

In the meantime it seems that our scan has completed!

Completed Scan.

Booyakasha!

So it appears that no XSS vulnerabilities were found which is both unfortunate and relieving because it’s always fun to break things but also: good job school! On the other hand there are these 3 SQL injection vulnerabilities. SQL injections are similar to XSS attacks except the code that is inputted into fields is SQL code (code for managing databases). These types of attacks would allow attackers to dump database contents to the attacker’s desired location. So it is somewhat worrying since who knows what sensitive data is on these servers.

And then there’s 1 “Page Fingerprint Differential Detected – Possible Local Files Include” which just means that there’s some place on the site where an attacker can include a file that is from the local server. The local file include (LFI) is different from a remote file include (RFI) in that one can essentially say that an RFI is the basis for XSS whereas a LFI can only use files that are local to the server (the locality of the file in an LFI is the crux of the difference).

And so I guess we can say that the Johns Hopkins Computer Science department’s website is fairly secure (at least against XSS)! Congratulations!

Fun Things Can Be Flawed

A super interesting topic, which I am personally very eager to explore, is information security. It should be said that this post is and many following posts will be inspired by two people: Michael Rushanan and Paul Martin so thanks a lot for these topics otherwise I probably never would have been able to cross “maintaining a technical blog” off of my bucket list.

Aside: I could never claim to be one of those “I learned the binary before decimal”/”I built a robot to tie my shoes before I could tie them myself”/”Computer and me are one” types of genius tech kids. I was more of a “I like to play video games so I’ll say that I’m interested in studying technology as an excuse to stay on the computer for hours on end farming gold for no reason at all.

So, disclaimer: my knowledge on certain topics result from multiple hours of scouring the web and begging experts to explain simple things to me.

So in lieu of my lack of knowledge on the topic, I’m taking this post as an opportunity to open the door to the vast topic of information security. What I’ve learned is that a great place to start exploring a field is to get a feel for real life applications that are relevant to said field. So I sifted the first 5 links of a simple Google search for relatively new vulnerabilities discovered for my primary OS, Windows 7. And voila, a fun little discovery was made on my part that every MS user should respond with a mild “huh.”

Apparently those gadgets that were cute on the first boot-up but turned out to be annoying slow and pointless were fatally flawed.

If you don’t know what the Windows Sidebar and Gadgets are, they’re similar to the widgets you can find on Android smartphones that try to make keeping track of various more convenient or provide benign benefits like telling the weather or the day’s date.

That thing on the side? Remember it? Yep, bad news bears.

That thing on the side? Remember it? Yep, bad news bears.

I mean it really was a cute feature but apparently it was also a bad one. Now let’s find out why.

From the previously linked Microsoft security advisory itself:

“Microsoft is aware that some legitimate Gadgets running in Windows Sidebar could contain vulnerabilities. An attacker who successfully exploited a Gadget vulnerability could run arbitrary code in the context of the current user. If the current user is logged on with administrative user rights, an attacker could take complete control of the affected system.”

How this is done is above me (for now). At this point, if I were to hedge a guess, the hack would involve some form of pointer misdirection that results from poorly implemented gadget code. But that’s just me spitting out what little knowledge I gained from a 2 hour first-day lecture on hardware hacking. The other bullet that the security advisory has:

“An attacker could create a malicious Gadget and then trick a user into installing the malicious Gadget. Once installed, the malicious Gadget could run arbitrary code in the context of the current user. If the current user is logged on with administrative user rights, an attacker could take complete control of the affected system.”

This seems sort of obvious since it’s essentially saying, if you download a virus, you will get kicked in the butt. But it really highlights the idea that the gadget has full reign when running. And since gadgets are mostly intended to act as processes running in the background, users would not be able to notice that they are doing damage and stop the source until the damage is clear.

So I guess that sort of explains why I haven’t seen the Windows Sidebar for a little over a year.

Who knew something so cute and plain had such malicious potential.

P.S. I promise that someday I will find out and share what kind of hacks specifically applied to this vulnerability; if any interesting cases ever arose from it.

My Lil’ Ol’ Duke

Tonight let’s talk about the little machine that makes this wonderful blog possible.

Cute puppy.

Duke feat. GLACÉAU smartwater and my multivitamin supplement that keeps me strong.

Duke keeps me alive. Duke maintains my sanity. So tonight we talk about what keeps it alive and what maintains its sanity.

What is Duke really? It’s a Sager, some sort of gaming laptop which I would claim to know a lot about and proceed to boast all about its specs but in reality I know nothing and just wanted to play RuneScape at the highest FPS possible (which I can’t and am extremely disappointed about; by the way I’m not being sponsored by Sager which is why I’ve chosen to badmouth them; just kidding I love this laptop).

My laptop.

Oh look at that fine finish. Duke you’re looking great tonight. You can see the Sager logo so now you know what to look for the next time you want to splurge on a gaming RuneScape laptop.

Apparently Duke feeds upon electricity which blew my mind when I first found out so don’t feel alone if you let out a little (wow!) just now. It came with this thing that people call a PSU or power adapter or whatever. I gave it a gratuitous photo shoot just as any hip 21st century teen does with his/her daily meals. I don’t have an Instagram though, so #nofilter.

This slideshow requires JavaScript.

If we really want to find out what Duke has been consuming, we should take a look at the last image. We find that the PSU outputs 19.5 V at 6.15 Amps. The wattage is then around 120 W (thanks manufacturing label standards for saving me from performing a gruesome multiplication but I will do so anyway: 19.5 V * 6.15 Amps is pretty much 120 W).

So we’ve gathered that apparently the PSU has an operating voltage of 19.5 V and an operating current of 6.15 Amps. Now, due to years of Physics-classroom breeding, it is absolutely necessary to find the internal resistance associated with these values which we find to be

19.5 V / 6.15 Amps = 3.17 Ohms.

Note that it is somewhat crude to treat the given output values as the voltage and current running through the PSU at all times. This is simply because what the computer actually consumes at various times will fluctuate based on how much power it actually needs! We’ll just ignore this for the sake of simplicity (this is somewhat of an introductory post anyhow).

Now what I really want to know is how much Duke’s food costs because, to be honest, I’m strapped on cash and I’ll save on whatever I can (sorry Duke). We can figure this out using BGE’s electric supply rates (because I currently live in Baltimore). Clearly I’m on Schedule R because that’s for residential people who want electricity all the time and only god knows how hungry Duke can get. Over the year the average cents/KW-h is 8.7955 cents. Since every hour Duke consumes about (120 Watts * 6.15 Amps) / 1000 = .738 KW-h, then every hour I’m paying

.738 * 8.7955 = 6.49 cents.

What the heck? That means I have to pay 6.49 * 24 = 156 cents every day to feed Duke. I can barely sustain myself with 10 times that amount where am I going to get a spare dollar and a half every day? What’s even worse is that’s how much Duke consumes but the PSU isn’t actually 100% efficient so it’s probably using a non-negligible amount more than 120 Watts…

Flaunting my wealth.

Tomorrow’s rations for Duke. What do I even have left?

Just kidding! I live in a dorm so my massive tuition pays for Duke’s food!

In retrospect, it’s pretty baffling how much money gets funneled into keeping our bodies warm and our lives occupied with little gadgets. I mean, simply charging a laptop costs around $1 per day. Maybe, if saving the environment wasn’t reason enough, this will get people (cough, myself) to be more energy conscious.