This morning one of the JavaScript procedures that had run every night for a few months, clamorously failed.
Why? It worked like a charm until today!
Someone changed something? None.
Has data changed in someway? Only the month, august instead of july.
It took a long time before I was able to discover the mystery: I had used a JS API, a simple parseInt() function, without reading docs carefully: that leaded me to a bad bug.
If you use the javascript parseInt embedded function, you've to know that it takes two parameters: the first is the string to parse, the second is the radix. OK, if you reason like me you may think: if I don't provide the radix, which is an optional argument, the function implicitly convert using base 10, right? Then you make some try, maybe you will use a JS command line in order to try something like this:
parseInt("1")
1
parseInt("5")
5
parseInt("12")
12
Ok, at this point you may think that you've understood how to use it. After that you can make some tests, some debugging, as I do. Then your procedure could work well for months, as mine did.
Until now.
What have I discovered, after dozens of minutes of debugging? After identifying that the problems was in the parseInt function I've found that parseInt("08") returns 0, while parseInt("07") returns 7.
Without anymore thinking I googled the magic keywords and readed this FAQ's entry:
Why parseInt(08) & parseInt(09) is showing the value 0 ?
Arg! This article says that parseInt assumes the base from the content of the string. If the string contains a leading '0' character, then parseInt identify the value as octal and do the relative conversion! That means that, in octal, converting '07' returns 7, but converting '08' or '09' doesn't mean anything in octal, so the function returns 0.
Without considerations of what the Javascript's architects had smoked when they had designed the APIs, I've learned another big point: read the docs carefully, always! Even if it seems that the things works, take time to study carefully if you want to write solid software.
OK Javascript guys, I've learned the lesson! Now you can return to write less cryptic functions!
Monday, August 4, 2008
Thursday, July 31, 2008
Mail server... hacked!
Monday morning my colleagues have found the mail server broken. When I've arrived at the office they've had already restored the situation by restarting the server from the console. Something's broken the sockets of the networking of the OS. Strange... very strange for a Linux kernel.
I've started my inspections reading the logs, obviously. Reading and reading, getting back line after line, I've found the time when the sockets got broken: I was horrified reading that someone, at the same time, two minutes before, logged in via ssh with the zimbra user (a program's user, that normally don't have any password, in order to disable remote ssh logins ).
Deep inspection of access logs reported that someone has used this user to login remotely, for a month or two. That was very bad. The IP used for the login changed every time, but the class was the same: all the IP's was pulled from the pool of the Romtelecom company, a rumanian company.
That was a very stupid security flaw: someone of us putted a too simple password for the zimbra user during a test and after the tests he forgotten to remove it.
The result was that a simple scanner was able to discover the too short password.
The next question was: what the hell does the hacker with my mail server?
I've found the answer in the /var/tmp directory: the only one opened for writing to all users. Our bad guy used this folder as a place to store, download and compile various scanner/knocking softwares, that was done in order to use our email server as a base for scanning very large set of ip's classes.
Our bad guy doesn't have any other interest, so, in order to hide his presence, he hadn't touched anything else: in this way he could perform his tasks for days, weeks... until he made the bad step that broken the sockets.
He was ingenuous too, and he doesn't removed the history, he never cleared anything, so now I can reconstruct everything: what was installed, what was his activities, what sites he used to download software: everything. I don't have interests to continue my inspections, but If I would... especially helped with a claim presented to the italian's police... I could easily follow him, and maybe one or two of the groups behind that.
I will report some of the software he downloaded, useful if someone want to study a little:
http://l3iliboi.hub.io/nonmin.tar.gz
http://mafiot.clan.io/pass.txt
http://personales.ya.com/q1w2/nonmin.tgz
http://personales.ya.com/q1w2/nonmin.tgz
http://mafiot.clan.io/webmin.txt
http://www.transfer.ro/storage/staykuS-f953a.tar
http://www.transfer.ro/storage/VIP-c2a6a.tgz
http://nasa-undernet.ucoz.org/screen.tgz
http://Linux-Help.clan.su/download/2008.TGZ
http://w.wtf.la/xpl/26roott
http://www.transfer.ro/storage/FidoScan-3fcb0.tgz
If you want to know something more, such as user and passwords lists, classes of scanned ip,
or if you want the full programs, in order to study them: feel free to ask me.
Oh, I've also wrote to the romanian telecommunication company. Here's their reply:
Thanks for Contacting Romtelecom's Abuse Team . Our customer will be notified .
Marius Nastase
AbuseTeam
abuse@romtelecom.ro
Very pleased to see all this interest to stop eastern's cracking groups.
I've started my inspections reading the logs, obviously. Reading and reading, getting back line after line, I've found the time when the sockets got broken: I was horrified reading that someone, at the same time, two minutes before, logged in via ssh with the zimbra user (a program's user, that normally don't have any password, in order to disable remote ssh logins ).
Deep inspection of access logs reported that someone has used this user to login remotely, for a month or two. That was very bad. The IP used for the login changed every time, but the class was the same: all the IP's was pulled from the pool of the Romtelecom company, a rumanian company.
That was a very stupid security flaw: someone of us putted a too simple password for the zimbra user during a test and after the tests he forgotten to remove it.
The result was that a simple scanner was able to discover the too short password.
The next question was: what the hell does the hacker with my mail server?
I've found the answer in the /var/tmp directory: the only one opened for writing to all users. Our bad guy used this folder as a place to store, download and compile various scanner/knocking softwares, that was done in order to use our email server as a base for scanning very large set of ip's classes.
Our bad guy doesn't have any other interest, so, in order to hide his presence, he hadn't touched anything else: in this way he could perform his tasks for days, weeks... until he made the bad step that broken the sockets.
He was ingenuous too, and he doesn't removed the history, he never cleared anything, so now I can reconstruct everything: what was installed, what was his activities, what sites he used to download software: everything. I don't have interests to continue my inspections, but If I would... especially helped with a claim presented to the italian's police... I could easily follow him, and maybe one or two of the groups behind that.
I will report some of the software he downloaded, useful if someone want to study a little:
http://l3iliboi.hub.io/nonmin.tar.gz
http://mafiot.clan.io/pass.txt
http://personales.ya.com/q1w2/nonmin.tgz
http://personales.ya.com/q1w2/nonmin.tgz
http://mafiot.clan.io/webmin.txt
http://www.transfer.ro/storage/staykuS-f953a.tar
http://www.transfer.ro/storage/VIP-c2a6a.tgz
http://nasa-undernet.ucoz.org/screen.tgz
http://Linux-Help.clan.su/download/2008.TGZ
http://w.wtf.la/xpl/26roott
http://www.transfer.ro/storage/FidoScan-3fcb0.tgz
If you want to know something more, such as user and passwords lists, classes of scanned ip,
or if you want the full programs, in order to study them: feel free to ask me.
Oh, I've also wrote to the romanian telecommunication company. Here's their reply:
Thanks for Contacting Romtelecom's Abuse Team . Our customer will be notified .
Marius Nastase
AbuseTeam
abuse@romtelecom.ro
Very pleased to see all this interest to stop eastern's cracking groups.
Wednesday, July 2, 2008
sendmail from cron with Zimbra
Today I've faced the problem of sending admin emails from cron, in a machine with Zimbra installed. Zimbra comes with a Postfix installation so, using a 2nd Postfix( or exim, or sendmail) in parallel with the Zimbra's one, could lead you to dangerous places.
With this in mind I've found a simple and fast way to send emails without the needs to touch any system configuration.
Supposing that you want to launch the "ls /" command with the root user, you can write this line:
* * * * * root (echo "Subject: Cron ls /";echo;ls /) | /opt/zimbra/postfix/sbin/sendmail admin@zimbrams.com
Within round brackets there's the subject, followed by the output of the command, followed by the recipient.
Simple, fast, secure.
With this in mind I've found a simple and fast way to send emails without the needs to touch any system configuration.
Supposing that you want to launch the "ls /" command with the root user, you can write this line:
* * * * * root (echo "Subject: Cron
Within round brackets there's the subject, followed by the output of the command, followed by the recipient.
Simple, fast, secure.
Friday, May 9, 2008
onBI: multiple email recipients
Added multiple email addresses capability. In order to use it you have to separate each address by comma or semicolon.
for ex: onbiadmin@myadm.com;onbivice@myadm.com
Sources are released. I will release a new binary version as soon as possible.
for ex: onbiadmin@myadm.com;onbivice@myadm.com
Sources are released. I will release a new binary version as soon as possible.
Thursday, May 8, 2008
Google search engine bug
Today I found a bug on the Google search engine, very easy to reproduce.
1) Search "Simone Tregnago" with quotes. As you can see in the following picture the search will return 269 results: 10 pages.

At the bottom of the page you can select any of the 10 pages. Ok, try to go to the 10th clicking directly on the number 10.

Ops! Google now showed the 5th page instead of the 10th, and actually is the last page! Also note that the results become 42 instead of 269!

That's a bug, sure. I have to immediately write to Google's guys :)
1) Search "Simone Tregnago" with quotes. As you can see in the following picture the search will return 269 results: 10 pages.

At the bottom of the page you can select any of the 10 pages. Ok, try to go to the 10th clicking directly on the number 10.

Ops! Google now showed the 5th page instead of the 10th, and actually is the last page! Also note that the results become 42 instead of 269!

That's a bug, sure. I have to immediately write to Google's guys :)
Tuesday, May 6, 2008
Printers on Gutsy
If you have printers that doesn't come with a Linux driver, and Ubuntu doesn't provide you the correct driver to print with them, you can try the PPD alternative.
I've successfully printed on a Ricoh Aficio SP C410 that doesn't print correctly with the drivers that comes with Ubuntu Gutsy.
Ricoh doesn't supply the Linux driver but you can download the Windows Postscript driver installation. Launching the .exe with Wine will expand the installation files in a temporary folder. Here you can find the necessary .ppd files. Now, in Ubuntu, you can install your Ricoh printer with the Postscript .ppd files.
This solution worked well for me and I think it could work for a large set of printers.
Remember: Postscript is your friend.
I've successfully printed on a Ricoh Aficio SP C410 that doesn't print correctly with the drivers that comes with Ubuntu Gutsy.
Ricoh doesn't supply the Linux driver but you can download the Windows Postscript driver installation. Launching the .exe with Wine will expand the installation files in a temporary folder. Here you can find the necessary .ppd files. Now, in Ubuntu, you can install your Ricoh printer with the Postscript .ppd files.
This solution worked well for me and I think it could work for a large set of printers.
Remember: Postscript is your friend.
Monodevelop 0.19 + Boo, very well on Gutsy
I've successfully installed latest Monodevelop on Gutsy. It works very well, including Boo syntax highlighting and inline MonoDoc references ( pressing F1 key)
The light comes up to me when I've found this post
So, from there I've downloaded the mono-addins and mono-0.19 .deb packages.
After that I've downloaded monodevelop-boo.rpm from openSuse and converted it to a deb package.
For monodoc i've downloaded the monodoc_1.2.6-2~bpo40+1_all.deb backport package.
Latest boo deb package was downloaded directly from the official site, it works well.
I've installed my 5, fresh, Mono and Boo packages and... voilĂ , I've got a perfect MonoDevelop installation, with a working Boo addin with syntax highlighting and a MonoDoc browser correctly linked with the IDE.
The light comes up to me when I've found this post
So, from there I've downloaded the mono-addins and mono-0.19 .deb packages.
After that I've downloaded monodevelop-boo.rpm from openSuse and converted it to a deb package.
For monodoc i've downloaded the monodoc_1.2.6-2~bpo40+1_all.deb backport package.
Latest boo deb package was downloaded directly from the official site, it works well.
I've installed my 5, fresh, Mono and Boo packages and... voilĂ , I've got a perfect MonoDevelop installation, with a working Boo addin with syntax highlighting and a MonoDoc browser correctly linked with the IDE.
Subscribe to:
Posts (Atom)