IP Library › Granted Patent US 9,219,742
Granted Patent B2
US 9,219,742 · App. 14/014,819 · Granted Dec 22, 2015

Transforming user-input data in scripting language

Inventors: Wei-Hsiang Hsiung (Taipei, TW); Cheng-Ta Lee (Taipei, TW); Wei-Shiau Suen (Taipei, TW); Rick M F Wu (Taipei, TW)
Assignee: International Business Machines Corporation
H04L63/14G06F21/6227H04L29/06G06F2221/031
View Patent ↗
Loading inventors, assignments & file history…
Monitor This Case
Get email alerts when status or documents change.
Order Certified Copies
Most orders are placed with the USPTO same day — all within 24 business hours.
Order via The Patent Place →
Pre-filled with this patent's details
Quick Facts
Patent No.
US 9,219,742
App. No.
14/014,819
Granted
Dec 22, 2015
Kind
B2
Abstract

A mechanism for preventing injection attacks of scripting languages is provided. There is a mechanism of transforming user-input data in a scripting language included. The mechanism comprises a step of tracing a script instruction to separate instruction related variables and user-input related variables; and a step of encoding the user-input related variables into data belonging to safe-character-set area which do not include reserved character, and passing the encoded user-input related variables to a statement of the script instruction.

Claims (31)

1. A method in a data processing system for transforming user input data in a scripting language, the method comprising:

tracing, by an interpreter module in a web server executing within the data processing system, a script instruction to separate instruction related variables and user-input related variables;

encoding by the interpreter module, user-input related variables in the instruction into data belonging to a safe-character-set area not including reserved characters of the scripting language, and passing the encoded user-input related variables to a statement of the script instruction to form an encoded script instruction; and

providing, by the web server the encoded script instruction to a script server;

wherein the script server retrieves all text tokens in the encoded script instruction, checks and determines whether each text token is encoded, decodes each encoded text token and returns a decoded text token in response to an affirmative determination, returns any unencoded text tokens in response to a negative determination, creates a syntax tree of the instruction based on the returned text tokens, and executes the syntax tree of the instruction.

2. The method of claim 1 , wherein the scripting language is a structured query language (SQL), and the script instruction is an SQL instruction.

3. The method of claim 1 , wherein encoding the user-input related variables further comprise placing a magic string in front of the user-input variables to enable retrospective operation.

4. The method of claim 1 , wherein the encoding is performed by Base64 or DES encoding.

5. A computer program product stored on a non-transitory computer-accessible medium, comprising a computer readable program, and, when executed on a computer, causes the computer to;

trace, by an interpreter module in a web server executing within the data processing system, a script instruction to separate instruction related variables and user input related variables;

encode, by interpreter module, user-input related variables in the instruction into data belonging to a safe-character-set area not including reserved characters of the scripting language, and pass the encoded user-input related variables to a statement of the script instruction to form an encoded script instruction; and

provide by the web server the encoded script instruction to a script server;

wherein the script server retrieves all text tokens in the encoded script instruction, checks and determines whether each text token is encoded, decodes each encoded text token and returns a decoded text token in response to an affirmative determination, returns any unencoded text tokens in response to a negative determination, creates a syntax tree of the instruction based on the returned text tokens, and executes the syntax tree of the instruction.

6. A computer system for transforming user-input data in a scripting language, the computer system comprising:

a host, comprising:

a bus system;

a memory connected to the bus system; wherein the memory comprises an instruction; and

a processing unit connected to the bus system, wherein the processing unit executes the instruction to:

trace, by an interpreter module in a web server executing within the data processing system, a script instruction to separate instruction related variables and user-input related variables;

encode, by interpreter module, user-input related variables in the instruction into data belonging to a safe- character-set area not including reserved characters of the scripting language, and pass the encoded user-input related variables to a statement of the script instruction to form an encoded script instruction; and

provide, by the web server the encoded script instruction to a script server;

wherein the script server retrieves all text tokens in the encoded script instruction, checks and determines whether each text token is encoded, decodes each encoded text token and returns a decoded text token in response to an affirmative determination, returns any unencoded text tokens in response to a negative determination, creates a syntax tree of the instruction based on the returned text tokens, and executes the syntax tree of the instruction.

7. The method of claim 1 , wherein the script server is a structured query language (SQL) server.

8. The computer program product of claim 5 , wherein the scripting language is a structured query language (SQL), and the script instruction is an SQL instruction.

9. The computer program product of claim 5 , wherein encoding the ‘User-input related variables further comprise placing a magic string in front of the user-input variables to enable retrospective operation.

10. The computer program product of claim 5 , wherein the encoding is performed by Base64 or DES encoding.

11. The computer system of claim 6 , wherein the scripting language is a structured query language (SQL), and the script instruction is an SQL instruction.

12. The computer system of claim 6 , wherein encoding the user input related variables further comprise placing a magic string in front of the user-input variables to enable retrospective operation.

13. The computer system of claim 6 , wherein the encoding is performed by Base-64 or DES encoding.

14. The computer program product of claim 5 , wherein the script server is a structured query language (SQL) server.

15. The computer system of claim 6 , wherein the script server is a structured query language (SQL) server.

Assignments (1)
ASSIGNMENT OF ASSIGNOR'S INTEREST Recorded Aug 30, 2013
From: HSIUNG, WEI-HSIANG; LEE, CHENG-TA; SUEN, WEI-SHIAU; WU, RICK MF
To: INTERNATIONAL BUSINESS MACHINES CORPORATION
Reel/Frame 031119/0668 →
Priority Claims (1)
TW 101131966 A · Aug 31, 2012 · national
Continuity (1)
Related Publication 20140068771A1 · Mar 6, 2014