반응형


오랫만에 글을 올리는거 같네요.. 컨퍼런스 정보와 함께 포스트를 쉽게 하나 올립니다.

별다른 작업없이 그냥 긁어서 올리네요.. ^^;;

요즘은 다른 프로젝트에 지원을 나와서 머얼리~~ 있어서 집에도 못가고 지인의 집에서 민폐를...

주말에 시간이 날지 모르지만 컨퍼런스 참가하고 싶군요..ㅋㅋ

득템~! 득템~! +_+   무엇보다 득템에 강한 의지를 불태우는 저입니다. ㅋ

전에 컨퍼런스에서 디자인패턴 책을 득템한 친구와 협상에 성공 하였습니다.

썬에서 테크블로거에게 주는 노트북 받침대와 교환하였습니다.

저에게는 잘만 놋북 받침대가 2개나 있어서 썬로고가 새겨진 받침대와 눈물의 결별을..

비닐조차 뜯어주지 못한 이 주인을 야속하게 생각하지마라!! 라는 외침과 협상 극적 타결!! ^^

나중에 어떤 책인지 책 서평과 함께 올리도록 하겠습니다. 지금 집이 아닌곳에 한달여간 머물게 되서..
반응형

ABSTRACT

Constructing a dynamic SQL statement with user input could allow an attacker to modify the statement's meaning or to execute arbitrary SQL commands.

EXPLANATION

SQL injection errors occur when:

1. Data enters a program from an untrusted source.

2. The data is used to dynamically construct a SQL query.



iBatis Data Maps allow you to specify dynamic parameters in SQL statements and are typically defined by using the # characters, like this:


<select id="getItems" parameterClass="MyClass" resultClass="items">
SELECT * FROM items WHERE owner = #userName#
</select>


The # characters around the variable name indicate that iBatis will create a parameterized query with the userName variable. However, iBatis also allows you to concatentate variables directly to SQL statements using $ characters, opening the door for SQL injection.

Example 1: The following code dynamically constructs and executes a SQL query that searches for items matching a specified name. The query restricts the items displayed to those where the owner matches the user name of the currently-authenticated user.


<select id="getItems" parameterClass="MyClass" resultClass="items">
SELECT * FROM items WHERE owner = #userName# AND itemname = '$itemName$'
</select>


However, because the query is constructed dynamically by concatenating a constant base query string and a user input string, the query only behaves correctly if itemName does not contain a single-quote character. If an attacker with the user name wiley enters the string "name' OR 'a'='a" for itemName, then the query becomes the following:


SELECT * FROM items
WHERE owner = 'wiley'
AND itemname = 'name' OR 'a'='a';


The addition of the OR 'a'='a' condition causes the where clause to always evaluate to true, so the query becomes logically equivalent to the much simpler query:


SELECT * FROM items;


This simplification of the query allows the attacker to bypass the requirement that the query only return items owned by the authenticated user; the query now returns all entries stored in the items table, regardless of their specified owner.

Example 2: This example examines the effects of a different malicious value passed to the query constructed and executed in Example 1. If an attacker with the user name wiley enters the string "name'; DELETE FROM items; --" for itemName, then the query becomes the following two queries:


SELECT * FROM items
WHERE owner = 'wiley'
AND itemname = 'name';

DELETE FROM items;

--'


Many database servers, including Microsoft(R) SQL Server 2000, allow multiple SQL statements separated by semicolons to be executed at once. While this attack string results in an error on Oracle and other database servers that do not allow the batch-execution of statements separated by semicolons, on databases that do allow batch execution, this type of attack allows the attacker to execute arbitrary commands against the database.

Notice the trailing pair of hyphens (--), which specifies to most database servers that the remainder of the statement is to be treated as a comment and not executed [4]. In this case the comment character serves to remove the trailing single-quote left over from the modified query. On a database where comments are not allowed to be used in this way, the general attack could still be made effective using a trick similar to the one shown in Example 1. If an attacker enters the string "name'); DELETE FROM items; SELECT * FROM items WHERE 'a'='a", the following three valid statements will be created:


SELECT * FROM items
WHERE owner = 'wiley'
AND itemname = 'name';

DELETE FROM items;

SELECT * FROM items WHERE 'a'='a';


One traditional approach to preventing SQL injection attacks is to handle them as an input validation problem and either accept only characters from a whitelist of safe values or identify and escape a blacklist of potentially malicious values. Whitelisting can be a very effective means of enforcing strict input validation rules, but parameterized SQL statements require less maintenance and can offer more guarantees with respect to security. As is almost always the case, blacklisting is riddled with loopholes that make it ineffective at preventing SQL injection attacks. For example, attackers can:

- Target fields that are not quoted

- Find ways to bypass the need for certain escaped meta-characters

- Use stored procedures to hide the injected meta-characters

Manually escaping characters in input to SQL queries can help, but it will not make your application secure from SQL injection attacks.

Another solution commonly proposed for dealing with SQL injection attacks is to use stored procedures. Although stored procedures prevent some types of SQL injection attacks, they fail to protect against many others. Stored procedures typically help prevent SQL injection attacks by limiting the types of statements that can be passed to their parameters. However, there are many ways around the limitations and many interesting statements that can still be passed to stored procedures. Again, stored procedures can prevent some exploits, but they will not make your application secure against SQL injection attacks.

< 출처: http://www.fortify.com/vulncat/en/vulncat/java/sql_injection_ibatis_data_map.html >

현재 참여하고 있는 프로젝트에서 IBATIS 프레임워크를 사용하고 있습니다.

우연히 IBATIS SQL Injection에 대한 자료가 있길래 흥미롭게 읽다가 이렇게 블로그에 옮겨 봅니다.

참고로 영문 자료로 되어있지만 어렵지 않게 이해할수 있기때문에 기타 설명은 달지 않겠습니다.

짧은 영어실력이고 ㅡㅡ; 정리해서 올릴 시간적 여건이 안되기에..(핑계입니다. ㅠㅠ)

담에 시간날때 다시 보고 정리해야 겠습니다.
반응형

격동의 60년 후반과 70년대 초, 일본에서 극화풍의 스포츠 만화가 전성기를 대표하는 작품 중 하나인 원작 만화(1968년 1월, 소년매거진)를 후지 텔레비젼(방영: 1970.4.1~1971.9.29)에서 총 79편으로 구성된 시리즈로 제작된 작품. 한국에서는 70년대 후반 <도전자 허리케인>이라는 제목으로 번역되어 나왔고, TV 애니메이션으로도 방영되어 인기를 모았던 고전이다. 1980년에는 극장 애니메이션 붐으로 인해 극장판으로 편집되어 개봉되기도 했으며, 이듬해에는 속편이 다시 TV 시리즈로 방영되었다.(1980.10.13~1981.8.31) 속편도 극장 애니메이션으로 제작되기도 했다.

내가 좋아하고 모토로 삼는 말이 "내 남자의 길!" 이다. 뭐 블로그에서 이글을 보는 분들도 쉽사리 알겠지만..

많은 사람들이 "내 남자의 길"은 여자가 해야 하는 말이 아니냐고 물어본다.

그때마다 나는 "나의 남자의 길" 이라고 말을 한다. 약간의 사투리가 섞여 있다고 말하곤 한다.

인생을 살면서 다들 한번쯤은 방황기를 거칠것이다. 그 시기가 청소년기 뿐만은 아닐것이다.

나또한 여러가지 일들을 겪으면서 방황도 하고 좌절도 많이 했다고 생각한다.

그때 무엇인가 나를 지탱해줄 무엇인가가 필요했다. 그리고 "내 남자의 길"을 목표로 삼았고

지금까지 8년여동안 잘 지켜왔다고 생각한다.  그리고 또 한가지 "내 남자의 열정"을 선포하려 한다.

거창하게 선포까지 할것까지야.. 라고 생각할수도 있지만 이렇게 글로써 남기는데 큰 의의가 있다.

새로운 한해가 될때마다 "내 남자의 길"에 올해의 목표를 추가하였었다.

다시 "내 남자의 열정" 이란 말을 추가 하는 이유는 나의 20대의 열정을 불태우기 위함이다.

위에 이미지와 그 이미지에 글귀는 내가 청소년기때부터 무척 좋아했던 이미지와 글귀이다.
(내일의 죠, 도전자 죠 등의로 참 감동깊게 봤었던 만화였다. 가슴져리도록...)

그리고 "타다만 하얀 담배 잿가루 같이 살긴 싫어!"라고 말하곤 했었다.

현재 나는 머리속에 많은 혼란들로 가득차 있다. 그 혼란들은 여러가지지만 정리가 안된다.

그러한 이유로 나를 지탱해줄 무엇인가가 필요하다고 생각했고 생각해 낸것이 "내 남자의 열정"이다.

한번뿐인 인생이라면 나를 위해 미친듯 살고 싶다!! 그리고 나의 모든 것을 불태우고 사그러질정도로..

이것저것 무작정 글을 쓰고 싶다. 내 이야기가 하고 싶다. 나의 모든것을 내뱉어 내고 싶다.

푸념을 섞어 본다면 20대 후반의 나이에 (아직 젊다.^^) 하고 싶은 것도 많아졌고

나의 가능성에 모든걸 걸어보고 싶기도 하고 모든걸 내던지고 아무것도 없이 시작하고 싶기도 하다.

내가 나를 시험해보고 싶다. 나는 어느정도의 남자인지.. 내 인생은 얼마만큼의 가치를 갖는지..

내가 이 세상에서 얼마만큼 무엇인가를 해낼수 있는지.. 차마 다 글로 뱉어내지 못할 많은 것들이 있다.

조금이나마 무작정 휘갈겨쓰고 뱉어내고 질러내고 싶었다..  나의 작은 공간안에서...

+ Recent posts