Friday, October 3, 2014

Shellshock Bash Vulnerability

System vulnerable to Shellshock


What type of systems are vulnerable? "Apache HTTP Servers that use CGI scripts (via mod_cgi and mod_cgid) that are written in Bash or launch to Bash subshells"

Quick test to see if your system is vulnerable:
env 'VAR=() { :;}; echo Bash is vulnerable!' 'FUNCTION()=() { :;}; echo Bash is vulnerable!' bash -c "echo Bash Test"

Example:
[root@testvm ~]# env 'VAR=() { :;}; echo Bash is vulnerable!' 'FUNCTION()=() { :;}; echo Bash is vulnerable!' bash -c "echo Bash Test"
Bash is vulnerable!
bash: FUNCTION(): line 0: syntax error near unexpected token `)'
bash: FUNCTION(): line 0: `FUNCTION() () { :;}; echo Bash is vulnerable!'
bash: error importing function definition for `FUNCTION'
Bash Test

To test if your web server is vulnerable, you can use the 'ShellShock' Bash Vulnerability Test Tool.

To secure your system, simply upgrade the Bash package (should be available on most distributions):
$  ## Debian Based
$ sudo apt-get update && sudo apt-get install --only-upgrade bash

$  ## RedHat Based
$ sudo yum update bash

References:




Danny Macaskill: The Ridge


Danny Macaskill takes on a death-defying mountain bike ride along the notorious Cuillin Ridgeline at the Isle of Skye in Scotland

Danny Macaskill: The Ridge - YouTube



Blowing Stuff Up with a Quadcopter

Destruction by Quadcopter
And now for something completely different...

What do you get if you attach a machine gun to a quadcopter?

 
Prototype Quadrotor with Machine Gun!

And if you fear the drones, here's a fun way to defend:

Johnny Dronehunter: Defender of Privacy - Official Trailer feat. Salvo 12 Shotgun Silencer



Wednesday, October 1, 2014

Invalid Argument When Trying to Write Direct I/O to a 4K Native Sector Size Device


Direct I/O Invalid Argument


When trying to write Direct I/O to a particular block device, I ran into this ugly error:

# dd if=/dev/zero of=/dev/sdb oflag=direct
dd: writing to ‘/dev/sdb’: Invalid argument
1+0 records in
0+0 records out
0 bytes (0 B) copied, 0.000202393 s, 0.0 kB/s

After some investigation, it turns out the cause was the device was actually configured and low level formatted to the newer 4K Native Sector Size (aka 4Kn Advanced Format). Older devices are all 512 byte sector size.

The problem is that the default block size for many applications is still 512 bytes. The solution is easy, once you know the cause. You just simply write blocks in 4K byte size.

# dd if=/dev/zero of=/dev/sdb oflag=direct bs=4k
^C
73063+0 records in
73063+0 records out
299266048 bytes (299 MB) copied, 4.83917 s, 61.8 MB/s

Is My Device 4K Sector Size?


Many newer storage devices may be configured for 512, 512e or 4K.  So how can you tell if you have a disk device that is in 4K native sector size? There are several options:

1) fdisk will tell you:

# fdisk /dev/sdb
Note: sector size is 4096 (not 512)
...

2) blockdev can tell you:

# blockdev --help
 --getss                   get logical block (sector) size
 --getpbsz                 get physical block (sector) size

# ## 512 mode:
# blockdev --getss /dev/sda
512
# blockdev --getpbsz /dev/sda
512

# ## 4Kn mode:
# blockdev --getss /dev/sdb
4096
# blockdev --getpbsz /dev/sdb
4096

# ## 512e mode:
# blockdev --getss /dev/sdc
512
# blockdev --getpbsz /dev/sdc
4096

3) Your storage vendor's tools should tell you.  Many times the storage vendor will also provide tools to low level format to either 512, 512e or 4K

Why 4Kn?


So why are some storage vendors providing newer storage devices in 4K sector size?  Efficiency, and Data Integrity.

"Larger sectors use the storage surface area more efficiently for large files but less efficiently for smaller files, and enable the integration of stronger error correction algorithms to maintain data integrity at higher storage densities." (source)

Summary:

  • Greater storage efficiency for larger files (but less efficient for smaller files)
    • Better bandwidth performance (large block read/writes), but IOPS (small block read/writes) will suffer
  • Improved error correction algorithms to maintain data integrity at higher storage densities


512e Alternative?


For Operating Systems and applications that may not support 4K native sector size, vendors may also provide a 512e mode (512 emulation). 512e mode is a 512 byte local sector size front-end emulation with 4K byte physical sector size back-end.

The Operating System would hand down a 512 byte request as usual, but then the storage controller would convert the request to a 4K byte request. This provides the efficiency and data integrity benefits for the physical storage, but may come with a performance hit, due to the emulation and conversion required (especially if not aligned properly).

This mode also allows a stepping stone for storage vendors to move forward with 4K technology, while still supporting older Operating Systems and applications.



Tuesday, September 30, 2014

Create a Slideshow with Microsoft Windows DVD Maker (HOWTO)

Microsoft Windows DVD Maker
I needed to make a quick DVD slides show of some pictures.  Fortunately, there is a free DVD creation program included with Windows 7 called Windows DVD Maker.
"Windows DVD Maker is available on Home Premium and Ultimate editions of Windows Vista and on Home Premium, Professional and Ultimate editions of Windows 7."
Windows DVD Maker is a pretty simple tool with minimal features, but sufficient to create a quick DVD slide show.
"Make a DVD-Video disc that includes your favorite videos and digital photos that you and others can watch on a TV or computer. Windows DVD Maker lets you create a DVD quickly, complete with professional-looking menus, a scene selection page, and even a slide show with music."

How To Create a Slideshow with Microsoft Windows DVD Maker



1) Start - To start Windows DVD Maker, select the program from the Start menu (or by running "dvdmaker.exe").

2) Title - From the DVD Maker title screen, select "Choose Photos and Videos" to continue.

3) Add Items - Drag and drop photos and videos to the project (or click the "add items" button)

4) Change Order - If you need to change the order of photos/videos, double click on the slideshow link and then you can drag and drop the items to any desired order.  You will notice the default duration is set to 7 seconds.  This duration can be changed at a later step.

5) DVD Options - Click the "options" link to change some basic DVD format options.  The option I prefer to change is the DVD playback setting to continuous loop.  Great for a continuously running background slideshow.

6) Final Touches - Once we have our order decided upon, we can click continue onto the "Ready to burn DVD" page where we can change DVD menu options and slide show options.

7) DVD Menu Text - If you wish to change the DVD menu text, click the "Menu text" button, and make the appropriate changes.  I left the defaults as is.

8) DVD Menu Style - If you wish to change the DVD menu style, click the "Customize menu" button, and make the appropriate changes. I left the defaults as is.

9) Slide Duration - If you wish to change the duration of the slide show, add music, or change the transitions used, select the "Slide Show" button. The duration is a global duration, meaning you can't set a different duration for individual photos. The Slide Duration can be set to 3, 5, 7, 10, 15, or 30 seconds.  There is also an option to set the slide duration to match the music length.

10) Slide Transitions - You can change the slide transition animation to a number of options (Cross fade, Cut, Dissolve, Flip, Inset, Page curl, Pixelate, Random, Wipe). Again only one global transition can be selected, unless you select Random to which it will randomly assign a transition to each slide. My preferred transition is the default "Cross fade". I also prefer to leave the "pan and zoom effect" enabled. Makes the slides a little more visually entertaining.

11) Music - Background music can be added to the slide show.  If there is less music than the length of the slide show, the background music will automatically repeat.  At the end of the slide show, the music will automatically fade out, instead of being harshly truncated.

12) Preview - Before burning your completed DVD, click the "Preview" button to preview the DVD video.  You will see how the DVD menu and transitions appear.

13) Burn - Finally, click the "Burn" button and your DVD begins burning.  Once the DVD has completed burning, you will be presented with an option to burn a second copy.


Enjoy your DVD slide show.


Thursday, September 11, 2014

Watch out for the shockwave

Watch out for the shockwave...

The eruption of Mount Tavurvur volcano on August 29th, 2014. Captured by Phil McNamara.