Hackers backdoor PHP source code after breaching internal git server

JoeElRancho

Smack-Fu Master, in training
86
Just another example of why you shouldn't ever try to roll your own security related infrastructure unless you really really know what you are doing.
I guess ignoring the fact that Github also rolled their own security-related infrastructure at some point as well? Or do you think their infrastructure poofed into being from the æther preformed?
 
Upvote
-1 (6 / -7)

andrewb610

Ars Tribunus Angusticlavius
6,141
Just another example of why you shouldn't ever try to roll your own security related infrastructure unless you really really know what you are doing.
I guess ignoring the fact that Github also rolled their own security-related infrastructure at some point as well? Or do you think their infrastructure poofed into being from the æther preformed?
Personally I say æther. And definitely not because I wanted to copy/paste "æ."
 
Upvote
8 (9 / -1)

TylerH

Ars Praefectus
5,660
Subscriptor
Upvote
3 (3 / 0)

Mr. Kite

Ars Scholae Palatinae
944
Subscriptor
PHP 80 % of websites? Humanity is doomed.

Because 80% of websites running Python/ASP.NET/Node/whatever is sooooo much better?

The biggest problem with PHP and all the other languages IMO is that people grab sample code from some rando site and it works and they think they are developers and they leave this shit running on live servers hooked up to the net.

My number one task for the last month or so has been trying to explain the difference between code that functions, and production ready code to senior management...

Well, it was a PHP website run by the top PHP experts that got hacked, so at least for me that's a reddish flag.

You have my sincere sympathy for speaking with senior management promoting quality of code. If you haven't, find an angle that quantifies the effort in money saved. That's the language they understand.
 
Upvote
-9 (5 / -14)
PHP 80 % of websites? Humanity is doomed.

Because 80% of websites running Python/ASP.NET/Node/whatever is sooooo much better?

The biggest problem with PHP and all the other languages IMO is that people grab sample code from some rando site and it works and they think they are developers and they leave this shit running on live servers hooked up to the net.

My number one task for the last month or so has been trying to explain the difference between code that functions, and production ready code to senior management...
PHP has a long history of iffy exploits and encouraging bad coding habits. Using Twisted or Express or whatever ASP.NET people use is better than a stock PHP install, which lots of people seem to use.
 
Upvote
-11 (3 / -14)

CraigJ ✅

Ars Legatus Legionis
27,010
Subscriptor
My number one task for the last month or so has been trying to explain the difference between code that functions, and production ready code to senior management...

Good luck.

In a meeting now. OMG THE SCOPE CREEP!

Repeat after me - "do you want to ship this in 2021?"
 
Upvote
12 (12 / 0)

Casual_Reader

Seniorius Lurkius
41
Subscriptor
Gonna go write my next (first) website in assembly. I don't even know if that's physically possible.

My daughter sent me some funny image a few years back of a fake O'Reily book cover Web Development With Assembly, I wrote a small dumb web server in x86 assembler on Linux to show her it could be done ab initio. Only supports three functions: an echo the request back to the client, a compute a squareroot form, and a page that displayed the source listing from a file on disk.

Source code was about 1K including macros to help invoke system calls

                // Invoke a system call
                .macro ..syscall operation:req, param1, param2, param3, param4
                                mov \operation, %rax
                                ..move from=\param1, to=%rdi
                                ..move from=\param2, to=%rsi
                                ..move from=\param3, to=%rdx
                                ..move from=\param4, to=%r10
                                syscall
                .endm

                // Read
                .macro ..sys_read fd, buffer, len
                                ..syscall $0, \fd, \buffer, \len
                .endm

to implement a parameter passing call/return idiom

               // Call a function
               .macro ..call function:req, param1, param2, param3, param4
                              ..move from=\param1, to=%rdi
                              ..move from=\param2, to=%rsi
                              ..move from=\param3, to=%rdx
                              ..move from=\param4, to=%rcx
                              call \function
               .endm

               /* Allocate a stack frame and save the parameters there */
               .macro ..enter parm1, parm2, parm3, parm4
                              .set .frame.size., 0
                              ..local_name \parm1
                              ..local_name \parm2
                              ..local_name \parm3
                              ..local_name \parm4
                              enter $.frame.size., $0
                              ..frame_save %rdi, \parm1
                              ..frame_save %rsi, \parm2
                              ..frame_save %rdx, \parm3
                              ..frame_save %rcx, \parm4
               .endm

subroutines to allow representing a response as a chain of blocks (including the ability to send the text length of another chain for HTML headers).

            /*
               * Subroutine to write a chain of blocks to the given socket.
               * Chain is a sequence of pairs:
               * ptr, len -- a block of text to send
               * ptr, CHAIN_ASCIZ -- a block of null-terminated text to send
               * ptr, CHAIN_CHAINLEN -- a chain whose length should be sent
               * ptr, CHAIN_FILE -- ptr to filename of a file to send
               * CHAIN_NUMBER, number_to_format -- write the number
               * CHAIN_0NUMBER8, number_to_format -- write an unsigned number in eight digits
               * with leading zeros
               * CHAIN_END
               */
               send_chain:
                              ..enter _chain, _socket

               send_chain$loop:
                              mov _chain(%rbp), %r10 # Pointer to buffer
                              mov 0(%r10), %r10 # Word 1: -1 or pointer to message

                              cmp $CHAIN_END, %r10 # null pointer ends chain
                              je send_chain$leave

                              addq $WORD$LEN, _chain(%rbp)
                              mov _chain(%rbp), %r11
                              mov 0(%r11), %r11 # Word 2:

                              cmp $CHAIN_NUMBER, %r10
                              je send_chain$number # A number to send

                              cmp $CHAIN_0NUMBER8, %r10
                              je send_chain$number8 # A number to send

                              cmp $CHAIN_CHAINLEN, %r11
                              je send_chain$chain_length

                              cmp $CHAIN_FILE, %r11
                              je send_chain$file # A file to send

                              jmp send_chain$msg # A block of text in memory.

...

               send_chain$next:
                              addq $WORD$LEN, _chain(%rbp)
                              jmp send_chain$loop

               send_chain$leave$error:
                              push %rax
                              ..call_write_msg $errormsg, $__stderr
                              pop %rax
                              push %rax
                              neg %rax # Result is -errno
                              ..call_write_number %rax, $__stderr
                              ..call_write_msg $eol, $__stderr
                              pop %rax

               send_chain$leave:
                              leave
                              ret

and the data chains for the web responses

              /*
                * Our response (in parts) for responding to a root request.
                */
               // Chain table when no value to insert
               root_chain$no_value:
                              .quad found_response$hdr, CHAIN_ASCIZ
                              .quad root_chain$no_value$body, CHAIN_CHAINLEN
                              .quad crlf, CHAIN_ASCIZ
                              .quad crlf, CHAIN_ASCIZ
               root_chain$no_value$body:
                              .quad root_request$body$intro, CHAIN_ASCIZ
                              .quad root_request$body$middle, CHAIN_ASCIZ
                              .quad root_request$body$finale, CHAIN_ASCIZ
                              .quad CHAIN_END

               root_chain$value:
                              .quad found_response$hdr, CHAIN_ASCIZ
                              .quad root_chain$value$body, CHAIN_CHAINLEN
                              .quad crlf, CHAIN_ASCIZ
                              .quad crlf, CHAIN_ASCIZ
               root_chain$value$body:
                              .quad root_request$body$intro, CHAIN_ASCIZ
                              .quad root_request$body$input$intro, CHAIN_ASCIZ
                              .quad CHAIN_NUMBER
               root_chain$value$input:
                              .quad 0
                              .quad root_request$body$middle, CHAIN_ASCIZ
                              .quad root_request$body$output$intro, CHAIN_ASCIZ
                              .quad CHAIN_NUMBER
               root_chain$value$output$front:
                              .quad 0
                              .quad dot, 1
                              .quad CHAIN_0NUMBER8
               root_chain$value$output$back:
                              .quad 0
                              .quad root_request$body$finale, CHAIN_ASCIZ
                              .quad CHAIN_END

               root_request$body$intro:
                              .ascii "<html><head><title>Square Root</title></head>\n"
                              .ascii "<body><h1>Square Root</h1>\n"
                              .ascii "<p>Enter a non-negative integer less than "
                              .ascii "10<sup>9</sup> and press <strong>Calculate</strong> "
                              .ascii "to compute it's square root.\n"
                              .ascii "<pr>"
                              .ascii "<form>\n"
                              .asciz "Number: <input type=\"text\" name=\"number"
 
Upvote
32 (32 / 0)
Just another example of why you shouldn't ever try to roll your own security related infrastructure unless you really really know what you are doing.

I don't know if that's the reason. Sometimes "rolling your own" is done out of necessity since there are hardly any alternatives at the time. GitHub is a lot newer then other source code repositories... it's certainly isn't as old as PHP itself (which started in 1994)

When you use someone else's security system, you might also import much more code and features you don't intend to use, more code dependencies, and get a much greater attack surface.
 
Upvote
-4 (3 / -7)

DaveSimmons

Ars Legatus Legionis
11,176
Subscriptor
PHP 80 % of websites? Humanity is doomed.

Because 80% of websites running Python/ASP.NET/Node/whatever is sooooo much better?
Python has "errors should not pass silently" as a core value. Yes, Python would be sooooo much better, it really would. ASP.NET would also be better, sure it's a pain to develop with, but I think it's pretty OK when it comes to security.

You have a point about Node.js, though.

With Python code you can add exploits just by changing the whitespace. Have fun catching that with a diff comparison.

Like almost all languages you can write either secure or insecure code with PHP.
 
Upvote
21 (22 / -1)

CraigJ ✅

Ars Legatus Legionis
27,010
Subscriptor
PHP 80 % of websites? Humanity is doomed.

Because 80% of websites running Python/ASP.NET/Node/whatever is sooooo much better?

The biggest problem with PHP and all the other languages IMO is that people grab sample code from some rando site and it works and they think they are developers and they leave this shit running on live servers hooked up to the net.

My number one task for the last month or so has been trying to explain the difference between code that functions, and production ready code to senior management...
PHP has a long history of iffy exploits and encouraging bad coding habits. Using Twisted or Express or whatever ASP.NET people use is better than a stock PHP install, which lots of people seem to use.

History that's 10 years old... 5.6 was OK, but PHP 7 is solid and has been for 6 or 7 years. 7.4 is very solid.

The biggest issues with web applications are, in no particular order:

Applications in the wild using deprecated unpached versions of PHP/ASP, etc.
Applications in the wild Using unsupported unpached versions of operating systems, deprecated versions of Apache, NGINX, etc...
Shitty development - I've seen awful bug ridden code in ASP and PHP equally. To this day SQL injection is a thing even though both PHP and ASP give you all the tools you need to not write that shit - just as an example.

"Most people" don't use ASP - most people use something like PHP which is running on almost 80% of web servers. ASP is on approximately 9% overall. For the top 1000 sites it's a bit closer - 58% of the top 1000 run PHP vs 21% running ASP. The fact that the entire stack for PHP dev is FOSS probably has a lot to do with that, and also probably has a lot to do with inexperienced devs building shitty sites because the price of entry is $0.

Honestly, I'm a language agnostic developer - I just get irritated with the knee jerk PHP SUX BALLZ bullshit, and frankly, this article is an example of why that's not really true - an exploit was checked in and found within a day, and not only was it pulled, the maintainers reviewed their entire source code management and made changes and implemented additional security measures within a day or two. We can argue about having all the eggs in the GitHub basket, and that's probably an important discussion to have, but as a developer this type of thing inspires confidence IMO.
 
Upvote
38 (38 / 0)

CraigJ ✅

Ars Legatus Legionis
27,010
Subscriptor
PHP 80 % of websites? Humanity is doomed.

Because 80% of websites running Python/ASP.NET/Node/whatever is sooooo much better?

The biggest problem with PHP and all the other languages IMO is that people grab sample code from some rando site and it works and they think they are developers and they leave this shit running on live servers hooked up to the net.

My number one task for the last month or so has been trying to explain the difference between code that functions, and production ready code to senior management...

Well, it was a PHP website run by the top PHP experts that got hacked, so at least for me that's a reddish flag.

You have my sincere sympathy for speaking with senior management promoting quality of code. If you haven't, find an angle that quantifies the effort in money saved. That's the language they understand.

I have 2 words for you. Microsoft Exchange.

EVERYTHING is hackable. The important thing is the response.
 
Upvote
17 (18 / -1)

numerobis

Ars Tribunus Angusticlavius
52,421
Subscriptor
I can see why they are doing this, but it still worries me that all source code tends to end up on GitHub.

Haven't we learned that platform monoculture is bad?

(I guess not).
There’s gitlab and bitbucket too.

More importantly, everyone who clones the repo has a backup. If GitHub blows up it’s trivial to migrate.
 
Upvote
14 (14 / 0)
PHP 80 % of websites? Humanity is doomed.

Because 80% of websites running Python/ASP.NET/Node/whatever is sooooo much better?

The biggest problem with PHP and all the other languages IMO is that people grab sample code from some rando site and it works and they think they are developers and they leave this shit running on live servers hooked up to the net.

My number one task for the last month or so has been trying to explain the difference between code that functions, and production ready code to senior management...

Well, it was a PHP website run by the top PHP experts that got hacked, so at least for me that's a reddish flag.
The article says that the server was hacked. Was it hacked via a PHP website or application running on the server?
 
Upvote
6 (6 / 0)

andocom

Ars Scholae Palatinae
861
The fact that these commits were scrutinized so quickly, and that corrective action was taken immediately, and that within a day or so policies and procedures were updated and additional layers of security were implemented is praise worthy.

There is no perfect 100% secure solution, but the fact that the maintainers are apparently eyeballing these commits in near real time is encouraging.

I agree, but I also imagine this is the most likely time for them to be caught, once its in there and no one has noticed chances of it being spotted later would decrease quickly you would think.
 
Upvote
1 (1 / 0)

andocom

Ars Scholae Palatinae
861
PHP 80 % of websites? Humanity is doomed.

Because 80% of websites running Python/ASP.NET/Node/whatever is sooooo much better?

The biggest problem with PHP and all the other languages IMO is that people grab sample code from some rando site and it works and they think they are developers and they leave this shit running on live servers hooked up to the net.

My number one task for the last month or so has been trying to explain the difference between code that functions, and production ready code to senior management...
PHP has a long history of iffy exploits and encouraging bad coding habits. Using Twisted or Express or whatever ASP.NET people use is better than a stock PHP install, which lots of people seem to use.

History that's 10 years old... 5.6 was OK, but PHP 7 is solid and has been for 6 or 7 years. 7.4 is very solid.

The biggest issues with web applications are, in no particular order:

Applications in the wild using deprecated unpached versions of PHP/ASP, etc.
Applications in the wild Using unsupported unpached versions of operating systems, deprecated versions of Apache, NGINX, etc...
Shitty development - I've seen awful bug ridden code in ASP and PHP equally. To this day SQL injection is a thing even though both PHP and ASP give you all the tools you need to not write that shit - just as an example.

"Most people" don't use ASP - most people use something like PHP which is running on almost 80% of web servers. ASP is on approximately 9% overall. For the top 1000 sites it's a bit closer - 58% of the top 1000 run PHP vs 21% running ASP. The fact that the entire stack for PHP dev is FOSS probably has a lot to do with that, and also probably has a lot to do with inexperienced devs building shitty sites because the price of entry is $0.

Honestly, I'm a language agnostic developer - I just get irritated with the knee jerk PHP SUX BALLZ bullshit, and frankly, this article is an example of why that's not really true - an exploit was checked in and found within a day, and not only was it pulled, the maintainers reviewed their entire source code management and made changes and implemented additional security measures within a day or two. We can argue about having all the eggs in the GitHub basket, and that's probably an important discussion to have, but as a developer this type of thing inspires confidence IMO.

Regarding market share a decent amount of this just comes down to wordpress, it runs something like 40% of all sites, 60% if you only count sites which use a CMS apparently.

When you have that much of the web on a single platform, (often setup by novices) that is a massive target on their back, for both WP & PHP.

I do think from the jump ASP.Net was designed with more security in mind, but if it had the market share of PHP or a single platform dominance like WP it might have been tested a bit more.
 
Upvote
3 (3 / 0)

passivesmoking

Ars Tribunus Angusticlavius
8,632
PHP 80 % of websites? Humanity is doomed.

Because 80% of websites running Python/ASP.NET/Node/whatever is sooooo much better?

The biggest problem with PHP and all the other languages IMO is that people grab sample code from some rando site and it works and they think they are developers and they leave this shit running on live servers hooked up to the net.

My number one task for the last month or so has been trying to explain the difference between code that functions, and production ready code to senior management...

Yeah, it's more the "I want it done yesterday and I can't sell bugfixes as a feature" mentality than PHP itself that's to blame for there being so much bad and insecure software out there, though PHP's very fast to develop in, which doesn't help. You show management the rough prototype you knocked together in a couple of hours and they want it up on a production server by the weekend once the design team have replaced all the placeholder graphics.
 
Upvote
9 (9 / 0)

darkdog

Ars Scholae Palatinae
908
Subscriptor++
PHP 80 % of websites? Humanity is doomed.

That is primarily Wordpress, Joomla and other consumer CMSs.

High volume serious PHP websites use Symfony or Laravel, which is an entirely different beast.
Yay, I'm doing serious websites! :D

Seriously though, I literally (as in, not figuratively) wouldn't be a web developer if it wasn't for Laravel.
 
Upvote
5 (6 / -1)
Post content hidden for low score. Show…
Just another example of why you shouldn't ever try to roll your own security related infrastructure unless you really really know what you are doing.
Git access requires SSH access, nothing else. If a group of developers can't handle such trivial demands securely, it shouldn't develop web server software to start with.

The move to Github was probably the lazy solution.
I wouldn’t assign “a group of developers” to secure and manage a server in such a critical position. Why not leave this trivial stuff to full-time pros, especially since this service can be had for peanuts these days (if not free).
 
Upvote
7 (7 / 0)
PHP 80 % of websites? Humanity is doomed.

Because 80% of websites running Python/ASP.NET/Node/whatever is sooooo much better?

The biggest problem with PHP and all the other languages IMO is that people grab sample code from some rando site and it works and they think they are developers and they leave this shit running on live servers hooked up to the net.

My number one task for the last month or so has been trying to explain the difference between code that functions, and production ready code to senior management...

Yeah, it's more the "I want it done yesterday and I can't sell bugfixes as a feature" mentality than PHP itself that's to blame for there being so much bad and insecure software out there, though PHP's very fast to develop in, which doesn't help. You show management the rough prototype you knocked together in a couple of hours and they want it up on a production server by the weekend once the design team have replaced all the placeholder graphics.

I feel that people have this backwards. Because you can get something functional quickly, it means there is more budget (time) to build solidly, because it means that the platform you're building on has a good set of composable primitives that get you up to speed.

If you had to bootstrap everything from scratch, you'd take longer to get a prototype, AND securing things would be that much more difficult.

Just because any novice can write php doesn't imply that expert C++ coders (this is a stereotypical placeholder for seasoned developer) are significantly better at security engineering than the average novice.

In fact, until the Snowden leaks, software developers were comically clueless about security on average. Situation is only marginally better today, but there's at least some awareness.

Insecurity doesn't follow from rapid prototyping. Causes include error, ignorance and priorities, none of which are exclusive to PHP.
 
Upvote
5 (5 / 0)
Just another example of why you shouldn't ever try to roll your own security related infrastructure unless you really really know what you are doing.
Git access requires SSH access, nothing else. If a group of developers can't handle such trivial demands securely, it shouldn't develop web server software to start with.

The move to Github was probably the lazy solution.

Your flippant comment betrays your naivette. Do you happen to run a server which if compromised could get an attacker access to 80% of the web?

I think I'll let the 400 billion dollar corporation handle the security, thank you very much.
 
Upvote
18 (20 / -2)
I can see why they are doing this, but it still worries me that all source code tends to end up on GitHub.

Haven't we learned that platform monoculture is bad?
FWIW, I moved our projects the opposite direction recently. Away from Github, onto the company server. There we have control over what's going on and don't donate our private code to the owner of Github, Microsoft.

Public code still gets mirrored on Github. Also using their bug tracker for public projects. Github is so incredibly popular that a lot of part time developers are not even aware that Git outside of Github exists. Much less how powerful it is on the command line.
 
Upvote
-9 (1 / -10)
PHP 80 % of websites? Humanity is doomed.

Because 80% of websites running Python/ASP.NET/Node/whatever is sooooo much better?

The biggest problem with PHP and all the other languages IMO is that people grab sample code from some rando site and it works and they think they are developers and they leave this shit running on live servers hooked up to the net.

My number one task for the last month or so has been trying to explain the difference between code that functions, and production ready code to senior management...

Yeah, it's more the "I want it done yesterday and I can't sell bugfixes as a feature" mentality than PHP itself that's to blame for there being so much bad and insecure software out there, though PHP's very fast to develop in, which doesn't help. You show management the rough prototype you knocked together in a couple of hours and they want it up on a production server by the weekend once the design team have replaced all the placeholder graphics.

I feel that people have this backwards. Because you can get something functional quickly, it means there is more budget (time) to build solidly, because it means that the platform you're building on has a good set of composable primitives that get you up to speed.

If you had to bootstrap everything from scratch, you'd take longer to get a prototype, AND securing things would be that much more difficult.

Just because any novice can write php doesn't imply that expert C++ coders (this is a stereotypical placeholder for seasoned developer) are significantly better at security engineering than the average novice.

In fact, until the Snowden leaks, software developers were comically clueless about security on average. Situation is only marginally better today, but there's at least some awareness.

Insecurity doesn't follow from rapid prototyping. Causes include error, ignorance and priorities, none of which are exclusive to PHP.
The difference that I see is that C++ doesn’t enable novice programmers to connect websites to the internet. I see PHP as somewhat uniquely problematic because it actively encourages this hazardous combination.

It’s true that PHP has tools in place that allow programmers to build from solid components. But , e.g. having an idiot-proof toolset for avoiding SQLi only does so much good when insecure legacy tools and methodologies are still laying around (perhaps because they are the foundation for the “good” ones).

I don’t know that C++ extended to offer the same functionality to the same user base would fare any better. It could easily be much worse. It’s a fraught sphere. But PHP wants to be there, so I think it has to own its reputation.
 
Upvote
4 (5 / -1)

DaveSimmons

Ars Legatus Legionis
11,176
Subscriptor
Just another example of why you shouldn't ever try to roll your own security related infrastructure unless you really really know what you are doing.
Git access requires SSH access, nothing else. If a group of developers can't handle such trivial demands securely, it shouldn't develop web server software to start with.

The move to Github was probably the lazy solution.

Your flippant comment betrays your naivette. Do you happen to run a server which if compromised could get an attacker access to 80% of the web?

I think I'll let the 400 billion dollar corporation handle the security, thank you very much.

Yep. My employer uses WPEngine for hosting the marketing website (no sensitive data or AWS access allowed) so that we don't need to keep up with WordPress security but the marketing folks can add their own content without going through a developer.

We also use Exchange Online for our mailboxes, so we didn't have to lift a finger to be safe from the Exchange exploits.

Why pay a developer's salary to manage git, WordPress, Exchange security when you can pay people who support them full-time? Our developers have better things to do than patching Exchange.
 
Upvote
6 (6 / 0)

StateOfRegency

Smack-Fu Master, in training
68
I can see why they are doing this, but it still worries me that all source code tends to end up on GitHub.

Haven't we learned that platform monoculture is bad?

(I guess not).

Indeed, there are others who share the same opinion:

https://lwn.net/Articles/850992/

There is some discussion there regarding sourcehut as a FOSS drop-in for GitHub.


Platforms are only as good as the people who run them.
 
Upvote
2 (2 / 0)
Why pay a developer's salary to manage git, WordPress, Exchange security when you can pay people who support them full-time?
If all your company's knowledge is public, or if industry espionage doesn't matter, there's indeed not much reason to not use third party offerings. However, I've heard there are companies where it matters who reads emails and source code and who'd better not.

Git is unencrypted; whoever hosts the Git repository can read everything. The same is true for email, with the (rarely used) exception of end-to-end encrypted messages. Likewise for WordPress.
 
Upvote
-14 (0 / -14)
Why pay a developer's salary to manage git, WordPress, Exchange security when you can pay people who support them full-time?
If all your company's knowledge is public, or if industry espionage doesn't matter, there's indeed not much reason to not use third party offerings. However, I've heard there are companies where it matters who reads emails and source code and who'd better not.

Git is unencrypted; whoever hosts the Git repository can read everything. The same is true for email, with the (rarely used) exception of end-to-end encrypted messages. Likewise for WordPress.
“Source code stored on GitHub.com will be encrypted at rest, by default.” https://github.blog/changelog/2019-05-2 ... n-at-rest/
 
Upvote
6 (7 / -1)

CraigJ ✅

Ars Legatus Legionis
27,010
Subscriptor
PHP 80 % of websites? Humanity is doomed.

Because 80% of websites running Python/ASP.NET/Node/whatever is sooooo much better?

The biggest problem with PHP and all the other languages IMO is that people grab sample code from some rando site and it works and they think they are developers and they leave this shit running on live servers hooked up to the net.

My number one task for the last month or so has been trying to explain the difference between code that functions, and production ready code to senior management...

Yeah, it's more the "I want it done yesterday and I can't sell bugfixes as a feature" mentality than PHP itself that's to blame for there being so much bad and insecure software out there, though PHP's very fast to develop in, which doesn't help. You show management the rough prototype you knocked together in a couple of hours and they want it up on a production server by the weekend once the design team have replaced all the placeholder graphics.

My life in 26 words.
 
Upvote
4 (4 / 0)
PHP 80 % of websites? Humanity is doomed.

Because 80% of websites running Python/ASP.NET/Node/whatever is sooooo much better?

The biggest problem with PHP and all the other languages IMO is that people grab sample code from some rando site and it works and they think they are developers and they leave this shit running on live servers hooked up to the net.

My number one task for the last month or so has been trying to explain the difference between code that functions, and production ready code to senior management...

Yeah, it's more the "I want it done yesterday and I can't sell bugfixes as a feature" mentality than PHP itself that's to blame for there being so much bad and insecure software out there, though PHP's very fast to develop in, which doesn't help. You show management the rough prototype you knocked together in a couple of hours and they want it up on a production server by the weekend once the design team have replaced all the placeholder graphics.

I feel that people have this backwards. Because you can get something functional quickly, it means there is more budget (time) to build solidly, because it means that the platform you're building on has a good set of composable primitives that get you up to speed.

If you had to bootstrap everything from scratch, you'd take longer to get a prototype, AND securing things would be that much more difficult.

Just because any novice can write php doesn't imply that expert C++ coders (this is a stereotypical placeholder for seasoned developer) are significantly better at security engineering than the average novice.

In fact, until the Snowden leaks, software developers were comically clueless about security on average. Situation is only marginally better today, but there's at least some awareness.

Insecurity doesn't follow from rapid prototyping. Causes include error, ignorance and priorities, none of which are exclusive to PHP.
The difference that I see is that C++ doesn’t enable novice programmers to connect websites to the internet. I see PHP as somewhat uniquely problematic because it actively encourages this hazardous combination.

It’s true that PHP has tools in place that allow programmers to build from solid components. But , e.g. having an idiot-proof toolset for avoiding SQLi only does so much good when insecure legacy tools and methodologies are still laying around (perhaps because they are the foundation for the “good” ones).

I don’t know that C++ extended to offer the same functionality to the same user base would fare any better. It could easily be much worse. It’s a fraught sphere. But PHP wants to be there, so I think it has to own its reputation.
C++, Java, C# and maybe even Pascal* :D come with their problems too.
We move towards mobile first in anything and everything.
Maybe it's not apparent to everybody, but kids learn to make mobile apps these days. We are about 5 years maybe from seeing these languages tested PHP style.

---
*Embarcadero maintain Pascal and my 13 yo has a friend whose father wants to teach him Pascal by means of coding a Tetris. So my son wants to learn the same. We'll see if he has the patience for it.
But the point is - we can do this and side load it on any Android phone.
And everything we do will be distributed among his peers and we aren't really ready to deal with this.
 
Upvote
1 (1 / 0)

drouu

Ars Scholae Palatinae
805
perl 5.8.5

That was released 17 years ago. I'm not sure this is a sufficient reason to stick with a legacy release for that long. Even if you are only doing offline development, surely there have been important bug fixes since then?

thou shalt speak no ill of holy perl.
 
Upvote
3 (3 / 0)

adamsc

Ars Praefectus
4,464
Subscriptor++
PHP 80 % of websites? Humanity is doomed.

Because 80% of websites running Python/ASP.NET/Node/whatever is sooooo much better?

The biggest problem with PHP and all the other languages IMO is that people grab sample code from some rando site and it works and they think they are developers and they leave this shit running on live servers hooked up to the net.

My number one task for the last month or so has been trying to explain the difference between code that functions, and production ready code to senior management...

I spent about a decade using PHP from around 1998 on, recently spent some time working with PHP 7, and could not agree less, despite missing the enthusiasm I had back then fleeing ASP and ColdFusion. PHP has two properties which are riskier than the common alternatives: error handling is off by default and it has various places which aggressively try to coerce types or execute code. There’s also a bunch of common foot-guns like the random ordering of function arguments in the standard library, which I’ve seen lead to security problems or simply background noise which masked more serious things (“we can’t lint this because it generates thousands of errors!”).

Things like register_globals are gone but that culture spread through too much of the community and it’s just too easy to find people stringing SQL queries together, using exec to parse things, loading user input into global variables, etc. because that’s just how it was done for so long. It’s true that you can write insecure or unreliable code in any language (yes, even Rust) but the community and especially the core developers have a strong influence on what people learn as normal and PHP has had a couple of decades of people racing to crank out code and ship it before thinking about the ways it could go wrong. That’s a volatile combination with a language which requires constant diligence to use correctly rather than being safe by default.
 
Upvote
11 (11 / 0)

mludd

Wise, Aged Ars Veteran
141
PHP 80 % of websites? Humanity is doomed.

Because 80% of websites running Python/ASP.NET/Node/whatever is sooooo much better?

The biggest problem with PHP and all the other languages IMO is that people grab sample code from some rando site and it works and they think they are developers and they leave this shit running on live servers hooked up to the net.

My number one task for the last month or so has been trying to explain the difference between code that functions, and production ready code to senior management...

I spent about a decade using PHP from around 1998 on, recently spent some time working with PHP 7, and could not agree less, despite missing the enthusiasm I had back then fleeing ASP and ColdFusion. PHP has two properties which are riskier than the common alternatives: error handling is off by default and it has various places which aggressively try to coerce types or execute code. There’s also a bunch of common foot-guns like the random ordering of function arguments in the standard library, which I’ve seen lead to security problems or simply background noise which masked more serious things (“we can’t lint this because it generates thousands of errors!”).

Is error handling really off by default? Maybe I'm just so used to working on larger enterprise-y projects but I thought it was on by default these days. I do see a lot of legacy (5.x) projects where the people who built it just turned off all warnings rather than fix the problems in their code (e.g. instead of checking that a variable is set before using it they just use it for comparison and turn off warnings so their logs won't get cluttered).

Things like register_globals are gone but that culture spread through too much of the community and it’s just too easy to find people stringing SQL queries together, using exec to parse things, loading user input into global variables, etc. because that’s just how it was done for so long. It’s true that you can write insecure or unreliable code in any language (yes, even Rust) but the community and especially the core developers have a strong influence on what people learn as normal and PHP has had a couple of decades of people racing to crank out code and ship it before thinking about the ways it could go wrong. That’s a volatile combination with a language which requires constant diligence to use correctly rather than being safe by default.

I agree a big issue with PHP is the culture but PHP 7+ is actually pretty nice. The problem is when you come across code that was originally written for 4.x that's still in production, hidden away at the back. Or code written by someone who doesn't regularly use PHP but totally hacked up a few sites in it back in 2000 so they just fall back on how they did things back then and suppress all warnings.
 
Upvote
7 (7 / 0)

DaveSimmons

Ars Legatus Legionis
11,176
Subscriptor
Why pay a developer's salary to manage git, WordPress, Exchange security when you can pay people who support them full-time?
If all your company's knowledge is public, or if industry espionage doesn't matter, there's indeed not much reason to not use third party offerings. However, I've heard there are companies where it matters who reads emails and source code and who'd better not.

Git is unencrypted; whoever hosts the Git repository can read everything. The same is true for email, with the (rarely used) exception of end-to-end encrypted messages. Likewise for WordPress.

You really think that Microsoft is reading our company email? OK then, we'll have to agree to disagree.

For Wordpress, it's a marketing site. We're happy to have anyone read everything on the server. There are no user logins, no stored personal information, no API keys to connect to any of our real servers. The only connections to servers with data we care about are through untrusted static HTTPS links.
 
Upvote
3 (3 / 0)

passivesmoking

Ars Tribunus Angusticlavius
8,632
PHP 80 % of websites? Humanity is doomed.

Because 80% of websites running Python/ASP.NET/Node/whatever is sooooo much better?

The biggest problem with PHP and all the other languages IMO is that people grab sample code from some rando site and it works and they think they are developers and they leave this shit running on live servers hooked up to the net.

My number one task for the last month or so has been trying to explain the difference between code that functions, and production ready code to senior management...

Yeah, it's more the "I want it done yesterday and I can't sell bugfixes as a feature" mentality than PHP itself that's to blame for there being so much bad and insecure software out there, though PHP's very fast to develop in, which doesn't help. You show management the rough prototype you knocked together in a couple of hours and they want it up on a production server by the weekend once the design team have replaced all the placeholder graphics.

I feel that people have this backwards. Because you can get something functional quickly, it means there is more budget (time) to build solidly, because it means that the platform you're building on has a good set of composable primitives that get you up to speed.

I wasn't trying to make a commentary on the relative quality of developers in various programming languages, the point I was trying to make is that because it's easy to develop something in PHP very quickly that is minimally functional it can give a misleading impression to management. They see something that looks like a working product when in reality it's a roughly-hewn proof-of-concept or a prototype that requires more fleshing out. Instead of giving the dev team the time they need to do that fleshing out they pressure them to release an unfinished product.
 
Upvote
2 (2 / 0)

Naine

Seniorius Lurkius
23
the second malicious commit, which was made under Popov’s account name. It purported to revert the previous typo fix.

Not exactly. In between the two there was a non-malicious commit that did revert the "typo fix". It was a straight git revert of the malicious commit with an auto-generated commit message.

The second malicious commit was a revert of the revert commit, reinstating the malicious changes, also using the auto-generated git revert commit message. It wasn't purporting anything, the commit message straight up says it reverts the revert.
 
Upvote
3 (3 / 0)