mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-01-06 18:21:39 +09:00
SECISSUE <object> tag의 XSS 문제 해결.
This commit is contained in:
parent
20436466fc
commit
c5845c4758
1 changed files with 12 additions and 12 deletions
|
|
@ -347,14 +347,14 @@ class EmbedFilter
|
|||
}
|
||||
}
|
||||
|
||||
if(!$isWhiteDomain && !$isWhiteMimetype && $ext)
|
||||
if($isWhiteDomain && $isWhiteMimetype && $ext)
|
||||
{
|
||||
$isWhiteExt = $this->isWhiteExt($ext);
|
||||
}
|
||||
|
||||
if(!$isWhiteDomain && !$isWhiteMimetype && !$isWhiteExt)
|
||||
if(!$isWhiteDomain || !$isWhiteMimetype || !$isWhiteExt)
|
||||
{
|
||||
$content = str_replace($objectTag, htmlspecialchars($objectTag), $content);
|
||||
$content = str_replace($objectTag, htmlspecialchars($objectTag, ENT_COMPAT, 'UTF-8', false), $content);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -400,14 +400,14 @@ class EmbedFilter
|
|||
}
|
||||
}
|
||||
|
||||
if(!$isWhiteDomain && !$isWhiteMimetype && $ext)
|
||||
if($isWhiteDomain && $isWhiteMimetype && $ext)
|
||||
{
|
||||
$isWhiteExt = $this->isWhiteExt($ext);
|
||||
}
|
||||
|
||||
if(!$isWhiteDomain && !$isWhiteMimetype && !$isWhiteExt)
|
||||
if(!$isWhiteDomain || !$isWhiteMimetype || !$isWhiteExt)
|
||||
{
|
||||
$content = str_replace($embedTag, htmlspecialchars($embedTag), $content);
|
||||
$content = str_replace($embedTag, htmlspecialchars($embedTag, ENT_COMPAT, 'UTF-8', false), $content);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -450,7 +450,7 @@ class EmbedFilter
|
|||
|
||||
if(!$isWhiteDomain)
|
||||
{
|
||||
$content = str_replace($iframeTag, htmlspecialchars($iframeTag), $content);
|
||||
$content = str_replace($iframeTag, htmlspecialchars($iframeTag, ENT_COMPAT, 'UTF-8', false), $content);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -483,14 +483,14 @@ class EmbedFilter
|
|||
$ext = strtolower(substr(strrchr($parser->iNodeAttributes['value'], "."), 1));
|
||||
$isWhiteDomain = $this->isWhiteDomain($parser->iNodeAttributes['value']);
|
||||
|
||||
if(!$isWhiteDomain && $ext)
|
||||
if($isWhiteDomain && $ext)
|
||||
{
|
||||
$isWhiteExt = $this->isWhiteExt($ext);
|
||||
}
|
||||
|
||||
if(!$isWhiteDomain && !$isWhiteExt)
|
||||
if(!$isWhiteDomain || !$isWhiteExt)
|
||||
{
|
||||
$content = str_replace($paramTag, htmlspecialchars($paramTag), $content);
|
||||
$content = str_replace($paramTag, htmlspecialchars($paramTag, ENT_COMPAT, 'UTF-8', false), $content);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -568,7 +568,7 @@ class EmbedFilter
|
|||
|
||||
if($m[1] == 'param')
|
||||
{
|
||||
if(strpos(strtolower($m[0]), 'allowscriptaccess'))
|
||||
if(stripos($m[0], 'allowscriptaccess'))
|
||||
{
|
||||
$m[0] = '<param name="allowscriptaccess" value="never"';
|
||||
if(substr($m[0], -1) == '/')
|
||||
|
|
@ -580,7 +580,7 @@ class EmbedFilter
|
|||
}
|
||||
else if($m[1] == 'embed')
|
||||
{
|
||||
if(strpos(strtolower($m[0]), 'allowscriptaccess'))
|
||||
if(stripos($m[0], 'allowscriptaccess'))
|
||||
{
|
||||
$m[0] = preg_replace('/always|samedomain/i', 'never', $m[0]);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue