刚刚被发送了JS病毒。如何安全地显示输出?

发布于 2024-09-24 22:51:23 字数 487 浏览 0 评论 0原文

我刚刚收到一个看起来像这样的病毒,

<script type='text/javascript'>
<!--
var s="=nfub!iuuq.frvjw>#sfgsfti#!------REST OF PAYLOAD REMOVED-----?";
m=""; 
for (i=0; i<s.length; i++) 
{   
if(s.charCodeAt(i) == 28)
{     
m+= '&';
}
 else if 
(s.charCodeAt(i) == 23) 
{     m+= '!';} 
else 
{     
 m+=String.fromCharCode(s.charCodeAt(i)-1); 
}}
document.write(m);//-->
</script>

我不是 JS 专家,但我想解密该字符串的内容。你能告诉我改变 document.write 看看它在做什么的最佳方法吗?

I just received a virus that looks something like this

<script type='text/javascript'>
<!--
var s="=nfub!iuuq.frvjw>#sfgsfti#!------REST OF PAYLOAD REMOVED-----?";
m=""; 
for (i=0; i<s.length; i++) 
{   
if(s.charCodeAt(i) == 28)
{     
m+= '&';
}
 else if 
(s.charCodeAt(i) == 23) 
{     m+= '!';} 
else 
{     
 m+=String.fromCharCode(s.charCodeAt(i)-1); 
}}
document.write(m);//-->
</script>

I'm not a JS expert but I would like to decrypt the contents of that string. Can you tell me the best way to alter document.write to see what it's doing?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

无所谓啦 2024-10-01 22:51:23

只需创建一个 ,然后写入

document.getElementsById('foo').value = m;

或者,您可以对 <& 进行编码code> 到 <& 并保留 document.write


仅供参考,有效负载以

<meta http-equiv="refresh" 

so 开头,看起来它只是将用户重定向到恶意站点。

Just create a <textarea id="foo"></textarea>, and write

document.getElementsById('foo').value = m;

Alternatively, you could encode < and & to < and & and keep the document.write.


FYI, the payload starts with

<meta http-equiv="refresh" 

so looks like it just redirects the user into the a malicious site.

末骤雨初歇 2024-10-01 22:51:23

使用 Malzilla 解码 URL。
http://malzilla.sourceforge.net/

Use Malzilla to decode the URL.
http://malzilla.sourceforge.net/

爱*していゐ 2024-10-01 22:51:23

由于 m 是一个字符串,因此您只需将 document.write() 替换为 alert() 即可。 Jsfiddle 演示

它似乎正在创建一个元刷新标头,可能是为了将其注入当前 HTML 页面的标头,以便重定向到另一个(恶意?)页面。

Since m is a String, you can just replace document.write() by alert(). Jsfiddle demo.

It seem to be creating a meta refresh header, probably with intent to inject it in the head of the current HTML page in order to redirect to a different (malicious?) page.

彩虹直至黑白 2024-10-01 22:51:23

不要在浏览器中运行它,而是尝试在 FireBug 中运行它(除了 document.write(m) 行 - 只需使用 FireBug 来查看 m 变量的内容)。

其中大多数将 iframe 嵌入到您的网站中

Don't run it your browser, instead try running it in FireBug for example (except document.write(m) line - just use FireBug to see contents of m variable).

Most of these embed an iframe into your site

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文