Archive

Archive for April, 2009

Forget your WebSphere password

April 27th, 2009

Call it hacking if you want but here is an example where it may be useful when it comes to WebSphere.  WebSphere uses a XOR-encrypted password system that isn’t really meant for rock hard security but more for not storing plain text passwords in configuration files.  In my average workday I could easily be using 5 different WebSphere servers for test/development in 4 different hosting environments.  So to decrypt the XOR-encrypted password use these commands.

WebSphere 5.x
> cd $WAS_INSTALL_DIR/lib
> ../java/bin/java -cp securityimpl.jar:iwsorb.jar com.ibm.ws.security.util.PasswordDecoder {xor}LDo8LTor
decoded password == “secret”, encoded password == “{xor}LDo8LTor”

WebSphere 6.0.x  (this also works with 6.1.x)

> cd $WAS_INSTALL_DIR/lib
> ../java/bin/java -cp securityimpl.jar:iwsorb.jar::ras.jar:wsexception.jar:bootstrap.jar:emf.jar:ffdc.jar com.ibm.ws.security.util.PasswordEncoder {xor}LDo8LTor
decoded password == “secret”, encoded password == “{xor}LDo8LTor”

Here are some other WebSphere 6.1.x commands I found but haven’t tested.

C:\IBM\WAS61\AppServer\bin\ProfileManagement\plugins\com.ibm.websphere.v61_6.1.200>C:\IBM\WAS61\AppServer\java\bin\java -cp ws_runtime.jar com.ibm.ws.security.util.PasswordDecoder {xor}LDo8LTor
encoded password == “{xor}LDo8LTor”, decoded password == “secret”

To encrypt

WebSphere 5.x

> cd $WAS_INSTALL_DIR/lib
> ../java/bin/java -cp securityimpl.jar:iwsorb.jar com.ibm.ws.security.util.PasswordEncoder secret
decoded password == “secret”, encoded password == “{xor}LDo8LTor”

WebSphere 6.0.x

> cd $WAS_INSTALL_DIR/lib
> ../java/bin/java -cp securityimpl.jar:iwsorb.jar::ras.jar:wsexception.jar:bootstrap.jar:emf.jar:ffdc.jar com.ibm.ws.security.util.PasswordEncoder secret
decoded password == “secret”, encoded password == “{xor}LDo8LTor”

IBM, Web development , ,

Fixing your usb drive

April 2nd, 2009

I have updated my Apple TV by using the patchstick on my usb flash drive.  Now I need to use my usb drive to do a linux boot so I can do a network install of RedHat AS 4.  I plugged in my usb drive to a SUSE 9 box I have and checked to see if it could see the device connected.

mikey:~ # view /proc/bus/usb/devices

T:  Bus=04 Lev=01 Prnt=01 Port=02 Cnt=01 Dev#=  2 Spd=480 MxCh= 0
D:  Ver= 2.00 Cls=00(>ifc ) Sub=00 Prot=00 MxPS=64 #Cfgs=  1
P:  Vendor=14af ProdID=af01 Rev=11.00
S:  Manufacturer=SAMSUNG
S:  Product=SAMSUNG SUM-2G
S:  SerialNumber=0190107060001334
C:* #Ifs= 1 Cfg#= 1 Atr=80 MxPwr=100mA
I:  If#= 0 Alt= 0 #EPs= 2 Cls=08(stor.) Sub=06 Prot=50 Driver=usb-storage
E:  Ad=81(I) Atr=02(Bulk) MxPS= 512 Ivl=0ms
E:  Ad=02(O) Atr=02(Bulk) MxPS= 512 Ivl=31875us

My machine sees the device but if I try and mount it.

mikey:~ # mkdir /mnt/usb
mikey:~ # mount -t vfat /dev/sda1 /mnt/usb/
mount: /dev/sda1 is not a valid block device

Now lets see what fdisk says.

mikey:~ # fdisk -l

Disk /dev/hda: 80.0 GB, 80032038912 bytes
255 heads, 63 sectors/track, 9730 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot      Start         End      Blocks   Id  System
/dev/hda1               1         131     1052226   82  Linux swap
/dev/hda2             132        9729    77095935   83  Linux

Disk /dev/sda: 2030 MB, 2030043136 bytes
255 heads, 63 sectors/track, 246 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot      Start         End      Blocks   Id  System
/dev/sda1               1         247     1982463+  ee  EFI GPT
Partition 1 has different physical/logical beginnings (non-Linux?):
phys=(1023, 254, 63) logical=(0, 0, 2)
Partition 1 has different physical/logical endings:
phys=(1023, 254, 63) logical=(246, 205, 23)
The problem is the first (non-Linux?) physical partition.  To fix it I need to delete the partitions and recreate them.  Now I know my device isn’t mounted but just to make sure.

mikey:~ # umount /dev/sda1
umount: /dev/sda1: not mounted

mikey:~ # fdisk /dev/sda

Command (m for help): d
Selected partition 1

Command (m for help): n
Command action
e   extended
p   primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-246, default 1): 1
Last cylinder or +size or +sizeM or +sizeK (1-246, default 246): +750M

Command (m for help): a
Partition number (1-4): 1

Command (m for help): t
Selected partition 1
Hex code (type L to list codes): 6
Changed system type of partition 1 to 6 (FAT16)

Command (m for help): n
Command action
e   extended
p   primary partition (1-4)
p
Partition number (1-4): 2
First cylinder (93-246, default 93):
Using default value 93
Last cylinder or +size or +sizeM or +sizeK (93-246, default 246):
Using default value 246

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.

WARNING: If you have created or modified any DOS 6.x
partitions, please see the fdisk manual page for additional
information.
Syncing disks.
mikey:~ # mkfs.vfat -F 16 -n rhboot /dev/sda1
mkfs.vfat 2.10 (22 Sep 2003)

mikey:~ # mkfs.ext2 -b 4096 -L casper -rw /dev/sdb2
mke2fs 1.38 (30-Jun-2005)
Filesystem label=casper
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
154880 inodes, 309251 blocks
15462 blocks (5.00%) reserved for the super user
First data block=0
10 block groups
32768 blocks per group, 32768 fragments per group
15488 inodes per group
Superblock backups stored on blocks:
32768, 65536, 98304, 131072, 163840, 196608, 229376, 262144, 294912

Writing inode tables: done
Writing superblocks and filesystem accounting information: done

This filesystem will be automatically checked every 32 mounts or
180 days, whichever comes first.  Use tune2fs -c or -i to override.

mikey:~ # mount /dev/sda1 /mnt/usb/

mikey:~ # dd if=/root/diskboot.img of=/dev/sda1
12288+0 records in
12288+0 records out

mikey:~ # fdisk /dev/sda

Command (m for help): p

Disk /dev/sda: 2030 MB, 2030043136 bytes
255 heads, 63 sectors/track, 246 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1          92      738958+   6  FAT16
/dev/sda2              93         246     1237005   83  Linux

Now windows and Linux can read/write to my flash drive.

Linux ,