Opened 2 years ago
Closed 2 years ago
#17779 closed defect (bug) (fixed)
Add some casts in Custom_Image_Header
| Reported by: |
|
Owned by: |
|
|---|---|---|---|
| Priority: | normal | Milestone: | 3.2 |
| Component: | Themes | Version: | |
| Severity: | normal | Keywords: | has-patch |
| Cc: |
Description
The step_3 method of the Custom_Image_Header class does not sanitize the input data. One can pass for example any value in $_POST['attachment_id'] (even an URL), which can cause memory consumption problems in multisite environments.
Attachments (1)
Change History (8)
- Keywords has-patch added
- Milestone changed from Awaiting Review to 3.2
In the future, please report things that sound like vulnerabilities to security@…. After walking through the code, this comes pretty close to being one.
I don't see a memory consumption issue, unless an image is being referenced, and thus GD goes through a resizing.
Replying to nacin:
In the future, please report things that sound like vulnerabilities to security@…. After walking through the code, this comes pretty close to being one.
I reported it before the latest minor release (on May 5) :)
I don't see a memory consumption issue, unless an image is being referenced, and thus GD goes through a resizing.
Well, I'm not sure about that. The imagecreatefromstring function still needs some amount of memory to load the image. Thus, if someone forces to load multiple large images you may have a problem there.
Replying to xknown:
Replying to nacin:
In the future, please report things that sound like vulnerabilities to security@…. After walking through the code, this comes pretty close to being one.
I reported it before the latest minor release (on May 5) :)
Ah, sorry Alex. You're right. I didn't recognize the username. :-) Thanks for going through the right channels. We should have included it in the omnibus, but at least there's no vuln here.
I don't see a memory consumption issue, unless an image is being referenced, and thus GD goes through a resizing.
Well, I'm not sure about that. The imagecreatefromstring function still needs some amount of memory to load the image. Thus, if someone forces to load multiple large images you may have a problem there.
Indeed. Still something we should fix.
Looking at the patch:
wp_crop_image() can take a ID, so I think we should pass an int and let that function call get_attached_file(). Thoughts?
Rest of the patch looks good.
Replying to nacin:
Looking at the patch:
wp_crop_image() can take a ID, so I think we should pass an int and let that function call get_attached_file(). Thoughts?
It seems okay to me, the proposed patch passes indeed an int to wp_crop_image.

Cast to the appropiate types