A Linux Exploit That Uses 6502 Code

With ubiquitous desktop computing now several decades old, anyone creating an operating system distribution now faces a backwards compatibility problem. Each upgrade brings its own set of new features, but it must maintain compatibility with the features of the previous versions or risk alienating users. If you are a critic of Microsoft products for their bloat, this is one of the factors behind that particular issue.

As well as a problem of compatibility, this extra software overhead creates one of security. A piece of code descended from a DOS word processor of the 1980s for example was not originally created with any idea that it might one day be hiding in a library on a machine visible to the entire world by the Internet. Our subject today is a good example, just such a vulnerability hiding in an old piece of code whose purpose is to maintain an obscure piece of backward compatibility. [Chris Evans] has demonstrated a vulnerability in an Ubuntu version by playing an NES music file that contains exploit code emulated by the player on a virtual 6502 processor.

The NES Sound Format is a music file standard that packages Nintendo game music for playback. It contains a scripting language, and it is this that is used to trigger the vulnerability. When you open an NSF file on the affected Ubuntu system it finds its way via your music player and the gstreamer multimedia framework to libgstnsf.so, a gstreamer plugin for playing NSF files.

Rather unbelievably, his plugin works by emulating a real 6502 as found in a NES to derive the musical output, and it is somewhere here that the vulnerability exists. So not only do we have layer upon layer of backward compatibility to play an obscure music file format, there is also a software emulation of some 8-bit silicon from the 1970s. [Chris] comments “Is that cool or what?“, and while we agree that a 6502 emulator buried in a modern distro is cool, we can’t help thinking something’s been lost along the way.

A proof-of-concept is provided for Ubuntu 12.04. It’s an older version, but he points out that while he thinks the most recent releases should not contain exactly the same vulnerability, it certainly exists in more than one still-supported version. There’s also a worrying twist in that due to the vagaries of Ubuntu’s file manager it auto-opens when its folder is accessed from the GUI. The year 2000 called, they want their auto-opening Windows ME worms back.

Sadly we suspect the 6502 lurking in this music player can’t be put to more general-purpose use. If you manage it, please do share it with us! But if emulated 6502s are your thing, take a look at this 150MHz 6502 co-processor for an Acorn BBC Micro that someone made using a Raspberry Pi.

[via r/hacking]

6502 image, Dirk Oppelt, (CC BY-SA 3.0) via Wikimedia Commons.

A Portable, Accurate, Low-Cost, Open Source Air Particle Counter

If you live in a city with poor air quality you may be aware that particulates are one of the chief contributors to the problem. Tiny particles of soot from combustion, less than 10μm across, hence commonly referred to as PM10. These are hazardous because they can accumulate deep in the lungs, wherein all kinds of nasties can be caused.

There are commercial sensors available to detect and quantify these particles, but they are neither inexpensive nor open source. [Rundong] tells us about a project that aims to change that situation, the MyPart, which is described as a portable, accurate, low-cost, open source air particle counter. There is a GitHub repository for the project as well as a series of Instructables covering the build in detail. It comes from a team of members of the Hybrid Ecologies Lab at UC Berkeley, USA.

Along the way, they provide a fascinating description of how a particulate sensor works. A laser shines at right angles across a photodiode, and is brought to a focal point above it. Any particulates in the air will scatter light in the direction of the photodiode, which can thus detect them. The design of a successful such sensor requires a completely light-proof chamber carefully built to ensure a laminar flow of air past laser and diode. To that end, their chamber has several layers and is machined rather than 3D-printed for internal smoothness.

We’ve covered quite a few environmental sensors over the years here at Hackaday. An open source volatile organic compound (VOC) detector featured last year for example, or this Raspberry Pi-based  system using a commercial gas sensor.

Linux On Your NES Classic Edition

Nintendo look as though they may have something of a hit on their hands with their latest console offering. It’s not the next in the line of high-end consoles with immersive VR or silicon that wouldn’t have looked out of place in last year’s supercomputer, instead it’s an homage to one of their past greats. The NES Classic Edition is a reboot of the 1980s console with the familiar styling albeit a bit smaller, and 30 of the best NES games included.

You do not, however, get an original NES with a 6502 derived processor, and a stack of game cartridges. In the Classic Edition is a modern emulator, running on very modern hardware. We’re told it contains an Allwinner R16 quad-core Cortex A7 SoC, 256Mb of RAM, and 512Mb of Flash. That’s a capable system, and unsurprisingly any hacking potential it may have has attracted some interest. Reddit user [freenesclassic] for example has been investigating its potential as a Linux machine, and has put up a post showing the progress so far. It is known that there is already some form of Linux underpinning the console because Nintendo have released a set of sources as part of their compliance with the terms of the relevant open-source licences. That and the availability of a serial port via pads on the PCB gives hope that a more open distro can be installed on it.

We’re taken through the process of starting the machine up with the serial port connected to a PC, and getting it into the Allwinner FEL mode for low-level flashing work. Then we’re shown the process of loading a custom U-Boot, from which in theory a kernel of your choice can be loaded.

Of course, it’s not quite that simple. There is still some way to go before the device’s Flash can be accessed so for now, all that is possible is to use the RAM, and the current state of play has a kernel panic as it is unable to mount a filesystem. However this is a new piece of hardware in its first few days after launch, so this is very much a work in progress. We are sure that this device will in time be opened up as a fully hackable piece of hardware, and we look forward to covering the interesting things people do with it when that has happened.

If you are interested in the NES Classic, take a look at it on Nintendo’s web site. Meanwhile, here at Hackaday as a quick look at our past stories tagged “nes” shows, we’ve covered a huge number of projects involving the platform in the past.

Thanks [Doc Oct] for the tip.

Original NES console header image: Evan-Amos [Public domain], via Wikimedia Commons.

Put A Pi In Your JAMMA

Most of us who play an occasional arcade game will have never taken a look inside a cabinet however much its contents might interest us. We’ll know in principle what kind of hardware we’d expect to see if we were given the chance, but the details are probably beyond us.

In fact, there is a standard for the wiring in arcade cabinets. Arcade operators demanded running costs as low as possible, and the industry responded with the JAMMA wiring standard. The Japan Amusement Machinery Manufacturers Association was the name the Japanese trade body was known under in the 1980s, and they originated a specification for both wiring and connector that would allow hardware to be easily installed for any game that supported it.

[Jochen Zurborg] has created an interesting board supporting the JAMMA connector, one that interfaces it with a Raspberry Pi and offers full support of the Pi as a video source. He’s launching his Pi2Jamma as a commercial product so sadly there are no schematics or Gerbers for you to look at, but if you’d prefer to roll your own it probably wouldn’t be beyond most Hackaday readers to do so. What it does though is open up the huge world of emulation on the Pi to owners of classic cabinets, and if you don’t mind forking out for one then we can see it might make for a very versatile addition to your cabinet.

We’ve featured [Jochen]’s work before here at Hackaday with a joystick that faithfully replicates arcade items. As to the Pi, this is the first JAMMA board we’ve seen with video, but we’ve featured another board using a Pi to bring console controllers to JAMMA boards in the past.

Drone Snags A Snag, Pilot Faces Fine

If you hail from somewhere to which Australian beers have been exported, you could be forgiven for forming a view of the country based solely on TV adverts for Foster’s, or Castlemaine XXXX. Entertaining 30-second stories of wily young Aussies, and their inventive schemes to get their hands on a cool glass of the Amber Nectar.

Whether it’s an accurate depiction or not is something you’d have to ask an Australian, but it seems to provide a blueprint for at least some real-life stories. An Australian man in Sunbury, west of Melbourne, is to face a fine of up to A$9000 for using his multirotor to pick up a sausage in a bun from a stall in a superstore car park, and deliver it to him relaxing in his hot tub.

From one perspective the video of the event which we’ve posted below the break is a very entertaining film. We see the flight over houses and a main road to a local branch of Bunnings, an Australian hardware store chain. Their sausage sizzle is a weekly institution in which local non-profit groups sell barbecued sausages from a stall in the car park as a fundraiser. The drone lowers a bag on a string over people queuing, with a note saying “Please buy snag(Aussie slang for sausage) and put in bag, here’s $10”. Someone complies, and the tasty treat is flown back over suburbia to our hero in his tub. It’s fairly obviously a production with many takes and supporting actors rather than a real continuous flight, but the Australian Civil Aviation Safety Authority is nevertheless investigating it. Breaches of the rules are reported as being use of a drone within 30 metres of people, as well as flight beyond the line of sight and over a populated area. The original video has been taken down, but it lives on courtesy of Australian tech site EFTM.

Aside from providing our readership with entertainment courtesy of our Australian friends there is an important message to take away from this story. It’s likely that if they can adequately prove that their flight was never out of the line of sight they can escape some of the charges, but even so they have strayed into difficult territory. We’ve written about drone hysteria on the part of authorities before, and we are living in an age during which twitchy agencies have shown themselves willing to view what we know to be little more than grown-up toys as something akin to terror weapons. Of course people who use multirotors for wilful endangerment should be brought to book in no uncertain terms, but the line between that and innocuous use feels sometimes to have been shifted in an alarming direction. Please keep entertaining us with your multirotor exploits and hacks, but never take your eye off how what you are doing could be misconstrued by those in authority. We’d prefer not to be writing up drone stories involving fines.

Continue reading “Drone Snags A Snag, Pilot Faces Fine”

Swear Bleep Detecting Eyebrows

Swear on broadcast television and they’re going to bleep out the audio to protect the sensibilities of the general public. Swear bleeps are fairly standardised at 1kHz, or so [mechatronicsguy] tells us. You learn something new every day.

OK, it’s not as though there’s an ISO document somewhere detailing the exact tone to use when someone says a naughty word on camera, it is far more likely that a 1kHz tone is the most likely frequency to be at hand in a studio. It’s so ubiquitous that even audio engineers with nowhere near perfect pitch can identify it, and one to which an acquaintance of ours swears years of exposure have given his ears a selective notch filter.

Armed with this information, [mechatronicsguy] created a fun project. As a fan of the [electroBOOM] Youtube channel he made a set of LED eyebrows for a picture of his bleep-prone hero, and using a Teensy with its audio and FFT libraries he made them light up whenever a 1kHz tone is detected. It’s not the most amazing of hacks, but if you find yourself in need of a smile on a chilly November morning then maybe it’ll have the same effect on you as it did with us. He’s posted a quick video of the ‘brows in action which we’ve embedded below the break.

Continue reading “Swear Bleep Detecting Eyebrows”

Retrotechtacular: [Walt] Builds A Family Fallout Shelter

In the 1950s it seemed likely that the Cold War could at any minute take a turn for the worse, and we might all be consumed in the fiery conflagration of nuclear war. Fortunately neither the leaders on our side of the fence nor those on the other were the dangerous unpredictable lunatics their opponent’s propaganda might have portrayed them as, and instead we continued on our way uneasily gazing at each other over the Iron Curtain.

For civilian America, the Government created a series of promotional efforts to prepare them for the effects of nuclear war and equip them with the means to survive. Some of them like the infamous “Duck and cover” film seem quaint and woefully inadequate when viewed with several decades hindsight, but others tried hard to equip the 1950s American with what looked like the real means to survive.

Our film below the break today is part of one such effort. The Family Fallout Shelter was a booklet produced in 1959 by the Office of Civil and Defense Mobilization, and it described in detail the construction of a series of fallout shelters of differing designs.  There was a concrete underground shelter, a partially buried twin-wall shelter with infill, and the one shown in the film, a basement fallout shelter made from concrete blocks. Our narrator and protagonist is [Walt], a capable bespectacled middle-aged man in a check shirt who takes us through the shelter’s construction.

We start with him giving some friends a tour of the finished shelter, and we see its cozy furnished interior with bunk beds and all mod cons. We’re told it would make a useful extra spare bedroom, or a darkroom. Then we flash back to construction as [Walt] takes us through all the steps required to build your own basement shelter. As he says, it’s a project that could be attempted by almost anyone, and what follows is a pretty good introduction to basic bricklaying. We can’t help being concerned about the security of those unmortared roof blocks in the face of a Tsar Bomba, but fortunately they were never put to the test. We do find it amusing that this is presented by the National Concrete Masonry Association — how better to boost sales than get the populace to build extra brick walls in every home?

The film and booklet provide a fascinating window into some of the culture surrounding preparations for nuclear war in the early Cold War era. The ideas that it would be survivable, and that two weeks in a home-made fallout shelter would be sufficient to ensure that civilians would be safe are in stark contrast to the then-secret deep shelters and long-term survival plans that the governments of the time created for themselves. It would be interesting to know how many of these home shelters were built, and how many survive. Did you ever spend a night in a basement spare bedroom with a blast wall?

We’ll leave you with the film’s closing words from the Director of the Office of Civil and Defense Mobilization.

No home in America is modern without a family fallout shelter. This is the nuclear age.

Continue reading “Retrotechtacular: [Walt] Builds A Family Fallout Shelter”