VYPR
High severityNVD Advisory· Published Jul 31, 2012· Updated Apr 29, 2026

CVE-2012-3444

CVE-2012-3444

Description

The get_image_dimensions function in the image-handling functionality in Django before 1.3.2 and 1.4.x before 1.4.1 uses a constant chunk size in all attempts to determine dimensions, which allows remote attackers to cause a denial of service (process or thread consumption) via a large TIFF image.

Affected packages

Versions sourced from the GitHub Security Advisory.

PackageAffected versionsPatched versions
DjangoPyPI
< 1.3.21.3.2
DjangoPyPI
>= 1.4, < 1.4.11.4.1

Affected products

29
  • cpe:2.3:a:djangoproject:django:*:*:*:*:*:*:*:*+ 28 more
    • cpe:2.3:a:djangoproject:django:*:*:*:*:*:*:*:*range: <=1.3
    • cpe:2.3:a:djangoproject:django:0.95:*:*:*:*:*:*:*
    • cpe:2.3:a:djangoproject:django:0.96:*:*:*:*:*:*:*
    • cpe:2.3:a:djangoproject:django:1.0:*:*:*:*:*:*:*
    • cpe:2.3:a:djangoproject:django:1.0.1:*:*:*:*:*:*:*
    • cpe:2.3:a:djangoproject:django:1.0.2:*:*:*:*:*:*:*
    • cpe:2.3:a:djangoproject:django:1.0:alpha1:*:*:*:*:*:*
    • cpe:2.3:a:djangoproject:django:1.0:alpha2:*:*:*:*:*:*
    • cpe:2.3:a:djangoproject:django:1.0:beta:*:*:*:*:*:*
    • cpe:2.3:a:djangoproject:django:1.0:beta2:*:*:*:*:*:*
    • cpe:2.3:a:djangoproject:django:1.1:*:*:*:*:*:*:*
    • cpe:2.3:a:djangoproject:django:1.1.2:*:*:*:*:*:*:*
    • cpe:2.3:a:djangoproject:django:1.1.3:*:*:*:*:*:*:*
    • cpe:2.3:a:djangoproject:django:1.1.4:*:*:*:*:*:*:*
    • cpe:2.3:a:djangoproject:django:1.1:alpha1:*:*:*:*:*:*
    • cpe:2.3:a:djangoproject:django:1.1:beta1:*:*:*:*:*:*
    • cpe:2.3:a:djangoproject:django:1.1:rc1:*:*:*:*:*:*
    • cpe:2.3:a:djangoproject:django:1.2:*:*:*:*:*:*:*
    • cpe:2.3:a:djangoproject:django:1.2.2:*:*:*:*:*:*:*
    • cpe:2.3:a:djangoproject:django:1.2.4:*:*:*:*:*:*:*
    • cpe:2.3:a:djangoproject:django:1.2.5:*:*:*:*:*:*:*
    • cpe:2.3:a:djangoproject:django:1.2.6:*:*:*:*:*:*:*
    • cpe:2.3:a:djangoproject:django:1.2.7:*:*:*:*:*:*:*
    • cpe:2.3:a:djangoproject:django:1.2-alpha1:*:*:*:*:*:*:*
    • cpe:2.3:a:djangoproject:django:1.2:beta1:*:*:*:*:*:*
    • cpe:2.3:a:djangoproject:django:1.2:rc1:*:*:*:*:*:*
    • cpe:2.3:a:djangoproject:django:1.3:alpha1:*:*:*:*:*:*
    • cpe:2.3:a:djangoproject:django:1.3:beta1:*:*:*:*:*:*
    • cpe:2.3:a:djangoproject:django:1.4:*:*:*:*:*:*:*

Patches

5
c14f325c4eef

[1.4.x] Fixed second security issue in image uploading. Disclosure and release forthcoming.

https://github.com/django/djangoFlorian ApollonerJul 30, 2012via ghsa
1 file changed · +4 14
  • django/forms/fields.py+4 14 modified
    @@ -570,20 +570,10 @@ def to_python(self, data):
                     file = StringIO(data['content'])
     
             try:
    -            # load() is the only method that can spot a truncated JPEG,
    -            #  but it cannot be called sanely after verify()
    -            trial_image = Image.open(file)
    -            trial_image.load()
    -
    -            # Since we're about to use the file again we have to reset the
    -            # file object if possible.
    -            if hasattr(file, 'reset'):
    -                file.reset()
    -
    -            # verify() is the only method that can spot a corrupt PNG,
    -            #  but it must be called immediately after the constructor
    -            trial_image = Image.open(file)
    -            trial_image.verify()
    +            # load() could spot a truncated JPEG, but it loads the entire
    +            # image in memory, which is a DoS vector. See #3848 and #18520.
    +            # verify() must be called immediately after the constructor.
    +            Image.open(file).verify()
             except ImportError:
                 # Under PyPy, it is possible to import PIL. However, the underlying
                 # _imaging C module isn't available, so an ImportError will be
    
b2eb4787a0ff

[1.3.x] Fixed second security issue in image uploading. Disclosure and release forthcoming.

https://github.com/django/djangoFlorian ApollonerJul 30, 2012via ghsa
1 file changed · +4 14
  • django/forms/fields.py+4 14 modified
    @@ -538,20 +538,10 @@ def to_python(self, data):
                     file = StringIO(data['content'])
     
             try:
    -            # load() is the only method that can spot a truncated JPEG,
    -            #  but it cannot be called sanely after verify()
    -            trial_image = Image.open(file)
    -            trial_image.load()
    -
    -            # Since we're about to use the file again we have to reset the
    -            # file object if possible.
    -            if hasattr(file, 'reset'):
    -                file.reset()
    -
    -            # verify() is the only method that can spot a corrupt PNG,
    -            #  but it must be called immediately after the constructor
    -            trial_image = Image.open(file)
    -            trial_image.verify()
    +            # load() could spot a truncated JPEG, but it loads the entire
    +            # image in memory, which is a DoS vector. See #3848 and #18520.
    +            # verify() must be called immediately after the constructor.
    +            Image.open(file).verify()
             except ImportError:
                 # Under PyPy, it is possible to import PIL. However, the underlying
                 # _imaging C module isn't available, so an ImportError will be
    
da33d67181b5

[1.4.x] Fixed a security issue in image uploading. Disclosure and release forthcoming.

https://github.com/django/djangoFlorian ApollonerJul 30, 2012via ghsa
1 file changed · +6 1
  • django/core/files/images.py+6 1 modified
    @@ -47,13 +47,18 @@ def get_image_dimensions(file_or_path, close=False):
             file = open(file_or_path, 'rb')
             close = True
         try:
    +        # Most of the time PIL only needs a small chunk to parse the image and
    +        # get the dimensions, but with some TIFF files PIL needs to parse the
    +        # whole file.
    +        chunk_size = 1024
             while 1:
    -            data = file.read(1024)
    +            data = file.read(chunk_size)
                 if not data:
                     break
                 p.feed(data)
                 if p.image:
                     return p.image.size
    +            chunk_size = chunk_size*2
             return None
         finally:
             if close:
    
9ca0ff6268ee

[1.3.x] Fixed a security issue in image uploading. Disclosure and release forthcoming.

https://github.com/django/djangoFlorian ApollonerJul 30, 2012via ghsa
1 file changed · +6 1
  • django/core/files/images.py+6 1 modified
    @@ -47,13 +47,18 @@ def get_image_dimensions(file_or_path, close=False):
             file = open(file_or_path, 'rb')
             close = True
         try:
    +        # Most of the time PIL only needs a small chunk to parse the image and
    +        # get the dimensions, but with some TIFF files PIL needs to parse the
    +        # whole file.
    +        chunk_size = 1024
             while 1:
    -            data = file.read(1024)
    +            data = file.read(chunk_size)
                 if not data:
                     break
                 p.feed(data)
                 if p.image:
                     return p.image.size
    +            chunk_size = chunk_size*2
             return None
         finally:
             if close:
    
dd16b17099b7

Fixed a security issue in image uploading. Disclosure and release forthcoming.

https://github.com/django/djangoFlorian ApollonerJul 30, 2012via ghsa
1 file changed · +6 1
  • django/core/files/images.py+6 1 modified
    @@ -47,13 +47,18 @@ def get_image_dimensions(file_or_path, close=False):
             file = open(file_or_path, 'rb')
             close = True
         try:
    +        # Most of the time PIL only needs a small chunk to parse the image and
    +        # get the dimensions, but with some TIFF files PIL needs to parse the
    +        # whole file.
    +        chunk_size = 1024
             while 1:
    -            data = file.read(1024)
    +            data = file.read(chunk_size)
                 if not data:
                     break
                 p.feed(data)
                 if p.image:
                     return p.image.size
    +            chunk_size = chunk_size*2
             return None
         finally:
             if close:
    

Vulnerability mechanics

Generated by null/stub on May 9, 2026. Inputs: CWE entries + fix-commit diffs from this CVE's patches. Citations validated against bundle.

References

15

News mentions

0

No linked articles in our index yet.