I'm aware there is Web API allowing this trick using current build number. But it requires authentication thus script must be edited on each hudson.
Is there a way to achieve that from script or through plugin?
If you're talking about setting the description of a build, Jenkins can do this, based on a regular expression in the build output.
See the Description Setter Plugin.