• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

micropython / micropython / 14143 / 6
98%
master: 98%

Build:
DEFAULT BRANCH: master
Ran 21 Aug 2020 06:20AM UTC
Files 274
Run time 11s
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

21 Aug 2020 06:08AM UTC coverage: 98.016% (-0.005%) from 98.021%
MAKEOPTS="-j4"

push

travis-ci-com

dpgeorge
tools/pyboard.py: Replace eval() of received data with alternative.

Prior to this commit, pyboard.py used eval() to "parse" file data received
from the board.  Using eval() on received data from a device is dangerous,
because a malicious device may inject arbitrary code execution on the PC
that is doing the operation.

Consider the following scenario:

Eve may write a malicious script to Bob's board in his absence.  On return
Bob notices that something is wrong with the board, because it doesn't work
as expected anymore.  He wants to read out boot.py (or any other file) to
see what is wrong.  What he gets is a remote code execution on his PC.

Proof of concept:

Eve:

  $ cat boot.py
  _print = print
  print = lambda *x, **y: _print("os.system('ls /; echo Pwned!')", end="\r\n\x04")
  $ ./pyboard.py -f cp boot.py :
  cp boot.py :boot.py

Bob:

  $ ./pyboard.py -f cp :boot.py /tmp/foo
  cp :boot.py /tmp/foo
  bin   chroot  dev  home  lib32  media  opt   root  sbin  sys  usr
  boot  config  etc  lib   lib64  mnt    proc  run   srv   tmp  var
  Pwned!

There's also the possibility that the device is malfunctioning and sends
random and possibly dangerous data back to the PC, to be eval'd.

Fix this problem by using ast.literal_eval() to parse the received bytes,
instead of eval().

Signed-off-by: Michael Buesch <m@bues.ch>

19466 of 19860 relevant lines covered (98.02%)

422298.63 hits per line

Source Files on job 14143.6 (MAKEOPTS="-j4")
  • Tree
  • List 0
  • Changed 50
  • Source Changed 0
  • Coverage Changed 50
Coverage ∆ File Lines Relevant Covered Missed Hits/Line
  • Back to Build 13704
  • Travis Job 14143.6
  • 60cf2c09 on github
  • Prev Job for MAKEOPTS="-j4" on master (#14141.6)
  • Next Job for MAKEOPTS="-j4" on master (#14144.6)
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc