unicode security mark davis. the unicode consortium software globalization standards: define...

29
Unicode Security Mark Davis

Upload: brianna-johnson

Post on 26-Mar-2015

230 views

Category:

Documents


2 download

TRANSCRIPT

Page 1: Unicode Security Mark Davis. The Unicode Consortium Software globalization standards: define properties and behavior for every character in every script

Unicode Security

Mark Davis

Page 2: Unicode Security Mark Davis. The Unicode Consortium Software globalization standards: define properties and behavior for every character in every script

The Unicode Consortium

Software globalization standards: define properties and behavior for every character in every script

Unicode Standard: a unique code for every character

Common Locale Data Repository: LDML format plus repository for required locale data

Collation, line breaking, regex, charset mapping, …

Used by every major modern operating system, browser, office software, email client,…

Core of XML, HTML, Java, C#, C (with ICU), Javascript, …

Page 3: Unicode Security Mark Davis. The Unicode Consortium Software globalization standards: define properties and behavior for every character in every script

Key issue: Identity

A thinks:X = x B thinks:

X ≠ x

Page 4: Unicode Security Mark Davis. The Unicode Consortium Software globalization standards: define properties and behavior for every character in every script

IDN Example

You get an email about your paypal.com account, click on the link…

You carefully examine your browser's address box to make sure that it is actually going to http://paypal.com/ …

But actually it is going to a spoof site: “paypal.com” with the Cyrillic letter “p”.

You (System A) think that they are the same

DNS (System B) thinks they are different

Page 5: Unicode Security Mark Davis. The Unicode Consortium Software globalization standards: define properties and behavior for every character in every script

Examples: Visual Confusables

Cross-Script

p in Latin vs p in Cyrillic

In-Script

rn may appear at display sizes like m

अ + �� typically looks identical to आ

so�s looks like søs

Rendering Support

ä with two umlauts may look the same as ä with one

el is actually e + l

Page 6: Unicode Security Mark Davis. The Unicode Consortium Software globalization standards: define properties and behavior for every character in every script

The answer to the ultimate question of the Universe:

৪ ୨ !

Thus ৪ ୨ = 42

Western 0 1 2 3 4 5 6 7 8 9

Bengali ০ ১ ২ ৩ ৪ ৫ ৬ ৭ ৮ ৯Oriya ୦ ୧ ୨ ୩ ୪ ୫ ୬ ୭ ୮ ୯

Page 7: Unicode Security Mark Davis. The Unicode Consortium Software globalization standards: define properties and behavior for every character in every script

Malicious Rendering

Font technologies such as TrueType/OpenType are extremely powerful.

A glyph in such a font actually may use a small program to deform the shape radically according to resolution, platform, or language.

Powerful enough to change the appearance of $100.00 on the screen to $200.00 when printed.

Page 8: Unicode Security Mark Davis. The Unicode Consortium Software globalization standards: define properties and behavior for every character in every script

Syntax Spoofing

http://example.org/1234/not.mydomain.com

http://example.org/1234/not.mydomain.com

/ = fraction-slash

Also possible without Unicode:

http://example.org--long-and-obscure-list-of-characters.mydomain.com

Page 9: Unicode Security Mark Davis. The Unicode Consortium Software globalization standards: define properties and behavior for every character in every script

Non-Visual Attacks

Exploiting Expectations

Collation: X < Y, so X + H < Y + Hwrong

Encoding: ‘/’ is always represented by 2F16

wrong

Casing: len(X) = len(toUpper(X)) wrong

Norm.: NFC(x + y) = NFC(x) + NFC(y)wrong

Buffer overflows & identity mismatches

Page 10: Unicode Security Mark Davis. The Unicode Consortium Software globalization standards: define properties and behavior for every character in every script

Casing: Buffer Overflows

Operation UTFFacto

rSample

Lower

8 1.5X Ⱥ U+023A

16, 32 1X A U+0041

Upper / Title / Fold

8, 16, 32

3X ΐ U+0390

Page 11: Unicode Security Mark Davis. The Unicode Consortium Software globalization standards: define properties and behavior for every character in every script

Comparison Vulnerability: Example

LDAP doesn’t specify comparison operation

Two different implementations can use different mechanisms, thus:

Malfunction: The user with valid access rights to a certain resource actually cannot access it, because the binary representation of user ID used for the user registry counts as different from the one specified in the access control list.

Security Hole: a new user whose ID is equivalent to another user's in the directory system can get the access right to a protected resource.

Page 12: Unicode Security Mark Davis. The Unicode Consortium Software globalization standards: define properties and behavior for every character in every script

Comparison IssuesTwo binary Unicode orders:

code point/UTF-8/UTF-32 vs UTF16 order.

Case-Sensitive vs Insensitive

Language-Sensitive vs Insensitive

Normalized vs Not

Vendor Differences

Regex matching: where important for security, ensure that:

conforms to the requirements of [UTS18], and

uses an up-to-date version of the Unicode Standard for its properties.

See Proposed Collation Registry

Page 13: Unicode Security Mark Davis. The Unicode Consortium Software globalization standards: define properties and behavior for every character in every script

Other ProblemsCharset Issues

IANA / MIME charset names are ill-defined: vendors often convert the same charset different ways. ► http://www.w3.org/TR/japanese-xml/

When converting charsets, don’t simply omit characters that cannot be converted.

Never use Private Use characters, unassigned characters.

Always tag data!Example: tag currencies with an explicit currency ID (from ISO 4217); a "naked" amount may be misinterpreted as the wrong currency.

Don’t assume currencies, timezones, etc can be derived from locales (but ok to default and then confirm)

See Globalization Gotchas

Page 14: Unicode Security Mark Davis. The Unicode Consortium Software globalization standards: define properties and behavior for every character in every script

UAX #31: Identifier & Pattern Syntax

For identification of entitiesprogramming variables, resources, domain names, ...

Appropriate characters -- stable across versions

Not all natural language words:can’t

U.S.A.

Provides foundation:specifications can “tailor” it for different environments: adding or removing characters.

Page 15: Unicode Security Mark Davis. The Unicode Consortium Software globalization standards: define properties and behavior for every character in every script

“StringPrep” Processing

Map

Normalize

Prohibit

A → a

c + ¸ → ç

ㄱ + ㅏ → 가カ → カfi → f + i

& / . , …

Page 16: Unicode Security Mark Davis. The Unicode Consortium Software globalization standards: define properties and behavior for every character in every script

UAX #15: Unicode Normalization Forms

Normalizes most visually confusable sequences to unique form

c + ¸ → ç

ㄱ + ㅏ → 가

カ → カ

fi → f + i

Core part of StringPrep, other Identifier Profiles

Page 17: Unicode Security Mark Davis. The Unicode Consortium Software globalization standards: define properties and behavior for every character in every script

Domain Names

  String UTF-16 Internal - IDNA

1a at.com 0061 0308 0074 002E 0063 006F 006D xn--t-zfa.com

1b at.com 00E4 0074 002E 0063 006F 006D xn--t-zfa.com

2atοp.co

m0074 03BF 0070 002E 0063 006F 006D xn--tp-jbc.com

2btοp.co

m0074 006F 0070 002E 0063 006F 006D top.com

4aso�s.co

m0073 006F 0337 0073 002E 0063 006F 006D

xn--sos-rjc.com

4bsøs.co

m0073 00F8 0073 002E 0063 006F 006D xn--ss-lka.com

Page 18: Unicode Security Mark Davis. The Unicode Consortium Software globalization standards: define properties and behavior for every character in every script

UTR #36: Security Recommendations

General Security Issues (not just IDN)

V1 approved mid-2005; V2 in progresshttp://unicode.org/draft/reports/tr36/tr36.html

Describes the problems, recommends best practices

Users

Programmers

User-Agents (browsers, email, office apps)

Registries

Registrars

Page 19: Unicode Security Mark Davis. The Unicode Consortium Software globalization standards: define properties and behavior for every character in every script

UTS #39: Security Mechanisms

Supplies data /algorithms for implementations

Restricted character repertoire:

Based on Unicode Identifier Profile

Intersect with current NamePrep

Characters → scripts, confusable characters

Originally in UTR #36 Version 1; split out for clarity

http://www.unicode.org/draft/reports/tr39/tr39.html

Page 20: Unicode Security Mark Davis. The Unicode Consortium Software globalization standards: define properties and behavior for every character in every script

Current NamePrep ≠ Unicode Identifiers

a œ и س ש ௫ अ ཀ ฎ あꀅ

タ 入 ৫ 2 …

℞ § / ♔∞ ☃ ➥

√ …

http://unicode.org/reports/tr36/idn-chars.html

U3.2Symbols (2,974)

Non-Mod. (52,842)

U3.2 Alphanum* (37,200)

�� ჹ �� ჺ ሇ ऄ ঽ

U5.0Alphanum*(+2,810)

Page 21: Unicode Security Mark Davis. The Unicode Consortium Software globalization standards: define properties and behavior for every character in every script

Restriction Levels*Highly Restrictive

Single script, or from limited combinations: Han + Hiragana + Katakana

Only Identifier Profile: Letters, Numbers; no Symbols, Punctuation,…

Moderately Restrictive: Allow Latin with others except Cyrillic, Greek, Cherokee:

ip- アドレス .co.jp xخدمةrss.egMinimally Restrictive: Allow arbitrary mixtures of scripts:

sony-βίντεο.gr игро-shop.com

Subject also to restrictions on confusables

Page 22: Unicode Security Mark Davis. The Unicode Consortium Software globalization standards: define properties and behavior for every character in every script

Q & A

Page 23: Unicode Security Mark Davis. The Unicode Consortium Software globalization standards: define properties and behavior for every character in every script

Backup Slides

Page 24: Unicode Security Mark Davis. The Unicode Consortium Software globalization standards: define properties and behavior for every character in every script

Agenda

Unicode Background

Security Issues

Page 25: Unicode Security Mark Davis. The Unicode Consortium Software globalization standards: define properties and behavior for every character in every script

ICANN Guidelines v2http://icann.org/general/idn-guidelines-14nov05.htm

Improvement on v1,… but needs new revision:

ProcedurallyInsufficient time for thorough review

The disposition (with rationale) of comments not available

Only single cycle of public review

TechnicallyAny specification needs a much clearer structure – the exact implications of a claim to adhere to the guidelines are currently impossible to measure, and useless for security

#3 (script/language limitations) has far too many loopholes.

#4 (symbols) is too permissive, and not well-defined

#5 (registration) should use the post-nameprep’ed form

Page 26: Unicode Security Mark Davis. The Unicode Consortium Software globalization standards: define properties and behavior for every character in every script

Guideline 3 (lang./script limitations)

a) Associate with script except with language and script, or except with set of languages, or except with “more than one designator”

b) Publish set of code points, define variant code points; indicate script/language.

Why language? (too fuzzy to be testable)

Why script? (derivable from characters)

c) Single script in label, except when language requires, except with mixed-script confusables, except with “policy & table” defined.

Who decides when required?

Allows single-script confusables.

d) All registry policies documented and publicly available, with table for each set of code points

Machine readable? Discursive description?

Page 27: Unicode Security Mark Davis. The Unicode Consortium Software globalization standards: define properties and behavior for every character in every script

Guideline 4 (disallowed symbols)

a) Line symbol-drawing characters (as those in the Unicode Box Drawing block)

One small set of the many symbols

b) Symbols and icons that are neither alphanumeric nor ideographic language characters,

Numbers? Combining Marks? Letter modifiers? Kana length mark? Ill-defined, untestable.

c) Characters with well-established functions as protocol elements/ is confusable with a “protocol element” but isn’t one. Ill-defined, untestable.

d) Punctuation marks used solely to indicate the structure of sentencesEm-dash? Who decides? Ill-defined, untestable.

e) Punctuation marks that are used within words except “essential to the language” & “associated with explicit prescriptive rules”

Ill-defined, untestable.

f) Except “under corresponding conditions, a single specified character may be used as a separator within a label, … by designating a functionally equivalent punctuation mark from within the script.”

Ill-defined, untestable.

Page 28: Unicode Security Mark Davis. The Unicode Consortium Software globalization standards: define properties and behavior for every character in every script

Guideline 5 (registration)

A registry will define an IDN registration in terms of both its Unicode and ASCII-encoded representations.

Should use output Unicode representation (after mapping and normalization): otherwise many more visually confusable characters are present

Should say “ACE”, not ASCII.

Page 29: Unicode Security Mark Davis. The Unicode Consortium Software globalization standards: define properties and behavior for every character in every script

Unicode Recommendations

Precise Specification, Mechanically Testable:

Guideline 3 (script/language limitations) → Publicly document the Restriction Level being enforced (≤ Level 4) Publicly document the enforcement policy on confusables: whether

any two domain names are allowed to be whole-script or mixed script confusables according to [UTR39].

Guideline 4 (symbols) → Only characters in IDN Security Profiles for Identifiers [UTR39].

Guideline 5 (registration) → Define an IDN registration in terms of its:

Nameprep-Normalized Unicode representation (output format) ACE representation

Work with IETF to update NamePrep to Unicode 5.0