possible symlink attack in blender 2.5 #22509

Closed
opened 2010-06-05 08:25:30 +02:00 by Paul Wise · 5 comments

%%%Blender is subject to symlink attack when the user closes the app without saving their changes. The consequences are that an attacker determined file owned by the victim is overwritten with a .blend file, destroying whatever data was in the file in the process.

Version 2.49.2 isn't vulnerable to this attack since it uses ~/.blender/quit.blend instead of /tmp/quit.blend. I would suggest this behaviour be restored before Blender 2.5 is released.

pabs@chianamo:~$ sudo ln -s /home/pabs/foo /tmp/quit.blend
[sudo] password for pabs:
pabs@chianamo:~$ ls -l /tmp/quit.blend /home/pabs/foo
ls: cannot access /home/pabs/foo: No such file or directory
lrwxrwxrwx 1 root root 14 Jun 5 13:51 /tmp/quit.blend -> /home/pabs/foo
pabs@chianamo:~$ file /tmp/quit.blend /home/pabs/foo
/tmp/quit.blend: symbolic link to /home/pabs/foo' /home/pabs/fooo: ERROR: cannot open /home/pabs/foo' (No such file or directory)
pabs@chianamo:~$ blender
Ob 'Camera' - Successfully removed 0 keyframes
bpy stats - tot exec: 5728, tot run: 0.4375sec, average run: 0.000076sec, tot usage 1.4299%
Saved session recovery to /tmp/quit.blend

Blender quit
pabs@chianamo:~$ ls -l /tmp/quit.blend /home/pabs/foo

  • rw-r----- 1 pabs pabs 78K Jun 5 13:53 /home/pabs/foo
    lrwxrwxrwx 1 root root 14 Jun 5 13:51 /tmp/quit.blend -> /home/pabs/foo
    pabs@chianamo:~$ file /tmp/quit.blend /home/pabs/foo
    /tmp/quit.blend: symbolic link to `/home/pabs/foo'
    /home/pabs/foo: Blender3D, saved as 64-bits little endian with version 2.50.0007
    pabs@chianamo:~$ echo foo > /home/pabs/foo
    pabs@chianamo:~$ ls -l /tmp/quit.blend /home/pabs/foo
  • rw-r----- 1 pabs pabs 4 Jun 5 14:00 /home/pabs/foo
    lrwxrwxrwx 1 root root 14 Jun 5 13:51 /tmp/quit.blend -> /home/pabs/foo
    pabs@chianamo:~$ file /tmp/quit.blend /home/pabs/foo
    /tmp/quit.blend: symbolic link to `/home/pabs/foo'
    /home/pabs/foo: ASCII text
    pabs@chianamo:~$ blender
    bpy stats - tot exec: 648, tot run: 0.0677sec, average run: 0.000104sec, tot usage 0.4556%
    Saved session recovery to /tmp/quit.blend

Blender quit
pabs@chianamo:~$ file /tmp/quit.blend /home/pabs/foo
/tmp/quit.blend: symbolic link to `/home/pabs/foo'
/home/pabs/foo: Blender3D, saved as 64-bits little endian with version 2.50.0007
%%%

%%%Blender is subject to symlink attack when the user closes the app without saving their changes. The consequences are that an attacker determined file owned by the victim is overwritten with a .blend file, destroying whatever data was in the file in the process. Version 2.49.2 isn't vulnerable to this attack since it uses ~/.blender/quit.blend instead of /tmp/quit.blend. I would suggest this behaviour be restored before Blender 2.5 is released. pabs@chianamo:~$ sudo ln -s /home/pabs/foo /tmp/quit.blend [sudo] password for pabs: pabs@chianamo:~$ ls -l /tmp/quit.blend /home/pabs/foo ls: cannot access /home/pabs/foo: No such file or directory lrwxrwxrwx 1 root root 14 Jun 5 13:51 /tmp/quit.blend -> /home/pabs/foo pabs@chianamo:~$ file /tmp/quit.blend /home/pabs/foo /tmp/quit.blend: symbolic link to `/home/pabs/foo' /home/pabs/fooo: ERROR: cannot open `/home/pabs/foo' (No such file or directory) pabs@chianamo:~$ blender Ob 'Camera' - Successfully removed 0 keyframes *bpy stats* - tot exec: 5728, tot run: 0.4375sec, average run: 0.000076sec, tot usage 1.4299% Saved session recovery to /tmp/quit.blend Blender quit pabs@chianamo:~$ ls -l /tmp/quit.blend /home/pabs/foo - rw-r----- 1 pabs pabs 78K Jun 5 13:53 /home/pabs/foo lrwxrwxrwx 1 root root 14 Jun 5 13:51 /tmp/quit.blend -> /home/pabs/foo pabs@chianamo:~$ file /tmp/quit.blend /home/pabs/foo /tmp/quit.blend: symbolic link to `/home/pabs/foo' /home/pabs/foo: Blender3D, saved as 64-bits little endian with version 2.50.0007 pabs@chianamo:~$ echo foo > /home/pabs/foo pabs@chianamo:~$ ls -l /tmp/quit.blend /home/pabs/foo - rw-r----- 1 pabs pabs 4 Jun 5 14:00 /home/pabs/foo lrwxrwxrwx 1 root root 14 Jun 5 13:51 /tmp/quit.blend -> /home/pabs/foo pabs@chianamo:~$ file /tmp/quit.blend /home/pabs/foo /tmp/quit.blend: symbolic link to `/home/pabs/foo' /home/pabs/foo: ASCII text pabs@chianamo:~$ blender *bpy stats* - tot exec: 648, tot run: 0.0677sec, average run: 0.000104sec, tot usage 0.4556% Saved session recovery to /tmp/quit.blend Blender quit pabs@chianamo:~$ file /tmp/quit.blend /home/pabs/foo /tmp/quit.blend: symbolic link to `/home/pabs/foo' /home/pabs/foo: Blender3D, saved as 64-bits little endian with version 2.50.0007 %%%
Author

Changed status to: 'Open'

Changed status to: 'Open'
Member

%%%Hi, revision of the way blender finds directory/file paths for these kinds of resource files is currently in development, and will allow customisation of these with environment variables. Technically this functionality is doing what it is designed to do, so it's not really a bug (there are many more 'security' issues in blender than this).

Incidentally, I'm not sure why 2.49 was saving in ~/.blender/ for you, afaik it has always saved in /tmp, perhaps you didn't have write access there or something.

Closing this report, thanks.%%%

%%%Hi, revision of the way blender finds directory/file paths for these kinds of resource files is currently in development, and will allow customisation of these with environment variables. Technically this functionality is doing what it is designed to do, so it's not really a bug (there are many more 'security' issues in blender than this). Incidentally, I'm not sure why 2.49 was saving in ~/.blender/ for you, afaik it has always saved in /tmp, perhaps you didn't have write access there or something. Closing this report, thanks.%%%
Member

Changed status from 'Open' to: 'Archived'

Changed status from 'Open' to: 'Archived'
Author

%%%According to the Debian maintainer, 2.49 was patched in Debian to save into the right directories and avoid the security issues but the 2.50 version in Debian experimental dropped those patches:

http://bugs.debian.org/584621
http://git.debian.org/?p=collab-maint/blender.git;a=blob;f=debian/NEWS;hb=experimental

In any case, it is a shame that the blender project isn't interested in fixing security issues, no matter how minor they might seem.%%%

%%%According to the Debian maintainer, 2.49 was patched in Debian to save into the right directories and avoid the security issues but the 2.50 version in Debian experimental dropped those patches: http://bugs.debian.org/584621 http://git.debian.org/?p=collab-maint/blender.git;a=blob;f=debian/NEWS;hb=experimental In any case, it is a shame that the blender project isn't interested in fixing security issues, no matter how minor they might seem.%%%
Author

%%%This bug is still present in blender 2.63a, it would be great if it were fixed.%%%

%%%This bug is still present in blender 2.63a, it would be great if it were fixed.%%%
Sign in to join this conversation.
No Label
Interest
Alembic
Interest
Animation & Rigging
Interest
Asset Browser
Interest
Asset Browser Project Overview
Interest
Audio
Interest
Automated Testing
Interest
Blender Asset Bundle
Interest
BlendFile
Interest
Collada
Interest
Compatibility
Interest
Compositing
Interest
Core
Interest
Cycles
Interest
Dependency Graph
Interest
Development Management
Interest
EEVEE
Interest
EEVEE & Viewport
Interest
Freestyle
Interest
Geometry Nodes
Interest
Grease Pencil
Interest
ID Management
Interest
Images & Movies
Interest
Import Export
Interest
Line Art
Interest
Masking
Interest
Metal
Interest
Modeling
Interest
Modifiers
Interest
Motion Tracking
Interest
Nodes & Physics
Interest
OpenGL
Interest
Overlay
Interest
Overrides
Interest
Performance
Interest
Physics
Interest
Pipeline, Assets & IO
Interest
Platforms, Builds & Tests
Interest
Python API
Interest
Render & Cycles
Interest
Render Pipeline
Interest
Sculpt, Paint & Texture
Interest
Text Editor
Interest
Translations
Interest
Triaging
Interest
Undo
Interest
USD
Interest
User Interface
Interest
UV Editing
Interest
VFX & Video
Interest
Video Sequencer
Interest
Virtual Reality
Interest
Vulkan
Interest
Wayland
Interest
Workbench
Interest: X11
Legacy
Blender 2.8 Project
Legacy
Milestone 1: Basic, Local Asset Browser
Legacy
OpenGL Error
Meta
Good First Issue
Meta
Papercut
Meta
Retrospective
Meta
Security
Module
Animation & Rigging
Module
Core
Module
Development Management
Module
EEVEE & Viewport
Module
Grease Pencil
Module
Modeling
Module
Nodes & Physics
Module
Pipeline, Assets & IO
Module
Platforms, Builds & Tests
Module
Python API
Module
Render & Cycles
Module
Sculpt, Paint & Texture
Module
Triaging
Module
User Interface
Module
VFX & Video
Platform
FreeBSD
Platform
Linux
Platform
macOS
Platform
Windows
Priority
High
Priority
Low
Priority
Normal
Priority
Unbreak Now!
Status
Archived
Status
Confirmed
Status
Duplicate
Status
Needs Info from Developers
Status
Needs Information from User
Status
Needs Triage
Status
Resolved
Type
Bug
Type
Design
Type
Known Issue
Type
Patch
Type
Report
Type
To Do
No Milestone
No project
No Assignees
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: blender/blender#22509
No description provided.