How to Hack a Mac OS X Password

Posted on 30th April 2011 in Tutorials

I may have mentioned some time ago that I learned how to change Mac passwords without knowing the current password. Whether or not I did, I do know how to do it, and I do feel like sharing today. To be clear, this is a brief tutorial on how to change the password for one Mac user account on a computer to which you have physical access, in order to gain administrative privileges. This method doesn’t create a new user, it only changes the password of an existing one. As such, it does cause the password stored in that user’s keychains to fail, meaning that next time that user logs in, they’ll be prompted repeatedly for their newly changed password. I understand that this knowledge could pretty easily be used maliciously – have some self control, seriously. Knowing how to do it should be enough, you don’t need to break your school’s grading system or anything like that.

So before we start, you should know that there is a slight bit of prerequisite knowledge required. You should be comfortable with the command line interface, and knowing UNIX well is a big plus. I would just hate for you to try and follow this tutorial and then realize too late that you’re in over your head and accidentally breaking things. So, if you need it, here‘s a good tutorial on command line basics. Do it, and then do another, and then come back and break into your own Mac.

If the above paragraph doesn’t apply to you, let’s get started. In English, the general process for changing the password is to gain root access to the system, find the user account to change the password for, change the password, and reboot. If you were trying to do this remotely, the hardest part would be gaining root access, but as we have physical access to the computer, it’s completely trivial.

To get root access, boot into single-user mode by holding down Command+S (or Apple+S, if you prefer) as you start the computer. That is, from the shut-down state, turn on the computer while holding down Command+S. The normal boot sequence won’t happen – instead you’ll be dropped to a UNIX prompt as the root user.

As a preliminary note, the $ preceding commands represents the shell prompt.

———————————————-

It’s generally a good idea to take this opportunity to check the hard disk for errors before mounting it. I like to do it for the peace of mind. The command to check the disk is

$ /sbin/fsck -fy

This will run the same check that’s run when you click “Verify Disk” in Disk Utility. It takes a little while, and it may look like it’s frozen, but it’s really not. It just takes a while. Once it’s done, mount the filesystem with

$ /sbin/mount -uw /

The slash on the end refers to the mount point of the filesystem, meaning the root directory. Now that the filesystem is mounted, load the Apple directory services commandline utility with

$ launchctl load /System/Library/LaunchDaemons/com.apple.DirectoryServices.plist

Now you can use the dscl command to perform some simple operations on the computer’s list of users. First off, you want to see the names of all of the accounts on the system. You can get a listing easily using the following command.

$ dscl . list /Users

You’ll see a listing of all of the machine’s accounts, most of which start with an underscore. Most of these are accounts required for the proper operation of the system, but you never see them. You can ignore these. The ones you’re interested will be near the bottom of the list, without underscores. Generally, if you’re on a personal computer, you’ll be able to deduce which account has administrative rights, because it will be the one named after the person who owns the computer. If this isn’t the case, though, and you see a bunch of users with similar or ambiguous names, there’s an easy way to find out if a user has admin rights. Just enter

$ groups theusernamehere | grep admin

Replace “theusernamehere” with the name of the user you want to check admin rights for. If the command returns anything, this means that the user is an admin. You’ll also see the word “admin” among the groups in the command’s output. If not, they’re not an admin. Alternately, you can delete everything in the command after the user name and manually scan each output for the word “admin”. Use a bit of trial and error to find out who the administrator of the computer is. Once you’ve done that, changing their password is trivial. The command is

$ passwd theusernamehere

Replace “theusernamehere” with the exact username of the account you want to change. You’ll be asked to type and retype the new password for the user. Don’t be surprised that nothing appears when you type the password, that’s normal. Just reboot using

$ reboot

and log in as the user whose password you just changed. Congratulations, the system is now at your mercy.

———————————————-

As an alternative to this method, it’s possible to redo the setup that ran once when the computer was first started and create a new admin account that way. To do that, after you’ve mounted the filesystem, use

$ rm /var/db/.AppleSetupDone

to delete the file that indicates the completion of the initial setup. Then, when you reboot, you’ll go through the account creation process as if it was the first time you ever started the computer.

So there you go, be responsible with how you use this information. Try the process out though, it’s an incredible feeling the first time you break into a computer, even if it’s your own.

Bill Withers and Mice in Java

Posted on 29th April 2011 in Something Daily

The few weeks before finals are never fun. I have way more stuff to be doing than time to do it in, and my desire to be productive is inversely proportional to how nice the weather is. But I think I spend too much time thinking about how much work I should be doing, which generally increases stress instead of decreasing it. Let’s just talk about what’s already done.

I had a long mix session last night for my second project for recording technology class, a cover of Bill Withers’ “Use Me”. The session seemed to go on forever, and I was totally cranky and tired by the end of it, but listening to our mix this morning, it sounds even better to me than it did last night. This is our rough mix, check it out.

Use Me by Raised by Robots

I played the clavinet part (not a real clav, unfortunately) and helped engineer and produce the whole thing. This has been a fun project, and it’s awesome to have another track for my portfolio.

I also was asked to present a project I did for my CS 101 class last year to the current 101 class, to give them ideas and confidence for the upcoming final project. I made this game where your cursor is a mouse and your move around collecting falling cheeses and avoiding mousetraps. Since making it, the laptop that I bring around with me has become an Ubuntu machine, and as a result, certain things I was doing in terms of graphics weren’t working anymore. So I just spent an hour or so fixing my year-old code to work on my new system, and taking a trip back in time as I did so. It’s interesting to look at my own old code and see how my practices have developed. When I finished the mouse game last April, it was throwing multiple NPEs per second as a result of some oversights I made at the time that I didn’t realize would affect performance on some systems. Clearing those up did the trick, though, and now I’ll be presenting my old work to a class of hopeful 101 students. I’m actually really excited, I love the opportunity to share knowledge (and be in a position of some power).

I think I’m going to put up the code for that old mouse game via webstart some time soon. It’s actually really addicting.

Ubuntu Natty Narwhal first impression

Posted on 28th April 2011 in Something Daily

So of course I downloaded Ubuntu 11.04 Natty Narwhal at my earliest convenience, which ended up being 9:30 this morning. I got incredibly fast download speeds for the computer science building (1100 kBps), which is strange for a network that usually kicks me off once every twenty minutes. But yeah. I downloaded it, and I’m using it now, and I like it, for the most part.

Good things about it include the new docking and window sizing options in Unity: you now have the option to automatically size a window by dragging it to a side of the screen. Docking on the left or right edge maximizes the window vertically and gives it half of the total screen width, so it’s easy to place two halfscreen windows next to each other. Also, docking on the top of the screen now maximizes the window, which I so far find alternately annoying and convenient. I find myself accidentally maximizing windows when I just wanted to move them up. Despite that, this is a great new addition to the user interface, because it provides a number of intuitive ways to do the same thing, none of which are confusing. This means that if you’re just meeting Ubuntu after using a different OS for a while, it’s more likely that you’ll have an easy time getting used to the interface.

The fact that the upper menu bar doesn’t really exist anymore is awesome. It bothers me to have “fullscreen” applications that don’t actually use the whole screen size, and this problem is diminished significantly with the consolidation of the global menu bar and the application menu bar. The new Firefox does something similar, doing away with some of the older default menu buttons in favor of a more streamlined, functional design. I like it.

I’m not so sure about the new applications dock menu thing. I’m having trouble finding the view settings for it, which I want to change because it looks too fisher-price with the huge rounded square buttons. I don’t know if there are other settings, but I’d like to use one if there are. The trash, desktop, and dock are all gone now, which makes me think of Mac OS X’s UI: everything is contained in the dock, with open applications indicated only there, instead of the older, Windows-esque tray method that contained an entry for each window. I’m ok with this, but it’ll take a little bit of getting used to.

Of course I think it’s awesome. I don’t have to tell you that. You knew that already. I love Ubuntu right now. This is the best interface it’s had since at least Intrepid (which I mention only because that’s the oldest distribution I’ve ever used). Download Ubuntu. It’s free, it’s awesome. Go.

comments: 1 » tags: , , ,

Flawless Failure

Posted on 27th April 2011 in Something Daily

I like to think that I’m pretty good at video games. I play them enough, I feel like I should know what’s going on. Give me a platformer, especially a 2D one, and I’m pretty much set. I’ve essentially been playing the same mario game in some form or another since 1997, so I should be pretty good at platformers. Also racing games I can do pretty well with, as a result of my Lego Racers/Mario Kart/DKR addiction in elementary school. Adventurers and shooters I can figure out as well. I don’t have as much experience with those types as I do with racing and platforming, but Zelda and the Halos have trained me well enough to hold my own.

The thing is, though, I kind of suck at fighting games. Like I suck really bad at them. Like I was just playing with my friends and I won one match out of about ten. It’s not that I don’t have experience with the genre; I played Tekken when I was younger, got 100% completion in Soul Calibur II, and recently owned Street Fighters 2, 3, Tekken 4, and Mortal Kombat: Armageddon. I played through them, and got to the point where I could at least make it through the single player fights. The thing about fighting games, though, is that just making it through the single player mode doesn’t really prepare you for a human opponent. Especially one as inhumanly skilled as Trevor, my friends’ roommate, with whom I played tonight, and who gave me the most thorough beatdown I’ve had the pleasure of receiving in a long time. He was literally ripping my characters in half in Mortal Kombat. He did the Noob fatality on me where Noob duplicates himself and he and the duplicate pull your legs in opposite directions and rip you apart. It was demeaning, seriously.


It actually looked just like this, because I was Scorpion when it happened. So rude.

Practice Street Fighter II as I might, for some reason I feel like I’m not really going to get to that level any time soon. Fighting games are awesome, but my gaming niche is the fact that I know every secret in Super Mario World and…you know….stuff like that.

Got Disassembled

Posted on 26th April 2011 in Something Daily

I’ve taken a few computer science classes now and in pretty much all of them, there has been some discussion of how memory works. Usually this means we’ve talked about function calls being used to build and shrink a stack somewhere in the nebulous area of “memory”, but that’s about the extent of what the classes I’ve taken so far have talked about. Today, though, I made a discovery on the matter as a result of working my way through my new book’s tutorial on C and assembly language. Essentially, what I learned today constituted a solidification of what I already understood in a general sense – the process by which functions cause the stack to change. Previously, I was able to explain the process in general terms (that the function is pushed onto the stack and popped off after execution), but with the help of the GNU debugger, I was able today to examine the actual memory addresses of the various pointers involved in the process. Basically, I understand it a lot better now, as I was able to see precisely the movement of data as the memory is allocated for a function call. This is a big revelation – it’s getting me more excited about assembly. If you use mac, install XCode from your original install disc, and if you use linux, sudo apt-get install gcc gdb. Do hello world in C and disassemble it with GDB – if you’ve never done this before, you’ll be amazed. So deep!

Also, I successfully created the beginning of my first working WordPress theme today by adapting my static mockup to a locally installed version of WordPress. It’s actually an incredibly easy process, as they give you all the tools you could want to use wordpress as a basic CMS. This is all fun!

Just felt like sharing a bit of my nerdiness. That was the good part of my day. I don’t feel like talking about the bad part. It wasn’t that bad, but it was bad enough for me to call it “bad”.

comments: 0 » tags: , , , , , ,

[insert name of beatles song here]

Posted on 24th April 2011 in Something Daily

Yesterday I got the first comment ever to be perpetrated on this blog that involved a positive reaction to one of my computer tutorials. It was the one where I explain how to make the keyboard backlight buttons work on Macbooks running Ubuntu. Surprisingly, someone actually followed the steps and it worked for them! Unexpected, for sure. Yet, of course, totally awesome.

I spent most of this wonderful afternoon in central park with my friend Sarah, just chatting and enjoying the very nice weather. I would have felt awful not spending at least part of today outside. I was tempted to wear shorts – that’s how warm it was, you guys. I got over my fear of sitting in the grass in new jeans, and I was reminded of the Tower of Terror by all the buildings surrounding central park. You know, they kind of look like this when you’re in the park and there are trees blocking the lower portions.

At least that’s what I think whenever I’m in the park. It reminds me of when we went there, and I rode that ride for the first and last time. Falling straight down isn’t really my thing. I like falling sideways, or forward.

I continued learning assembly, C, and as a result, memory architecture, today, and learned an interesting lesson in the process. Of course, this makes total sense, but I had to learn it firsthand. I’m following a tutorial that uses Linux and the GNU debugger to step through programs and teach assembly, and I decided to try it on Mac. I downloaded XCode and started running all of the tutorial examples, but soon found out that all of the register names are different under Mac. EIP wasn’t doing anything for me other than causing an unknown register error. So I examined the registers, and sure enough, they were all totally different from the Linux ones. I’m sure they have similar functions, but for now, I’m sticking to Linux, because that’s what the book I’m using covers, and it covers it very well. Interesting lesson, though. I also noted that the memory addresses that my Mac was displaying were twice as long as those on my Linux system, which makes a lot of sense as the Mac has 4GB of RAM and the Linux box only has 2GB. Hooray for learning.

Maybe I’ll go watch a movie tonight. Maybe I’ll just keep coding. Both are fun.

Moved into Place

Posted on 24th April 2011 in Something Daily

I’m learning a lot about assembly and C as a result of reading this book I got called “Hacking: The Art of Exploitation” from No Starch Press. And no I was not paid to plug them just now. The reason I was originally attracted to this book is probably obvious: because the idea of being able to crack computer security sounds awesome. But as it turns out, being able to stuff like that requires a huge amount of prerequisite knowledge, or so this book would have me believe. I’m learning to use the GNU C debugger and write in C, as well as look at actual assembly instructions generated by the code that I write. This is some deep stuff. Fun, but it seems impenetrable sometimes. I’m having fun anyway. Of course I’m having fun. I’m coding.

Also, my roommate moved into our new place today, so I was able for the first time to see it with some real amount of furniture in it. Surprisingly, it looks a lot bigger when it’s crammed full of stuff. But it’s awesome to actually be moving into an apartment instead of a dorm. I made a trip from my 14th street dorm down to our 9th street apartment this morning in the pouring rain carrying four bags full of various things from my room to put in the apartment, so that was interesting. I was soaking wet by the time I got there. But it was worth it.

comments: 0 » tags: , , ,

Sugar High-Five

Posted on 22nd April 2011 in Something Daily

Last night, I was in the mood for chocolate. So I put on my slippers and walked downstairs to the Duane Reade and bought one of these.

And then I went back up to my room and on the way up shared the elevator with two girls, each of whom I offered a truffle. They both took them, of course, because who can resist chocolate, especially when it’s offered by a dude with a strange mohawk on your dorm elevator? So I took the rest of the bag up to my room and ate the whole thing in ten minutes while listening to Earthless, who are a cool blues-metal band who kind of sound like a more rocking Black Sabbath. Let me just say that eating the whole thing in ten minutes was a very bad idea. I couldn’t sleep from the sugar rush, and also my stomach was killing me as a result of it being filled with mostly dark chocolate. Seriously, bad idea.

Apart from that, yesterday was a bit weird. I did make a ton of progress on the Wonderleague website, taking the time to implement the foundation of a small-scale content management system that will allow whoever it is that ends up maintaining the site to easily edit the content. The blog section will be WordPress-based, but the rest of the site will essentially be a pretty frontend for my CMS built around a database of music, video, and upcoming tour dates. So far I’ve built the system by which entries can be added and edited by the administrator. It just occurred to me that I still need to implement a deletion function as well. That’s coming soon. This really isn’t as difficult as I thought it would. I’m getting a lot of incredible PHP practice, and building something really usable that I can put into my portfolio. Keep in mind that it’s really my first time doing something quite like this on such a scale. It’s going well though!

Sweet, rad, everything is awesome.

Screw You Guys, I’m Going Home

Posted on 21st April 2011 in Something Daily

I might get a coauthor soon, my very good friend David told me that he wants to write stuff here. I think it would be rad.

Also, I don’t really feel like writing tonight. So there. You’ll just have to wait until tomorrow.

comments: 0 » tags: ,

Eat Chocolate to Gain Energy

Posted on 20th April 2011 in Something Daily

If you have trouble keeping your eyes open, typing correctly, or thinking in clearly delineated thoughts, just eat some chocolate. It’ll give you the extra boost you need to keep doing whatever it is that you need to be doing. I’m eating a bag of M&Ms right now, and seriously, it’s doing amazing things for my ability to think clearly. That combined with listening once again to Radical and then Bastard will help me get over my extreme fatigue after staying up until 3 AM two nights in a row.

[citation needed]

This is how my sleep schedule works. I need to go to bed before 1 and wake up before 9 to feel well rested; anything else and I’m a little off. I know some people who are ok with pulling multiple allnighters per week – I just could never do that. I mean I know that they’re not really ‘ok’, but they can function. See I wouldn’t be able to. I did one all-night for the hackathon, and by the end of that, I felt like I was drunk. I couldn’t really walk straight, and Eric, who I was with, definitely noticed that my thoughts and speech weren’t really making sense. I slept for like 14 hours after that. But you knew that.

Also, i just learned that the half of my SNES collection that I was given by my friend last year is now being reclaimed by his older brother. Never has a text message murdered my buzz so egregiously. This is a sad day. I lost Yoshi’s Island, Link to the Past, all 3 Donkey Kongs, Mega Man X, Power Rangers, and Mario Kart. Isn’t that messed up? I’m told that I’ll get them back at the end of the summer, but oh man…it might be a slowish summer.