hacking swf

67
Hacking SWF Claus Wahlers côdeazur brasil @cwahlers Sunday, 25. April 2010

Upload: saurabh-mathur

Post on 06-Jan-2017

8.663 views

Category:

Technology


4 download

TRANSCRIPT

Page 1: Hacking swf

Hacking SWFClaus Wahlers

côdeazur brasil

@cwahlers

Sunday, 25. April 2010

Page 2: Hacking swf

SWF 10 Specadobe.com/devnet/swf

RTFM !

Sunday, 25. April 2010

Page 3: Hacking swf

as3swfgithub.com/claus/as3swf

Low level ActionScript 3 class library to parse, create, modify and publish SWF files.

Sunday, 25. April 2010

Page 4: Hacking swf

swfassistlibspark.org/wiki/yossy/swfassist

Low level ActionScript 3 class library to parse, create, modify and publish SWF files.

Sunday, 25. April 2010

Page 5: Hacking swf

as3abcgithub.com/claus/as3abc

Jim Cheng’s port of Joa’s ABC parser(from Joa’s excellent Apparat framework)

Sunday, 25. April 2010

Page 6: Hacking swf

DEMO

Sunday, 25. April 2010

Page 7: Hacking swf

The structure of a SWF

SWF Anatomy

SWF HeaderSignatureVersion

File lengthFrame sizeFrame rate

Frame count

Tag

Tag

Tag

Tag

Sunday, 25. April 2010

Page 8: Hacking swf

The structure of a SWF

SWF Anatomy

SWF HeaderSignatureVersion

File lengthFrame sizeFrame rate

Frame count

Tag

Tag

Tag

Tag

Signature:”FWS” - uncompressed”CWS” - compressedbtw... “FWS” is “SWF” backwards

Sunday, 25. April 2010

Page 9: Hacking swf

The structure of a SWF

SWF Anatomy

SWF HeaderSignatureVersion

File lengthFrame sizeFrame rate

Frame count

For SWF 8 or later, the first tag must be the FileAttributes tag

The last tag must be the End tag

FileAttributes

Tag

Tag

End

Sunday, 25. April 2010

Page 10: Hacking swf

The structure of a SWF

SWF Anatomy

SWF HeaderSignatureVersion

File lengthFrame sizeFrame rate

Frame count

Tag

Unknown Tag

Tag

Tag

Sunday, 25. April 2010

Page 11: Hacking swf

The structure of a tag

SWF Anatomy

Tag HeaderType

Length

Tag Content

Sunday, 25. April 2010

Page 12: Hacking swf

The structure of a tag

SWF Anatomy

Tag HeaderType

Length

Tag Content

When the Flash Player encounters a tag with an unknown type, it skips it

ExtensibleForward compatible

Sunday, 25. April 2010

Page 13: Hacking swf

Data types used by SWF

SWF Anatomy

A tag’s content is made up of various data types.The exact format for each tag is defined in the SWF spec.

Some of the data types are rather obscure:

IntegersUI8UI16UI24UI32SI8SI16SI32EncodedU32

NumbersFIXEDFIXED8FLOATFLOAT16DOUBLE

Bit arraysUB[nBits]SB[nBits]FB[nBits]

OthersStringRGBRGBARECTMATRIX

Sunday, 25. April 2010

Page 14: Hacking swf

Data types used by SWF

SWF Anatomy

Example: RECT and bit arrays

000000000001010 1000100110 0000000000 0110010000

xmin xmax ymin ymaxnBits

0 550 0 40010

nBits specifies the minimum number of bits needed to represent all values in the array

All values are stored as a bit stream(no byte boundaries)

Sunday, 25. April 2010

Page 15: Hacking swf

Data types used by SWF

SWF Anatomy

Example: RECT and bit arrays

xmin

xmax

ymin

ymax

0

550

0

400

0

1000100110

0

110010000

Sunday, 25. April 2010

Page 16: Hacking swf

Data types used by SWF

SWF Anatomy

Example: RECT and bit arrays

0

550

0

400

0

1000100110

0

110010000

1110110110 nBits = 10

xmin

xmax

ymin

ymax

Sunday, 25. April 2010

Page 17: Hacking swf

Data types used by SWF

SWF Anatomy

Example: RECT and bit arrays

0

550

0

400

0000000000

1000100110

0000000000

0110010000

1110110110 nBits = 10

xmin

xmax

ymin

ymax

Sunday, 25. April 2010

Page 18: Hacking swf

Data types used by SWF

SWF Anatomy

Example: RECT and bit arrays

0

550

0

400

0000000000

1000100110

0000000000

0110010000

concatenate

0000000000 1000100110 0000000000 0110010000

xmin

xmax

ymin

ymax

Sunday, 25. April 2010

Page 19: Hacking swf

Data types used by SWF

SWF Anatomy

Example: RECT and bit arrays

0

550

0

400

0000000000

1000100110

0000000000

0110010000

0000000000

uses 40 + 5 bitsvs 128 bits

01010 1000100110 0000000000 0110010000

xmin

xmax

ymin

ymax

Sunday, 25. April 2010

Page 20: Hacking swf

Data types used by SWF

SWF Anatomy

Example: RECT and bit arrays

0

0

0

0

0

0

0

0

-

Special case:uses 0 + 5 bits

vs 128 bits

00000 - - -

xmin

xmax

ymin

ymax

Sunday, 25. April 2010

Page 21: Hacking swf

SWF 10 defines a total of 64 different tags

SWF Tag Evolution

CSMTextSettingsDefineBinaryDataDefineBitsDefineBitsJPEG2DefineBitsJPEG3DefineBitsJPEG4DefineBitsLosslessDefineBitsLossless2DefineButtonDefineButton2DefineButtonCxformDefineButtonSoundDefineEditTextDefineFontDefineFont2DefineFont3

DefineFont4DefineFontAlignZonesDefineFontInfoDefineFontInfo2DefineFontNameDefineMorphShapeDefineMorphShape2DefineScalingGridDefineSceneAnd...DefineShapeDefineShape2DefineShape3DefineShape4DefineSoundDefineSpriteDefineText

DefineText2DefineVideoStreamDoABCDoActionDoInitActionEnableDebuggerEnableDebugger2EndExportAssetsFileAttributesFrameLabelImportAssetsImportAssets2JPEGTablesMetadataPlaceObject

PlaceObject2PlaceObject3ProtectRemoveObjectRemoveObject2ScriptLimitsSetBackgroundColorSetTabIndexShowFrameSoundStreamBlockSoundStreamHeadSoundStreamHead2StartSoundStartSound2SymbolClassVideoFrame

Sunday, 25. April 2010

Page 22: Hacking swf

SWF 1

SWF Tag Evolution

CSMTextSettingsDefineBinaryDataDefineBitsDefineBitsJPEG2DefineBitsJPEG3DefineBitsJPEG4DefineBitsLosslessDefineBitsLossless2DefineButtonDefineButton2DefineButtonCxformDefineButtonSoundDefineEditTextDefineFontDefineFont2DefineFont3

DefineFont4DefineFontAlignZonesDefineFontInfoDefineFontInfo2DefineFontNameDefineMorphShapeDefineMorphShape2DefineScalingGridDefineSceneAnd...DefineShapeDefineShape2DefineShape3DefineShape4DefineSoundDefineSpriteDefineText

DefineText2DefineVideoStreamDoABCDoActionDoInitActionEnableDebuggerEnableDebugger2EndExportAssetsFileAttributesFrameLabelImportAssetsImportAssets2JPEGTablesMetadataPlaceObject

PlaceObject2PlaceObject3ProtectRemoveObjectRemoveObject2ScriptLimitsSetBackgroundColorSetTabIndexShowFrameSoundStreamBlockSoundStreamHeadSoundStreamHead2StartSoundStartSound2SymbolClassVideoFrame

Sunday, 25. April 2010

Page 23: Hacking swf

SWF 2

SWF Tag Evolution

CSMTextSettingsDefineBinaryDataDefineBitsDefineBitsJPEG2DefineBitsJPEG3DefineBitsJPEG4DefineBitsLosslessDefineBitsLossless2DefineButtonDefineButton2DefineButtonCxformDefineButtonSoundDefineEditTextDefineFontDefineFont2DefineFont3

DefineFont4DefineFontAlignZonesDefineFontInfoDefineFontInfo2DefineFontNameDefineMorphShapeDefineMorphShape2DefineScalingGridDefineSceneAnd...DefineShapeDefineShape2DefineShape3DefineShape4DefineSoundDefineSpriteDefineText

DefineText2DefineVideoStreamDoABCDoActionDoInitActionEnableDebuggerEnableDebugger2EndExportAssetsFileAttributesFrameLabelImportAssetsImportAssets2JPEGTablesMetadataPlaceObject

PlaceObject2PlaceObject3ProtectRemoveObjectRemoveObject2ScriptLimitsSetBackgroundColorSetTabIndexShowFrameSoundStreamBlockSoundStreamHeadSoundStreamHead2StartSoundStartSound2SymbolClassVideoFrame

Sunday, 25. April 2010

Page 24: Hacking swf

SWF 3

SWF Tag Evolution

CSMTextSettingsDefineBinaryDataDefineBitsDefineBitsJPEG2DefineBitsJPEG3DefineBitsJPEG4DefineBitsLosslessDefineBitsLossless2DefineButtonDefineButton2DefineButtonCxformDefineButtonSoundDefineEditTextDefineFontDefineFont2DefineFont3

DefineFont4DefineFontAlignZonesDefineFontInfoDefineFontInfo2DefineFontNameDefineMorphShapeDefineMorphShape2DefineScalingGridDefineSceneAnd...DefineShapeDefineShape2DefineShape3DefineShape4DefineSoundDefineSpriteDefineText

DefineText2DefineVideoStreamDoABCDoActionDoInitActionEnableDebuggerEnableDebugger2EndExportAssetsFileAttributesFrameLabelImportAssetsImportAssets2JPEGTablesMetadataPlaceObject

PlaceObject2PlaceObject3ProtectRemoveObjectRemoveObject2ScriptLimitsSetBackgroundColorSetTabIndexShowFrameSoundStreamBlockSoundStreamHeadSoundStreamHead2StartSoundStartSound2SymbolClassVideoFrame

Sunday, 25. April 2010

Page 25: Hacking swf

SWF 4

SWF Tag Evolution

CSMTextSettingsDefineBinaryDataDefineBitsDefineBitsJPEG2DefineBitsJPEG3DefineBitsJPEG4DefineBitsLosslessDefineBitsLossless2DefineButtonDefineButton2DefineButtonCxformDefineButtonSoundDefineEditTextDefineFontDefineFont2DefineFont3

DefineFont4DefineFontAlignZonesDefineFontInfoDefineFontInfo2DefineFontNameDefineMorphShapeDefineMorphShape2DefineScalingGridDefineSceneAnd...DefineShapeDefineShape2DefineShape3DefineShape4DefineSoundDefineSpriteDefineText

DefineText2DefineVideoStreamDoABCDoActionDoInitActionEnableDebuggerEnableDebugger2EndExportAssetsFileAttributesFrameLabelImportAssetsImportAssets2JPEGTablesMetadataPlaceObject

PlaceObject2PlaceObject3ProtectRemoveObjectRemoveObject2ScriptLimitsSetBackgroundColorSetTabIndexShowFrameSoundStreamBlockSoundStreamHeadSoundStreamHead2StartSoundStartSound2SymbolClassVideoFrame

Sunday, 25. April 2010

Page 26: Hacking swf

SWF 5

SWF Tag Evolution

CSMTextSettingsDefineBinaryDataDefineBitsDefineBitsJPEG2DefineBitsJPEG3DefineBitsJPEG4DefineBitsLosslessDefineBitsLossless2DefineButtonDefineButton2DefineButtonCxformDefineButtonSoundDefineEditTextDefineFontDefineFont2DefineFont3

DefineFont4DefineFontAlignZonesDefineFontInfoDefineFontInfo2DefineFontNameDefineMorphShapeDefineMorphShape2DefineScalingGridDefineSceneAnd...DefineShapeDefineShape2DefineShape3DefineShape4DefineSoundDefineSpriteDefineText

DefineText2DefineVideoStreamDoABCDoActionDoInitActionEnableDebuggerEnableDebugger2EndExportAssetsFileAttributesFrameLabelImportAssetsImportAssets2JPEGTablesMetadataPlaceObject

PlaceObject2PlaceObject3ProtectRemoveObjectRemoveObject2ScriptLimitsSetBackgroundColorSetTabIndexShowFrameSoundStreamBlockSoundStreamHeadSoundStreamHead2StartSoundStartSound2SymbolClassVideoFrame

Sunday, 25. April 2010

Page 27: Hacking swf

SWF 6

SWF Tag Evolution

CSMTextSettingsDefineBinaryDataDefineBitsDefineBitsJPEG2DefineBitsJPEG3DefineBitsJPEG4DefineBitsLosslessDefineBitsLossless2DefineButtonDefineButton2DefineButtonCxformDefineButtonSoundDefineEditTextDefineFontDefineFont2DefineFont3

DefineFont4DefineFontAlignZonesDefineFontInfoDefineFontInfo2DefineFontNameDefineMorphShapeDefineMorphShape2DefineScalingGridDefineSceneAnd...DefineShapeDefineShape2DefineShape3DefineShape4DefineSoundDefineSpriteDefineText

DefineText2DefineVideoStreamDoABCDoActionDoInitActionEnableDebuggerEnableDebugger2EndExportAssetsFileAttributesFrameLabelImportAssetsImportAssets2JPEGTablesMetadataPlaceObject

PlaceObject2PlaceObject3ProtectRemoveObjectRemoveObject2ScriptLimitsSetBackgroundColorSetTabIndexShowFrameSoundStreamBlockSoundStreamHeadSoundStreamHead2StartSoundStartSound2SymbolClassVideoFrame

Sunday, 25. April 2010

Page 28: Hacking swf

SWF 7

SWF Tag Evolution

CSMTextSettingsDefineBinaryDataDefineBitsDefineBitsJPEG2DefineBitsJPEG3DefineBitsJPEG4DefineBitsLosslessDefineBitsLossless2DefineButtonDefineButton2DefineButtonCxformDefineButtonSoundDefineEditTextDefineFontDefineFont2DefineFont3

DefineFont4DefineFontAlignZonesDefineFontInfoDefineFontInfo2DefineFontNameDefineMorphShapeDefineMorphShape2DefineScalingGridDefineSceneAnd...DefineShapeDefineShape2DefineShape3DefineShape4DefineSoundDefineSpriteDefineText

DefineText2DefineVideoStreamDoABCDoActionDoInitActionEnableDebuggerEnableDebugger2EndExportAssetsFileAttributesFrameLabelImportAssetsImportAssets2JPEGTablesMetadataPlaceObject

PlaceObject2PlaceObject3ProtectRemoveObjectRemoveObject2ScriptLimitsSetBackgroundColorSetTabIndexShowFrameSoundStreamBlockSoundStreamHeadSoundStreamHead2StartSoundStartSound2SymbolClassVideoFrame

Sunday, 25. April 2010

Page 29: Hacking swf

SWF 8

SWF Tag Evolution

CSMTextSettingsDefineBinaryDataDefineBitsDefineBitsJPEG2DefineBitsJPEG3DefineBitsJPEG4DefineBitsLosslessDefineBitsLossless2DefineButtonDefineButton2DefineButtonCxformDefineButtonSoundDefineEditTextDefineFontDefineFont2DefineFont3

DefineFont4DefineFontAlignZonesDefineFontInfoDefineFontInfo2DefineFontNameDefineMorphShapeDefineMorphShape2DefineScalingGridDefineSceneAnd...DefineShapeDefineShape2DefineShape3DefineShape4DefineSoundDefineSpriteDefineText

DefineText2DefineVideoStreamDoABCDoActionDoInitActionEnableDebuggerEnableDebugger2EndExportAssetsFileAttributesFrameLabelImportAssetsImportAssets2JPEGTablesMetadataPlaceObject

PlaceObject2PlaceObject3ProtectRemoveObjectRemoveObject2ScriptLimitsSetBackgroundColorSetTabIndexShowFrameSoundStreamBlockSoundStreamHeadSoundStreamHead2StartSoundStartSound2SymbolClassVideoFrame

Sunday, 25. April 2010

Page 30: Hacking swf

SWF 9

SWF Tag Evolution

CSMTextSettingsDefineBinaryDataDefineBitsDefineBitsJPEG2DefineBitsJPEG3DefineBitsJPEG4DefineBitsLosslessDefineBitsLossless2DefineButtonDefineButton2DefineButtonCxformDefineButtonSoundDefineEditTextDefineFontDefineFont2DefineFont3

DefineFont4DefineFontAlignZonesDefineFontInfoDefineFontInfo2DefineFontNameDefineMorphShapeDefineMorphShape2DefineScalingGridDefineSceneAnd...DefineShapeDefineShape2DefineShape3DefineShape4DefineSoundDefineSpriteDefineText

DefineText2DefineVideoStreamDoABCDoActionDoInitActionEnableDebuggerEnableDebugger2EndExportAssetsFileAttributesFrameLabelImportAssetsImportAssets2JPEGTablesMetadataPlaceObject

PlaceObject2PlaceObject3ProtectRemoveObjectRemoveObject2ScriptLimitsSetBackgroundColorSetTabIndexShowFrameSoundStreamBlockSoundStreamHeadSoundStreamHead2StartSoundStartSound2SymbolClassVideoFrame

Sunday, 25. April 2010

Page 31: Hacking swf

SWF 10

SWF Tag Evolution

CSMTextSettingsDefineBinaryDataDefineBitsDefineBitsJPEG2DefineBitsJPEG3DefineBitsJPEG4DefineBitsLosslessDefineBitsLossless2DefineButtonDefineButton2DefineButtonCxformDefineButtonSoundDefineEditTextDefineFontDefineFont2DefineFont3

DefineFont4DefineFontAlignZonesDefineFontInfoDefineFontInfo2DefineFontNameDefineMorphShapeDefineMorphShape2DefineScalingGridDefineSceneAnd...DefineShapeDefineShape2DefineShape3DefineShape4DefineSoundDefineSpriteDefineText

DefineText2DefineVideoStreamDoABCDoActionDoInitActionEnableDebuggerEnableDebugger2EndExportAssetsFileAttributesFrameLabelImportAssetsImportAssets2JPEGTablesMetadataPlaceObject

PlaceObject2PlaceObject3ProtectRemoveObjectRemoveObject2ScriptLimitsSetBackgroundColorSetTabIndexShowFrameSoundStreamBlockSoundStreamHeadSoundStreamHead2StartSoundStartSound2SymbolClassVideoFrame

Sunday, 25. April 2010

Page 32: Hacking swf

Definition tags

SWF Tag Families

DefineShapeDefineButtonDefineSpriteDefineBitsDefineFontDefineText

DefineSoundDefineVideoStream

define the SWF’s contentassign a unique character id

characters are stored in dictionary for use/reuse

Sunday, 25. April 2010

Page 33: Hacking swf

Control tags

SWF Tag Families

control the flow of the SWFcreate/manipulate instances of objects from the dictionary

PlaceObjectRemoveObject

ShowFrame

Sunday, 25. April 2010

Page 34: Hacking swf

A simple example

The Flow

SWF Dictionary Display list

Empty EmptyDefineShapeID 1

DefineSpriteID 2

PlaceObjectID 1 at depth 1

ShowFrame

ShowFrame

PlaceObjectID 2 at depth 2

RemoveObjectfrom depth 1

Sunday, 25. April 2010

Page 35: Hacking swf

A simple example

The Flow

SWF

DefineShapeID 1

DefineSpriteID 2

PlaceObjectID 1 at depth 1

ShowFrame

ShowFrame

Dictionary Display list

Empty

PlaceObjectID 2 at depth 2

RemoveObjectfrom depth 1

ShapeID 1

Sunday, 25. April 2010

Page 36: Hacking swf

A simple example

The Flow

SWF

DefineShapeID 1

DefineSpriteID 2

PlaceObjectID 1 at depth 1

ShowFrame

ShowFrame

Dictionary Display list

Empty

PlaceObjectID 2 at depth 2

RemoveObjectfrom depth 1

ShapeID 1

SpriteID 2

Sunday, 25. April 2010

Page 37: Hacking swf

A simple example

The Flow

SWF

DefineShapeID 1

DefineSpriteID 2

ShowFrame

ShowFrame

Dictionary Display list

PlaceObjectID 2 at depth 2

RemoveObjectfrom depth 1

ShapeID 1

SpriteID 2

PlaceObjectID 1 at depth 1

Shapeat depth 1

Sunday, 25. April 2010

Page 38: Hacking swf

A simple example

The Flow

SWF

DefineShapeID 1

DefineSpriteID 2

ShowFrame

ShowFrame

Dictionary Display list

PlaceObjectID 2 at depth 2

RemoveObjectfrom depth 1

ShapeID 1

SpriteID 2

PlaceObjectID 1 at depth 1

Shapeat depth 1

Spriteat depth 2

Sunday, 25. April 2010

Page 39: Hacking swf

A simple example

The Flow

SWF

DefineShapeID 1

DefineSpriteID 2

ShowFrame

ShowFrame

Dictionary Display list

PlaceObjectID 2 at depth 2

RemoveObjectfrom depth 1

ShapeID 1

SpriteID 2

PlaceObjectID 1 at depth 1

Shapeat depth 1

Spriteat depth 2

Sunday, 25. April 2010

Page 40: Hacking swf

A simple example

The Flow

SWF

DefineShapeID 1

DefineSpriteID 2

ShowFrame

ShowFrame

Dictionary Display list

PlaceObjectID 2 at depth 2

RemoveObjectfrom depth 2

ShapeID 1

SpriteID 2

PlaceObjectID 1 at depth 1

Shapeat depth 1

Spriteat depth 2

Sunday, 25. April 2010

Page 41: Hacking swf

A simple example

The Flow

SWF

DefineShapeID 1

DefineSpriteID 2

ShowFrame

ShowFrame

Dictionary Display list

PlaceObjectID 2 at depth 2

RemoveObjectfrom depth 2

ShapeID 1

SpriteID 2

PlaceObjectID 1 at depth 1

Shapeat depth 1

Sunday, 25. April 2010

Page 42: Hacking swf

Defines some characteristics of the SWF file

The FileAttributes tag

[69:FileAttributes] AS3: true HasMetadata: true UseDirectBlit: false UseGPU: false UseNetwork: true

Sunday, 25. April 2010

Page 43: Hacking swf

Defines some characteristics of the SWF file

The ScriptLimits tag

[65:ScriptLimits] MaxRecursionDepth: 1000 ScriptTimeoutSeconds: 60

Sunday, 25. April 2010

Page 44: Hacking swf

Compile time/date, info about compiler used

The ProductInfo tag

[41:ProductInfo] ProductID: 3 Edition: 6 Version: 4.0.0.14159 CompileDate: Wed Apr 21 03:23:16 GMT-0400 2010

ProductID (UI32) 0: Unknown 1: Macromedia Flex for J2EE 2: Macromedia Flex for .NET 3: Adobe Flex

Edition (UI32) 0: Developer Edition 1: Full Commercial Edition 2: Non Commercial Edition 3: Educational Edition 4: Not For Resale (NFR) Edition 5: Trial Edition 6: None

Sunday, 25. April 2010

Page 45: Hacking swf

Defines styles and geometry of a shape

The DefineShape tag

[83:DefineShape4] ID: 1, ShapeBounds: 15,125,15,125, EdgeBounds: 20,120,20,120 FillStyles: [1] [SWFFillStyle] Type: 0 (solid), Color: FF0000 LineStyles: [1] [SWFLineStyle2] Width: 10, Color: 000000 ShapeRecords: [SWFShapeRecordStyleChange] MoveTo: 120,20, FillStyle1: 1, LineStyle: 1 [SWFShapeRecordStraightEdge] Vertical: 100 [SWFShapeRecordStraightEdge] Horizontal: -100 [SWFShapeRecordStraightEdge] Vertical: -100 [SWFShapeRecordStraightEdge] Horizontal: 100 [SWFShapeRecordEnd]

Sunday, 25. April 2010

Page 46: Hacking swf

Defines styles and geometry of a shape

The DefineShape tag

[83:DefineShape4] ID: 1, ShapeBounds: 15,125,15,125, EdgeBounds: 20,120,20,120 FillStyles: [1] [SWFFillStyle] Type: 0 (solid), Color: FF0000 LineStyles: [1] [SWFLineStyle2] Width: 10, Color: 000000 ShapeRecords: [SWFShapeRecordStyleChange] MoveTo: 120,20, FillStyle1: 1, LineStyle: 1 [SWFShapeRecordStraightEdge] Vertical: 100 [SWFShapeRecordStraightEdge] Horizontal: -100 [SWFShapeRecordStraightEdge] Vertical: -100 [SWFShapeRecordStraightEdge] Horizontal: 100 [SWFShapeRecordEnd]

Shape records are NOT drawing instructions!

They merely DEFINE the styles and geometry of the shape!

Sunday, 25. April 2010

Page 47: Hacking swf

The DefineShape tag

[83:DefineShape4] ID: 1, ShapeBounds: 15,175,15,125, EdgeBounds: 20,170,20,120 FillStyles: [1] [SWFFillStyle] Type: 0 (solid), Color: FF0000 [2] [SWFFillStyle] Type: 0 (solid), Color: 666666 LineStyles: [1] [SWFLineStyle2] Width: 10, Color: 000000 ShapeRecords: [SWFShapeRecordStyleChange] MoveTo: 120,45, FillStyle1: 2, LineStyle: 1 [SWFShapeRecordStraightEdge] Horizontal: 50 [SWFShapeRecordStraightEdge] Vertical: 50 [SWFShapeRecordStraightEdge] Horizontal: -50 [SWFShapeRecordStyleChange] FillStyle1: 1 [SWFShapeRecordStraightEdge] Vertical: 25 [SWFShapeRecordStraightEdge] Horizontal: -100 [SWFShapeRecordStraightEdge] Vertical: -100 [SWFShapeRecordStraightEdge] Horizontal: 100 [SWFShapeRecordStraightEdge] Vertical: 25 [SWFShapeRecordStyleChange] FillStyle0: 2 [SWFShapeRecordStraightEdge] Horizontal: -50 [SWFShapeRecordStraightEdge] Vertical: 50 [SWFShapeRecordStraightEdge] Horizontal: 50 [SWFShapeRecordEnd]

Defines styles and geometry of a shape

Sunday, 25. April 2010

Page 48: Hacking swf

The DefineShape tag

[83:DefineShape4] ID: 1, ShapeBounds: 15,175,15,125, EdgeBounds: 20,170,20,120 FillStyles: [1] [SWFFillStyle] Type: 0 (solid), Color: FF0000 [2] [SWFFillStyle] Type: 0 (solid), Color: 666666 LineStyles: [1] [SWFLineStyle2] Width: 10, Color: 000000 ShapeRecords: [SWFShapeRecordStyleChange] MoveTo: 120,45, FillStyle1: 2, LineStyle: 1 [SWFShapeRecordStraightEdge] Horizontal: 50 [SWFShapeRecordStraightEdge] Vertical: 50 [SWFShapeRecordStraightEdge] Horizontal: -50 [SWFShapeRecordStyleChange] FillStyle1: 1 [SWFShapeRecordStraightEdge] Vertical: 25 [SWFShapeRecordStraightEdge] Horizontal: -100 [SWFShapeRecordStraightEdge] Vertical: -100 [SWFShapeRecordStraightEdge] Horizontal: 100 [SWFShapeRecordStraightEdge] Vertical: 25 [SWFShapeRecordStyleChange] FillStyle0: 2 [SWFShapeRecordStraightEdge] Horizontal: -50 [SWFShapeRecordStraightEdge] Vertical: 50 [SWFShapeRecordStraightEdge] Horizontal: 50 [SWFShapeRecordEnd]

Defines styles and geometry of a shape

Sunday, 25. April 2010

Page 49: Hacking swf

The DefineShape tag

[83:DefineShape4] ID: 1, ShapeBounds: 15,175,15,125, EdgeBounds: 20,170,20,120 FillStyles: [1] [SWFFillStyle] Type: 0 (solid), Color: FF0000 [2] [SWFFillStyle] Type: 0 (solid), Color: 666666 LineStyles: [1] [SWFLineStyle2] Width: 10, Color: 000000 ShapeRecords: [SWFShapeRecordStyleChange] MoveTo: 120,45, FillStyle1: 2, LineStyle: 1 [SWFShapeRecordStraightEdge] Horizontal: 50 [SWFShapeRecordStraightEdge] Vertical: 50 [SWFShapeRecordStraightEdge] Horizontal: -50 [SWFShapeRecordStyleChange] FillStyle1: 1 [SWFShapeRecordStraightEdge] Vertical: 25 [SWFShapeRecordStraightEdge] Horizontal: -100 [SWFShapeRecordStraightEdge] Vertical: -100 [SWFShapeRecordStraightEdge] Horizontal: 100 [SWFShapeRecordStraightEdge] Vertical: 25 [SWFShapeRecordStyleChange] FillStyle0: 2 [SWFShapeRecordStraightEdge] Horizontal: -50 [SWFShapeRecordStraightEdge] Vertical: 50 [SWFShapeRecordStraightEdge] Horizontal: 50 [SWFShapeRecordEnd]

Defines styles and geometry of a shape

Sunday, 25. April 2010

Page 50: Hacking swf

The DefineShape tag

[83:DefineShape4] ID: 1, ShapeBounds: 15,175,15,125, EdgeBounds: 20,170,20,120 FillStyles: [1] [SWFFillStyle] Type: 0 (solid), Color: FF0000 [2] [SWFFillStyle] Type: 0 (solid), Color: 666666 LineStyles: [1] [SWFLineStyle2] Width: 10, Color: 000000 ShapeRecords: [SWFShapeRecordStyleChange] MoveTo: 120,45, FillStyle1: 2, LineStyle: 1 [SWFShapeRecordStraightEdge] Horizontal: 50 [SWFShapeRecordStraightEdge] Vertical: 50 [SWFShapeRecordStraightEdge] Horizontal: -50 [SWFShapeRecordStyleChange] FillStyle1: 1 [SWFShapeRecordStraightEdge] Vertical: 25 [SWFShapeRecordStraightEdge] Horizontal: -100 [SWFShapeRecordStraightEdge] Vertical: -100 [SWFShapeRecordStraightEdge] Horizontal: 100 [SWFShapeRecordStraightEdge] Vertical: 25 [SWFShapeRecordStyleChange] FillStyle0: 2 [SWFShapeRecordStraightEdge] Horizontal: -50 [SWFShapeRecordStraightEdge] Vertical: 50 [SWFShapeRecordStraightEdge] Horizontal: 50 [SWFShapeRecordEnd]

Defines styles and geometry of a shape

Sunday, 25. April 2010

Page 51: Hacking swf

The DefineShape tag

[83:DefineShape4] ID: 1, ShapeBounds: 15,175,15,125, EdgeBounds: 20,170,20,120 FillStyles: [1] [SWFFillStyle] Type: 0 (solid), Color: FF0000 [2] [SWFFillStyle] Type: 0 (solid), Color: 666666 LineStyles: [1] [SWFLineStyle2] Width: 10, Color: 000000 ShapeRecords: [SWFShapeRecordStyleChange] MoveTo: 120,45, FillStyle1: 2, LineStyle: 1 [SWFShapeRecordStraightEdge] Horizontal: 50 [SWFShapeRecordStraightEdge] Vertical: 50 [SWFShapeRecordStraightEdge] Horizontal: -50 [SWFShapeRecordStyleChange] FillStyle1: 1 [SWFShapeRecordStraightEdge] Vertical: 25 [SWFShapeRecordStraightEdge] Horizontal: -100 [SWFShapeRecordStraightEdge] Vertical: -100 [SWFShapeRecordStraightEdge] Horizontal: 100 [SWFShapeRecordStraightEdge] Vertical: 25 [SWFShapeRecordStyleChange] FillStyle0: 2 [SWFShapeRecordStraightEdge] Horizontal: -50 [SWFShapeRecordStraightEdge] Vertical: 50 [SWFShapeRecordStraightEdge] Horizontal: 50 [SWFShapeRecordEnd]

Defines styles and geometry of a shape

Sunday, 25. April 2010

Page 52: Hacking swf

The DefineShape tag

[83:DefineShape4] ID: 1, ShapeBounds: 15,175,15,125, EdgeBounds: 20,170,20,120 FillStyles: [1] [SWFFillStyle] Type: 0 (solid), Color: FF0000 [2] [SWFFillStyle] Type: 0 (solid), Color: 666666 LineStyles: [1] [SWFLineStyle2] Width: 10, Color: 000000 ShapeRecords: [SWFShapeRecordStyleChange] MoveTo: 120,45, FillStyle1: 2, LineStyle: 1 [SWFShapeRecordStraightEdge] Horizontal: 50 [SWFShapeRecordStraightEdge] Vertical: 50 [SWFShapeRecordStraightEdge] Horizontal: -50 [SWFShapeRecordStyleChange] FillStyle1: 1 [SWFShapeRecordStraightEdge] Vertical: 25 [SWFShapeRecordStraightEdge] Horizontal: -100 [SWFShapeRecordStraightEdge] Vertical: -100 [SWFShapeRecordStraightEdge] Horizontal: 100 [SWFShapeRecordStraightEdge] Vertical: 25 [SWFShapeRecordStyleChange] FillStyle0: 2 [SWFShapeRecordStraightEdge] Horizontal: -50 [SWFShapeRecordStraightEdge] Vertical: 50 [SWFShapeRecordStraightEdge] Horizontal: 50 [SWFShapeRecordEnd]

Defines styles and geometry of a shape

Sunday, 25. April 2010

Page 53: Hacking swf

The DefineShape tag

[83:DefineShape4] ID: 1, ShapeBounds: 15,175,15,125, EdgeBounds: 20,170,20,120 FillStyles: [1] [SWFFillStyle] Type: 0 (solid), Color: FF0000 [2] [SWFFillStyle] Type: 0 (solid), Color: 666666 LineStyles: [1] [SWFLineStyle2] Width: 10, Color: 000000 ShapeRecords: [SWFShapeRecordStyleChange] MoveTo: 120,45, FillStyle1: 2, LineStyle: 1 [SWFShapeRecordStraightEdge] Horizontal: 50 [SWFShapeRecordStraightEdge] Vertical: 50 [SWFShapeRecordStraightEdge] Horizontal: -50 [SWFShapeRecordStyleChange] FillStyle1: 1 [SWFShapeRecordStraightEdge] Vertical: 25 [SWFShapeRecordStraightEdge] Horizontal: -100 [SWFShapeRecordStraightEdge] Vertical: -100 [SWFShapeRecordStraightEdge] Horizontal: 100 [SWFShapeRecordStraightEdge] Vertical: 25 [SWFShapeRecordStyleChange] FillStyle0: 2 [SWFShapeRecordStraightEdge] Horizontal: -50 [SWFShapeRecordStraightEdge] Vertical: 50 [SWFShapeRecordStraightEdge] Horizontal: 50 [SWFShapeRecordEnd]

Defines styles and geometry of a shape

Sunday, 25. April 2010

Page 54: Hacking swf

The DefineShape tag

[83:DefineShape4] ID: 1, ShapeBounds: 15,175,15,125, EdgeBounds: 20,170,20,120 FillStyles: [1] [SWFFillStyle] Type: 0 (solid), Color: FF0000 [2] [SWFFillStyle] Type: 0 (solid), Color: 666666 LineStyles: [1] [SWFLineStyle2] Width: 10, Color: 000000 ShapeRecords: [SWFShapeRecordStyleChange] MoveTo: 120,45, FillStyle1: 2, LineStyle: 1 [SWFShapeRecordStraightEdge] Horizontal: 50 [SWFShapeRecordStraightEdge] Vertical: 50 [SWFShapeRecordStraightEdge] Horizontal: -50 [SWFShapeRecordStyleChange] FillStyle1: 1 [SWFShapeRecordStraightEdge] Vertical: 25 [SWFShapeRecordStraightEdge] Horizontal: -100 [SWFShapeRecordStraightEdge] Vertical: -100 [SWFShapeRecordStraightEdge] Horizontal: 100 [SWFShapeRecordStraightEdge] Vertical: 25 [SWFShapeRecordStyleChange] FillStyle0: 2 [SWFShapeRecordStraightEdge] Horizontal: -50 [SWFShapeRecordStraightEdge] Vertical: 50 [SWFShapeRecordStraightEdge] Horizontal: 50 [SWFShapeRecordEnd]

Defines styles and geometry of a shape

Sunday, 25. April 2010

Page 55: Hacking swf

The DefineShape tag

[83:DefineShape4] ID: 1, ShapeBounds: 15,175,15,125, EdgeBounds: 20,170,20,120 FillStyles: [1] [SWFFillStyle] Type: 0 (solid), Color: FF0000 [2] [SWFFillStyle] Type: 0 (solid), Color: 666666 LineStyles: [1] [SWFLineStyle2] Width: 10, Color: 000000 ShapeRecords: [SWFShapeRecordStyleChange] MoveTo: 120,45, FillStyle1: 2, LineStyle: 1 [SWFShapeRecordStraightEdge] Horizontal: 50 [SWFShapeRecordStraightEdge] Vertical: 50 [SWFShapeRecordStraightEdge] Horizontal: -50 [SWFShapeRecordStyleChange] FillStyle1: 1 [SWFShapeRecordStraightEdge] Vertical: 25 [SWFShapeRecordStraightEdge] Horizontal: -100 [SWFShapeRecordStraightEdge] Vertical: -100 [SWFShapeRecordStraightEdge] Horizontal: 100 [SWFShapeRecordStraightEdge] Vertical: 25 [SWFShapeRecordStyleChange] FillStyle0: 2 [SWFShapeRecordStraightEdge] Horizontal: -50 [SWFShapeRecordStraightEdge] Vertical: 50 [SWFShapeRecordStraightEdge] Horizontal: 50 [SWFShapeRecordEnd]

Defines styles and geometry of a shape

Sunday, 25. April 2010

Page 56: Hacking swf

The DefineShape tag

[83:DefineShape4] ID: 1, ShapeBounds: 15,175,15,125, EdgeBounds: 20,170,20,120 FillStyles: [1] [SWFFillStyle] Type: 0 (solid), Color: FF0000 [2] [SWFFillStyle] Type: 0 (solid), Color: 666666 LineStyles: [1] [SWFLineStyle2] Width: 10, Color: 000000 ShapeRecords: [SWFShapeRecordStyleChange] MoveTo: 120,45, FillStyle1: 2, LineStyle: 1 [SWFShapeRecordStraightEdge] Horizontal: 50 [SWFShapeRecordStraightEdge] Vertical: 50 [SWFShapeRecordStraightEdge] Horizontal: -50 [SWFShapeRecordStyleChange] FillStyle1: 1 [SWFShapeRecordStraightEdge] Vertical: 25 [SWFShapeRecordStraightEdge] Horizontal: -100 [SWFShapeRecordStraightEdge] Vertical: -100 [SWFShapeRecordStraightEdge] Horizontal: 100 [SWFShapeRecordStraightEdge] Vertical: 25 [SWFShapeRecordStyleChange] FillStyle0: 2 [SWFShapeRecordStraightEdge] Horizontal: -50 [SWFShapeRecordStraightEdge] Vertical: 50 [SWFShapeRecordStraightEdge] Horizontal: 50 [SWFShapeRecordEnd]

Defines styles and geometry of a shape

Sunday, 25. April 2010

Page 57: Hacking swf

The DefineShape tag

[83:DefineShape4] ID: 1, ShapeBounds: 15,175,15,125, EdgeBounds: 20,170,20,120 FillStyles: [1] [SWFFillStyle] Type: 0 (solid), Color: FF0000 [2] [SWFFillStyle] Type: 0 (solid), Color: 666666 LineStyles: [1] [SWFLineStyle2] Width: 10, Color: 000000 ShapeRecords: [SWFShapeRecordStyleChange] MoveTo: 120,45, FillStyle1: 2, LineStyle: 1 [SWFShapeRecordStraightEdge] Horizontal: 50 [SWFShapeRecordStraightEdge] Vertical: 50 [SWFShapeRecordStraightEdge] Horizontal: -50 [SWFShapeRecordStyleChange] FillStyle1: 1 [SWFShapeRecordStraightEdge] Vertical: 25 [SWFShapeRecordStraightEdge] Horizontal: -100 [SWFShapeRecordStraightEdge] Vertical: -100 [SWFShapeRecordStraightEdge] Horizontal: 100 [SWFShapeRecordStraightEdge] Vertical: 25 [SWFShapeRecordStyleChange] FillStyle0: 2 [SWFShapeRecordStraightEdge] Horizontal: -50 [SWFShapeRecordStraightEdge] Vertical: 50 [SWFShapeRecordStraightEdge] Horizontal: 50 [SWFShapeRecordEnd]

Defines styles and geometry of a shape

Sunday, 25. April 2010

Page 58: Hacking swf

The DefineShape tag

[83:DefineShape4] ID: 1, ShapeBounds: 15,175,15,125, EdgeBounds: 20,170,20,120 FillStyles: [1] [SWFFillStyle] Type: 0 (solid), Color: FF0000 [2] [SWFFillStyle] Type: 0 (solid), Color: 666666 LineStyles: [1] [SWFLineStyle2] Width: 10, Color: 000000 ShapeRecords: [SWFShapeRecordStyleChange] MoveTo: 120,45, FillStyle1: 2, LineStyle: 1 [SWFShapeRecordStraightEdge] Horizontal: 50 [SWFShapeRecordStraightEdge] Vertical: 50 [SWFShapeRecordStraightEdge] Horizontal: -50 [SWFShapeRecordStyleChange] FillStyle1: 1 [SWFShapeRecordStraightEdge] Vertical: 25 [SWFShapeRecordStraightEdge] Horizontal: -100 [SWFShapeRecordStraightEdge] Vertical: -100 [SWFShapeRecordStraightEdge] Horizontal: 100 [SWFShapeRecordStraightEdge] Vertical: 25 [SWFShapeRecordStyleChange] FillStyle0: 2 [SWFShapeRecordStraightEdge] Horizontal: -50 [SWFShapeRecordStraightEdge] Vertical: 50 [SWFShapeRecordStraightEdge] Horizontal: 50 [SWFShapeRecordEnd]

Defines styles and geometry of a shape

Sunday, 25. April 2010

Page 59: Hacking swf

The DefineShape tagSo what about those two FillStyles?!

Sunday, 25. April 2010

Page 60: Hacking swf

The DefineShape tagSo what about those two FillStyles?!

Sunday, 25. April 2010

Page 61: Hacking swf

The DefineShape tagSo what about those two FillStyles?!

FillStyle1

FillStyle0

Sunday, 25. April 2010

Page 62: Hacking swf

The DefineShape tag

[83:DefineShape4] ID: 1, ShapeBounds: 15,175,15,125, EdgeBounds: 20,170,20,120 FillStyles: [1] [SWFFillStyle] Type: 0 (solid), Color: FF0000 [2] [SWFFillStyle] Type: 0 (solid), Color: 666666 LineStyles: [1] [SWFLineStyle2] Width: 10, Color: 000000 ShapeRecords: [SWFShapeRecordStyleChange] MoveTo: 120,45, FillStyle1: 2, LineStyle: 1 [SWFShapeRecordStraightEdge] Horizontal: 50 [SWFShapeRecordStraightEdge] Vertical: 50 [SWFShapeRecordStraightEdge] Horizontal: -50 [SWFShapeRecordStyleChange] FillStyle1: 1 [SWFShapeRecordStraightEdge] Vertical: 25 [SWFShapeRecordStraightEdge] Horizontal: -100 [SWFShapeRecordStraightEdge] Vertical: -100 [SWFShapeRecordStraightEdge] Horizontal: 100 [SWFShapeRecordStraightEdge] Vertical: 25 [SWFShapeRecordStyleChange] FillStyle0: 2 [SWFShapeRecordStraightEdge] Horizontal: -50 [SWFShapeRecordStraightEdge] Vertical: 50 [SWFShapeRecordStraightEdge] Horizontal: 50 [SWFShapeRecordEnd]

Defines styles and geometry of a shape

Sunday, 25. April 2010

Page 63: Hacking swf

The DefineShape tag

[83:DefineShape4] ID: 1, ShapeBounds: 15,175,15,125, EdgeBounds: 20,170,20,120 FillStyles: [1] [SWFFillStyle] Type: 0 (solid), Color: FF0000 [2] [SWFFillStyle] Type: 0 (solid), Color: 666666 LineStyles: [1] [SWFLineStyle2] Width: 10, Color: 000000 ShapeRecords: [SWFShapeRecordStyleChange] MoveTo: 120,45, FillStyle1: 2, LineStyle: 1 [SWFShapeRecordStraightEdge] Horizontal: 50 [SWFShapeRecordStraightEdge] Vertical: 50 [SWFShapeRecordStraightEdge] Horizontal: -50 [SWFShapeRecordStyleChange] FillStyle1: 1 [SWFShapeRecordStraightEdge] Vertical: 25 [SWFShapeRecordStraightEdge] Horizontal: -100 [SWFShapeRecordStraightEdge] Vertical: -100 [SWFShapeRecordStraightEdge] Horizontal: 100 [SWFShapeRecordStraightEdge] Vertical: 25 [SWFShapeRecordStyleChange] FillStyle0: 2 [SWFShapeRecordStraightEdge] Horizontal: -50 [SWFShapeRecordStraightEdge] Vertical: 50 [SWFShapeRecordStraightEdge] Horizontal: 50 [SWFShapeRecordEnd]

Defines styles and geometry of a shape

Sunday, 25. April 2010

Page 64: Hacking swf

The DefineShape tag

[83:DefineShape4] ID: 1, ShapeBounds: 15,175,15,125, EdgeBounds: 20,170,20,120 FillStyles: [1] [SWFFillStyle] Type: 0 (solid), Color: FF0000 [2] [SWFFillStyle] Type: 0 (solid), Color: 666666 LineStyles: [1] [SWFLineStyle2] Width: 10, Color: 000000 ShapeRecords: [SWFShapeRecordStyleChange] MoveTo: 120,45, FillStyle1: 2, LineStyle: 1 [SWFShapeRecordStraightEdge] Horizontal: 50 [SWFShapeRecordStraightEdge] Vertical: 50 [SWFShapeRecordStraightEdge] Horizontal: -50 [SWFShapeRecordStyleChange] FillStyle1: 1 [SWFShapeRecordStraightEdge] Vertical: 25 [SWFShapeRecordStraightEdge] Horizontal: -100 [SWFShapeRecordStraightEdge] Vertical: -100 [SWFShapeRecordStraightEdge] Horizontal: 100 [SWFShapeRecordStraightEdge] Vertical: 25 [SWFShapeRecordStyleChange] FillStyle0: 2 [SWFShapeRecordStraightEdge] Horizontal: -50 [SWFShapeRecordStraightEdge] Vertical: 50 [SWFShapeRecordStraightEdge] Horizontal: 50 [SWFShapeRecordEnd]

Defines styles and geometry of a shape

Sunday, 25. April 2010

Page 65: Hacking swf

The DefineShape tag

[83:DefineShape4] ID: 1, ShapeBounds: 15,175,15,125, EdgeBounds: 20,170,20,120 FillStyles: [1] [SWFFillStyle] Type: 0 (solid), Color: FF0000 [2] [SWFFillStyle] Type: 0 (solid), Color: 666666 LineStyles: [1] [SWFLineStyle2] Width: 10, Color: 000000 ShapeRecords: [SWFShapeRecordStyleChange] MoveTo: 120,45, FillStyle1: 2, LineStyle: 1 [SWFShapeRecordStraightEdge] Horizontal: 50 [SWFShapeRecordStraightEdge] Vertical: 50 [SWFShapeRecordStraightEdge] Horizontal: -50 [SWFShapeRecordStyleChange] FillStyle1: 1 [SWFShapeRecordStraightEdge] Vertical: 25 [SWFShapeRecordStraightEdge] Horizontal: -100 [SWFShapeRecordStraightEdge] Vertical: -100 [SWFShapeRecordStraightEdge] Horizontal: 100 [SWFShapeRecordStraightEdge] Vertical: 25 [SWFShapeRecordStyleChange] FillStyle0: 2 [SWFShapeRecordStraightEdge] Horizontal: -50 [SWFShapeRecordStraightEdge] Vertical: 50 [SWFShapeRecordStraightEdge] Horizontal: 50 [SWFShapeRecordEnd]

Defines styles and geometry of a shape

Sunday, 25. April 2010

Page 66: Hacking swf

DEMO

Sunday, 25. April 2010

Page 67: Hacking swf

Thanks!

wahlers.com.br/claus/blogBlog

github.com/clausGitHub

@cwahlersTwitter

Claus Wahlerscôdeazur brasil

[email protected]

Sunday, 25. April 2010