peoplesoft 注入

简介: Preventing SQL InjectionThe following functions and methods provide a way for SQL to be submit...
Preventing SQL Injection

The following functions and methods provide a way for SQL to be submitted to the database; they are, therefore, subject to SQL injection vulnerabilities:

  • SQLExec function

  • CreateSQL function

  • Rowset class Select method

  • Rowset class SelectNew method

  • Rowset class Fill method

  • Rowset class FillAppend method

Look at the following PeopleCode as an example:

 
 

rem Retrieve user input from the name field; &UserInput = GetField(Field.NAME).Value; SQLExec("SELECT NAME, PHONE FROM PS_INFO WHERE NAME='" | &UserInput | "'", &Name, &Phone);

The code is meant to enable the user to type in a name and get the person's phone number. In the example, the developer expects that the user will input data such as Smith, in which case the resulting SQL would look like this:

 
 

SELECT NAME, PHONE FROM PS_INFO WHERE NAME='Smith'

However, if the user specified "Smith' OR AGE > 55 --", the resulting SQL would look like this:

 
 

SELECT NAME, PHONE FROM PS_INFO WHERE NAME='Smith' OR AGE > 55 --'

Note the use of the comment operator (--) to ignore the trailing single quotation mark placed by the developer's code. This would allow a devious user to find everyone older than 55.

Use the following approaches to avoid SQL injection vulnerabilities:

  • Where possible, avoid using string-building techniques to generate SQL.

    Note. String-building techniques cannot always be avoided. String-building does not pose a threat unless unvalidated user input is concatenated to SQL.

  •  

     

    Use bind variables where possible rather that string concatenation.

    The following example is vulnerable:

    SQLExec("SELECT NAME, PHONE FROM PS_INFO WHERE NAME='" | 
    &UserInput | "'", &Name, &Phone);
  •  

     

    Use the Quote PeopleCode function on the user input before concatenating it to SQL.

    This pairs the quotation marks in the user input, effectively negating any SQL injection attack.

    The following example is vulnerable:

    SQLExec("SELECT NAME, PHONE FROM PS_INFO WHERE NAME='" | 
    &UserInput | "'", &Name, &Phone);

    This example is not vulnerable:

    SQLExec("SELECT NAME, PHONE FROM PS_INFO WHERE NAME='" | 
    Quote(&UserInput) | "'", &Name, &Phone);
  •  

     

     

    Specify whether SQL errors appear to the user with the Suppress SQL Error setting in the PSTOOLS section of the application server configuration file. Normally, the SQL in error appears to the user in a number of messages. If you consider this a security issue, add the following line to your application server configuration file:
    Suppress SQL Error=1

    When this line is set, SQL errors do not display details; instead, they refer the user to consult the system log. The detail that was in the SQL message is written to the log file.

 

 

 

目录
相关文章
|
2月前
|
XML 安全 数据库
24、显错注入(updatexml和extractvalue)
24、显错注入(updatexml和extractvalue)
27 0
|
4月前
|
Java 开发者 Spring
Spring中获取Bean对象的三种注入方式和两种注入方法
Spring中获取Bean对象的三种注入方式和两种注入方法
|
2月前
|
数据库
报错注入
报错注入
12 1
|
2月前
|
数据库
13、报错注入(Get)
13、报错注入(Get)
14 0
|
9月前
|
容器
什么是依赖注入?有哪些注入方式?
什么是依赖注入?有哪些注入方式?
96 0
|
8月前
|
Java Spring
2021-08-09构造方法注入,项目搭建,通过注释注入,注解扫描器,spring,ioc结束,AOP(一)
2021-08-09构造方法注入,项目搭建,通过注释注入,注解扫描器,spring,ioc结束,AOP
165 0
|
8月前
|
Java Spring
2021-08-09构造方法注入,项目搭建,通过注释注入,注解扫描器,spring,ioc结束,AOP(二)
2021-08-09构造方法注入,项目搭建,通过注释注入,注解扫描器,spring,ioc结束,AOP
163 0
|
11月前
|
存储 SQL 网络协议
利用DNSLog实现无回显注入
测试一些网站的时候,一些注入都是无回显的,我们可以写脚本来进行盲注,但有些网站会ban掉我们的ip,这样我们可以通过设置ip代理池解决, 但是盲注往往效率很低,所以产生了DNSlog注入
356 0
|
11月前
|
设计模式
依赖注入和构造器注入的区别
依赖注入和构造器注入的区别
|
11月前
|
Java 容器 Spring
构造器注入
构造器注入