Showing posts with label security. Show all posts
Showing posts with label security. Show all posts

Saturday, May 3, 2025

Understanding VLANs

A topic I'd like to cover with Networking is VLANs. To understand a VLAN is very good for getting into networking concepts looking towards it as a profession. Hopefully this article helps you understanding the basic concepts of a VLAN as well as some of the more technical terms related to a VLAN. Let's begin!

1. What is a VLAN?

Definition: Virtual Local Area Network (LAN)

A VLAN is a Virtual LAN that can be used to create a logical separation on network devices. This can allow multiple networks to ride on the same equipment, and even links, providing extra efficiency for networks and adding some extra security (not perfect, but it helps).

When we are talking about efficiency, this is because it helps to control the size of a broadcast domain. This can allow a single piece of equipment the ability to serve multiple requirements for networks without things getting to big that they begin to interfere with each other. This broadcast domain is on Layer 2 of the OSI model. This is where your Media Access Control Address, or MAC address comes into play. You may also see the term Hardware Address, or the least common term EUI-48 (Extended Unique Identifier) 

2. How VLANs Work

As mentioned a VLAN is Layer 2 on the OSI model. The protocols fall under the IEEE 802.1Q protocol. The VLAN is attached to the Ethernet Frame. Now a common misconception is that Ethernet is a cord. Ethernet is a Layer 2 protocol that defines how frames are formatted and transmitted over physical media. It's not just the cabling; it's the entire protocol standard used at Layer 2. The simplest way to put what happens, is we add a 4-byte identifier to the Ethernet frame. 


When devices on a network need to find one another within the same subnet or need to talk to all devices on the same subnet, they will send out broadcasts. On a large network, this can be a lot of traffic. To reduce this, when devices do not need to interact with one another, we use the segmentation methodology by utilizing VLANs. On the network, this traffic will be virtually isolated to devices within the same VLAN.


A quick overview into 802.1Q shows is will insert a 4 byte segment into the Ethernet Frame. The first 16 bits is the Tag Protocol Identifier (TPID), followed by 3 bits of Priority Code Point (PCP, part of 802.1P related to QoS), 1 bit Drop Eligible Indicator (DEI, indicates if frame can be dropped from congestion), and finally 12 bits of VLAN Identifier (VID) which gives 2^12 or 0-4095 of potential values.

3. Types of VLANs

Let's start with a very special VLAN. This is a special VLAN you can never truly get rid of because it is very important, VLAN 1. This VLAN is used for a lot of internal communication on the network such as CDP, LLDP, VTP, and many other protocols. It is also the VLAN used when you have no VLAN explicitly selected for a default VLAN.


Other special VLANs include some reserved VLANs.

  • 0 and 4095 - Unusable, reserved for system
  • 1 - Remember, you cannot delete this, it's a default
  • 1002 through 1005 - Defaults for FDDI and Token Ring


Outside of the reserved VLANs, for best practice you can use any others for data. How you choose to use them is really up to you and however deemed best to setup the internal functions and really just configure them however you want.


Voice VLANs are used for VoIP services. If your equipment allows you to identify a VLAN for a voice function, I highly recommend you set that up. Aside from the optimization they will allow, it also allows the VoIP devices you plug in the chance to discover the VLAN they need if they support that kind of feature. This can help reduce a lot of headaches and even speed up a VoIP device configuring itself.


A Native VLAN is a VLAN on a trunk that is the default VLAN assigned should there not be a tagged VLAN. This is usually going to be the VLAN that is directly interfacing the user devices or anything that does not support tagging its own VLAN. Pay attention to your native VLAN when trunking as it will default to a native VLAN of 1. Also, if the native VLANs do not match, traffic will still pass.


Tagged VLANs are explicitly marked as being on a specific VLAN. By tagging a VLAN, you can have a single interface participate in multiple VLANs where it can be separated out to different segments.


4. Access vs. Trunk Ports

An access port is a port with a single native VLAN usually interfacing an end device. If you are on a Cisco device, you can have an "access" port that also has a voice VLAN. Other devices will use a trunk port with the voice VLAN tagged on that port. A trunk port will also facilitate communication between switches containing multiple VLANs. You will often hear the terms "access port" and "trunk port" when discussing higher level network design.


When it comes to 802.1Q, you will likely see no tagging on a native VLAN, but you need the tagging on the frame for a tagged VLAN. Some switches have an option to force a VLAN to be tagged even if it is a native VLAN.

5. VLAN Configuration

Instead of giving a specific brand example, I'm just going to go over what it needed to configure a VLAN. The reason is, I've worked with too many different brands and I know they can be a bit... too different, and I don't want people to copy-paste and then be confused when it doesn't work. Instead, here's the concepts and you can grab yourself a CLI reference for your brand and good luck!


When configuring a VLAN, the first thing you need to do is make the VLAN. Some devices will let you just apply it to a port, but if the VLAN is not in the global configuration, it does not work. Some devices will not let you add a VLAN unless it is configured.


With your VLANs created, you can then configure your ports. First you need to identify if it will be an access or a trunk port. Then you decide what VLAN(s) you want to assign to that port. Simple as that!

6. Benefits of Using VLANs

  • Improved security with isolation.
  • Reduced broadcast traffic through segmentation.
  • Better organization by function or need or usage.
  • Easier network management and scalability by running multiple virtual networks the same devices.

7. Common Mistakes and Gotchas

Always remember to configure your VLAN so it actually exists to be used! Seems simple, but I've seen too many people make that mistake in a rush.


Pay attention to your trunk links. If a tagged VLAN is missing, the traffic will not traverse. If the native VLAN is mismatched, traffic will pass unless you set the switch to force native tagging. This means you risk leaking traffic or hopping VLANs. A scary thought is I have seen this done on purpose, which may lead to traffic working when it should never have worked. Fixing this down the road could lead to a major lift, so do not do it or rely on it. Should also mention that a mismatch can cause issues with Spanning Tree Protocol (STP) and general security issues.


Make sure your VLAN covers the broadcast domain you need. It sounds simple, but that means also taking into consideration how it can affect routing, like when it will need to route on Layer 3 instead of switching on Layer 2.


8. Real-World Use Cases

In the world of technology, segregating traffic is necessary for being efficient and secure. Micro segmentation is even better, but let's start here. When it comes to networking, a VLAN may be used to separate departments, VoIP, Security devices, HVAC systems, fire alarms, IoT devices, WiFi traffic, etc.


If you have two departments in the same business, you may want to prevent departments from seeing and using a printer in a different department, a VLAN can help with this. If VoIP is having an issue with jitter or something about the quality, a VLAN can help you manage this. If you don't want people seeing very discoverable IoT devices, put it on its own VLAN. Security devices should be isolated, so put it on a VLAN. HVAC systems send out a ton of broadcasts, keep it under control on its own VLAN. Fire alarms are critical, secure them on a VLAN. Your WiFi system may need a lot to configure itself and pass traffic, keep it on its own VLAN to help manage it.


There are so many instances a VLAN can be used to make things better, so use them. Just remember to keep track of everything so you can keep traffic flowing and do not accidentally isolate it.


One other thing to consider is what some may call a "no hop" VLAN or an isolated network. All this means is a VLAN that goes nowhere. It's a way to make an isolated traffic segment and just means do not have it leave. I've used VLANs of that design for internal functions that need to move mass amount of data I do not want to interfere with anything. It's also fairly secure if there's no way in or out.


9. VLANs and Layer 3 Boundaries

As I have mentioned, a VLAN is a Layer 2 function. A VLAN is also used for a Layer 3 boundary. This can be achieved on a switch using a Switch Virtual Interface (SVI). I have heard people say it is still Layer 2, but it is not. It is just a virtual Layer 3 interface directly associated with a Layer 2 VLAN.


An SVI can be used as a gateway, for setting up point to points, an access IP to interact with the network device, or anything else you can think you want to use an IP for. If you need to extend your Layer 2 traffic to something outside, you can use the SVI with an IP helper address to facilitate that.


These are good to know, especially when getting more into Layer 3, but for now we can leave it at that.

10. Final Tips and Best Practices

Now the fun part.


Avoid using VLAN 1 in production for normal traffic. VLAN 1 does a lot with discovery, so for security and sanity, keep your traffic off of it. Also remember, even if the device does not show it in the config, it's there. I've been told to delete it before, it's not possible. Best we can do is pretend it isn't there by not passing normal traffic across it.


Management traffic should be on its own VLAN. This is things like your SSH for devices. I also recommend you keep it a flat Layer 2. By keeping your management traffic separate, that means as long as you have that traffic flowing, you can get to your devices remotely and keep it secure since it's virtually separated. By keeping it a flat Layer 2, then you can maintain traffic while working on Layer 3 configurations with less risk. Basically, give it as few chances to fail as possible.


Document your VLANs and use good descriptions. Keep in mind, if there is no Layer 2 connection, you can in theory re-use a VLAN ID without issues. However, once they touch, the traffic flows. So document well. The descriptions just help you keep your sanity.


All of that being said, VLANs are actually a very simple concept with a lot of utility. So keep it simple, obvious, and well documented. Do not overthink it or you may get lost in your own spaghetti mess.

Wednesday, April 7, 2021

File Synchronization and Backup

 Having access to your files at any given time is a convenience some people today rely on so heavily, that as a person who often never really needs any particular files I find it humorous. Despite this, I have been rather obsessive about file access and backups in the past few years. This is so much so that I realized recently I have over 50 USB flash drives and 4 external hard drives accessible to the network. tow of the hard drives are specifically for TV and movies because I keep duplicates at the ready should an external fail on Kodi. One of them is an old Apple time machine that is ready to go, but I don't actually use it. Another is an old Seagate I have had for about 10 years or so now that keeps chugging along despite the slow speeds and for the small files I usually work with it works just as I need it. Taking it a step further, I have a RAID 1 setup on my main laptop with most of my documents duplicated onto a secondary laptop, and everything else was in Google Drive.


So here's the thing about all of this. Google Drive, like any other cloud service, can have terms changed, storage space altered, and on top of that, do you really want your files in "the cloud?" Truth be told you could easily just manually copy files onto each device you have and be relatively fine. So if you do have storage available, you should make use of it. So stop being lazy and back up your files yourself!


That being said, of course there are solutions that depending on the effort you put in, can be  Let me start out by saying that ANY local network solution can be an "anywhere" solution with tools like a VPN. I personally have OpenVPN setup at home because my Asus router has that option built in. You can create your own OpenVPN server fairly easily, but that's not the topic at hand for this.


For file synchronizing across multiple devices and types of devices, I was recently made aware of some rather cool software called Syncthing. The program name is rather unappealing, but the software is one of the coolest things I did not realize I needed in my life. What sets this apart from any solution I have seen before is that it is a "decentralized" file sync program. This means it uses a Peer-to-Peer model as opposed to the typical Server-Client model. If that doesn't make sense to you, view it like this. Normally you have a "centralized" server that handles all requests, files get uploaded to and downloaded from the server. In a peer-to-peer model, any device can serve files to any device asking and any device can ask any device that has the file for the file. This creates a huge advantage in file accessibility for a busy connection.


This means a few things to consider. The first is that you will need at least two devices to synchronize, not a hard thing to find now-a-days. The second is that rather than configuring a server, you must configure each device. As of writing this, I have four devices connected and the only limiting factor is a raspberry pi 4 connected to a very slow external. So here is some food for thought over any problems I have run into.


The first thing is be certain where you want the files stored and what you will sync. The reason being if you blanket a whole swath of folders, there is a chance some program specific or computer specific stuff will take up room on devices you do not need it to. I have separated all of my stuff to be synchronized out of the normal workflow and pieced it back together with shortcuts. I have also tried to break down the folders that get synced into separate items on the list for greater control and flexibility. The second thing to keep in mind is space on each device, what you need, and where. This is in addition to deciding a good folder structure.


With that in mind, there is a little catch on Linux. I have an external formatted in NTFS, which Linux is not exactly a fan of. I did this because the ntfs-3g stuff works better than ext drivers on Windows which love to lock up the file system and make everything unusable. If you have the same setup, the device should be mounted with the user you launch Syncthing under as the owner. If you launch it as root, there's probably nothing to worry about.


Head on over to the download page and install Syncthing on any and every device you want to be involved. For Windows, I suggest also installing the SyncTrayzor just for ease of access. To launch on Windows, you can use the SyncTrayzor in the start menu or you can launch it via command line with the syncthing command. To get to the console to set everything up you can either launch a web browser and go to http://127.0.0.1:8384/ or if you have SyncTrazor, there is an icon in your notification tray there is an icon that you can right click on and select "Open SyncTrayzor." We want to begin to lock things down a bit and make them better.


It will start out with asking you for statistical data, do as you want there. Then it will mention something about setting a username and password, let's do that. If you missed it on the box, just go to the "Actions" menu on the top right hand corner and select "Settings." Under the "GUI" tab at the top you can set a username, a password, and select a theme if you wish to change the color scheme. I also recommend you check the option to use HTTPS for the GUI because why wouldn't you encrypt when there's an option? Click save, then "X" out of the GUI and relaunch. If you are using the website, you need to change http://127.0.0.1:8384/ to https://127.0.0.1:8384/ if you checked the option. After that you should be all set where it has a default folder. Let's remove that. To remove a folder, you click on it and select "Edit" and then "Remove" on the edit page, bottom left corner this time. Now you can go through and add all the folders you want to sync, remember to organize them first. After you get all the folders set, you can start on the next device. Follow the same process. It does a good job at auto-discovery for when you add a device. When you add the device, the device you are trying to add will prompt for approval, nice little security measure.


When you have both devices set of any folder, if any, each is going to share (keep in mind if you want to merge a folder on both devices, sync one to the other and then move the files you want into that folder to make things easier). Just edit the folder on the device and use the "Sharing" tab up top and check any device you want to sync with.


Before you add more devices, I recommend you let everything sync and normalize before you add the next device. When you get a third setup, you will need to add it to  ALL devices you want to sync with, then on ALL the other devices elect to share with ALL devices expected to sync for the best stability and performance. You can keep a more-or-less centralized model, but I would take advantage of removing single point failures and have everything connect.


Now let's talk phone. Chances are the big thing is going to be syncing your photos to your computer. We can do that and ditch Google Photos or whatever other invasive "online photo album" software is the flavor of the day. It's generally more polite this way because chances are you will also help protect the privacy of friends and family that may make an appearance in your photos. Unless you're like me and the majority of your pictures are sleeping dogs, screw-ups at work, and memes.



That being said, just download the app for your phone. Add your folders in there, then we can add devices the cool way. Select the devices tab, hit the plus, then select that little QR code icon. Then on the device you need to add, on it's interface under "Actions" there is a "Show ID" option that gives you a QR code you can scan. As usual, it the device will want confirmation that you are trying to add it. Share your folders like normal.

So that's a quick overview of a fairly easy to use, decentralized, file sync program. So here are my thoughts.

The first is, it's really cool and I am quite happy with it. The interface is usable and it's just easy to setup and use. The only real critique I have is I really wish there was a built in function to move a folder. Instead I have to remove the folder in the control panel, move it on the system, then tell it to re-add the folder in the new location and wait for it to sync and a couple of times complain about "conflicting" files. Not a deal breaker for me, the advantages are just too good.

All that being said, I will continue in my search for secure and private alternatives for everyday conveniences and hope that you too will join me in taking the necessary steps to protect your data. Targeted marketing and advertisements on top of data breaches has hit levels it never should have all for the sake of what is convenient and I hope we can remedy it. If that's not your goal, then maybe you will at least find some cool software to check out.


Tuesday, April 6, 2021

Stay Safe and Private

 With everything going on in the world, I have been very busy between work and life. I wanted to make a quick post about some things you can do to keep yourself digitally safe during these uncertain times. So let's begin.


If you have an Android phone, there are some steps you can take to mask yourself a bit. While it's not perfect, you can hide yourself and your data a little better. The first big thing that popped into my brain was keyboard. Chances are that your keyboard is sending everything you type and your habits typing somewhere for the sake of analysis to make typing easier. However, do you really want everything you type sitting on a server that you do not know that well? I would rather not because I know the things I look up and some things are better off going to the grave. I found a keyboard that does enough to keep me happy and keep my privacy. AnySoftKeyboard is a good privacy focused keyboard. It can be challenging at times, but privacy is worth taking some extra time to spell check yourself. Another glaring hole for security is text messages. They are oh so convenient, however convenience should not take away from privacy and security. Signal has our backs here. It can do many other things, however text messaging is primarily what I use it for. You can also conveniently link it to your computer. Quite a cool app. More often than not another key function we use on a day to day basis is web browsers. Web browsers are nice, but they can harvest so much data you would not even think about. In this area there are multiple options. The cool thing about browsers focused on privacy is they usually block ads, so it's a great thing to have. I use DuckDuckGo, but Brave is also a good option. Privacy, Ad blocking, and there's alternatives to choose from, this is a great thing to see. Finally for the phone, if you are worried about Google tracking everything you download and install you can try other "play store" variations. I have been trying out APKPure. Aside from a lot of ads, there isn't anything I have found "wrong" with it. Keep in mind, there entirety of the Google Play Store is basically an ad platform, so it is what it is.a


Now we are going to start rolling into some crossover of what to use for any device you have. One of the greatest points of protection you can consider is a VPN. If you don't know what a VPN is, it stands for Virtual Private Network and allows you to connect to a different network remotely for accessing local resources in another network or region. The majority of them offer encrypted tunnels, meaning your traffic is going to be very difficult for people in between to see what you're doing. Even more so, by using a major VPN along side everyone else, the traffic to and from the VPN is going to be difficult to determine who it is for or from. There are MANY options like ExpressVPN, Nord VPN, Surf Shark, Private Internet Access and so on. For the sake of honesty, I use ExpressVPN. They are fast, outside of most legal jurisdictions you might worry about, have not had any data breaches to my knowledge, the price is reasonable, and I have not had a problem with them yet. I encourage you to do your own research and find what you think is best. Remember to install an equivalent app for your phone, computer, and any other device you can put it on.


Next thing to cover is Tor. Tor can be used while on a lot of VPNs, has an app for your phone, runs on the computer and so on. The main idea with Tor, in my opinion, is security through obscurity. Basically, it bounces the connection around like mad making it hard to trace. The concern you should have is here it is bouncing through. So I would not recommend using any passwords over the Tor network.


Email is another must have today. There are many secure email options now. The one I have been using is Proton Mail. There's an app to use it on your phone as well. Not much else to say other than do some research and find the best option for you.


Options for computer security include web browsers like Brave, or the modified version from Gab called Dissenter. I would mention others, but it is a long list that seems to grow every day. Regardless, I highly recommend if you have the option to use an addon called uBlock Origin. uBlock Origin is hands down the best ad block I have ever used with great performance. It works better than Ad Block Plus and feels far faster. So if you're an ABP fan, I would consider trying upgrading and see how it fits for you. Ads are notorious for tracking, so blocking them is a must for privacy and security. Not to mention most of the tracking is done for targeted advertising so just make it even harder for them to deliver there messages. Make them work for it.


That all being said, remember to use a firewall on any device possible, whenever possible. Do not connect to open wireless access or the wireless access of any store, hotel, or other. Be smart, question everything, and do your own research before you hit a download button or run a program, click a link, so on and so forth.


Other things I will hopefully have time to look into in the future will be a more secure camera app, file sync/storage, and so on. There is a lot to look into.


Now the big speech. This isn't about being paranoid. This isn't about hiding. This is about being aware of our own safety and security. This is about being aware of the information we allow others access to. For far too long we have sacrificed an understanding of what information there is being bought and sold about us purely for convenience sake. I am guilty of this myself. I hope you will join me in trying to become aware of all of this and taking the steps necessary to protect yourself in today's world. Not everyone has your best interest in mind and the only person you should trust absolutely is yourself. Please stay safe.

Tuesday, May 14, 2019

Asus Router Connection Problems and Possible Fix

I have an Asus RT-AC3100, but this fix may potentially work on other models.

So the symptoms of the problem I was having included:
  • inconsistent pings or unable to ping another device (sometimes it worked if I tried to ping from one and then the other)
  • Network printing drops off
  • inconsistent network discovery if it works at all
  • high latency for simple local pings (like 9-15ms as opposed to 1ms)
  • network map constantly dropping and adding devices as their activity changed
  • inconsistent snmp, sometimes devices not responding for days (I had a few days when the router showed as down, but all my other devices as up, which is impossible to actually happen)
I searched the internet for days trying to find any hints at this, and it was always the same story, upgrade your firmware. Well, I do. I check at least once a month for updates and update, even if I have to upload it manually. So what is the solution I just found? Well, it's dumb and stupid but it looks like it's working.

Solution:

Go into the LAN option under Advanced Settings. Click on the Route tab. Change Enable static route to yes. Then we add a network to it, I'll assume yours is like mine. Under network/host, add 192.168.1.0. Netmask should be 255.255.255.0. Gateway will be the router ip, 192.168.1.1. I just ignored metric and left the interface on LAN. Click the + and then apply. It took my router a moment after rebooting before it went into full swing, but that could have been in part due to this old mac book pro being a bit weird with the network connection in general.

I hope this helps anyone having these issues.

Saturday, February 16, 2019

ROT Cipher in Python

Recently I was messing around with some stuff and kept needing a Caesar Cipher deciphered and kept using some not-so-good online ones. So what better thing to do than make one myself. Why even stop at a Caesar Cipher and just make an adjustable ROT tool. So rather than copying one that probably works better and has a nicer design, I made my own.

#!/usr/bin/python3
#
# Made by: Matthew DeSantis
#          www.anarchy46.net

import sys
import os

# Upper case limits
CAP_MIN = ord( 'A' )
CAP_MAX = ord( 'Z' )
# Lower case limits
LOW_MIN = ord( 'a' )
LOW_MAX = ord( 'z' )

# Rotate the characters
def rotate ( offset, c ):
    o = ord( c )
    # Uppercase
    if o >= CAP_MIN and o <= CAP_MAX:
        o = o + offset
        # Loop back to beginning
        if o > CAP_MAX:
            o = o - CAP_MAX + CAP_MIN - 1

        # Loop back to end for backwards
        elif o < CAP_MIN:
            o = CAP_MAX - CAP_MIN + o + 1

    # Lowercase
    elif o >= LOW_MIN and o <= LOW_MAX:
        o = o + offset
        # Loop back to beginning
        if o > LOW_MAX:
            o = o - LOW_MAX + LOW_MIN - 1

        # Loop back to the end
        elif o < LOW_MIN:
            o = LOW_MAX - LOW_MIN + o + 1

    return chr( o )

# Cycle through the string
def cipher ( offset, text ):
    output=''
    for t in text:
        output += rotate( offset, t )
    return output

if __name__ == '__main__':
    try:
        # Max rotation offset
        max_off = CAP_MAX - CAP_MIN + 1
        offset = int( sys.argv[1] )
        # Get the offset from max (like if 27 is in and max is 25, you get 2)
        # Then set positive or negative
        offset = offset and (abs( offset ) - abs( max_off * int( offset / max_off ) )) * (offset / abs( offset )) or offset

        # Text is passed via args
        if len( sys.argv ) > 2:
            text = " ".join( sys.argv[2:] )
            eol = os.linesep

        # Or text is passed via pipe (./rot.py 13 < example.txt)
        elif not sys.stdin.isatty():
            text = "".join( sys.stdin.readlines() )
            eol = ''

        # No text!
        else:
            raise Exception( "Missing text!" )
        print( cipher( int( offset ), text ), end=eol )

    # Not a valid number or the like.
    except ValueError:
        print( "Invalid type." )
        exit( 1 )

    # Catch anything else because oops.
    except Exception as err:
        print( err )
        exit( 1 )


So saving this as rot.py, I can use it for stuff in the terminal:

./rot.py 13 This is a secret message

Or I can use it to decrypt a file:

./rot.py -13 < secret.txt

I tried to make it as flexible as possible. Decryption can be done by using a negative, or you could cipher it negatively, whatever makes you happy. My math for doing the offset is a bit of evil. The idea is to rotate no more than once around while preserving which way around it goes. There are most certainly better ways to do it, but I was feeling "artistic."

Saturday, December 30, 2017

Tech Review: Asus RT-AC3100

After finally getting fed up with my old router dropping devices, locking up, and corrupting firmware, I decided to get a new one. Working in IT, one would think I had a good idea of what to get, but I only had a list of brands in my head to avoid. So off to the Googles for lists of good routers. I came across some various Asus routers and figured I would check their site for what they have to offer. Generally my goal is to go for a newer device to avoid upgrading for as long as possible. In this case, it was a matter of I need something that also works well.

So after a same day in store pick-up, it was time to set up a brand new router. So as far as basic setup to get going, it was so simple and quick that I don't remember any of it. Seriously, it was simple with a fully guided setup. For me, that's too boring. After it was setup, it was time to fine tune and update. The control panel for this is nice, however setting IPs manually is very annoying and was hard enough to find where to do it. There is also a rather bad disconnect between what you can do with the phone app for it and what you can do on the actual control panel.

When it comes to security, it has a guided scan for that, making it easy enough to lock down the features. The one thing that annoyed me is that if you don't go through the security stuff, it has a lot of outside access enabled. I turned off all of the dydns stuff and it's actually in its own NAT anyway, so that won't work. Reason for that is I have a business class router that gives me four separate networks I could configure, but I just use one and only really have it because I use too much internet. As far as all the security options, a quick run through is:

  • Change default login
  • Strong wifi password (mine is way too long but it keeps others from learning it)
  • Wireless encryption
  • WPS disabled
  • Ping from WAN disabled (doesn't do much in my case because the WAN is a private network)
  • DMZ disabled (WAN is private, so not much of a problem either way in my case)
  • Port trigger disabled
  • Port forwarding disabled (If you lock down your device, this doesn't matter too much)
  • Anonymous login to FTP disabled (I keep FTP disabled as a whole because it's plain text, they need to add SFTP)
  • Disable anonymous login to network shares
  • Malicious website blocking enabled
  • Vulnerability protection enabled
  • Infected device prevention and blocking
These are all good things, especially when you share a network or even have kids using it. My niece was using her new laptop she got for Christmas while she was over and I noticed she clocked on an ad which took her down a string of fake search engines. I feel having a safe network both outside and in will be quite necessary in the not so distant future.

The parental controls on this seem quite simple, I have not tested to see what catches them though. I'd imagine that I'd trip off parental controls quite often. The options are to block porn, violence, gambling and illegal stuff (sounds like a good weekend to me), messengers, social media, file sharing and streaming. Basically everything that runs into either age restrictions or COPPA.

Now the QoS stuff is my favorite. It doesn't do much on a not so heavily used network, but it has all the monitoring stuff there for you to view. It's very basic in controls and I don't know how much of an impact ia will have, but games and streaming are high priorities for me, so that's the gist of my setup. There's also further information in a traffic analyzer that can give some more insight into individual device usages.

A feature I have setup and plan to use quite a bit is the samba share. I have a 2TB external that I keep for backups, but since it is NTFS that can cause some problems. Luckily, every modern device known to man now seems to support samba, so we can dance the night away with some file transfers. I have noticed that while trying to move files off of a time machine to the hard drive, it times out quite often. I think that's just a culmination of other problems and aging hardware. You can isolate file permissions, but keep in mind that the router login will have full access to everything. You can remove its access but when I tried that, everything came apart at the seems. I couldn't write to the drive.

One feature I have enables that I think will prove to be very useful is the IFTTT options. I have my phone text me when someone connects to the network. One major security hole I see though, is the Alexa support. When you can voice command your router to do things like turn on a guest network or even administration stuff, that just seems like poor design. Voice recognition is not secure, so why add it to something you are trying to keep secure?

The last feature I want to touch on is the mobile app. It works. It's not great. It makes a good monitoring tool and the family feature lets you group devices together per person to either check their usage or quickly block someone entirely from the network. You can check on things and do some basic tasks quickly. I personally want more, but I can't fault it on that. I fault it on the fact that some mobile features are not available on the control panel as far as I can find and the same goes the other way. This is the disconnect.

I could go on for quite a while point by point with features and such, but the rest are boring. So quick overview: firewall, url filtering, keyword filtering, dual wan with fallback and loadbalancing, 3g/4g through usb devices, ipv6, vpn, WTFast integration, ssh (yay!), telnet (why?!), ping, traceroute, and nslookup. There are probably other things I missed, but whatever.

So, coverage and reliability. I live in a small house that was not designed with networking in mind. This router is made for large area coverage. My signal goes all over mu .98 acres and beyond. I have no idea where the signal ends. I have not had a device drop off for the two days I've had the router, but here's the thing. There is the AC88U that is the same 3100 class router, but with an extra network card that has 4 more ports. That one has a lot fo complaints about it just suddenly not working or things dropping off. I imagine it's a bit of user error and a bit of hardware not playing nice. This is just a guess. There were fewer complaints about that on this router, and by fewer I mean enough to chalk up to purely user error, mishandling, or actual defects on those specific devices. So I'm confident that it will hold up fine.

Now for the conclusion. Yes I would recommend it to others, even the less tech-savvy. In fact, I think it was made for the less savvy with a few bones thrown for the more technical minded. I've personally never had a problem with Asus before, but I have had problems with some of the pairings with Asus. So until the router decides to go down in a blaze of glory, I'd say it's a good deal. It's not cheap, but seeing as it is the only device that will be the backbone of most people's home network, it's something you should spend a little extra on.

Now for some after stuff of my network. I got a business class router/modem thing from Xfinity that I'm not going to check what the model is because that requires getting up. I just use one port right now that goes to the router. The router goes off to a very old switch that goes to everything else in the house. I have a newer switch, but that is in the office right now because I was working on stuff but then the RAM died and I'm too cheap and lazy to replace it right now. One of the ethernet cords goes to the entertainment center, which has an old time machine acting as a switch because reasons. I need a couple of new switches, but I'm too cheap to mess with what seems to work for now. The old switch is an HP procurve 8 port managed piece of junk and the newer one in the office is an unmanaged Cisco 8 port. I got the managed one to mess around with vlans, but I don't have anything that has a reason for that, so that's just me taking ideas from work home with me for no reason other than it's fun. Eventually I will do everything all proper, but for now it works.

Monday, October 23, 2017

Tech Review: Rexing V1P

Due to driving an hour to get to work, an hour to get home, and drive between buildings at work, I supposed it best to get a dash cam. Not to mention getting rear-ended on my way in to work not more than a few months ago. So after browsing around, I settled on the Rexing V1P for the low price and additional rear camera. I got the camera itself without doing real in-depth research, a fatal flaw of mine to jump on a reasonable price and good ratings. So here's my review after a week of owning one.

The first thing to note is that you need loop recording enabled because after an email from Rexing, you can only have a 4GB single file, which is roughly 40 minutes. No major drawback there, and having the separate 10 minute files is easier to find events. If you let it hit the 4GB file, it tells you the SD card is full and stops recording. I was also advised to avoid a SanDisk Ultra SD card, after I bought one with it because Amazon recommended it. So far, I haven't had any real problems with it, but I figured I would mention it. They recommend some Lexar SD card.

So the part I think is most important, is installation. I've now installed one in a 2010 Toyota Prius and a 2016 Toyota Rav4. Installation itself is super easy, I just did the normal charger as apposed to a hardwire because I'm still a little nervous about what the actual impact would be as far as the fuses itself and I already hard to replace a fuse for a plug and USB adapter. Now the installation was very easy, but of course it depends on your car. With both cars, I was able to pull paneling away and pop the gasket out of the runs to get the wires behind everything, including behind the airbag. I was worried if I put it in front of the airbag, it could cause a problem. To drop the power to a plug, I dropped it behind the glove box where there's already an exposed hole. To get the rear camera wire from door to door required getting a rigid wire and some tape.

To attach the front camera, rather than stick it on the windshield and worry about the 3M pad getting wrecked by the sun and heat in Georgia or needing to replace it if the windshield needs to be replaced, I bought the suction cup mount. All seemed well, but there was one final problem. My windshield has a low angle and I'm over 6ft tall. The screen has a low angle viewing and I can only seem to manage a high angle.

Despite the random problems I've run into, I've been very happy with the camera. Now I'll tack on some video for the front and rear with an example of why I need a dash cam. I pulled some clips from the front and rear for both the daytime and night/early morning.


So as a final rating for the dash cam... I would say it's great for the price with a simple install.

Sunday, May 14, 2017

Kali Live with Persistence and Updating

So recently I was trying to set up Kali Linux on a live USB fully updated. I kept running into a few problems with it that ultimately are based on how the instructions online are worded. After modifying the steps, I managed to create a fully updated Kali Linux live USB and hopefully you can set one up as well by following these instructions.

So the obvious first step is to download the most recent ISO image that you plan on using. At the time of this writing, that would be 2017.1 and I will be using the 64 bit, so my ISO file is named:
kali-linux-2017.1-amd64.iso

Starting from Windows, I use a program called Rufus to create a live USB. It's a very handy program to keep around and my go to for this stuff on Windows. At work, it's gotten disks working with less effort than all the random tools my co-workers download from the random tutorials they read and with no installation required you can keep it on removable medium and have it with you for when you need it. So download that as well, pop your USB drive in and load up Rufus. Then you need to select your ISO file.

After selecting the ISO, the drop down should say something about it being a DD image, and that's exactly what we want. Tell it to start and let the magic happen.


Starting from Linux, we are going to ignore the dd command (dd if=kali-linux-2017.1-amd64.iso of=/dev/sdb bs=512k) because that's both complicated and pointless. A much simpler way to get this done with a LOT less to remember is the cat command. Assuming the drive is /dev/sdb, we simply do: cat kali-linux-2017.1-amd64.iso > /dev/sdb
Simple, easy to remember since it's not using a different syntax style than other bash commands and straight forward. I've also read online that cat is quicker and has less overhead than dd, but I do not know enough about them to confirm or deny these claims. I just think it's a lot easier and gets the job done just as well.

Now with this drive ready to boot from, we shall move on to the next step through Kali because then we know we have the simple and easy tools we need to get the persistence set up. So boot on into Kali and select Live, NOT PERSISTENCE. We need to create the persistence partition. In the actual instructions, they list off some commands than every time I try, they do not work. Even when in Kali Live itself. The commands themselves are a bit beyond my understanding, but that seems to happen every time someone makes a "copy and paste" tutorial because they need to compensate for dynamic possibilities. I, on the other hand, think gparted is a perfectly acceptable solution for today's day in age. If you want to do this via command, I suggest you learn the parted command and do it yourself rather than copy-paste.

So first, press the windows key on your keyboard or bump the top left corner with your mouse. That should bring you to the activities view. Type in "gp" and an icon for gparted should show up, click on that to open it up.

Right click on the empty space and select New. Create an ext3 partition with the label persistence.

Now click on the apply arrow.




Now we are entering the home stretch. The command portion. Open up a terminal, it's the little black icon on the left dock. Enter in these commands:
mount /dev/sdb3 /mnt
echo "/ union" > /mnt/persistence.conf
umount /mnt

Now we reboot the computer to Live with persistence. On some random installation like this, I have run into just a black screen with a pointer. To fix that, I pressed ctrl+alt+f2, which should bring you into TTY2. Then run the command:
kill -9 $(pgrep gnome)
This then dumped me back over to TTY1 and after some time the desktop came back up on TTY3 (ctrl+alt+f3). In the meantime, I just updated on TTY2.

So to finish things off with a clean and easy update:
apt-get update && apt-get upgrade -y

Hopefully this will help anyone struggling with this process. I did notice a lot of people ran into the same problems I did, so now to list off those problems and what caused them for me:

Out of space because updates going into the disk image.
This was caused by booting into persistence and trying to do things before persistence was set up which then lead to an non-bootable USB.

Boots to a black screen with a cursor.
I don't know the cause of it, but killing all gnome related processes seems to correct it. While performing this process 

Could not write files while updating.
This was another case of not having the persistence set up properly.

Friday, March 4, 2016

Malware: 1-855-298-4477

So while at work, I get an email. Someone has a popup saying stuff along the lines of malware detected, your computer is locked, don't reboot or you could damage your system. Then it says repeatedly to call "tech support" at 1-855-298-4477. After looking at the screen shot, it was easy to tell the problems. First, it was in a web browser. Second, the spacing was all messed up.Like this. Most importantly, it just says "call tech support" and not specifically who this tech support is supposed to be. So, obviously just close the window and move on.

Now being the jerk that I am, I decide while I have a moment to call the number. The number seems to re-route you to different recipients, all who answer along the lines of "this is tech support, how may I help you?" So when I get that, I hang up and cross my fingers I get a call back. I do. The number was marked as being in Texas, but I highly doubt that was its origin. The number was 1-713-589-4442. So the guy calls and says that he missed my call and asks how he can help. There was a thick accent, so I had to get him to repeat it 3 times before he slowed down so I could hear what he was trying to say.

I blatantly ask him "is this a tech support scam?" I imagine he was either terrible at English or just didn't understand me because he said yes and asked how he could help. So I tell him that he's not listening, and I asked if it was a scam. He tells me he's tech support and can remotely connect to remove the malware. I let him know that first off, a web browser isn't going to detect malware on your computer like that and that I am the tech support. After a bit of back and forth and me insisting that it is indeed a scam, he replied that if companies like Microsoft charge for fixing computers and it's not a scam then they were not a scam.

Eventually... he hung up on me. I imagine it was something to do with me laughing at him and calling it a stupid scam.

Now the reason I post this is for a simple reason. I believe that if you can recognize scams like these, you should pick up the phone and bug the scammers and liars. Try this number if you want, call them up and if "tech support" answers, have some fun. Make a bogus report and give them fake credit card info or just simply call them out. I think scams like this are done just simply because it is so easy as most people who can tell it is a scam just ignore it and those that can't lose.

That's just my thoughts, anyway. It really bothers me when others take advantage of people like that.

***Edit: Just wanted to add this because I decided to call it again just because. So, this guy I ask for the name of the company he works for. After some poking and prodding, I get him spewing out some really bad fake information about his company and its support. Eventually, after pointing out he didn't know jack, he hung up and then all I got was a disconnected message. How rude.

Sunday, January 24, 2016

Information Dump: Comptia Security+

So a few days ago, I passed the test to get my Security+. Now, I'm going to give you an idea of what the test was like. The reason I want to is because my cousin, who had already gotten the certification, said the test was easy. I was using the CertMaster material, and that stuff was hard as far as lots of little things to remember.

Well, here's the broad overview. Like the A+ tests, it includes simulations and multiple choice. The simulations were not exactly simulations so much as a visual word problem. The simulations were a bit confusing as far as the directions go, but once I understood what the goal was, it was easy.

The biggest problem I ran into was how the questions were worded. I had flagged a few for review and when I went through them again, I realized I had picked the wrong answer because I didn't understand the question correctly. So, I went through the whole test roughly three times before I ran out of time. When the questions were understood, the test itself was relatively easy, even for someone like myself with horrible test taking skills.

As far as must know material for the test, it jumped around a lot. I was assuming it would probably focus on some core concepts such as CIA or risk and controls, but that only seemed to be present in maybe two questions.

Either way, the test was easy to answer, just read the questions very carefully. Now here's my study guide/cheat sheet I made while studying for the test.

Comptia Security+ Reference

Wednesday, July 17, 2013

Multiple Operating Systems on One Flashdrive from Linux

Recently I decided to take some old flash drives I have not been using and turn them into tools for things like security and data recovery. The problem became I had so many tools I wanted to cram on them, but only a handful of flashdrives. Furthermore, a good portion of what I wanted was small and putting them on their own dedicated drive was a bad use of space.

So now the hunt was on to turn one of the larger flash drives into a multi-boot. Normally I use UNetBootin to create bootable flash drives. I did this for Kali and PartedMagic because I started with making those tools first. Now after much trying to use UNetBootin to create multiple operating systems on one drive, tried multiple partitions, I went to Google. Google gave some possible ways to do it, but they were inefficient. So finally I found something late at night.

Multisystem is a quick and easy way to set this up. Despite it being in French (according to Google), but I only speak English and can work it with no problem, so it's all good. You can load operating systems onto it by dragging and dropping. You can view more options by clicking the button on the left hand side with the eyeball. To see what any of the buttons do, just hover over them. Everything else should be pretty straight-forward.

Now after doing all of this, I found one slight problem. Installing tinycore is done slightly incorrect and makes it so that you can't setup programs for loading on the boot as a result. So if you want to set up tinycore, here's what you should do after it is all set up. First, you want to browse the files. Change the folder "cde" to "tce". Next, open up boot/grub/grub.cfg. Look for something along the line of this in the file:

#MULTISYSTEM_MENU_DEBUT|12-07-2013-00:13:33-278461639|cde|multisystem-tinycore|12Mio|
menuentry "Tiny Core Linux" {
linux /cde/boot/vmlinuz quiet cde showapps desktop=flwm_topside
initrd /cde/boot/core.gz
}
#MULTISYSTEM_MENU_FIN|12-07-2013-00:13:33-278461639|cde|multisystem-tinycore|12Mio|

Now you want to change it so that all the places it says "cde" say "tce". So the end result of the example posted looks like this.

#MULTISYSTEM_MENU_DEBUT|12-07-2013-00:13:33-278461639|tce|multisystem-tinycore|12Mio|
menuentry "Tiny Core Linux" {
linux /tce/boot/vmlinuz quiet tce showapps desktop=flwm_topside
initrd /tce/boot/core.gz
}
#MULTISYSTEM_MENU_FIN|12-07-2013-00:13:33-278461639|tce|multisystem-tinycore|12Mio|

I have not come across any other problems yet, but I haven't really messed around with everything on it yet.

Wednesday, July 3, 2013

Damn Vulnerable Linux Full Install on Hard Drive

Damn Vulnerable Linux (DVL) is a Linux distribution that was made purposefully insecure and configured poorly for a learning experience to teach things like exploitation. I managed to find an ISO of it off of some torrent a while back and never really did anything with it. Recently, I got an old laptop that was too broken to do what was wanted with it, so I figured I may as well use it for something. So I installed DVL on to it so I have a machine I can experiment with and get back to learning hacking and other such things. Now most of what I found online was installing into a virtual machine, and the directions were also wrong on quite a few steps. So using my limited knowledge, I played around until I got it right. So here's a quick step-by-step to install DVL on a USB flash drive. I'll try to set up a download link at some point as well.

Put the image on a flash drive, I used Unetbootin.

When booting up the computer with the flash drive, remember to check the boot order in the BIOS so that the flash drive is booted first.

When the system loads, log in. Username is root, password is toor.

Now you should be in the prompt. These instructions are for a clean install. First thing we want to do here is identify what device is where, as far as the hard drive and the USB drive. For me, the hard drive was /dev/hda and the USB drive was /dev/sda. This may change if you have multiple hard drives. We need to tweak some stuff on the hard drive, so we want to unmount it first. Check what is mounted in /mnt, then unmount every folder related to the hard drive. For me, it was just this.

umount /mnt/hda

Next we want to repartition  everything because why not. Run this command, change the hda part if you're setting up on a different system.

fdisk /dev/hda

Now in fdisk, you want to delete any partitions. Press p then enter to see all partitions. Delete all of them. The letter d then enter should do the trick, if there's more than one, just repeat starting at 1 and moving up until it says there are no more. Now we want to write a partition. Press n then enter sticking with the default values (just press enter for the prompts) because that makes life easy. Now to save it, press w then enter and it should take a moment to write the partitions. After this, you should be back at the original prompt.

Okay, now we have a partition, but we have not formatted it to a file system type. So if you've been working on hda, just follow along, if not, remember to change hda to your device. Run this command.

mkfs.ext3 /dev/hda1

Let that run and BAM, ext3 partition. The tutorial I found didn't put the number, which lead to everything completely screwing up, so it's important. If not, it gives a warning message I should have listened to.

So now we want to mount back our newly partitioned and formatted space.

mkdir /mnt/dvl
mount /dev/hda1 /mnt/dvl

Okay, now we should be ready and raring to go to the GUI!

startx

Okay, now in the GUI, we do some fun stuff. In the bottom right hand corner is a German flag with a "de" written on it (short for deustch, for those that didn't know and are curious). Right click on that to bring up the language settings and change that to your locale. Trying to use an American keyboard on a German layout does not work at all.

Okay, now that that is out of the way, in the bottom left corner is the thing for the KDE start menu. Click on that, go to the "Be ReSlaxed" > System > BackTrack Installer.

Leave the first box blank, set the second box to /mnt/dvl if it isn't already. Change the radio buttons from Live to Real. Click the install button and let it do its thing. Once it's finished, hold and because we're not done yet. You can click the close button then go to the logout option under the start menu. Now we should be back at the prompt.

At this prompt, you want to put in this command.

lilo -v -b /dev/hda

If you have a different hard drive setup, this command may need to be different. If that is the case, take a moment to look more into the lilo man pages because I don't know much about it.

If all went well, type this command.

poweroff

After it shuts down, remove the USB drive, start it back up and make sure everything works. It took myself 3 times because I kept goofing up, first time I accidentally wiped the USB drive. Second time I forgot to put lilo on. Third time was the charm.

Friday, July 27, 2012

Technical Speak (some thoughts and advice)

This post is not going to be technical so much as I really want to write about some tech things people say that are either completely wrong or just down right annoying. So take this how you will, but this is an opinion piece.

Something I once did before I knew much about computers but now that drives me crazy when I hear it, is when people talk about Java and call it Javascript or visa versa. Let us get a few things straight. Java is not related to Javascript nor the other way around. Javascript is a scripting language based on ECMAScript whereas Java is an interpreted language developed by Sun Microsystems. While Java can be used as a web technology, it is not the same as Javascript and while they have some similar naming conventions, any real depth into some code would reveal they are very dissimilar. So stop mixing them up, it is frustrating.

Another irritating point for me was created by the media, "Mac vs PC." The real goal of this is Mac OS vs Windows. Mac computers are PC's, as PC stands for personal computer. Furthermore, Mac computers can run Windows and if you're crafty, you can run a Mac OS on another PC, virtual machines being the easiest to get things going. Also some people throw Linux into the list. Well, OS X is Unix based as well. So they have some similar things to them. As to which is better, all three of them suck. It is just a matter of picking which one sucks less at what you personally need to accomplish. None of them are good at everything no matter what they claim.

Overuse of acronyms. In the technical world, many acronyms exist. Many acronyms overlap and it depends on what you are talking about. Overuse of acronyms in situations where it is not necessary is annoying and even a tech geek can get lost in such conversations. Granted there are exceptions where some technologies are explicitly referred to their acronym based name because some of the names are long and annoying. Some examples are XML (eXtensible Markup Language), HTML (HyperText Markup Language), or even php (Personal Home Page/Hypertext Preprocessor [it has changed over time]). Choosing to use all those acronyms in an environment outside of a situation that deals directly with such things is annoying, confusing and not many people can follow clearly. Use words.

Being able to navigate a website does not make you tech savvy, same goes for navigating software. I am relatively tech savvy and I get lost on so many websites and various user interfaces. One annoying example is of Microsoft Office. They keep changing the interface, and while I know what I want to do, I can spend a lot of time looking for various options. These things are esoteric and not standardized. While many try to keep similar conventions in an attempt to create better ease of use, they do not have to. Reliance on people trying to make similar and familiar interfaces is not possible.

Do not use tech terms you do not understand. If the media is to teach us anything, let it be this. For example the famous CIS line, "I'll make a GUI interface in visual basic, see if I can track an IP address" (GUI pronounced "gooey"). Taking this I would have to respond, okay, I will make an OS in Piet, see if I can make a super computer. Despite the lack of need to sum up why this is dumb, I am going to do it anyway. A GUI is not necessary for any of this. A good deal of tools for sniffing are done in command line interfaces because there is no point in the extra computational time and effort going to making a pretty window. Visual Basic is a dumb choice. I don't even know if you could make a sniffer from VB. If you can, it is probably some random .NET feature that is a waste of time. Now you do not "track" an ip, you can trace a route. Tracing would be following something along its path. That is a small thing to pick at, but tracking an ip would be like sniffing just that ip. Tracing would be finding the origin.

Using tech terms from one thing for a separate case.When drawing a comparison it is fine. However, using that comparison like the cases are equal is usually not fine.

Comparing things on levels that they are not comparable. I am sure at some point you have come across things like Perl vs Python, where they argue about dumb things like which is easier to read or application. Seeing as how Perl was more so made for text processing and Python is more of a general purpose language, they are obviously not going to be good at the same things. Benchmarking comparisons are one thing, but arguing about readability or which way of doing things is better is dumb because it depends on the application and the person.

Skids. Script kiddies. People that claim to hack when they are using premade tools without knowledge of the underlying innerworks of how or why things work they way they do. Downloading things like custom firmware to break a game system or opening up a tool to do some network scanning. Some of these can be dangerous if you do not have some understanding of how they work. In this light, the use is not that of a tool but a black box effect. Someone puts something in and gets the desired result out without understanding what just happened. So not everyone that uses these tools are skids or something to that effect, some actually understand in general how they work and use a premade tool to build something else faster.

So those are just some thoughts and opinions based off of things I have heard people said that just really catch me the wrong way and I have seen them criticized for saying such things as well. An easy way to keep yourself from saying something that will annoy others, whether you are right or wrong, is to remember you do not need to prove anything to anyone what you know, because you already know you know it.

Thursday, June 28, 2012

MyBB Registered-only view BBCode

Decided to make another quick MyBB addon, this adds some BBCode. You can use [paranoid][/paranoid] tags to prevent non-registered and banned members from viewing stuff selectively. I am using it to cover up various resource links. If you are logged in, it will appear like nothing is changed, you can only tell what's covered up by logging out or being banned.

[Download v1.0]

Maintained: https://github.com/anarchywolf46/MyBB-Plugins

Sunday, June 10, 2012

Refused to set unsafe header

*** If interested in CORS, try this.

This is an annoying little error that I've seen some people mention and even ran into with JavaScript. Moreover, it appears only in Webkit based browsers. So what's the problem? Basically a browser like Google Chrome will not change certain http headers in an XMLHttpRequest using setRequestHeader(). This is not a problem in Firefox or Opera from my testing so far. According to W3, it is actually the behavior they have as "standard" in their working draft. Headers they don't want you to overwrite are
"
  • Accept-Charset
  • Accept-Encoding
  • Access-Control-Request-Headers
  • Access-Control-Request-Method
  • Connection
  • Content-Length
  • Cookie
  • Cookie2
  • Date
  • DNT
  • Expect
  • Host
  • Keep-Alive
  • Origin
  • Referer
  • TE
  • Trailer
  • Transfer-Encoding
  • Upgrade
  • User-Agent
  • Via
Or if the start of header is a case-insensitive match for Proxy- or Sec- (including when header is just Proxy- or Sec-)."[1]
Now as to where this could be a problem, for me at least, is when I am trying to spoof some headers and want to do so in a browser as apposed to writing a script or getting an addon to do so for me. However, there is a security risk it could open up called HTTP Request Smuggling. As to how one would pull it off, I think an XSS vulnerability would need to be there as well for this in JavaScript to do anything. Bottom line for the security of it on the design end, make sure you check your sources before you use things like external scripts. As for user-end security, just be careful what sites you go to and use some common sense when you can.

Now as for ways around this, you would need either an addon to modify this for you or use related command line arguments. For example, to change the User-Agent header, you launch Chrome from your terminal with the option --user-agent="Some new UA string". As for an addon to do this, I do not know of any or if it is even possible, but if I find something I will update that here.

*[1] - http://www.w3.org/TR/XMLHttpRequest/#the-setrequestheader-method

Monday, March 19, 2012

NoScript URL Javascript

I've been messing around with javascript and helping someone learn it, and one thing I've noticed is a lot of people seem to have NoScript now. NoScript is an addon that can allow you to selectively run or block javascript. While this is great, there is one option I don't see openly on the options for it. Whenever trying to run javascript in the url bar, it's blocked. While this is good for people dumb enough to run javascript directly from someone not trustworthy (I have used url run javascript to get someone's cookie information and hijack their session), it can be a problem when just messing around with stuff for someone who knows what they are doing but doesn't know about the way to allow url run javascript.

So to find the option, first go to the about:config (enter about:config in your url). Then in the filter, enter noscript.allowURLBarJS. You can right click and select the toggle option or simply double click the result you get. Once set to true, should be able to run url javascript, but only on sites that the domain is allowed to run javascript. Running javascript in the url still sandboxes it in to whatever tab you're on.

Whatever you do, be careful what you run when using this, can lead to information being taken to breaking some stuff. Other times, can be just a way to mess around with a site you're on quickly and easily, like bookmarklets.

Monday, December 12, 2011

Javascript Exploit: setTimeout

When I was messing around with some javascript animation, I came across a rather strange exploit in javascript that can be taken advantage of to cause a little havoc on browsers. A quick explanation of javascript, when using an alert or other popup, that popup will pause the execution of the script until it is dealt with. However, setTimeout spawns another. This means using setTimeout, you can spawn multiple alert boxes or other such things that will pause and wait for input.

So then the question is how to use this to an exploit. A quick rough version would be something like
while (1){
  setTimeout(function (){
    alert("");
  }, 0);
}
This will create an infinite loop that will spawn alert boxes really fast, and probably freeze up or crash a browser. However due to browsers keeping javascript "sandboxed" for protection, there is a chance it will just say the script stopped responding and suspend it. This sandbox effect is to keep scripts from being able to interact with any other tabs or windows the user might have open as well as personal data stored, while not perfect, it can prevent certain exploits from causing damage.

Now alternatively, we could create a fork bomb. A fork bomb will multiply processes exponentially as apposed to what we have setup where it just increases directly. That will end up looking something like this.
function fork() {
  while (1){
    alert("");
    setTimeout(fork, 0);
  }
} fork();
This will then keep doubling but the effect will most likely be it just stops responding faster due to the sandbox setup. This could also have uses as this will fake multithreading by faking concurrency. So fake multithreading exploit is the bottom line.