Navigation Menu

Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Security issue with dart:io + dart:mirrors #10963

Open
DartBot opened this issue May 30, 2013 · 9 comments
Open

Security issue with dart:io + dart:mirrors #10963

DartBot opened this issue May 30, 2013 · 9 comments
Labels
area-core-library SDK core library issues (core, async, ...); use area-vm or area-web for platform specific libraries. library-io P2 A bug or feature request we're likely to work on type-bug Incorrect behavior (everything from a crash to more subtle misbehavior)

Comments

@DartBot
Copy link

DartBot commented May 30, 2013

This issue was originally filed by podivilov@google.com


The code below sets arbitrary pointer as _RandomAccessFile._id, which is then reinterpret casted as File* in File_Close.

import 'dart:io';
import 'dart:mirrors';

main() {
  var file = new File('test.dart').openSync();

  findSymbol(list, name) => list.firstWhere(
      (symbol) => symbol.toString() == 'Symbol("$name")');

  var ms = currentMirrorSystem();
  var library = ms.libraries[Uri.parse('dart:io')];
  var clazz = findSymbol(library.classes.keys, '_RandomAccessFile');
  var member = findSymbol(library.classes[clazz].members.keys, '_id');
  reflect(file).setField(member, 0xdeadbeef);
  file.close();
}

@peter-ahe-google
Copy link
Contributor

This is expected. Native code needs to validate arguments.

It should be fairly simple to implement a secure class for storing native pointers in the heap.

@peter-ahe-google
Copy link
Contributor

Removed Area-Library label.
Added Area-IO label.

@sgjesse
Copy link
Contributor

sgjesse commented Jun 3, 2013

It is simple enough to store the native pointer in a native field of a Dart object (by extending NativeFieldWrapperClass1). This will easily work for the direct/sync calls. However for async file operations this pointer is send through a native port to the handler thread. So we need to fix the serialization of this as well.


Added this to the M6 milestone.
Added Accepted label.

@larsbak
Copy link

larsbak commented Aug 28, 2013

Removed this from the M6 milestone.
Added this to the M7 milestone.

@sgjesse
Copy link
Contributor

sgjesse commented Sep 25, 2013

Removed this from the M7 milestone.
Added this to the M8 milestone.

@sgjesse
Copy link
Contributor

sgjesse commented Oct 30, 2013

Need some serialization hook.


Removed this from the M8 milestone.
Added this to the Later milestone.

@kevmoo
Copy link
Member

kevmoo commented May 14, 2014

Removed Area-IO label.
Added Library-IO, Area-Library labels.

@kasperl
Copy link

kasperl commented Jul 10, 2014

Removed this from the Later milestone.
Added Oldschool-Milestone-Later label.

@kasperl
Copy link

kasperl commented Aug 4, 2014

Removed Oldschool-Milestone-Later label.

@DartBot DartBot added Type-Defect library-io area-core-library SDK core library issues (core, async, ...); use area-vm or area-web for platform specific libraries. labels Aug 4, 2014
@kevmoo kevmoo added P2 A bug or feature request we're likely to work on type-bug Incorrect behavior (everything from a crash to more subtle misbehavior) and removed accepted labels Feb 29, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-core-library SDK core library issues (core, async, ...); use area-vm or area-web for platform specific libraries. library-io P2 A bug or feature request we're likely to work on type-bug Incorrect behavior (everything from a crash to more subtle misbehavior)
Projects
None yet
Development

No branches or pull requests

6 participants