编辑
2024-05-29
hackthebox
00
请注意,本文编写于 238 天前,最后修改于 238 天前,其中某些信息可能已经过时。

目录

CRLF Injection Vulnerability

webrick

CVE-2008-1891 Open this link in a new tab

version < 1.4.0.beta1

Directory Traversal

webrick is a HTTP server toolkit that can be configured as an HTTPS server, a proxy server, and a virtual-host server.

Affected versions of this package are vulnerable to Directory Traversal. WEBrick, when using NTFS or FAT filesystems, allows remote attackers to read arbitrary CGI files via any of the following trailing characters in the URI:

  1. + (plus),
  2. %2b (encodedplus),
  3. . (dot),
  4. %2e (encoded dot), or
  5. %20 (encoded space)

PoC

Accessing the following URIs to gain access to file.cgi: http://SERVER/file.cgi. http://SERVER/file.cgi%2e

example:

curl http://localhost:8080/public/%2e%2e/%2e%2e/%2e%2e/%2e%2e/%2e%2e/root/.ssh/id_rsa

CVE-2009-4492 Open this link in a new tab

Affected versions of this package are vulnerable to Improper Input Validation. WEBrick lets attackers to inject malicious escape sequences to its logs, making it possible for dangerous control characters to be executed on a victim's terminal emulator. This is due to data being written to a log file without sanitizing non-printable characters. Remote attackers could modify a window's title, execute arbitrary commands, or overwrite files via an HTTP request containing an escape sequence for a terminal emulator.

PoC

% xterm -e ruby -rwebrick -e 'WEBrick::HTTPServer.new(:Port=>8080).start' & % wget http://localhost:8080/%1b%5d%32%3b%6f%77%6e%65%64%07%0a

CVE-2020-25613 Open this link in a new tab

Affected versions of this package are vulnerable to Improper Input Validation. WEBrick lets attackers to inject malicious escape sequences to its logs, making it possible for dangerous control characters to be executed on a victim's terminal emulator. This is due to data being written to a log file without sanitizing non-printable characters. Remote attackers could modify a window's title, execute arbitrary commands, or overwrite files via an HTTP request containing an escape sequence for a terminal emulator.

PoC

% xterm -e ruby -rwebrick -e 'WEBrick::HTTPServer.new(:Port=>8080).start' & % wget http://localhost:8080/%1b%5d%32%3b%6f%77%6e%65%64%07%0a

SSTI一篇文章带你理解漏洞之 SSTI 漏洞 | K0rz3n's Blog

一种服务器模板漏洞,

ruby
output = template.render(name=request.args.get('name'))

由于直接将name渲染填充

example:

right:

php
<?php require_once dirname(__FILE__).‘/../lib/Twig/Autoloader.php‘; Twig_Autoloader::register(true); $twig = new Twig_Environment(new Twig_Loader_String()); $output = $twig->render("Hello {{name}}", array("name" => $_GET["name"])); // 将用户输入作为模版变量的值 echo $output;

wrong:

示例PHP代码2:

php
<?php require_once dirname(__FILE__).‘/../lib/Twig/Autoloader.php‘; Twig_Autoloader::register(true); $twig = new Twig_Environment(new Twig_Loader_String()); $output = $twig->render("Hello {$_GET[‘name‘]}"); // 将用户输入作为模版内容的一部分 echo $output;

CRLF Injection Vulnerability

如果对你有用的话,可以打赏哦
打赏
ali pay
wechat pay

本文作者:Hyrink

本文链接:

版权声明:本博客所有文章除特别声明外,均采用 BY-NC-SA 许可协议。转载请注明出处!