DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Refcards Trend Reports Events Over 2 million developers have joined DZone. Join Today! Thanks for visiting DZone today,
Edit Profile Manage Email Subscriptions Moderation Admin Console How to Post to DZone Article Submission Guidelines
View Profile
Sign Out
Refcards
Trend Reports
Events
Zones
Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Partner Zones AWS Cloud
by AWS Developer Relations
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Partner Zones
AWS Cloud
by AWS Developer Relations
11 Monitoring and Observability Tools for 2023
Learn more

Peering Into Firmware

Learn how to use binwalk to extract a kernel image and filesystem from a firmware image from TP-Link's NC200 Cloud Camera using embedded Linux.

Christopher Lamb user avatar by
Christopher Lamb
CORE ·
Apr. 25, 17 · Tutorial
Like (2)
Save
Tweet
Share
5.81K Views

Join the DZone community and get the full member experience.

Join For Free

Today, I'm going to show you how to use binwalk to extract a kernel image and filesystem from a firmware using embedded Linux. This is actually a very common configuration; embedded Linux is a very popular alternative to writing your own embedded system from scratch.

I'm going to use the firmware image from TP-Link's NC200 Cloud Camera. You can download the firmware image from TP-Link's site if you want to follow along. And seriously, kudos to TP-Link — if you look around their site, they're distributing the source code they're using in their devices. Granted, I think that GPL compliance is part of the reason they're doing it, but still, other companies don't and it's a really good idea. It allows folks to start to develop their own apps on TP-Link's devices, potentially creating an IoT platform for TP-Link. It also gives cybersecurity researchers something to work with so they can find potential problems before others do. Good for them.

Anyway, let's look at the NC200 firmware. They have two versions up. I downloaded the A version for this. You can use the other if you'd like something slightly different. First, let's take a quick look through the contents:

cclamb@fawkes:~/Work/tplink/nc200 $ binwalk NC200_2.1.7_Build_160315_Rel.27420.bin 

DECIMAL HEXADECIMAL DESCRIPTION
--------------------------------------------------------------------------------
104448 0x19800 U-Boot version string, "U-Boot 1.1.3 (Sep 15 2015 - 08:38:27)"
106096 0x19E70 xz compressed data
127264 0x1F120 uImage header, ... , CPU: MIPS, ..."Linux Kernel Image"
127328 0x1F160 LZMA compressed data, ...
1984851 0x1E4953 JFFS2 filesystem, little endian

This by itself is interesting. We can already see the bootloader used, the kernel, the target CPU architecture, and the filesystem type. JFFS2 is what OpenWRT uses, too, by the way.

But we can go farther than this - check this out:

cclamb@fawkes:~/Work/tplink/nc200 $ binwalk -eM NC200_2.1.7_Build_160315_Rel.27420.bin 

Scan Time: 2017-04-23 17:33:31
Target File: /home/cclamb/Work/tplink/nc200/NC200_2.1.7_Build_160315_Rel.27420.bin
MD5 Checksum: b9824fac60e302add83daa0ea27b10d6
Signatures: 344
...

Now, move into the _NC200_2.1.7_Build_160315_Rel.27420.bin.extracted directory and take a look around. The bootloader image is in the 19E70 file and the kernel components are in the _1F160.extracted directory. The filesystem, uncompressed, is in the jffs2-root directory. We have another one, too; take a look at _NC200_2.1.7_Build_160315_Rel.27420.bin.extracted/_1F160.extracted/_432000.extracted/cpio-root.

The filesystem is very interesting — this is where the binaries that provide the cloud and camera services live. We'll take a closer look at these next.

Firmware

Opinions expressed by DZone contributors are their own.

Popular on DZone

  • Reliability Is Slowing You Down
  • 7 Most Sought-After Front-End Frameworks for Web Developers
  • gRPC on the Client Side
  • Build an Automated Testing Pipeline With GitLab CI/CD and Selenium Grid

Comments

Partner Resources

X

ABOUT US

  • About DZone
  • Send feedback
  • Careers
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 600 Park Offices Drive
  • Suite 300
  • Durham, NC 27709
  • support@dzone.com
  • +1 (919) 678-0300

Let's be friends: