Closed
Bug 742614
Opened 13 years ago
Closed 13 years ago
Allocation of string is not checked in WebSockets text frame parsing, which can lead to data being truncated before being returned to the application
Categories
(Core :: Networking: WebSockets, defect)
Core
Networking: WebSockets
Tracking
()
RESOLVED
FIXED
mozilla16
People
(Reporter: briansmith, Assigned: jduell.mcbugs)
References
Details
Attachments
(2 files)
|
1.34 KB,
patch
|
briansmith
:
review+
lsblakk
:
approval-mozilla-aurora+
|
Details | Diff | Splinter Review |
|
1.39 KB,
patch
|
briansmith
:
review+
lsblakk
:
approval-mozilla-beta+
|
Details | Diff | Splinter Review |
See http://hg.mozilla.org/mozilla-central/annotate/ed9cbe6a817e/netwerk/protocol/websocket/WebSocketChannel.cpp#l1065
We attempt to create an nsCString of the given length, which may be VERY large (up to 2^31, AFAICT). After we create the string, we don't check the length of the string to make sure it succeeded. Consequently, when we call CallOnMessageAvailable, we may have truncated the data to "".
And, CallOnMessageAvailable makes a copy of that string, and that copying has the same problem.
BTW, does this mean that, once we have infallable strings (bug 737164), then any server can instantly crash Firefox with an OOM by sending a single very large text frame--i.e. a ping of death? I know that we generally accept that a server can cause us OOM accidentally or on purpose, but this seems a little too easy.
| Reporter | ||
Comment 1•13 years ago
|
||
BTW, I assigned this to Patrick because I originally thought it was a security bug caused by his checkin (based on hg blame), but AFAICT it isn't directly a security bug, so I am unassigning it.
Assignee: mcmanus → nobody
| Assignee | ||
Updated•13 years ago
|
Assignee: nobody → jduell.mcbugs
| Assignee | ||
Comment 2•13 years ago
|
||
Thanks for noticing this. Patch uses new fallible_t String API that landed in bug 737164.
Attachment #623072 -
Flags: review?(bsmith)
| Assignee | ||
Updated•13 years ago
|
Attachment #623072 -
Flags: review?(bsmith) → review?(mcmanus)
| Reporter | ||
Comment 3•13 years ago
|
||
Comment on attachment 623072 [details] [diff] [review]
v1. check allocation
Review of attachment 623072 [details] [diff] [review]:
-----------------------------------------------------------------
This will stop a crash.
Attachment #623072 -
Flags: review?(mcmanus) → review+
| Assignee | ||
Comment 4•13 years ago
|
||
Target Milestone: --- → mozilla16
| Assignee | ||
Comment 5•13 years ago
|
||
Comment on attachment 623072 [details] [diff] [review]
v1. check allocation
One liner allocation check that prevents large websocket messages from crashing browser.
I can port to beta too if we want, but will need different patch since this one relies on bug 737164. Let me know.
[Approval Request Comment]
Risk to taking this patch (and alternatives if risky): ~0%
String or UUID changes made by this patch: none
Attachment #623072 -
Flags: approval-mozilla-aurora?
Comment 6•13 years ago
|
||
Status: NEW → RESOLVED
Closed: 13 years ago
Resolution: --- → FIXED
Comment 7•13 years ago
|
||
Comment on attachment 623072 [details] [diff] [review]
v1. check allocation
[Triage comment]
Looks good, feel free to nominate a patch for beta and we'll approve it.
Attachment #623072 -
Flags: approval-mozilla-aurora? → approval-mozilla-aurora+
| Assignee | ||
Comment 8•13 years ago
|
||
https://hg.mozilla.org/releases/mozilla-aurora/rev/54b3267d0292
beta patch coming up...
| Assignee | ||
Comment 9•13 years ago
|
||
Just a version w/o using fallible_t, for the beta branch
Attachment #635046 -
Flags: review?(bsmith)
| Reporter | ||
Updated•13 years ago
|
Attachment #635046 -
Flags: review?(bsmith) → review+
| Assignee | ||
Comment 10•13 years ago
|
||
Comment on attachment 635046 [details] [diff] [review]
Same patch w/o fallible_t for beta
Beta version of patch.
Attachment #635046 -
Flags: approval-mozilla-beta?
Updated•13 years ago
|
Attachment #635046 -
Flags: approval-mozilla-beta? → approval-mozilla-beta+
| Assignee | ||
Comment 11•13 years ago
|
||
Updated•13 years ago
|
status-firefox14:
--- → fixed
status-firefox15:
--- → fixed
You need to log in
before you can comment on or make changes to this bug.
Description
•