Mobistar iPhone tethering possible again (personal hotspot)

Mobistar has always blocked tethering on their network. Years ago their was a workaround but that was only for very old iOS versions.

Today, it is once again possible to enable tethering. This time without "hacks". Rumor has it this will be officially announced on monday but the functionality is already working. All you need is an up-to-date iOS version and the latest carrier update.

To obtain the latest carrier update, go to Settings > General > Usage. Here a popup will appear asking if you want to install the carrier update.
Select update, and as soon as you have done that, the Settings > General > Network > Personal Hotspot item should appear.

Configuration is quite simple. At the top of the page, enable the personal hotspot.
You will be asked if you want to use USB or Bluetooth/Wireless. USB requires iTunes to be installed on the computer, if you use this option, don't forget to disable the hotspot after use, otherwise the computer will use it every time the iphone is connected.
Wireless/Bluetooth are especially useful if you want to use a second device to access the internet (such as an iPad), or if you don't want to install any additional software on your computer.

The main disadvantage for now is the poor 3G coverage of the mobistar network. In most of the places all you get is Edge, which is enough to synchronize email but to slow for anything else.

Juniper SRX global security policy - revisited

Quite a while ago I wrote about creating a global policy using apply-groups. It works, but its main disadvantage was that it only logs traffic if there is at least one permit rule between the source and destination zones.

As of Junos 11.2, a global firewall rulebase can now be configured. Just like the netscreen global rulebase, this only gets evaluated if there is no match in the regular rulebase. So, it can be used to create a default logdrop rule like this:

[edit security policies global]
    policy default-logdrop {
        match {
            source-address any;
            destination-address any;
            application any;
        then {
            log {

When traffic does not match any of the permit policies, it is now logged in the following format:

RT_FLOW - RT_FLOW_SESSION_DENY [junos@2636. source-address="" source-port="5947" destination-address="" destination-port="80" service-name="junos-http" protocol-id="6" icmp-type="0" policy-name="default-logdrop(global)" source-zone-name="trust" destination-zone-name="untrust" application="UNKNOWN" nested-application="UNKNOWN" username="N/A" role="N/A" packet-incoming-interface="fe-0/0/8.6"]

The global policy works fine for a default logdrop rule, but when you want to specify specific source or destination addresses in a rule, things get more interesting. The addresses need to be defined in the new global address book at [security address-book] instead of the zone-specific ones. Unfortunately, the two cannot be combined. If you try to commit this change, you'll see error messages like this:

[edit security zones security-zone untrust]
    Zone specific address books are not allowed when there are global address books defined

So you will have to convert all your address books to the new style, which is quite a bit of work.

Blog Category:

Rant: Network Application Firewalls

I often get into discussions about "next-generation firewalls" versus "traditional firewalls". All firewall vendors are moving in this same direction, adding deeper inspection to their devices.
For sales, it's a very easy pitch. Everyone is annoyed with the limited visibility L4 firewalls have and proxies have always been a necessary evil. Along comes this one new box that will fix all these issues. Who wouldn't want one?

Marketing will say you no longer need to worry about TCP or UDP ports, just applications. But if you think about this for a few seconds, you'll know this isn't true. Applications can only be identified once a connection has been established and a certain amount of traffic has been passed back and forth. So if you want to allow HTTP on any port, you need to allow TCP connections to any port and block them once they turn out to be something different than HTTP. You just opened your entire network to portscans and all sorts of badness. This is a very easy configuration error to make - I've seen it happen several times already.

I was going to write about some of the interesting things you could do to trick the application-identification, but found an excellent presentation which pretty much sums up my thoughts:
DEFCON19 Presentation Slides
DEFCON19 Presentation Video
You may recognize the CLI - but this applies to all vendors. It's about the technology, not the individual products.

In summary:

  • application-identification only looks at the first bytes and can be tricked.
  • application-identification caches can be poisoned.
  • its not all unicorns and rainbows, sorry.

Does this mean application firewalls are useless? Absolutely not. You simply need to be aware of its limitations.

In my opinion, L7 firewalls are an additional layer of defense, not a replacement for the stateful firewalls. You still need a stateful L4 box in front to attach the network segments to that don't require application-identification or need better performance. This also reduces the risk of configuration errors on the L7 device.
On the L7 firewall you need to remember to only allow applications on the ports they need and that application-identification is an expensive operation, especially for certain UDP based protocols.

Juniper SRX DNS ALG behavior

The Juniper SRX firewalls have a special application layer gateway (ALG) for the DNS protocol. This ALG performs the following tasks:

  1. Closes the session as soon as a DNS reply is seen.
  2. Limits the maximum message length.
  3. Drops packet when domain name is more than 255 bytes or the label is more than 63 bytes.
  4. Decompresses points and detects loops.
  5. Performs DNS Doctoring.

Some of these functions are interesting to provide a little bit more security but most of the have major drawbacks and their default settings are just plain stupid. The default maximum message size is 512, even though everyone has been using EDNS0 for years. DNS doctoring is enabled by default, very poorly documented and causes unexpected changes in DNS replies. I'll explain the issues a bit more in detail and then suggest what I would consider to be a better default configuration.
Feel free to skip the rant :)

Closing sessions when a response is received

Closing the session as soon as the DNS server responds sounds like a very good idea to reduce the number of sessions in use on the firewall. DNS transactions are typically just two packets, waiting for the UDP session timeout every time would mean the firewall has to keep track of a lot more sessions and as most will probably know, DNS is the easiest way to kill stateful firewalls.

The drawback here is that the ALG does not keep track of the DNS transaction IDs, it closes the session as soon as a reply packet is seen. If you have an ancient DNS server which sends all its requests from the same source port, this will cause problems when there is a lot of DNS traffic. The DNS server may send multiple requests in parallel to a remote server for different names, but as soon as the first response is received, the ALG closes the session and the subsequent responses are dropped.
In practice this isn't that much of an issue nowadays. Everyone should be using random source ports on their DNS servers, for security reasons. But years after the Kaminsky hype, there are still servers that haven't been patched.

Limiting the message length to 512 bytes

I have no idea why Juniper even implemented this "feature", let alone make it the default behavior. When the first SRX was released, EDNS0 was already used by most DNS servers and that requires the firewall to allow larger DNS packet sizes.

EDNS0 is an extension which allows for larger DNS packet sizes. The original RFC only allowed 512 bytes, but now that more and more domains are switching to IPv6 and start using DNSSEC, responses are often larger than that. Nearly all DNS servers support EDNS0 and will attempt to to use it. The problem is that the SRX will block the responses, the DNS server waits for a timeout and then retries with a smaller packet size, which will get a response. To the end user, it will appear as if "the internet is slow".
BIND based name servers will generate a lot of these log messages:

named[666]: success resolving '' (in ''?) after reducing the advertised EDNS UDP packet size to 512 octets

Luckily this behavior can be fixed in configuration. I would recommend everyone using the DNS ALG to increase the permitted message size:
set security alg dns maximum-message-length 8192

DNS Doctoring

DNS Doctoring is a functionality where the firewall will look at DNS responses from your DNS servers for addresses that have a static NAT rule defined and will then change the IP in the DNS response to the NAT address. This behavior is wrong in so many ways. There is very little documentation about this - as far as I know this behavior gets triggered when both the DNS server and the response have a static NAT rule, but I may be wrong. If you think you need functionality like this, you should rethink your DNS infrastructure. Other than it being an extremely ugly kludge, it doesn't always work and will fail in the future if you decide to use DNSSEC.

When this feature was first introduced, it couldn't even be disabled. But in more recent JunOS releases it can be disabled using the following command:

set security alg dns doctoring sanity-check

Known limitiation: DDNS Updates

As documented on the Juniper KB, the SRX DNS ALG does not permit DDNS updates. Especially when the SRX is used as an internal firewall, separating clients from their Active Directory DNS servers, this can be a problem. Many people rely on DDNS to register client or server names in DNS. The SRX will drop these registrations, resulting in missing or outdated DNS records. The only solution until now is disabling the DNS ALG:

set security alg dns disable

ALG Statistics

There are no CLI commands to see how much traffic was dropped by the ALG, but the information can be obtained from the forwarding daemon directly:

admin@srx> request pfe execute target fwdd command "show usp alg dns stats"
SENT: Ukern command: show usp alg dns stats
GOT: dns-alg init state: 1
GOT: dns-alg (total 34)
GOT:    pkts received                      32265728
GOT:    pkts received NULL jbuf                   0
GOT:    pkts received dup NULL jbuf               0
GOT:    pkts received ipfrag                      0
GOT:    pkts received V6                     181659
GOT:    pkts received V4                   32084069
GOT:    pkts invalid                              0
GOT:    pkts examine                       32119585
GOT:    pkts reply                         15771693
GOT:    pkts truncated message                 2448
GOT:    pkts oversize message                     1
GOT:    parse oversize name                       0
GOT:    parse oversize label                      0
GOT:    oversize compression pointer              0
GOT:    undersize compression pointer             1
GOT:    pkts parse quesion fail                   3
GOT:    pkts parse answers fail                   0
GOT:    pkts parse authority fail            227501
GOT:    pkts parse additional fail                3
GOT:    pkts parse fail                      227507
GOT:    pkts NAT need                       2599821
GOT:    pkts NAT V4 need                          0
GOT:    pkts NAT V6 need                          0
GOT:    pkts NAT xlated                           0
GOT:    pkts NATPT need                           0
GOT:    pkts DUP A query                          0
GOT:    pkts Dup A query fail                     0
GOT:    pkts receive A response                   0
GOT:    pkts receive DUP A response               0
GOT:    pkts xlate A2AAAA fail                    0
GOT:    pkts xlate A2AAAA                         0
GOT:    session interest                   13808061
GOT:    session not interest                  91325
GOT:    pkts update name offset                   0
GOT: max message length                        8192
LOCAL: End of file

TL;DR: Recommended Default Config

For branch SRX devices, I would use the following default configuration:

security {
    alg {
        dns {
            maximum-message-length 8192;
            doctoring {

This maintains some of the ALG advantages and fixes the annoying default behavior.
When you need to allow DDNS through the firewall, the only option is to disable the ALG entirely:

security {
    alg {
        dns {

Blog Category:


Subscribe to Bart Jansens RSS Subscribe to Bart Jansens - All comments