Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
A
antSword
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
HuangJunbo
antSword
Commits
095ab9af
Commit
095ab9af
authored
Mar 18, 2016
by
peablog
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix: 执行sql 语句时,如果数据本身包含换行符和html标签的情况
增加base64编码,同时前端也html编码一次避免xss 只修改了php shell 类型的,实际测试php + mysql 通过
parent
596e261a
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
7 additions
and
4 deletions
+7
-4
informix.jsx
source/core/php/template/database/informix.jsx
+1
-1
mssql.jsx
source/core/php/template/database/mssql.jsx
+1
-1
mysql.jsx
source/core/php/template/database/mysql.jsx
+1
-1
oracle.jsx
source/core/php/template/database/oracle.jsx
+1
-1
index.jsx
source/modules/database/php/index.jsx
+3
-0
No files found.
source/core/php/template/database/informix.jsx
View file @
095ab9af
...
@@ -38,7 +38,7 @@ module.exports = {
...
@@ -38,7 +38,7 @@ module.exports = {
// 执行SQL语句
// 执行SQL语句
query
:
{
query
:
{
_
:
_
:
`$m=get_magic_quotes_gpc();$hst=$m?stripslashes($_POST["
${
arg1
}
"]):$_POST["
${
arg1
}
"];$usr=$m?stripslashes($_POST["
${
arg2
}
"]):$_POST["
${
arg2
}
"];$pwd=$m?stripslashes($_POST["
${
arg3
}
"]):$_POST["
${
arg3
}
"];$dbn=$m?stripslashes($_POST["
${
arg4
}
"]):$_POST["
${
arg4
}
"];$sql=base64_decode($_POST["
${
arg5
}
"]);$T=(strlen($usr)>0)?@ifx_connect($hst,$usr,$pwd):@ifx_connect($hst);$q=@ifx_query($sql,$T);$i=0;while($rs=@ifx_fetch_row($q)){if($i==0){for(reset($rs);$f=key($rs);next($rs)){echo($f."\t|\t");}echo("\r\n");}for(reset($rs);$f=key($rs);next($rs)){echo(
trim($rs[$f]
));echo("\t|\t");}echo("\r\n");$i++;}@ifx_close($T);`
,
`$m=get_magic_quotes_gpc();$hst=$m?stripslashes($_POST["
${
arg1
}
"]):$_POST["
${
arg1
}
"];$usr=$m?stripslashes($_POST["
${
arg2
}
"]):$_POST["
${
arg2
}
"];$pwd=$m?stripslashes($_POST["
${
arg3
}
"]):$_POST["
${
arg3
}
"];$dbn=$m?stripslashes($_POST["
${
arg4
}
"]):$_POST["
${
arg4
}
"];$sql=base64_decode($_POST["
${
arg5
}
"]);$T=(strlen($usr)>0)?@ifx_connect($hst,$usr,$pwd):@ifx_connect($hst);$q=@ifx_query($sql,$T);$i=0;while($rs=@ifx_fetch_row($q)){if($i==0){for(reset($rs);$f=key($rs);next($rs)){echo($f."\t|\t");}echo("\r\n");}for(reset($rs);$f=key($rs);next($rs)){echo(
base64_encode(trim($rs[$f])
));echo("\t|\t");}echo("\r\n");$i++;}@ifx_close($T);`
,
[
arg1
]:
'#{host}'
,
[
arg1
]:
'#{host}'
,
[
arg2
]:
'#{user}'
,
[
arg2
]:
'#{user}'
,
[
arg3
]:
'#{passwd}'
,
[
arg3
]:
'#{passwd}'
,
...
...
source/core/php/template/database/mssql.jsx
View file @
095ab9af
...
@@ -39,7 +39,7 @@ module.exports = {
...
@@ -39,7 +39,7 @@ module.exports = {
// 执行SQL语句
// 执行SQL语句
query
:
{
query
:
{
_
:
_
:
`$m=get_magic_quotes_gpc();$hst=$m?stripslashes($_POST["
${
arg1
}
"]):$_POST["
${
arg1
}
"];$usr=$m?stripslashes($_POST["
${
arg2
}
"]):$_POST["
${
arg2
}
"];$pwd=$m?stripslashes($_POST["
${
arg3
}
"]):$_POST["
${
arg3
}
"];$dbn=$m?stripslashes($_POST["
${
arg4
}
"]):$_POST["
${
arg4
}
"];$sql=base64_decode($_POST["
${
arg5
}
"]);$T=@mssql_connect($hst,$usr,$pwd);@mssql_select_db($dbn,$db);$q=@mssql_query($sql,$T);$i=0;while($rs=@mssql_fetch_field($q)){echo($rs->name."\t|\t");$i++;}echo("\r\n");while($rs=@mssql_fetch_row($q)){for($c=0;$c<$i;$c++){echo(
trim($rs[$c]
));echo("\t|\t");}echo("\r\n");}@mssql_free_result($q);@mssql_close($T);`
,
`$m=get_magic_quotes_gpc();$hst=$m?stripslashes($_POST["
${
arg1
}
"]):$_POST["
${
arg1
}
"];$usr=$m?stripslashes($_POST["
${
arg2
}
"]):$_POST["
${
arg2
}
"];$pwd=$m?stripslashes($_POST["
${
arg3
}
"]):$_POST["
${
arg3
}
"];$dbn=$m?stripslashes($_POST["
${
arg4
}
"]):$_POST["
${
arg4
}
"];$sql=base64_decode($_POST["
${
arg5
}
"]);$T=@mssql_connect($hst,$usr,$pwd);@mssql_select_db($dbn,$db);$q=@mssql_query($sql,$T);$i=0;while($rs=@mssql_fetch_field($q)){echo($rs->name."\t|\t");$i++;}echo("\r\n");while($rs=@mssql_fetch_row($q)){for($c=0;$c<$i;$c++){echo(
base64_encode(trim($rs[$c])
));echo("\t|\t");}echo("\r\n");}@mssql_free_result($q);@mssql_close($T);`
,
[
arg1
]:
'#{host}'
,
[
arg1
]:
'#{host}'
,
[
arg2
]:
'#{user}'
,
[
arg2
]:
'#{user}'
,
[
arg3
]:
'#{passwd}'
,
[
arg3
]:
'#{passwd}'
,
...
...
source/core/php/template/database/mysql.jsx
View file @
095ab9af
...
@@ -39,7 +39,7 @@ module.exports = {
...
@@ -39,7 +39,7 @@ module.exports = {
// 执行SQL语句
// 执行SQL语句
query
:
{
query
:
{
_
:
_
:
`$m=get_magic_quotes_gpc();$hst=$m?stripslashes($_POST["
${
arg1
}
"]):$_POST["
${
arg1
}
"];$usr=$m?stripslashes($_POST["
${
arg2
}
"]):$_POST["
${
arg2
}
"];$pwd=$m?stripslashes($_POST["
${
arg3
}
"]):$_POST["
${
arg3
}
"];$dbn=$m?stripslashes($_POST["
${
arg4
}
"]):$_POST["
${
arg4
}
"];$sql=base64_decode($_POST["
${
arg5
}
"]);$T=@mysqli_connect($hst,$usr,$pwd);@mysqli_query($T,"SET NAMES
${
arg6
}
");@mysqli_select_db($T,$dbn);$q=@mysqli_query($T,$sql);$i=0;while($col=@mysqli_fetch_field($q)){echo($col->name."\t|\t");$i++;}echo("\r\n");while($rs=@mysqli_fetch_row($q)){for($c=0;$c<$i;$c++){echo(
trim($rs[$c]
));echo("\t|\t");}echo("\r\n");}@mysqli_close($T);`
,
`$m=get_magic_quotes_gpc();$hst=$m?stripslashes($_POST["
${
arg1
}
"]):$_POST["
${
arg1
}
"];$usr=$m?stripslashes($_POST["
${
arg2
}
"]):$_POST["
${
arg2
}
"];$pwd=$m?stripslashes($_POST["
${
arg3
}
"]):$_POST["
${
arg3
}
"];$dbn=$m?stripslashes($_POST["
${
arg4
}
"]):$_POST["
${
arg4
}
"];$sql=base64_decode($_POST["
${
arg5
}
"]);$T=@mysqli_connect($hst,$usr,$pwd);@mysqli_query($T,"SET NAMES
${
arg6
}
");@mysqli_select_db($T,$dbn);$q=@mysqli_query($T,$sql);$i=0;while($col=@mysqli_fetch_field($q)){echo($col->name."\t|\t");$i++;}echo("\r\n");while($rs=@mysqli_fetch_row($q)){for($c=0;$c<$i;$c++){echo(
base64_encode(trim($rs[$c])
));echo("\t|\t");}echo("\r\n");}@mysqli_close($T);`
,
[
arg1
]:
'#{host}'
,
[
arg1
]:
'#{host}'
,
[
arg2
]:
'#{user}'
,
[
arg2
]:
'#{user}'
,
[
arg3
]:
'#{passwd}'
,
[
arg3
]:
'#{passwd}'
,
...
...
source/core/php/template/database/oracle.jsx
View file @
095ab9af
...
@@ -38,7 +38,7 @@ module.exports = {
...
@@ -38,7 +38,7 @@ module.exports = {
// 执行SQL语句
// 执行SQL语句
query
:
{
query
:
{
_
:
_
:
`$m=get_magic_quotes_gpc();$sid=$m?stripslashes($_POST["
${
arg1
}
"]):$_POST["
${
arg1
}
"];$usr=$m?stripslashes($_POST["
${
arg2
}
"]):$_POST["
${
arg2
}
"];$pwd=$m?stripslashes($_POST["
${
arg3
}
"]):$_POST["
${
arg3
}
"];$dbn=$m?stripslashes($_POST["
${
arg4
}
"]):$_POST["
${
arg4
}
"];$sql=base64_decode($_POST["
${
arg5
}
"]);$H=@ora_plogon("{$usr}@{$sid}","{$pwd}");if(!$H){echo("ERROR:// Login Failed!");}else{$T=@ora_open($H);@ora_commitoff($H);$q=@ora_parse($T,"{$sql}");$R=ora_exec($T);if($R){$n=ora_numcols($T);for($i=0;$i<$n;$i++){echo(Ora_ColumnName($T,$i)."\t|\t");}echo("\r\n");while(ora_fetch($T)){for($i=0;$i<$n;$i++){echo(
trim(ora_getcolumn($T,$i
)));echo("\t|\t");}echo("\r\n");}}else{echo("ErrMsg\t|\t\r\n");}@ora_close($T);};`
,
`$m=get_magic_quotes_gpc();$sid=$m?stripslashes($_POST["
${
arg1
}
"]):$_POST["
${
arg1
}
"];$usr=$m?stripslashes($_POST["
${
arg2
}
"]):$_POST["
${
arg2
}
"];$pwd=$m?stripslashes($_POST["
${
arg3
}
"]):$_POST["
${
arg3
}
"];$dbn=$m?stripslashes($_POST["
${
arg4
}
"]):$_POST["
${
arg4
}
"];$sql=base64_decode($_POST["
${
arg5
}
"]);$H=@ora_plogon("{$usr}@{$sid}","{$pwd}");if(!$H){echo("ERROR:// Login Failed!");}else{$T=@ora_open($H);@ora_commitoff($H);$q=@ora_parse($T,"{$sql}");$R=ora_exec($T);if($R){$n=ora_numcols($T);for($i=0;$i<$n;$i++){echo(Ora_ColumnName($T,$i)."\t|\t");}echo("\r\n");while(ora_fetch($T)){for($i=0;$i<$n;$i++){echo(
base64_encode(trim(ora_getcolumn($T,$i)
)));echo("\t|\t");}echo("\r\n");}}else{echo("ErrMsg\t|\t\r\n");}@ora_close($T);};`
,
[
arg1
]:
'#{host}'
,
[
arg1
]:
'#{host}'
,
[
arg2
]:
'#{user}'
,
[
arg2
]:
'#{user}'
,
[
arg3
]:
'#{passwd}'
,
[
arg3
]:
'#{passwd}'
,
...
...
source/modules/database/php/index.jsx
View file @
095ab9af
...
@@ -427,6 +427,9 @@ class PHP {
...
@@ -427,6 +427,9 @@ class PHP {
let
data_arr
=
[];
let
data_arr
=
[];
arr
.
map
((
_
)
=>
{
arr
.
map
((
_
)
=>
{
let
_data
=
_
.
split
(
'
\
t|
\
t'
);
let
_data
=
_
.
split
(
'
\
t|
\
t'
);
for
(
let
i
=
0
;
i
<
_data
.
length
;
i
++
)
{
_data
[
i
]
=
antSword
.
noxss
(
new
Buffer
(
_data
[
i
],
"base64"
).
toString
());
}
data_arr
.
push
(
_data
);
data_arr
.
push
(
_data
);
});
});
data_arr
.
pop
();
data_arr
.
pop
();
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment