Showing posts with label rit. Show all posts
Showing posts with label rit. Show all posts

Tuesday, September 2, 2008

How To: Break MOLLY!

I have wanted to post this for a long time now, but I had previously been afraid of retaliation by RIT's IT department since this exploit was discovered using their public facing website. However, http://it.rit.edu and http://nssa.rit.edu have both recently switched from Molly, a pseudo in-house solution written mostly by Ronald Vullo. Molly's status as a publicly available CMS from sourceforge opens the possibility that other people outside of RIT will be using it, and these people would probably appreciate being told about a security vulnerability in their software...unlike the IT department which would likely try to expel me or prevent me from graduating on schedule. (Yeah, I have great faith in these people.)

Anyway. Molly stands as a key case example for how you should NOT write PHP. It makes heavy use of BAD-THINGS ®, does not use any sort of legitimate string munging to prevent SQL injection, and has almost no concept of session security.
As for bad things, I mean things like polluting the global namespace, using .html files with PHP in them, the eval() statement, old functions like eregi_*(), and heavy use of $_REQUEST as opposed to $_GET and $_POST. The PHP manual itself states that $_REQUEST cannot be trusted, as you do not know which of Environment, Cookies, Get, Post, Server sources provided the variable you're looking at in $_REQUEST or if one has over-written what you actually want.

The most glaring exploit I've found, however, is related to the rendering engine the the database module (Called forms). Molly controlled pages will often have some string in their URL which tells the Molly engine how to render said page, example: people.maml?id=77&renderAs=output Or renderAs=edit
Yup. I can just see all the tech minded people thinking "What if I change output to input?".
When RIT used Molly, exactly what your worst fears were, is what happened. Each element on the page became HTML Input.


After that point it became trivial to use the Firebug plugin for Firefox to modify the contents of the page on the fly to make Molly bend over for you. To update any record you wanted, it was a simple matter of navigating to that page, changing the URL, using firebug to change the form action from "insert.html" to "replace.html" and adding a value to a hidden input element named something along the lines of "form[0][id]".

Since Molly doesn't understand security, the files which parse the form input and create the SQL queries are wide open for all to access, as long as you can post the right information.

One way these can be protected is through the use of an .htaccess file using the directive and some form of HTTP authentication. And that's probably the simplest way, but I don't know if there's anything resembling security on the rest of the engine that could be expanded to these files.

YOUR CODE IS BAD AND YOU SHOULD FEEL BAD TOO!

--PXA

Monday, August 18, 2008

When lolz turn to sadness

My current employment is as the Co-op student for ITS Desktop Support, the only major project so far has been the rebuilding of the department's internal website in a more interactive, database driven format. The new version of the site is being hosted in RIT's new totally redone better-than-the-old-environment-ever-could-have-been web applications environment. Despite the rather cramped space limitation, and unnecessary staging server, it's been less painful than it could be. Until I got around to porting a few of our backend processes that need to run on a regular basis. This involves command line PHP and UNIX Cron. Which would normally be well and good but this environment is really more than meets the eye.
In short, developing in it is like trying to get from point A to point B in this room:
It took a day to get database connections, because for some reason scripts run by Cron run on a DIFFERENT HOST than scripts run manually from the command line or scripts run by the browser. WHAT?!!!

These people have obviously never heard of the principle of Keep It Simple, Stupid. So when any of these points of failure go down, the whole system dies. I found this out over the weekend. Because it went down.
Every 5 minutes my cron task ran, and every 5 minutes it failed. Which meant that every 5 minutes, I got an e-mail saying that there was a problem running the script, and then another e-mail saying the script failed. I was greeted Saturday morning by well over 100 e-mails.

Remember, don't laugh at the convolution of your development environment, for it might come back and pee in your shoes.

:(


--PXA

Sunday, May 11, 2008

Setting up for failure.

As an IT student it, certain things about the way IT is viewed by the rest of RIT. Not the least of which being why everyone I meet always says "Oh, don't you mean 'I Tried'?" when I mention I'm an IT major. I always feel like I need to defend my major, because really...in college we are defined very much by our majors, because once we graduate these will be our careers and we'll be defined by our jobs. Sorry, Fight Club.

As depressing as it is, though, I realize there's an amount of truth to the myth of I Tried. In some sense, anyway. I don't know a single washed out CS or SE that went to IT because they couldn't hack "real programming".

RIT's first mistake is using Java to teach Programming and OOP to IT students. At least in CS you're eventually exposed to C++, but that leaves a bitter taste with a lot of people. They get used to the language coddling them and holding their hand, which is what Java does. In addition, it's incredibly well documented which makes it easy to teach. But the way the sequence is designed, all you do is learn to write code...they don't teach anything about design, or WHY OOP, or the more groady low-down details of programming.
Not that I have any idea what would make a better language...Python maybe? The problem isn't the language, but how they teach it. They spoonfeed you things, and never teach you how to be a programmer. It sets people up to fail when they think they know how to code but don't actually know the finer points.

Since I am on the web track, I had to take RIT's programming for web class, but was lucky enough to be allowed to bypass it. I helped out tutoring some of the students and I was initially horrified at the way to class was taught. It taught students to use procedural, spaghetti code. Now while there isn't anything wrong with procedural code...make spaghetti of HTML and PHP is very bad. It's hard to maintain, confusing to debug, and makes it nigh on impossible to correctly design a large project.
Soon I moved from horror to disappointment when I realized that that was how I learned to code PHP, but I moved on. Unfortunately what I had that RIT doesn't (Maybe can't?) teach is the idea that there is more beyond this.

What they're not doing, is exciting people about programming. Now I'm not saying that they should be trying to get people to become programmers if they don't like it, but there's gotta be a decent amount of people in these classes...especially track courses...that already like programming or are just looking for a reason to.
In programming for the web, RIT should show off some cool stuff that PHP can do. CMS, templating code, sessions, security layers, image editing...interact it with some javascript. Make it do cool stuff on the backend, like talk to other services and send info back to the browser...and not just databases.
All they teach is code-by-numbers quizzes and blogs. Some basic "stick some PHP in here to pull from MySQL and bake a dynamic website" stuff. Yes it's simple and gives you enough to learn the basics of the language...but people need to know it's a spring board to REALLY dive in, and not the end of things.

RIT's failing us as IT programmers, and it's making us look bad. Not cool, dudes.

--PXA

Monday, May 5, 2008

Shenanigans!

The requisite post describing how sweet Steak And Whiskey Night was will be coming soon. This post is serving as an announcement, I am calling shenanigans on the IT department.

I have found a security vulnerability in http://it.rit.edu/, the IT department's public facing website which allows me to arbitrarily inject faculty and staff into the site's database. I have made the department aware of this issue, however should they fail to acknowledge the issue or attempt to take any action against me I will make the exploit publicly available.
Also should they fix it, I will also make the exploit (and my theories for how they fixed it) publicly available as website security is an interest of mine...being a web developer. It should be an informative adventure.

Also the IT department has elected to not offer the course I need to finish my concentration in fall, meaning I will likely not get to take it until winter...and I'm sure will somehow play a role in prolonging my stay at RIT.

-- PXA

Thursday, April 17, 2008

Checking for life...... Not found.

Since the last update to BE, RIT has been bending me over the desk as is its custom. I have a small amount of time free at the moment and I feel I need to keep a modicum of momentum in my quest to have a regularly updated web log. Since I have nothing major to report I will just summarize.

RIT SG:
RIT Student Government Elections are this week, I have already voted. My initial thoughts on the election can be found at the RIT Sentinel:
http://sentinel.ironcouncil.net/2008/04/07/sg-election-time-2008-edition/

As a note, apparently SG will actually count votes for the cockboat this year.

Unfortunately, due to academic concerns, I was not able to make it to the RIT Parking Advisory Group meeting this month. Which is actually quite a pity considering I finally don't have class or work during the hour of the meeting and would've have been able to go if my System Administration lab hadn't taken 6 hours to do. It's hard to find the time to be politically active.



Google Sync:
I have made a pretty decent amount of progress on the Exchange -> Google implementation, however there are still some problems translating Microsoft to Standards. This makes for some annoyances when applying recurring appointments. I was hoping to avoid having to parse and then reassemble the RRULE myself, but this appears to be the only way to get Google to play ball. The UNTIL clause of some RRULEs uses a date/time format which looks like "20080512T010000" or yearmonthdayThourminutesecond. According to Austin from Google's API team I should be saying "20080512T010000Z", I don't get why something that is likely just looking at the day/month/year stuff cares about what timezone the stamp is in (Z refers to Zulu time which was an older name for what became UTC)


Samba:
Recently a co-worker upgraded all the Vista computers in the office where I work to SP1 of Vista, which generally went unnoticed until he went to update our department's intranet site (called DSWeb). DSWeb has been a bit of a pet project for a while for me, working on my sysadmin skills in a practical application environment. The new update to Vista breaks the way it talks to standard Samba servers. Windows based shares (Win 2k3, XP) are likely not affected but the open source implementation Samba, which emulates bits of Windows networking in Linux to allow Linux to do things like Windows File Sharing or join Active Directory managed domains, cannot speak the new dialect that Vista is using. Something about SP1 causes Samba to fail decrypting the challenge when a Vista machine is trying to authenticate. After much misadventure I found that Samba released a bugfix version, 3.0.28a, to address the issue. This is generally marked as unstable or testing by most distributions and must be explicitly installed at this time. However, I have seen no major issues with it and it did fix the Vista issue without even having to modify the configuration file.


Steak & Whiskey Night:
Back in the fall my apartment began a celebration/tradition called Steak & Whiskey Night. It can be celebrated at any time, as often as we want to. This became quite popular, even in the short span of time it existed before Rochester weather became too cold to enjoy the outdoors.
This May, Steak & Whiskey Night returns! It is currently planned for Friday, May 2nd. Attendees are encouraged to bring their own cuts of meat or custom steak rubs. It promises to be delicious.


Graduation:
Is approaching, that is all. With any luck if I can hack around some requirements and get another co-op soon, I will likely be RIT Alumni come next Winter. This concept is bizarre, and frankly a little frightening. I have paid over $32,000 a year for 4 years of my life for this education, and everything I consider at this point to be a marketable skill I have no learned from RIT. I have taught myself, or learned on the job. When my knowledge and RIT's curriculum overlapped, I was told I was out of luck and had to sit through their version. My self-motivation and ability to learn very technical skills on my own was NOT rewarded like I always thought it would be in college, it was effectively punished. So...if they're not going to teach me anything...and I'm not learning anything...Why am I paying this much again? And why does this degree matter? ...Do these skills even matter?

It's probably just Realworld-phobia. I hope.

Thursday, March 13, 2008

Syncronization again

Google has, in some ways, beaten me to the punch. For this I am actually grateful, since they built the calendar service, and the GData API they should have figured it out before me.

Unfortunately they're doing so in a bit of a different way than I am going about it so we may still be leaving some people in the dust.

The Google Calendar Sync utility:
http://www.google.com/support/calendar/bin/answer.py?answer=89955

The nature of the tool requires you to be using Windows, and Microsoft Outlook which is problematic. I primarily use Linux with Thunderbird at home, and I have the Lightning Thunderbird plugin to allow me to use it for calendaring. At the office I do use Windows mostly, but spend some of my time in Linux and Evolution or using Entourage on the Mac. Google cannot help me here.
The utility itself is a compiled executable and Google has not release the code, so developers don't know how the tool works. The Terms of Service also prevent developers from reverse-engineering to find these things out, so our only hope is to ask Google how this thing does what it does.


On a related note I've been making some progress with my own sync tool, but Spring Quarter here at RIT just started so my time is growing slim. With any luck I should have a working beta within a few weeks, but that probably will have limited support for recurring appointments, at best.

-PXA

(Edit, I went to retag this and blogger.com ate some of my article. Looks like their regex got a little too greedy)