Skip to content

TIMO V2.0.3存在HTML注入 #10

@xfgvgfg

Description

@xfgvgfg

漏洞地址

github地址:https://github.com/auntvt/Timo

target:http://192.168.137.1:8081/#/system/dept/index

漏洞版本

TimoV2.0.3

简介

TimoV2.0.3存在HTML注入

分析过程

输入payload:

<a href="http://www.baidu.com">link</a>
Image

实现HTML注入:

Image Image

代码分析:

首先该系统采用的是Jsoup ,Jsoup 全局配置

Image

覆盖的请求类型

java

registration.addUrlPatterns(propertiesXxs.getUrlPatterns().split(","));
  • 默认配置通常是 /\*:这意味着所有URL都会被检测
  • 包括所有HTTP方法:GET、POST、PUT、DELETE等都包括
  • 包括所有参数位置:查询参数、表单参数、路径参数(取决于实现)

检测规则配置:

Image
    public static Whitelist relaxed() {
        return (new Whitelist()).addTags("a", "b", "blockquote", "br", "caption", "cite", "code", "col", "colgroup", "dd", "div", "dl", "dt", "em", "h1", "h2", "h3", "h4", "h5", "h6", "i", "img", "li", "ol", "p", "pre", "q", "small", "span", "strike", "strong", "sub", "sup", "table", "tbody", "td", "tfoot", "th", "thead", "tr", "u", "ul").addAttributes("a", "href", "title").addAttributes("blockquote", "cite").addAttributes("col", "span", "width").addAttributes("colgroup", "span", "width").addAttributes("img", "align", "alt", "height", "src", "title", "width").addAttributes("ol", "start", "type").addAttributes("q", "cite").addAttributes("table", "summary", "width").addAttributes("td", "abbr", "axis", "colspan", "rowspan", "width").addAttributes("th", "abbr", "axis", "colspan", "rowspan", "scope", "width").addAttributes("ul", "type").addProtocols("a", "href", "ftp", "http", "https", "mailto").addProtocols("blockquote", "cite", "http", "https").addProtocols("cite", "cite", "http", "https").addProtocols("img", "src", "http", "https").addProtocols("q", "cite", "http", "https");
    }

只允许特定的属性:

  • a: href, title没有onclick等事件处理器

  • img: align, alt, height, src, title, width没有onerror

  • 其他标签只有基本的展示属性

  • a[href]: 只允许 ftp, http, https, mailto没有javascript协议

  • img[src]: 只允许 http, https没有data协议

所以这里可以使用

<a href="http://www.baidu.com">link</a>

再次检测页面配置:

Image

可以看到是在页面中直接输出

所以导致了HTML注入。

攻击者可以借此构造恶意链接,钓鱼攻击

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions