Vulnerabilities > CVE-2012-0805 - SQL Injection vulnerability in Sqlalchemy

047910
CVSS 7.5 - HIGH
Attack vector
NETWORK
Attack complexity
LOW
Privileges required
NONE
Confidentiality impact
PARTIAL
Integrity impact
PARTIAL
Availability impact
PARTIAL
network
low complexity
sqlalchemy
CWE-89
nessus

Summary

Multiple SQL injection vulnerabilities in SQLAlchemy before 0.7.0b4, as used in Keystone, allow remote attackers to execute arbitrary SQL commands via the (1) limit or (2) offset keyword to the select function, or unspecified vectors to the (3) select.limit or (4) select.offset function.

Common Attack Pattern Enumeration and Classification (CAPEC)

  • Command Line Execution through SQL Injection
    An attacker uses standard SQL injection methods to inject data into the command line for execution. This could be done directly through misuse of directives such as MSSQL_xp_cmdshell or indirectly through injection of data into the database that would be interpreted as shell commands. Sometime later, an unscrupulous backend application (or could be part of the functionality of the same application) fetches the injected data stored in the database and uses this data as command line arguments without performing proper validation. The malicious data escapes that data plane by spawning new commands to be executed on the host.
  • Object Relational Mapping Injection
    An attacker leverages a weakness present in the database access layer code generated with an Object Relational Mapping (ORM) tool or a weakness in the way that a developer used a persistence framework to inject his or her own SQL commands to be executed against the underlying database. The attack here is similar to plain SQL injection, except that the application does not use JDBC to directly talk to the database, but instead it uses a data access layer generated by an ORM tool or framework (e.g. Hibernate). While most of the time code generated by an ORM tool contains safe access methods that are immune to SQL injection, sometimes either due to some weakness in the generated code or due to the fact that the developer failed to use the generated access methods properly, SQL injection is still possible.
  • SQL Injection through SOAP Parameter Tampering
    An attacker modifies the parameters of the SOAP message that is sent from the service consumer to the service provider to initiate a SQL injection attack. On the service provider side, the SOAP message is parsed and parameters are not properly validated before being used to access a database in a way that does not use parameter binding, thus enabling the attacker to control the structure of the executed SQL query. This pattern describes a SQL injection attack with the delivery mechanism being a SOAP message.
  • Expanding Control over the Operating System from the Database
    An attacker is able to leverage access gained to the database to read / write data to the file system, compromise the operating system, create a tunnel for accessing the host machine, and use this access to potentially attack other machines on the same network as the database machine. Traditionally SQL injections attacks are viewed as a way to gain unauthorized read access to the data stored in the database, modify the data in the database, delete the data, etc. However, almost every data base management system (DBMS) system includes facilities that if compromised allow an attacker complete access to the file system, operating system, and full access to the host running the database. The attacker can then use this privileged access to launch subsequent attacks. These facilities include dropping into a command shell, creating user defined functions that can call system level libraries present on the host machine, stored procedures, etc.
  • SQL Injection
    This attack exploits target software that constructs SQL statements based on user input. An attacker crafts input strings so that when the target software constructs SQL statements based on the input, the resulting SQL statement performs actions other than those the application intended. SQL Injection results from failure of the application to appropriately validate input. When specially crafted user-controlled input consisting of SQL syntax is used without proper validation as part of SQL queries, it is possible to glean information from the database in ways not envisaged during application design. Depending upon the database and the design of the application, it may also be possible to leverage injection to have the database execute system-related commands of the attackers' choice. SQL Injection enables an attacker to talk directly to the database, thus bypassing the application completely. Successful injection can cause information disclosure as well as ability to add or modify data in the database. In order to successfully inject SQL and retrieve information from a database, an attacker:

Nessus

  • NASL familyFedora Local Security Checks
    NASL idFEDORA_2012-3414.NASL
    description - Fix the sqlalchemy0.5 backwards and forwards compat packages for a security problem with limit. Note that Tenable Network Security has extracted the preceding description block directly from the Fedora security advisory. Tenable has attempted to automatically clean and format it as much as possible without introducing additional issues.
    last seen2020-03-17
    modified2012-04-02
    plugin id58543
    published2012-04-02
    reporterThis script is Copyright (C) 2012-2020 and is owned by Tenable, Inc. or an Affiliate thereof.
    sourcehttps://www.tenable.com/plugins/nessus/58543
    titleFedora 15 : python-sqlalchemy0.5-0.5.8-9.fc15 (2012-3414)
  • NASL familyGentoo Local Security Checks
    NASL idGENTOO_GLSA-201209-16.NASL
    descriptionThe remote host is affected by the vulnerability described in GLSA-201209-16 (SQLAlchemy: SQL injection) SQLAlchemy does not properly sanitize input passed from the “limit” and “offset” keywords to the select() function before using it in an SQL query. Impact : A remote attacker could exploit this vulnerability to execute arbitrary SQL statements. Workaround : There is no known workaround at this time.
    last seen2020-06-01
    modified2020-06-02
    plugin id62345
    published2012-09-27
    reporterThis script is Copyright (C) 2012-2018 Tenable Network Security, Inc.
    sourcehttps://www.tenable.com/plugins/nessus/62345
    titleGLSA-201209-16 : SQLAlchemy: SQL injection
  • NASL familyOracle Linux Local Security Checks
    NASL idORACLELINUX_ELSA-2012-0369.NASL
    descriptionFrom Red Hat Security Advisory 2012:0369 : An updated python-sqlalchemy package that fixes one security issue is now available for Red Hat Enterprise Linux 6. The Red Hat Security Response Team has rated this update as having moderate security impact. A Common Vulnerability Scoring System (CVSS) base score, which gives a detailed severity rating, is available from the CVE link in the References section. SQLAlchemy is an Object Relational Mapper (ORM) that provides a flexible, high-level interface to SQL databases. It was discovered that SQLAlchemy did not sanitize values for the limit and offset keywords for SQL select statements. If an application using SQLAlchemy accepted values for these keywords, and did not filter or sanitize them before passing them to SQLAlchemy, it could allow an attacker to perform a SQL injection attack against the application. (CVE-2012-0805) All users of python-sqlalchemy are advised to upgrade to this updated package, which contains a patch to correct this issue. All running applications using SQLAlchemy must be restarted for this update to take effect.
    last seen2020-06-01
    modified2020-06-02
    plugin id68492
    published2013-07-12
    reporterThis script is Copyright (C) 2013-2019 and is owned by Tenable, Inc. or an Affiliate thereof.
    sourcehttps://www.tenable.com/plugins/nessus/68492
    titleOracle Linux 6 : python-sqlalchemy (ELSA-2012-0369)
  • NASL familyRed Hat Local Security Checks
    NASL idREDHAT-RHSA-2012-0369.NASL
    descriptionAn updated python-sqlalchemy package that fixes one security issue is now available for Red Hat Enterprise Linux 6. The Red Hat Security Response Team has rated this update as having moderate security impact. A Common Vulnerability Scoring System (CVSS) base score, which gives a detailed severity rating, is available from the CVE link in the References section. SQLAlchemy is an Object Relational Mapper (ORM) that provides a flexible, high-level interface to SQL databases. It was discovered that SQLAlchemy did not sanitize values for the limit and offset keywords for SQL select statements. If an application using SQLAlchemy accepted values for these keywords, and did not filter or sanitize them before passing them to SQLAlchemy, it could allow an attacker to perform a SQL injection attack against the application. (CVE-2012-0805) All users of python-sqlalchemy are advised to upgrade to this updated package, which contains a patch to correct this issue. All running applications using SQLAlchemy must be restarted for this update to take effect.
    last seen2020-04-16
    modified2012-03-08
    plugin id58284
    published2012-03-08
    reporterThis script is Copyright (C) 2012-2020 and is owned by Tenable, Inc. or an Affiliate thereof.
    sourcehttps://www.tenable.com/plugins/nessus/58284
    titleRHEL 6 : python-sqlalchemy (RHSA-2012:0369)
  • NASL familyScientific Linux Local Security Checks
    NASL idSL_20120307_PYTHON_SQLALCHEMY_ON_SL6.NASL
    descriptionSQLAlchemy is an Object Relational Mapper (ORM) that provides a flexible, high-level interface to SQL databases. It was discovered that SQLAlchemy did not sanitize values for the limit and offset keywords for SQL select statements. If an application using SQLAlchemy accepted values for these keywords, and did not filter or sanitize them before passing them to SQLAlchemy, it could allow an attacker to perform a SQL injection attack against the application. (CVE-2012-0805) All users of python-sqlalchemy are advised to upgrade to this updated package, which contains a patch to correct this issue. All running applications using SQLAlchemy must be restarted for this update to take effect.
    last seen2020-03-18
    modified2012-08-01
    plugin id61278
    published2012-08-01
    reporterThis script is Copyright (C) 2012-2020 and is owned by Tenable, Inc. or an Affiliate thereof.
    sourcehttps://www.tenable.com/plugins/nessus/61278
    titleScientific Linux Security Update : python-sqlalchemy on SL6.x (20120307)
  • NASL familyFedora Local Security Checks
    NASL idFEDORA_2012-3412.NASL
    description - Fix the sqlalchemy0.5 backwards and forwards compat packages for a security problem with limit. Note that Tenable Network Security has extracted the preceding description block directly from the Fedora security advisory. Tenable has attempted to automatically clean and format it as much as possible without introducing additional issues.
    last seen2020-03-17
    modified2012-04-02
    plugin id58542
    published2012-04-02
    reporterThis script is Copyright (C) 2012-2020 and is owned by Tenable, Inc. or an Affiliate thereof.
    sourcehttps://www.tenable.com/plugins/nessus/58542
    titleFedora 16 : python-sqlalchemy0.5-0.5.8-9.fc16 (2012-3412)
  • NASL familyFedora Local Security Checks
    NASL idFEDORA_2012-3373.NASL
    description - Fix the sqlalchemy0.5 backwards and forwards compat packages for a security problem with limit. Note that Tenable Network Security has extracted the preceding description block directly from the Fedora security advisory. Tenable has attempted to automatically clean and format it as much as possible without introducing additional issues.
    last seen2020-03-17
    modified2012-04-12
    plugin id58687
    published2012-04-12
    reporterThis script is Copyright (C) 2012-2020 and is owned by Tenable, Inc. or an Affiliate thereof.
    sourcehttps://www.tenable.com/plugins/nessus/58687
    titleFedora 17 : python-sqlalchemy0.5-0.5.8-9.fc17 (2012-3373)
  • NASL familyMandriva Local Security Checks
    NASL idMANDRIVA_MDVSA-2012-059.NASL
    descriptionIt was discovered that SQLAlchemy did not sanitize values for the limit and offset keywords for SQL select statements. If an application using SQLAlchemy accepted values for these keywords, and did not filter or sanitize them before passing them to SQLAlchemy, it could allow an attacker to perform a SQL injection attack against the application (CVE-2012-0805). The updated packages have been patched to correct this issue.
    last seen2020-06-01
    modified2020-06-02
    plugin id61949
    published2012-09-06
    reporterThis script is Copyright (C) 2012-2019 and is owned by Tenable, Inc. or an Affiliate thereof.
    sourcehttps://www.tenable.com/plugins/nessus/61949
    titleMandriva Linux Security Advisory : python-sqlalchemy (MDVSA-2012:059)
  • NASL familyCentOS Local Security Checks
    NASL idCENTOS_RHSA-2012-0369.NASL
    descriptionAn updated python-sqlalchemy package that fixes one security issue is now available for Red Hat Enterprise Linux 6. The Red Hat Security Response Team has rated this update as having moderate security impact. A Common Vulnerability Scoring System (CVSS) base score, which gives a detailed severity rating, is available from the CVE link in the References section. SQLAlchemy is an Object Relational Mapper (ORM) that provides a flexible, high-level interface to SQL databases. It was discovered that SQLAlchemy did not sanitize values for the limit and offset keywords for SQL select statements. If an application using SQLAlchemy accepted values for these keywords, and did not filter or sanitize them before passing them to SQLAlchemy, it could allow an attacker to perform a SQL injection attack against the application. (CVE-2012-0805) All users of python-sqlalchemy are advised to upgrade to this updated package, which contains a patch to correct this issue. All running applications using SQLAlchemy must be restarted for this update to take effect.
    last seen2020-06-01
    modified2020-06-02
    plugin id58276
    published2012-03-08
    reporterThis script is Copyright (C) 2012-2020 and is owned by Tenable, Inc. or an Affiliate thereof.
    sourcehttps://www.tenable.com/plugins/nessus/58276
    titleCentOS 6 : python-sqlalchemy (CESA-2012:0369)
  • NASL familyDebian Local Security Checks
    NASL idDEBIAN_DSA-2449.NASL
    descriptionIt was discovered that SQLAlchemy, a SQL toolkit and object relational mapper for Python, is not sanitizing input passed to the limit/offset keywords to select() as well as the value passed to select.limit()/offset(). This allows an attacker to perform SQL injection attacks against applications using SQLAlchemy that do not implement their own filtering.
    last seen2020-03-17
    modified2012-04-13
    plugin id58728
    published2012-04-13
    reporterThis script is Copyright (C) 2012-2020 and is owned by Tenable, Inc. or an Affiliate thereof.
    sourcehttps://www.tenable.com/plugins/nessus/58728
    titleDebian DSA-2449-1 : sqlalchemy - missing input sanitization

Redhat

advisories
bugzilla
id783305
titleCVE-2012-0805 python-sqlalchemy: SQL injection flaw due to not checking LIMIT input for correct type
oval
OR
  • commentRed Hat Enterprise Linux must be installed
    ovaloval:com.redhat.rhba:tst:20070304026
  • AND
    • commentRed Hat Enterprise Linux 6 is installed
      ovaloval:com.redhat.rhba:tst:20111656003
    • commentpython-sqlalchemy is earlier than 0:0.5.5-3.el6_2
      ovaloval:com.redhat.rhsa:tst:20120369001
    • commentpython-sqlalchemy is signed with Red Hat redhatrelease2 key
      ovaloval:com.redhat.rhsa:tst:20120369002
rhsa
idRHSA-2012:0369
released2012-03-07
severityModerate
titleRHSA-2012:0369: python-sqlalchemy security update (Moderate)
rpmspython-sqlalchemy-0:0.5.5-3.el6_2

Seebug

bulletinFamilyexploit
descriptionBugtraq ID: 52330 CVE ID: CVE-2012-0805 SQLAlchemy是一个Python的SQL工具包以及数据库对象映射框架 通过"limit"和"offset"关键词传递给"select()"函数的输入在用于SQL查询之前缺少过滤,攻击者可以利用漏洞进行SQL注入攻击,可获得敏感信息或操作数据库 0 SQLAlchemy 0.7.0 SQLAlchemy 0.6.8 SQLAlchemy 0.6.7 厂商解决方案 SQLAlchemy 0.7.0b已经修复此漏洞,建议用户下载使用: http://www.sqlalchemy.org/
idSSV:30184
last seen2017-11-19
modified2012-03-10
published2012-03-10
reporterRoot
titleSQLAlchemy 'limit'和'offset'参数SQL注入漏洞