GreenSQL

MySQL에 GreenSQL이라는 Database용 Firewall를 두어 SQL Injection Attack을 차단하는 방법입니다.

GreenSQL이라는 것이 꽤 흥미롭군요. 오라클 등에 이와 비슷한 미들웨어 형태가 있긴 합니다만, 보안용이 아니라

쿼리 분석 또는 성능 상승 등의 이유로 사용하는 겁니다. 하지만, GreenSQL은 보안용으로 나왔네요.

Open Source라서 자기의 DB에 맞게 수정, 확장도 가능하겠군요.

MySQL 용이라 조금 아쉽군요...MSSQL Injection Attack은 MSSQL에서 대량으로 발생하는데...

MSSQL용으로 사용할 수 있는 방안을 한번 고려해봐야겠군요..

링크 : http://www.greensql.net/
다운로드 : http://www.greensql.net/public/releases/

-------------------------------------------------------------------------------------------------------------------

About GreenSQL

What is GreenSQL?

GreenSQL is an Open Source database firewall used to protect databases from SQL injection attacks. GreenSQL works as a proxy for SQL commands and has built in support for MySQL. The logic is based on evaluation of SQL commands using a risk scoring matrix as well as blocking known db administrative commands (DROP, CREATE, etc). GreenSQL is distributed under the GPL license.

GreenSQL Architecture

GreenSQL works as a reverse proxy for MySQL connections. It means, that instead of MySQL server, your applications will connect to GreenSQL server. GreenSQL will analyze SQL queries and forward them to the back-end MySQL server.

The following picture describes the whole process.
GreenSQL Architecture

                                                  GreenSQL Architecture


As you can see, GreenSQL calls real database server to execute SQL commands and web application connects to GreenSQL server as if it is a real database server.

GreenSQL can be installed together with database server on the same computer or it can use a distinct server. By default GreenSQL listens on local port 127.0.0.1:3305 redirecting SQL requests to 127.0.0.1:3306 (default MySQL settings). This settings could be altered using GreenSQL Console.

Supported modes

GreenSQL db firewall can be used in a number of ways:

  • Simulation Mode (database IDS)
  • Blocking Suspicious Commands (database IPS)
  • Learning mode
  • Active protection from unknown queries (db firewall)

During the Simulation Mode nothing is basically blocked. In this case GreenSQL works as database IDS system (IDS stands for Intrusion Detection System). During this mode we use our risk scoring matrix engine to find suspicious queries and notify the database administrator using the GreenSQL Management Console.

When the system is configured to Block Suspicious Commands we use our heuristics engine to find "illegal" queries and block them automatically. This is basically database IPS system (IPS is Intrusion Prevention System). If the query is considered illegal - whitelist is checked. If it was found in the whitelist, it will be redirected to genuine MySQL server. If it was found "illegal", an empty result set will be send to application. During this mode, we can sometimes generate false positive and false negative errors. As a result, some legal queries can be blocked or our system can pass "illegal" query undetected. These are pros and cons of the IPS systems. We constantly improve our heuristics engine but it is still not perfect.

In order to address disadvantages of the above methods we recommend to enable Learning Mode and after learning period is over switch to Active protection from unknown queries. During the learning mode all queries are automatically added to the whitelist. When the learning mode is over, we automatically enable active protection. If Active protection from unknown queries is enabled, all unknown commands are blocked. This is basically database firewall mode. When unknown SQL command is detected, it is automatically blocked. In addition we calculate it's risk using our heuristics methods and display the result using GreenSQL Management Console. This is basically the most fastest mode because we calculate risk only for new queries witch will not happen that often.

How GreenSQL finds "illegal" queries?

The GreenSQL finds suspicious queries using a number of methods:

  • Finds administrative and sensitive SQL commands.
  • Calculates risk of the query.

Finds administrative and sensitive SQL commands

GreenSQL uses a pattern matching engine to find commands that are considered "illegal". Basically this is a signature-based subsystem. For example, the following commands will be considered "illegal": database administrative commands; commands that try to change db structure; commands used to access system files. Administrator can also approve "illegal" query by adding it to the whitelist or by altering configuration file with a list of "illegal" patterns.

Calculates risk of the query.

For each query GreenSQL calculates its risk. Basically this is anomaly detection subsystem. After the risk is calculated GreenSQL can block the query or just create a warning message (depends on the application mode). There are a number of heuristics we use when calculating risk. For example:

  • Access to sensitive tables increases risk query (users, accounts, credit information)
  • Comments inside SQL commands increases query risk
  • Usage of an empty password string
  • Found ‘or’ token inside query
  • Found SQL expression that always return true (SQL tautology)
  • Comparison of constant values (SQL tautology)
  • ...

In order to find anomalies GreenSQL uses it's own SQL language lexer to find SQL tokens.

How commands are blocked?

When GreenSQL determines that a query should be blocked it will generate an empty resultset send back to the application so it can continue gracefully.

How Whitelist works?

Each time GreenSQL considers a SQL query as a security risk - it is blocked. You can alter this behavior for a specific query by explicitly adding it to the whitelist.
New: During the Learning mode all new queries are automatically added to the whitelist.
--------------------------------------------------------------------------------------------------------------------

GreenSQL-FW: 0.9.4 released

GreenSQL is a database firewall used to protect database from SQL injection attacks. New release fixes a number of critical bugs. We recommend all users to update.

This release includes a number of pre-build packages of popular operating systems.
We supply packages for: CentOS, openSUSE, Fedora, Ubuntu, Debian.

List of changes:
1. Code optimization.
2. A number of risk matrix calculation bugs were fixed.
3. New MySQL patterns added.
4. Minor management bugs fixes.

Together with the new release, we prepared performance test for the new version. You can access the results online here:
http://www.greensql.net/publications/greensql-performance-test

In addition to greensq-fw application we released new version of greensql-console management tool. New version contains a number bug fixes.

You can get the latest application version here:
http://www.greensql.net/download

Application installation howto:
http://www.greensql.net/howto

For any questions, ideas, and feedback please join our support forum:
http://www.greensql.net/forum/1

Thanks,

Yuli Stremovsy
GreenSQL project admin


이글루스 가든 - professional secur...

by ZIZI | 2008/10/30 09:12 | Hacking&Security | 트랙백(1) | 덧글(1)

Tracked from 좋은진호의 여유만만 at 2008/12/13 00:14

제목 : MySQL 인젝션 공격 방어하는 GreenSQL
GreenSQL( http://www.greensql.net/ )은 MySQL에 대한 SQL 인젝션(Injection) 공격을 방어하는 프락시 개념의 어플리케이션이다. 웹페이지를 호출하면 DB쿼리는 먼저 GreenSQL 로 넘어겨지고, 검사한 후 정상적이면 MySQL 서버로 요청하는 과정을 거친다. GreenSQL을 설치하고 실행과정은 이렇다. MySQL 서버는 기존 그대로 실행(디폴트 3306 포트)하고, GreenSQL을 3305포트로 실행......more

Commented by hkpco at 2008/10/30 11:44
Cool~!
저번에 봤을땐 그냥 넘어갔는데.. 다시 보니까 괜찮네요 ㅎㅎ
굿!!,
※ 로그인 사용자만 덧글을 남길 수 있습니다.

◀ 이전 페이지다음 페이지 ▶